/* ============================================================
   AIGTS Intranet: site styles

   The system, top down:
   - Surfaces: warm paper is the page, white panels with a hairline
     sit on it, and navigation is a charcoal rail so the paper reads
     as the page.
   - One accent, red: the current item and the one primary action.
     States are a dot or icon with words, never tinted banners.
   - Light is the default; [data-theme="dark"] overrides tokens only.
   - No inline styles (the page runs a strict CSP).
   ============================================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root,
[data-theme='light'] {
  color-scheme: light;

  --paper: #fbfcf8;
  --surface: #ffffff;
  --well: #f4f5f0;
  --track: #eaece6;
  --border: #dbe3ea;
  --border-strong: #bfc9d4;
  --text: #121722;
  --text-2: #253044;
  --text-muted: #5e6b7d;

  --rail: #111722;
  --rail-hover: rgba(255, 255, 255, 0.07);
  --rail-current: rgba(255, 255, 255, 0.1);
  --rail-text: #c9d3e0;
  --rail-text-strong: #ffffff;
  --rail-muted: #8e9bae;
  --rail-line: #232c3b;
  --rail-accent: #ff6b6b;

  --accent: #c1121f;
  --accent-strong: #8a0d16;
  --accent-soft: #fdeaea;
  --accent-ink: #ffffff;

  --focus: #c1121f;
  --backdrop: rgba(18, 23, 34, 0.48);
  --shadow-overlay: 0 24px 56px -16px rgba(18, 23, 34, 0.28), 0 4px 12px rgba(18, 23, 34, 0.08);

  --side-w: 248px;
  --topbar-h: 56px;
  --radius: 8px;
  --radius-sm: 6px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --dur: 160ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme='dark'] {
  color-scheme: dark;

  --paper: #0f141c;
  --surface: #171e29;
  --well: #1b2430;
  --track: #26303f;
  --border: #2a3446;
  --border-strong: #3e4a5e;
  --text: #e8edf4;
  --text-2: #c9d3e0;
  --text-muted: #9aa8ba;

  --rail: #0b0f15;
  --rail-line: #1d2533;
  --rail-accent: #ff8a92;

  --accent: #ef5a5f;
  --accent-strong: #ff8a92;
  --accent-soft: #2a1a1d;
  --accent-ink: #170c0e;

  --focus: #ef5a5f;
  --backdrop: rgba(0, 0, 0, 0.62);
  --shadow-overlay: 0 24px 56px -16px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
p,
ul,
dl,
dd {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-overlay);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

/* Shell: rail and main column */

.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 14px 16px;
  background: var(--rail);
  color: var(--rail-text);
  overflow-y: auto;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px 18px;
  border-bottom: 1px solid var(--rail-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: var(--radius-sm);
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: none;
}

.brand-mark rect {
  fill: #c1121f;
}

.brand-mark path {
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  color: var(--rail-text-strong);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  color: var(--rail-muted);
  font-size: 0.8125rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--rail-text);
  font-weight: 500;
  transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

.nav-link .icon {
  color: var(--rail-muted);
  transition: color var(--dur) var(--ease-out);
}

.nav-link:hover {
  background: var(--rail-hover);
  color: var(--rail-text-strong);
}

.nav-link[aria-current='page'] {
  background: var(--rail-current);
  color: var(--rail-text-strong);
}

.nav-link[aria-current='page'] .icon {
  color: var(--rail-accent);
}

.nav-label {
  margin: 22px 10px 6px;
  color: var(--rail-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-empty {
  padding: 4px 10px;
  color: var(--rail-muted);
  font-size: 0.875rem;
}

.side-foot {
  margin-top: auto;
  padding: 16px 10px 0;
  border-top: 1px solid var(--rail-line);
  color: var(--rail-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.side .side-close {
  display: none;
}

.backdrop {
  display: none;
}

.main-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 40px;
  border-bottom: 1px solid var(--border);
  background: var(--paper);
}

.topbar-title {
  flex: 1;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}

.icon-button:hover {
  background: var(--well);
  border-color: var(--border-strong);
}

.icon-button .icon {
  width: 18px;
  height: 18px;
}

.menu-button {
  display: none;
}

.icon-sun,
[data-theme='dark'] .icon-moon {
  display: none;
}

[data-theme='dark'] .icon-sun {
  display: block;
}

/* Content */

.content {
  width: 100%;
  max-width: 1120px;
  padding: 40px 40px 72px;
}

.content:focus {
  outline: none;
}

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.022em;
}

.page-date {
  margin-top: 6px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 24px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.012em;
}

.count {
  min-width: 24px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--well);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.panel-body {
  padding: 16px 20px 18px;
  color: var(--text-2);
}

/* Application rows */

.rows li + li {
  border-top: 1px solid var(--border);
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  transition: background-color var(--dur) var(--ease-out);
}

.row:hover {
  background: var(--well);
}

.rows li:last-child .row {
  border-radius: 0 0 var(--radius) var(--radius);
}

.row-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--well);
  color: var(--text-2);
}

.row:hover .row-mark {
  background: var(--surface);
}

.row-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.row-name {
  font-weight: 600;
}

.row-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.row-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

.row:hover .row-chevron {
  color: var(--accent);
  transform: translateX(2px);
}

/* Empty state */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 24px 60px;
  text-align: center;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--well);
  color: var(--text-muted);
}

.empty-mark .icon {
  width: 22px;
  height: 22px;
}

.empty-title {
  font-weight: 600;
}

.empty-text {
  max-width: 36ch;
  margin-top: 4px;
  color: var(--text-muted);
}

/* Facts */

.facts {
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.facts div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.facts dt {
  color: var(--text-muted);
}

.facts dd {
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Narrow screens: the rail becomes a drawer */

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(288px, 86vw);
    box-shadow: var(--shadow-overlay);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 220ms var(--ease-out), visibility 0s linear 220ms;
  }

  .side.is-open {
    transform: none;
    visibility: visible;
    transition: transform 220ms var(--ease-out);
  }

  .side .side-close {
    display: inline-grid;
    border-color: var(--rail-line);
    background: transparent;
    color: var(--rail-text);
  }

  .side-close:hover {
    background: var(--rail-hover);
    border-color: var(--rail-line);
  }

  .backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    background: var(--backdrop);
  }

  .menu-button {
    display: inline-grid;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-title {
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 600;
  }

  .content {
    padding: 28px 16px 56px;
  }

  .page-head h1 {
    font-size: 1.5rem;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .row {
    padding: 14px 16px;
  }

  .panel-head,
  .panel-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  body.nav-open {
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
