/* =========================================================================
   INTERLINK base: reset, typography, application shell.
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--text-1);
  background: var(--surface-0);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, p, dl, dd, ol, ul, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font-size: var(--fs-xl); line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: var(--fs-md); font-weight: 650; }
h3 { font-size: var(--fs-base); font-weight: 650; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
code, .mono, pre { font-family: var(--font-mono); font-size: .92em; }
code { background: var(--surface-2); border-radius: 3px; padding: 1px 4px; color: var(--text-1); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-control); }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--sp-4); top: -100px; z-index: 100;
  background: var(--accent); color: #fff; padding: var(--sp-2) var(--sp-4); border-radius: var(--r-control);
}
.skip-link:focus { top: var(--sp-2); color: #fff; }

.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- Brand ------------------------------------------------------------- */
.brand { display: flex; align-items: center; gap: var(--sp-3); color: var(--ops-text-1); }
.brand__mark { width: 30px; height: 30px; flex: none; color: var(--ops-accent); }
.brand__node { fill: var(--ops-text-1); }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-weight: 750; letter-spacing: .14em; font-size: 15px; }
.brand__sub { font-size: var(--fs-xs); color: var(--ops-text-2); margin-top: 2px; }

/* ---- Application shell ------------------------------------------------- */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-6);
  height: var(--topbar-h); padding: 0 var(--sp-5);
  background: var(--ops-1); color: var(--ops-text-1);
  border-bottom: 1px solid var(--ops-line);
}
.topbar__menu {
  display: none; background: none; border: 0; color: var(--ops-text-1);
  padding: var(--sp-2); margin-left: calc(var(--sp-2) * -1); cursor: pointer;
}
.topbar__menu .icon { width: 22px; height: 22px; }
.topbar__brand, .topbar__brand:hover { text-decoration: none; }
.topbar__clock {
  margin-left: auto; display: flex; align-items: baseline; gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-3); border: 1px solid var(--ops-line); border-radius: var(--r-control);
  background: var(--ops-0);
}
.topbar__time { font-family: var(--font-mono); font-size: 18px; font-weight: 600; color: var(--ops-text-1); letter-spacing: .04em; }
.topbar__date { font-size: var(--fs-xs); color: var(--ops-text-2); text-transform: uppercase; letter-spacing: .06em; }
.topbar__user { display: flex; align-items: center; gap: var(--sp-3); }
.topbar__account { display: flex; align-items: center; gap: var(--sp-2); color: var(--ops-text-1); }
.topbar__account:hover { color: #fff; text-decoration: none; }
.topbar__name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.shell {
  display: flex; min-height: calc(100vh - var(--topbar-h));
  /* Keeps the sidebar colour down the full page height on long pages. */
  background: linear-gradient(to right, var(--ops-2) var(--sidebar-w), transparent var(--sidebar-w));
}
@media (max-width: 1024px) { .shell { background: none; } }
.sidebar {
  position: sticky; top: var(--topbar-h); align-self: flex-start;
  width: var(--sidebar-w); height: calc(100vh - var(--topbar-h)); overflow-y: auto; flex: none;
  background: var(--ops-2); color: var(--ops-text-2);
  border-right: 1px solid var(--ops-line);
  padding: var(--sp-4) 0 var(--sp-6);
  display: flex; flex-direction: column;
}
.sidebar__section { padding: 0 var(--sp-3); margin-bottom: var(--sp-5); }
.sidebar__heading {
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .1em;
  color: #6F84A5; padding: 0 var(--sp-3) var(--sp-2);
}
.sidebar__link {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  min-height: 36px; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-control);
  color: var(--ops-text-2); font-weight: 500;
}
.sidebar__link:hover { background: var(--ops-3); color: var(--ops-text-1); text-decoration: none; }
.sidebar__link.is-active { background: var(--ops-3); color: #fff; }
.sidebar__link.is-active::before {
  content: ""; position: absolute; left: calc(var(--sp-3) * -1); top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 2px 2px 0; background: var(--ops-accent);
}
.sidebar__link.is-active .icon { color: var(--ops-accent); }
.sidebar__link:focus-visible { box-shadow: 0 0 0 2px var(--ops-accent); }
.sidebar__footer { margin-top: auto; padding: 0 var(--sp-6); font-size: var(--fs-xs); color: #5A6E8E; }
.sidebar-backdrop { display: none; }

.content {
  flex: 1; min-width: 0;
  padding: var(--sp-6) var(--sp-8) var(--sp-10);
  max-width: var(--content-max);
}
.content:focus { outline: none; }
.content > * + * { margin-top: var(--sp-5); }

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 1024px) {
  .topbar__menu { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 40;
    height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); align-self: auto;
    transform: translateX(-100%); transition: transform .15s ease;
  }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 35; background: rgba(7, 17, 31, .5);
  }
  .content { padding: var(--sp-5) var(--sp-5) var(--sp-8); }
}
@media (max-width: 640px) {
  .topbar { gap: var(--sp-3); padding: 0 var(--sp-4); }
  .topbar .brand__sub, .topbar__date, .topbar__name, .topbar__user .btn span { display: none; }
  .topbar__time { font-size: 15px; }
  .content { padding: var(--sp-4) var(--sp-4) var(--sp-8); }
  h1 { font-size: var(--fs-lg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
