/* ==========================================================================
   CSPC Lost & Found — design system
   --------------------------------------------------------------------------
   Brand palette  #03195B  #0B2CB1  #1951FC  #3781FC  #77BFFF  #CBE9FD

   Structure
     1. tokens      palette, scales, and the two themes (dark / light)
     2. base        reset, type, focus
     3. layout      shell, sidebar, topbar, page grid
     4. components  buttons, forms, badges, cards, tables, dialogs, toasts
     5. pages       hero, auth, management
     6. motion      theme transition + reduced-motion

   Themes are plain CSS-variable sets on <html data-theme="dark|light">.
   Components only read semantic variables (--card, --text, --accent …), so
   a new surface or page never needs a per-theme override.
   ========================================================================== */

@layer tokens, base, layout, components, pages, motion;

/* ---------- Fonts (self-hosted, latin subset, SIL OFL) ---------- */
@font-face {
  font-family: "Sora";
  src: url("../fonts/sora-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   1. TOKENS
   ========================================================================== */
@layer tokens {
  :root {
    /* Brand palette */
    --navy: #03195b;
    --royal: #0b2cb1;
    --electric: #1951fc;
    --bright: #3781fc;
    --sky: #77bfff;
    --ice: #cbe9fd;

    /* Type */
    --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
    --font-text: "Instrument Sans", "Segoe UI", system-ui, sans-serif;

    /* Radius hierarchy: shell > panel > card/row > control. Pills are reserved
       for status and the theme switch. */
    --r-shell: 28px;
    --r-lg: 18px;
    --r-md: 14px;
    --r-sm: 10px;
    --r-xs: 7px;
    --r-pill: 999px;

    --sidebar: 248px;
    --gutter: 14px;

    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --t-fast: 140ms;
    --t-base: 220ms;
  }

  /* ---------- Dark: midnight blue, lit from the top-left ---------- */
  :root,
  :root[data-theme="dark"] {
    color-scheme: dark;

    --canvas: #020922;
    --canvas-a: rgba(11, 44, 177, 0.5);
    --canvas-b: rgba(25, 81, 252, 0.26);
    --canvas-c: rgba(55, 129, 252, 0.12);

    --shell: linear-gradient(180deg, rgba(9, 24, 84, 0.84), rgba(3, 10, 40, 0.95));
    --shell-line: rgba(170, 205, 255, 0.15);
    --shell-shadow: 0 40px 90px -24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    --side: rgba(2, 8, 34, 0.4);
    --topbar: rgba(6, 16, 56, 0.7);

    --card: #0c1f5c;
    --card-2: #112876;
    --hover: rgba(160, 196, 255, 0.08);
    --field: rgba(2, 8, 34, 0.55);
    --field-line: rgba(160, 196, 255, 0.24);

    --line: rgba(160, 196, 255, 0.13);
    --line-strong: rgba(160, 196, 255, 0.28);
    --line-solid: #172b74;

    --text: #eaf2ff;
    --text-2: #b4c6e8;
    --text-3: #8da2cf;

    --accent: #3781fc;
    --accent-strong: #77bfff;
    --glow: rgba(55, 129, 252, 0.65);
    --focus: #77bfff;

    --btn-a: #3472ff;
    --btn-b: #1951fc;
    --btn-c: #1444dc;
    --btn-ink: #ffffff;
    --btn-shadow: 0 8px 18px -6px rgba(25, 81, 252, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.3);

    --ok-a: #4bdc97;
    --ok-b: #22b86f;
    --ok-ink: #032816;
    --danger: #ff8d85;

    /* Semantics: lost = coral, found = teal; status uses blue / amber / green */
    --lost: #ff7a6e;
    --lost-ink: #3b0b06;
    --lost-soft: rgba(255, 122, 110, 0.15);
    --lost-text: #ffa59b;
    --found: #3ad8c1;
    --found-ink: #032f29;
    --found-soft: rgba(58, 216, 193, 0.14);
    --found-text: #72e8d6;
    --open-text: #a3cfff;
    --open-soft: rgba(55, 129, 252, 0.22);
    --claimed-text: #f7c765;
    --claimed-soft: rgba(247, 199, 101, 0.15);
    --resolved-text: #6be6a6;
    --resolved-soft: rgba(107, 230, 166, 0.14);

    --shadow-1: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --shadow-3: 0 30px 70px -16px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(160, 196, 255, 0.14);
    --drop-1: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.28));
    --drop-2: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.42));
    --scrim: rgba(2, 6, 26, 0.66);

    /* Campus billboard (always a deep-blue photographic block) */
    --hero-edge: #061249;
    --hero-line: rgba(170, 205, 255, 0.18);
    --hero-glow-a: rgba(25, 81, 252, 0.55);
    --hero-glow-b: rgba(3, 25, 91, 0.9);
    --auth-panel: #040e3b;
    --auth-glow: rgba(25, 81, 252, 0.28);
  }

  /* ---------- Light: cool white, navy ink — designed, not inverted ---------- */
  :root[data-theme="light"] {
    color-scheme: light;

    --canvas: #e4ecfa;
    --canvas-a: rgba(119, 191, 255, 0.5);
    --canvas-b: rgba(55, 129, 252, 0.2);
    --canvas-c: rgba(203, 233, 253, 0.9);

    --shell: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 249, 255, 0.92));
    --shell-line: rgba(3, 25, 91, 0.1);
    --shell-shadow: 0 40px 80px -34px rgba(3, 25, 91, 0.36), 0 1px 0 #fff inset;
    --side: rgba(233, 241, 255, 0.72);
    --topbar: rgba(255, 255, 255, 0.74);

    --card: #ffffff;
    --card-2: #f1f6ff;
    --hover: rgba(25, 81, 252, 0.06);
    --field: #ffffff;
    --field-line: rgba(3, 25, 91, 0.2);

    --line: rgba(3, 25, 91, 0.1);
    --line-strong: rgba(3, 25, 91, 0.2);
    --line-solid: #dde5f5;

    --text: #07184f;
    --text-2: #3d4e82;
    --text-3: #576a9c;

    --accent: #1951fc;
    --accent-strong: #0b2cb1;
    --glow: rgba(25, 81, 252, 0);
    --focus: #1951fc;

    --btn-a: #2f68ff;
    --btn-b: #1951fc;
    --btn-c: #0f3fe0;
    --btn-ink: #ffffff;
    --btn-shadow: 0 8px 16px -8px rgba(25, 81, 252, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);

    --ok-a: #17a064;
    --ok-b: #0b7e4b;
    --ok-ink: #ffffff;
    --danger: #c2332f;

    --lost: #c4372f;
    --lost-ink: #ffffff;
    --lost-soft: rgba(214, 68, 62, 0.09);
    --lost-text: #b42d29;
    --found: #0a7a6f;
    --found-ink: #ffffff;
    --found-soft: rgba(11, 138, 125, 0.1);
    --found-text: #07695f;
    --open-text: #0b2cb1;
    --open-soft: rgba(25, 81, 252, 0.09);
    --claimed-text: #84510a;
    --claimed-soft: rgba(224, 150, 20, 0.17);
    --resolved-text: #0a6d44;
    --resolved-soft: rgba(14, 150, 90, 0.12);

    --shadow-1: 0 1px 2px rgba(3, 25, 91, 0.05), 0 12px 28px -16px rgba(3, 25, 91, 0.2);
    --shadow-3: 0 30px 70px -20px rgba(3, 25, 91, 0.4), 0 0 0 1px rgba(3, 25, 91, 0.08);
    --drop-1: drop-shadow(0 1px 1px rgba(3, 25, 91, 0.07)) drop-shadow(0 10px 14px rgba(3, 25, 91, 0.09));
    --drop-2: drop-shadow(0 2px 2px rgba(3, 25, 91, 0.08)) drop-shadow(0 20px 24px rgba(3, 25, 91, 0.16));
    --scrim: rgba(7, 24, 79, 0.42);

    --hero-edge: #0a2aa8;
    --hero-line: rgba(3, 25, 91, 0.22);
    --hero-glow-a: rgba(119, 191, 255, 0.5);
    --hero-glow-b: rgba(3, 25, 91, 0.75);
    --auth-panel: #f5f8ff;
    --auth-glow: rgba(119, 191, 255, 0.4);
  }
}

/* ==========================================================================
   2. BASE
   ========================================================================== */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
  body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-text);
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text);
    background:
      radial-gradient(900px 520px at -6% -8%, var(--canvas-a), transparent 62%),
      radial-gradient(700px 460px at 106% 0%, var(--canvas-b), transparent 58%),
      radial-gradient(760px 480px at 78% 112%, var(--canvas-c), transparent 56%),
      var(--canvas);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  body.nav-lock { overflow: hidden; }

  h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
  h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; letter-spacing: -0.012em; }
  ul, ol { padding: 0; list-style: none; }
  img, svg { display: block; max-width: 100%; }
  a { color: var(--accent-strong); text-decoration: none; }
  a:hover { text-decoration: underline; text-underline-offset: 3px; }
  button, input, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; }
  [hidden] { display: none !important; }
  ::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); color: inherit; }

  :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }

  * { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

  .sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .skip-link {
    position: fixed; left: 14px; top: 0; z-index: 100;
    transform: translateY(-140%);
    padding: 10px 14px; border-radius: 0 0 var(--r-sm) var(--r-sm);
    background: var(--card); color: var(--text); font-weight: 600; text-decoration: none;
    box-shadow: var(--shadow-3);
    transition: transform var(--t-base) var(--ease);
  }
  .skip-link:focus { transform: none; text-decoration: none; }

  .i {
    width: 1.25rem; height: 1.25rem; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
}

/* ==========================================================================
   3. LAYOUT
   ========================================================================== */
@layer layout {
  .stage { padding: var(--gutter); }

  /* The frame is a fixed-height window: only the content area scrolls, so the
     sidebar and top bar stay composed. Below 1024px it becomes a normal page. */
  .app-frame {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    height: calc(100vh - var(--gutter) * 2);
    height: calc(100dvh - var(--gutter) * 2);
    border-radius: var(--r-shell);
    overflow: hidden;
    background: var(--shell);
    border: 1px solid var(--shell-line);
    box-shadow: var(--shell-shadow);
    backdrop-filter: blur(20px) saturate(1.2);
  }

  .main-wrapper { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
  .scroll-area {
    flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column;
    container-type: inline-size; container-name: page;
    scroll-behavior: smooth;
  }
  .page-content {
    flex: 1; width: 100%; max-width: 1180px; margin-inline: auto;
    padding: 28px 32px 44px; outline: none;
  }
  .app-footer {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 16px 32px 22px; color: var(--text-3); font-size: 0.8rem;
    border-top: 1px solid var(--line);
  }

  /* ----- Sidebar ----- */
  .sidebar {
    display: flex; flex-direction: column; min-height: 0; overflow-y: auto;
    background: var(--side); border-right: 1px solid var(--line);
  }
  .brand { display: flex; align-items: center; gap: 12px; padding: 22px 18px 18px; color: var(--text); text-decoration: none; }
  .brand:hover { text-decoration: none; }
  .brand__seal {
    width: 42px; height: 42px; flex: none; border-radius: 50%;
    background: #fff; padding: 3px;
    box-shadow: 0 0 0 1px rgba(203, 233, 253, 0.5), 0 6px 18px -4px var(--glow);
  }
  .brand__seal img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
  .brand__seal--lg { width: 56px; height: 56px; padding: 4px; }
  .brand__text { display: flex; flex-direction: column; min-width: 0; }
  .brand__name { font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; line-height: 1.2; }
  .brand__sub { font-size: 0.72rem; line-height: 1.3; color: var(--text-3); margin-top: 2px; }

  .nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px 12px; }
  .nav__rule { border: 0; height: 1px; background: var(--line); margin: 8px 10px; }
  .nav__link {
    position: relative; display: flex; align-items: center; gap: 12px;
    height: 42px; padding: 0 12px; border-radius: var(--r-sm);
    color: var(--text-2); font-weight: 500; text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast);
  }
  .nav__link .i { color: var(--text-3); transition: color var(--t-fast), transform var(--t-base) var(--ease); }
  .nav__link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
  .nav__link:hover .i { color: var(--text-2); transform: translateX(1px); }
  .nav__link.is-active {
    color: var(--text); font-weight: 600;
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent) 4%, transparent));
  }
  .nav__link.is-active .i { color: var(--accent-strong); }
  .nav__link--lost.is-active .i { color: var(--lost-text); }
  .nav__link--found.is-active .i { color: var(--found-text); }
  .nav__link.is-active::before {
    content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--accent);
    box-shadow: 0 0 14px var(--glow);
  }
  .nav__link--lost.is-active::before { background: var(--lost); box-shadow: 0 0 14px color-mix(in srgb, var(--lost) 60%, transparent); }
  .nav__link--found.is-active::before { background: var(--found); box-shadow: 0 0 14px color-mix(in srgb, var(--found) 60%, transparent); }

  .sidebar__foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }
  .profile { display: flex; align-items: center; gap: 10px; padding: 8px; }
  .profile__avatar {
    width: 36px; height: 36px; flex: none; border-radius: 50%;
    display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 600; font-size: 0.9rem;
    color: #fff; background: linear-gradient(145deg, var(--bright), var(--royal));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
  }
  .profile__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
  .profile__name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile__role { font-size: 0.78rem; color: var(--text-3); }
  .signout {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; margin-top: 4px;
    border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); font-weight: 500;
    transition: background var(--t-fast), color var(--t-fast);
  }
  .signout .i { width: 1.1rem; height: 1.1rem; }
  .signout:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

  .sidebar-overlay { display: none; }

  /* ----- Top bar ----- */
  .topbar {
    position: relative; z-index: 5; flex: none;
    display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 28px;
    background: var(--topbar); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .topbar__title { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; letter-spacing: -0.005em; }
  .topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

  /* ----- Shared page header ----- */
  .page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 28px; margin-bottom: 24px; }
  .page-head__copy { min-width: 0; flex: 1 1 320px; }
  .page-head__title { font-weight: 500; font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.1rem); line-height: 1.15; letter-spacing: -0.02em; overflow-wrap: anywhere; }
  .page-head__lede { margin-top: 8px; max-width: 56ch; color: var(--text-2); }
  .page-head__actions { display: flex; flex-wrap: wrap; gap: 10px; }

  .split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .split--ops { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }

  /* ----- Tablet and phone: no frame, drawer navigation ----- */
  @media (max-width: 1023.98px) {
    .stage { padding: 0; }
    .app-frame {
      display: block; height: auto; min-height: 100vh; min-height: 100dvh;
      border-radius: 0; border: 0; overflow: visible; backdrop-filter: none;
    }
    .main-wrapper { min-height: 100dvh; }
    .scroll-area { overflow: visible; }
    .topbar { position: sticky; top: 0; padding: 0 16px; }
    .page-content { padding: 22px 16px 36px; }
    .app-footer { padding: 16px; }

    .sidebar {
      position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(300px, 86vw);
      background: var(--card); border-right: 1px solid var(--line-strong);
      box-shadow: 24px 0 60px -12px rgba(0, 0, 0, 0.5);
      transform: translateX(-104%); visibility: hidden;
      transition: transform 300ms var(--ease), visibility 0s linear 300ms;
    }
    .sidebar.is-open { transform: none; visibility: visible; transition-delay: 0s; }
    .sidebar-overlay {
      display: block; position: fixed; inset: 0; z-index: 35; background: var(--scrim);
      opacity: 0; visibility: hidden; transition: opacity 240ms, visibility 0s linear 240ms;
    }
    .sidebar-overlay.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
  }

  @container page (max-width: 880px) {
    .split, .split--ops { grid-template-columns: minmax(0, 1fr); }
  }
  @media (max-width: 560px) {
    .topbar__actions { gap: 8px; }
    .topbar__actions .btn span { display: none; }
    .topbar__actions .btn { width: 38px; padding: 0; }
  }
}

/* ==========================================================================
   4. COMPONENTS
   ========================================================================== */
@layer components {

  /* ----- Buttons ----- */
  .btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--r-sm);
    font-family: var(--font-text); font-weight: 600; font-size: 0.875rem; line-height: 1; white-space: nowrap;
    text-decoration: none; cursor: pointer;
    transition: transform var(--t-fast) var(--ease), box-shadow var(--t-base), background var(--t-fast), border-color var(--t-fast), filter var(--t-fast);
  }
  .btn:hover { text-decoration: none; transform: translateY(-1px); }
  .btn:active { transform: translateY(0) scale(0.985); }
  .btn .i { width: 1.05rem; height: 1.05rem; }
  .btn--sm { height: 34px; padding: 0 12px; font-size: 0.82rem; }
  .btn--lg { height: 48px; padding: 0 20px; font-size: 0.95rem; }
  .btn--block { width: 100%; }

  .btn--primary {
    color: var(--btn-ink);
    background: linear-gradient(180deg, var(--btn-a), var(--btn-b) 55%, var(--btn-c));
    box-shadow: var(--btn-shadow);
  }
  .btn--primary:hover { color: var(--btn-ink); filter: brightness(1.07); }
  .btn--ghost { color: var(--text); background: transparent; border-color: var(--line-strong); }
  .btn--ghost:hover { background: var(--hover); border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong)); color: var(--text); }
  .btn--success {
    color: var(--ok-ink); background: linear-gradient(180deg, var(--ok-a), var(--ok-b));
    box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--ok-b) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  .btn--success:hover { color: var(--ok-ink); filter: brightness(1.06); }

  .btn:disabled, .btn.is-busy { cursor: progress; opacity: 0.8; transform: none; }
  .btn.is-busy::before {
    content: ""; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin 700ms linear infinite;
  }

  .icon-btn {
    display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
    border: 1px solid var(--line-strong); border-radius: var(--r-sm);
    background: transparent; color: var(--text-2); cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  }
  .icon-btn:hover { background: var(--hover); color: var(--text); }
  .icon-btn.topbar__menu { display: none; }
  @media (max-width: 1023.98px) { .icon-btn.topbar__menu { display: inline-grid; } }

  /* ----- Theme switch ----- */
  .theme-toggle {
    position: relative; flex: none; width: 60px; height: 32px; padding: 0;
    border-radius: var(--r-pill); border: 1px solid var(--line-strong);
    background: var(--card-2); cursor: pointer; color: var(--text-3);
    transition: border-color var(--t-fast), background var(--t-base);
  }
  .theme-toggle:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line-strong)); }
  .theme-toggle__icon { position: absolute; top: 50%; translate: 0 -50%; display: grid; }
  .theme-toggle__icon .i { width: 15px; height: 15px; }
  .theme-toggle__icon--sun { left: 8px; }
  .theme-toggle__icon--moon { right: 8px; }
  .theme-toggle__thumb {
    position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
    background: linear-gradient(145deg, var(--bright), var(--electric));
    box-shadow: 0 2px 8px -1px var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: transform 320ms var(--ease);
  }
  .theme-toggle__thumb::after {
    content: ""; position: absolute; inset: 0; background: #fff;
    -webkit-mask: var(--thumb-icon) center / 14px 14px no-repeat; mask: var(--thumb-icon) center / 14px 14px no-repeat;
  }
  :root[data-theme="dark"] .theme-toggle { --thumb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 14.2A8 8 0 0 1 9.8 4a8 8 0 1 0 10.2 10.2z'/%3E%3C/svg%3E"); }
  :root[data-theme="light"] .theme-toggle { --thumb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2.5v2.2M12 19.3v2.2M2.5 12h2.2M19.3 12h2.2M5.3 5.3l1.5 1.5M17.2 17.2l1.5 1.5M18.7 5.3l-1.5 1.5M6.8 17.2l-1.5 1.5'/%3E%3C/svg%3E"); }
  :root[data-theme="dark"] .theme-toggle__thumb { transform: translateX(28px); }
  :root[data-theme="light"] .theme-toggle__thumb { transform: translateX(0); }
  :root[data-theme="dark"] .theme-toggle__icon--moon,
  :root[data-theme="light"] .theme-toggle__icon--sun { opacity: 0; }

  /* ----- Forms ----- */
  .field { margin-bottom: 16px; }
  .field__label { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; font-size: 0.85rem; font-weight: 600; color: var(--text); }
  .field__hint { font-weight: 500; font-size: 0.76rem; color: var(--text-3); }
  .field__help { margin-top: 7px; font-size: 0.8rem; color: var(--text-3); }
  .field__help ul { margin: 4px 0 0; padding-left: 1.1rem; list-style: disc; }
  .field__help li { margin: 2px 0; }
  .field__error { margin-top: 7px; font-size: 0.82rem; font-weight: 500; color: var(--danger); }
  .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

  input[type="text"], input[type="password"], input[type="search"], input[type="number"],
  input[type="email"], input[type="date"], textarea, select {
    width: 100%; min-height: 44px; padding: 10px 14px;
    border: 1px solid var(--field-line); border-radius: var(--r-sm);
    background: var(--field); color: var(--text); outline: none;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  }
  textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
  select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
  ::placeholder { color: var(--text-3); opacity: 1; }
  input:hover, textarea:hover, select:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--field-line)); }
  input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
  }
  .has-error input, input[aria-invalid="true"] { border-color: var(--danger); }

  .pw { position: relative; }
  .pw input { padding-right: 48px; }
  .pw__btn {
    position: absolute; right: 5px; top: 50%; translate: 0 -50%;
    display: grid; place-items: center; width: 34px; height: 34px;
    border: 0; border-radius: var(--r-xs); background: transparent; color: var(--text-3);
  }
  .pw__btn:hover { color: var(--text); background: var(--hover); }
  .pw__btn .i { width: 1.1rem; height: 1.1rem; }

  /* Search */
  .search {
    position: relative; display: flex; align-items: center; gap: 8px;
    width: min(380px, 100%); height: 46px; padding: 0 6px 0 14px;
    border: 1px solid var(--field-line); border-radius: var(--r-sm);
    background: var(--field);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
  }
  .search:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--field-line)); }
  .search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent); }
  .search__icon { color: var(--text-3); width: 1.15rem; height: 1.15rem; }
  .search input[type="search"] {
    flex: 1; min-width: 0; min-height: 0; height: 100%; padding: 0; border: 0; border-radius: 0;
    background: transparent; box-shadow: none; appearance: none;
  }
  .search input::-webkit-search-cancel-button { display: none; }
  .search__kbd {
    display: none; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
    border: 1px solid var(--line-strong); border-radius: 6px;
    font: 600 0.72rem/1 var(--font-text); color: var(--text-3);
  }
  @media (hover: hover) and (pointer: fine) {
    .search__kbd { display: inline-grid; }
    .search:focus-within .search__kbd, .search:has(input:not(:placeholder-shown)) .search__kbd { display: none; }
  }
  .search--lg { width: min(460px, 100%); height: 52px; }

  /* Upload */
  .upload {
    position: relative; text-align: center; padding: 22px 16px;
    border: 1.5px dashed var(--field-line); border-radius: var(--r-md);
    background: color-mix(in srgb, var(--accent) 5%, transparent);
    transition: border-color var(--t-fast), background var(--t-fast);
  }
  .upload:hover, .upload.is-drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
  .upload:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent); }
  .upload input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  .upload__icon { width: 28px; height: 28px; margin: 0 auto 8px; color: var(--accent-strong); }
  .upload__text { font-weight: 600; overflow-wrap: anywhere; }
  .upload__hint { margin-top: 2px; font-size: 0.8rem; color: var(--text-3); }
  .upload__preview { display: none; width: 100%; max-height: 170px; margin-top: 14px; object-fit: cover; border-radius: var(--r-sm); pointer-events: none; }
  .upload__preview.is-visible { display: block; }

  .banner {
    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); border-radius: var(--r-sm);
    background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--text); font-weight: 500;
  }
  .banner .i { color: var(--danger); margin-top: 1px; }

  /* ----- Status, type ----- */
  .status {
    display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; flex: none;
    border-radius: var(--r-pill); font-size: 0.76rem; font-weight: 600; line-height: 1; white-space: nowrap;
    color: var(--open-text); background: var(--open-soft);
  }
  .status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .status--claimed { color: var(--claimed-text); background: var(--claimed-soft); }
  .status--resolved { color: var(--resolved-text); background: var(--resolved-soft); }

  .dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: currentColor; flex: none; }
  .dot--open { color: var(--open-text); }
  .dot--claimed { color: var(--claimed-text); }
  .dot--resolved { color: var(--resolved-text); }

  .type-label { font-weight: 600; }
  .type-label--lost { color: var(--lost-text); }
  .type-label--found { color: var(--found-text); }

  .type-tab {
    position: absolute; top: 0; left: 14px; z-index: 1;
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px 0 9px;
    border-radius: 0 0 var(--r-sm) var(--r-sm);
    font-size: 0.78rem; font-weight: 700; line-height: 1;
    background: var(--lost); color: var(--lost-ink);
    box-shadow: 0 8px 14px -8px rgba(0, 0, 0, 0.5);
  }
  .type-tab .i { width: 0.95rem; height: 0.95rem; stroke-width: 2; }
  .type-tab--found { background: var(--found); color: var(--found-ink); }

  /* ----- Panels, records ----- */
  .panel {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: var(--shadow-1); overflow: hidden;
  }
  .panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 16px; }
  .panel__title { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; }
  .panel__note { margin-top: 3px; font-size: 0.85rem; color: var(--text-3); }
  .panel__actions { display: flex; gap: 8px; flex: none; }

  .records { max-height: 27rem; overflow-y: auto; border-top: 1px solid var(--line); }
  .record {
    display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 16px; align-items: center; gap: 14px;
    padding: 13px 22px; color: var(--text); text-decoration: none;
    border-bottom: 1px solid var(--line);
    transition: background var(--t-fast);
  }
  .record:last-child { border-bottom: 0; }
  a.record:hover { background: var(--hover); text-decoration: none; }
  .record--static { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .record--approval { grid-template-columns: 46px minmax(0, 1fr) auto auto; }
  .management-requests { margin-bottom: 20px; }
  .record__thumb {
    width: 46px; height: 46px; border-radius: var(--r-sm); overflow: hidden; flex: none;
    display: grid; place-items: center; color: var(--text-3);
    background: var(--card-2); border: 1px solid var(--line);
  }
  .record__thumb img { width: 100%; height: 100%; object-fit: cover; }
  .record__thumb--lost { color: var(--lost-text); background: var(--lost-soft); border-color: transparent; }
  .record__thumb--found { color: var(--found-text); background: var(--found-soft); border-color: transparent; }
  .record__thumb--claim { color: var(--accent-strong); background: var(--open-soft); border-color: transparent; }
  .record__thumb:has(img) { border-color: var(--line); }
  .record__main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .record__title { font-weight: 600; letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .record__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 0.83rem; color: var(--text-2); }
  .record__loc { min-width: 0; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .record__state { display: inline-flex; align-items: center; gap: 6px; }
  .record__state .i { width: 0.95rem; height: 0.95rem; color: var(--claimed-text); }
  .record__state--done .i { color: var(--resolved-text); }
  .record__go { width: 1rem; height: 1rem; color: var(--text-3); transition: transform var(--t-base) var(--ease), color var(--t-fast); }
  a.record:hover .record__go { transform: translateX(3px); color: var(--text); }

  /* ----- Empty states ----- */
  .empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 30px 24px 38px; border-top: 1px solid var(--line); }
  .panel > .empty:only-child, .empty--page { border-top: 0; padding-block: 52px 60px; }
  .art { width: 152px; height: auto; margin-bottom: 10px; overflow: visible; }
  .art-line { fill: none; stroke: var(--text-3); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .art-soft { stroke: color-mix(in srgb, var(--text-3) 55%, transparent); }
  .art-dash { stroke-dasharray: 4.5 4.5; }
  .art-accent { stroke: var(--accent-strong); }
  .art-fill { fill: color-mix(in srgb, var(--accent) 18%, transparent); stroke: none; }
  .art-glow { fill: color-mix(in srgb, var(--accent) 16%, transparent); filter: blur(16px); }
  .art-dot { fill: var(--text-3); opacity: 0.7; }
  .empty__title { font-size: 1.12rem; font-weight: 600; }
  .empty__text { margin-top: 6px; max-width: 40ch; color: var(--text-2); }
  .empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }

  /* ----- Segmented filter ----- */
  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
  .segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--card-2); border: 1px solid var(--line); }
  .segmented__btn {
    display: inline-flex; align-items: center; gap: 0; height: 34px; padding: 0 13px;
    border: 0; border-radius: calc(var(--r-md) - 3px); background: transparent;
    color: var(--text-2); font-weight: 600; font-size: 0.85rem;
    transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  }
  .segmented__btn .dot { margin-right: 7px; }
  .segmented__btn:hover { color: var(--text); }
  .segmented__btn.is-active { color: var(--text); background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 0 0 1px var(--line-strong); }
  .count { margin-left: 8px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--hover); font-size: 0.74rem; font-weight: 600; color: var(--text-3); }
  .segmented__btn.is-active .count { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-strong); }
  .filter-empty { display: none; margin-bottom: 18px; color: var(--text-2); }
  .filter-empty.is-visible { display: block; }
  .is-filtered-out { display: none !important; }

  /* ----- Item cards (claim-tag motif: punched stub) ----- */
  .items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 20px; align-items: stretch; }
  .item-card {
    filter: var(--drop-1);
    transition: transform var(--t-base) var(--ease), filter var(--t-base);
    scroll-margin-top: 24px;
  }
  .item-card:hover { transform: translateY(-3px); filter: var(--drop-2); }
  .item-card__in {
    --notch: 8px; --stub-h: 74px;
    position: relative; display: flex; flex-direction: column; height: 100%;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
    -webkit-mask:
      radial-gradient(circle at 0 calc(100% - var(--stub-h)), #0000 calc(var(--notch) - 0.6px), #000 var(--notch)) left / 51% 100% no-repeat,
      radial-gradient(circle at 100% calc(100% - var(--stub-h)), #0000 calc(var(--notch) - 0.6px), #000 var(--notch)) right / 51% 100% no-repeat;
    mask:
      radial-gradient(circle at 0 calc(100% - var(--stub-h)), #0000 calc(var(--notch) - 0.6px), #000 var(--notch)) left / 51% 100% no-repeat,
      radial-gradient(circle at 100% calc(100% - var(--stub-h)), #0000 calc(var(--notch) - 0.6px), #000 var(--notch)) right / 51% 100% no-repeat;
    transition: border-color var(--t-base);
  }
  .item-card:hover .item-card__in { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
  .item-card:target .item-card__in { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

  .item-card__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: calc(var(--r-md) - 1px) calc(var(--r-md) - 1px) 0 0; background: var(--card-2); }
  .item-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease); }
  .item-card:hover .item-card__media img { transform: scale(1.045); }
  .item-card__media::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(180deg, transparent, rgba(2, 8, 34, 0.28)); pointer-events: none; }
  .item-card__media.is-empty::after { display: none; }
  .item-card__media.is-empty {
    background:
      repeating-linear-gradient(135deg, transparent 0 11px, color-mix(in srgb, var(--text) 5%, transparent) 11px 12px),
      var(--card-2);
  }
  .item-card__ph { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); font-size: 0.82rem; font-weight: 500; }
  .item-card__ph .i { width: 38px; height: 38px; stroke-width: 1.3; }
  .item-card--lost .item-card__ph .i { color: var(--lost-text); }
  .item-card--found .item-card__ph .i { color: var(--found-text); }
  .item-card__status {
    position: absolute; top: 12px; right: 12px; z-index: 1;
    background: color-mix(in srgb, var(--card) 90%, transparent);
    box-shadow: 0 0 0 1px var(--line); backdrop-filter: blur(6px);
  }

  .item-card__body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 16px; min-width: 0; }
  .item-card__name {
    font-size: 1.04rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
  }
  .item-card__desc {
    color: var(--text-2); font-size: 0.89rem; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
  }
  .item-card__meta { display: flex; flex-direction: column; gap: 5px; margin-top: auto; padding-top: 6px; font-size: 0.83rem; color: var(--text-2); }
  .item-card__meta li { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .item-card__meta .i { width: 0.95rem; height: 0.95rem; color: var(--text-3); }
  .item-card__meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .item-card__stub {
    height: var(--stub-h); flex: none; display: flex; align-items: center; padding: 0 18px;
    border-top: 1.5px dashed var(--line-strong);
  }
  .item-card__stub form { width: 100%; }
  .stub-note { display: flex; align-items: center; gap: 10px; font-size: 0.83rem; line-height: 1.35; color: var(--text-2); }
  .stub-note .i { color: var(--claimed-text); width: 1.05rem; height: 1.05rem; }
  .stub-note--done .i { color: var(--resolved-text); }

  /* Compact list layout when the content area is narrow (phones) */
  @container page (max-width: 560px) {
    .items-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .item-card__in {
      display: grid; grid-template-columns: 112px minmax(0, 1fr);
      grid-template-areas: "media body" "stub stub"; grid-template-rows: 1fr auto;
    }
    .item-card__media { grid-area: media; position: static; aspect-ratio: auto; min-height: 136px; border-radius: calc(var(--r-md) - 1px) 0 0 0; }
    .item-card__body { grid-area: body; padding: 14px 14px 12px; }
    .item-card__stub { grid-area: stub; }
    .type-tab { left: 10px; }
    .item-card__status { top: 12px; right: 12px; }
    .item-card__name { padding-right: 78px; font-size: 1rem; }
    .item-card__ph .i { width: 30px; height: 30px; }
  }

  /* ----- Tables ----- */
  .table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
  .table { width: 100%; border-collapse: collapse; }
  .table th { padding: 11px 16px; text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--text-3); background: color-mix(in srgb, var(--card-2) 60%, transparent); border-bottom: 1px solid var(--line); white-space: nowrap; }
  .table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--text-2); }
  .table tbody tr:last-child td { border-bottom: 0; }
  .table tbody tr { transition: background var(--t-fast); }
  .table tbody tr:hover { background: var(--hover); }
  .table__action { text-align: right; white-space: nowrap; }
  .cell-item { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); text-decoration: none; }
  .cell-item:hover { text-decoration: none; }
  .cell-item:hover .record__title { color: var(--accent-strong); }
  .cell-item__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .table th:first-child, .table td:first-child { padding-left: 22px; }
  .table th:last-child, .table td:last-child { padding-right: 22px; }
  .table td[data-label="Location"] { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cell-item__meta { display: flex; gap: 10px; font-size: 0.82rem; color: var(--text-2); min-width: 0; }
  .cell-item .record__title { max-width: 24ch; }
  .cell-user { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 500; }
  .mini-avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 600 0.74rem var(--font-display); color: #fff; background: linear-gradient(145deg, var(--bright), var(--royal)); }

  @container page (max-width: 560px) { .panel__head { flex-direction: column; } }
  @container page (max-width: 720px) {
    .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .table, .table tbody, .table tr, .table td { display: block; }
    .table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
    .table tbody tr:last-child { border-bottom: 0; }
    .table td { padding: 0; border: 0; }
    .table td[data-label="Item"] { grid-column: 1 / -1; margin-bottom: 8px; }
    .table td[data-label]:not([data-label="Item"])::before { content: attr(data-label); display: block; font-size: 0.74rem; font-weight: 600; color: var(--text-3); margin-bottom: 2px; }
    .table__action { grid-column: 1 / -1; margin-top: 12px; text-align: left; }
    .table__action .btn { width: 100%; }
    .cell-item .record__title { max-width: none; }
  }

  /* ----- Dialogs ----- */
  .dialog {
    position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
    background: var(--scrim); backdrop-filter: blur(6px);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 220ms, visibility 0s linear 220ms;
  }
  .dialog.is-open { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .dialog__panel {
    width: min(440px, 100%); max-height: min(92vh, 860px); max-height: min(92dvh, 860px); overflow-y: auto;
    border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line-strong); box-shadow: var(--shadow-3);
    transform: translateY(16px) scale(0.985); transition: transform 300ms var(--ease);
  }
  .dialog.is-open .dialog__panel { transform: none; }
  .dialog__panel--wide { width: min(580px, 100%); }
  .dialog--confirm .dialog__panel { padding: 24px; }
  .dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 8px; }
  .dialog__title { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.015em; }
  .dialog__sub { margin-top: 5px; color: var(--text-2); font-size: 0.9rem; }
  .dialog__text { margin-top: 8px; color: var(--text-2); }
  .dialog__body { padding: 14px 24px 6px; }
  .dialog__foot, .dialog__actions { display: flex; justify-content: flex-end; gap: 10px; }
  .dialog__foot { padding: 16px 24px 22px; border-top: 1px solid var(--line); margin-top: 8px; }
  .dialog__actions { margin-top: 22px; }

  @media (max-width: 600px) {
    .dialog--form { place-items: end stretch; padding: 0; }
    .dialog--form .dialog__panel { width: 100%; max-height: 94dvh; border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(40px); }
    .field-row { grid-template-columns: 1fr; }
    .dialog__head, .dialog__body, .dialog__foot { padding-inline: 18px; }
    .dialog__foot .btn { flex: 1; }
  }

  /* ----- Toasts ----- */
  .toasts { position: fixed; z-index: 80; top: calc(var(--gutter) + 72px); right: 28px; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
  .toast {
    position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 14px 12px 14px 16px; overflow: hidden;
    border-radius: var(--r-md); background: var(--card); border: 1px solid var(--line-strong); box-shadow: var(--shadow-3);
    pointer-events: auto; animation: toast-in 380ms var(--ease) both;
  }
  .toast::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
  .toast--success::before { background: var(--resolved-text); }
  .toast--error::before { background: var(--danger); }
  .toast__icon { margin-top: 1px; color: var(--accent-strong); }
  .toast--success .toast__icon { color: var(--resolved-text); }
  .toast--error .toast__icon { color: var(--danger); }
  .toast__text { flex: 1; min-width: 0; font-weight: 500; line-height: 1.45; }
  .toast__close { display: grid; place-items: center; width: 28px; height: 28px; margin-top: -4px; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--text-3); }
  .toast__close:hover { background: var(--hover); color: var(--text); }
  .toast__close .i { width: 1rem; height: 1rem; }
  .toast.is-leaving { opacity: 0; transform: translateX(14px); transition: opacity 260ms, transform 260ms var(--ease); }
  @media (max-width: 1023.98px) { .toasts { top: 76px; right: 16px; } }
  @media (max-width: 560px) { .toasts { right: 16px; left: 16px; width: auto; } }

  /* ----- Quick-action tickets ----- */
  .tickets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 20px 0 24px; }
  .ticket {
    --notch: 8px; --stub: 72px; --t: var(--accent-strong); --t-soft: var(--open-soft);
    position: relative; display: flex; align-items: center; min-height: 86px; padding: 0;
    appearance: none; color: var(--text); text-align: left; text-decoration: none;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
    -webkit-mask:
      radial-gradient(circle at var(--stub) 0, #0000 calc(var(--notch) - 0.6px), #000 var(--notch)) top / 100% 51% no-repeat,
      radial-gradient(circle at var(--stub) 100%, #0000 calc(var(--notch) - 0.6px), #000 var(--notch)) bottom / 100% 51% no-repeat;
    mask:
      radial-gradient(circle at var(--stub) 0, #0000 calc(var(--notch) - 0.6px), #000 var(--notch)) top / 100% 51% no-repeat,
      radial-gradient(circle at var(--stub) 100%, #0000 calc(var(--notch) - 0.6px), #000 var(--notch)) bottom / 100% 51% no-repeat;
    transition: background var(--t-base), border-color var(--t-base), transform var(--t-base) var(--ease);
  }
  .ticket:hover { text-decoration: none; transform: translateY(-2px); background: var(--card-2); border-color: color-mix(in srgb, var(--t) 60%, var(--line)); }
  .ticket--lost { --t: var(--lost-text); --t-soft: var(--lost-soft); }
  .ticket--found { --t: var(--found-text); --t-soft: var(--found-soft); }
  .ticket__stub { align-self: stretch; width: var(--stub); flex: none; display: grid; place-items: center; color: var(--t); border-right: 1.5px dashed var(--line-strong); background: linear-gradient(90deg, var(--t-soft), transparent); }
  .ticket--lost .ticket__stub { background: var(--lost-soft); }
  .ticket--found .ticket__stub { background: var(--found-soft); }
  .ticket__stub .i { width: 1.6rem; height: 1.6rem; stroke-width: 1.6; transition: transform var(--t-base) var(--ease); }
  .ticket:hover .ticket__stub .i { transform: scale(1.1) rotate(-6deg); }
  .ticket__body { display: flex; flex-direction: column; gap: 2px; padding: 14px 8px 14px 18px; min-width: 0; flex: 1; }
  .ticket__title { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; letter-spacing: -0.01em; }
  .ticket__hint { font-size: 0.83rem; color: var(--text-3); }
  .ticket__go { margin-right: 16px; color: var(--text-3); transition: transform var(--t-base) var(--ease), color var(--t-fast); }
  .ticket:hover .ticket__go { transform: translateX(3px); color: var(--t); }

  @container page (max-width: 900px) { .tickets { grid-template-columns: minmax(0, 1fr); gap: 12px; } .ticket { min-height: 76px; } }
  @media (max-width: 560px) {
    .record--approval { grid-template-columns: 36px minmax(0, 1fr); gap: 8px; padding: 12px 14px; }
    .record--approval .record__thumb { width: 36px; height: 36px; }
    .record--approval .status, .record--approval .btn { grid-column: 2; justify-self: start; }
  }
}

/* ==========================================================================
   5. PAGES
   ========================================================================== */
@layer pages {

  /* ----- Student dashboard: campus billboard ----- */
  .hero {
    position: relative; isolation: isolate; overflow: hidden; display: grid;
    border-radius: var(--r-lg); border: 1px solid var(--hero-line);
    background: var(--hero-edge); color: #fff;
    box-shadow: var(--shadow-1);
  }
  .hero::before {
    content: ""; position: absolute; inset: 0; z-index: -2;
    background:
      radial-gradient(520px 340px at 8% 0%, var(--hero-glow-a), transparent 70%),
      radial-gradient(640px 360px at 100% 110%, var(--hero-glow-b), transparent 70%);
  }
  .hero__photo { position: absolute; z-index: -1; inset: 0 0 0 auto; width: 58%; margin: 0; overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.55) 28%, #000 62%);
    mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.55) 28%, #000 62%);
  }
  .hero__photo img {
    width: 100%; height: 100%; object-fit: cover; object-position: 48% 66%;
    filter: saturate(0.85) contrast(1.06) brightness(0.92);
    animation: hero-in 1100ms var(--ease) both;
  }
  .hero__photo::after {
    content: ""; position: absolute; inset: 0;
    background:
      linear-gradient(180deg, rgba(3, 25, 91, 0.1) 30%, rgba(3, 12, 50, 0.82) 100%),
      linear-gradient(135deg, rgba(25, 81, 252, 0.5), rgba(3, 25, 91, 0.35));
    mix-blend-mode: multiply;
  }
  .hero__photo figcaption {
    position: absolute; z-index: 1; right: 18px; bottom: 14px; display: inline-flex; align-items: center; gap: 7px;
    font-size: 0.78rem; font-weight: 500; color: rgba(255, 255, 255, 0.88);
    padding: 5px 10px 5px 8px; border-radius: var(--r-pill);
    background: rgba(3, 12, 50, 0.55); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.16);
  }
  .hero__photo figcaption .i { width: 0.9rem; height: 0.9rem; color: var(--sky); }
  .hero__copy { position: relative; padding: 38px 40px 32px; max-width: 640px; display: flex; flex-direction: column; }
  .hero__title { font-weight: 300; font-size: clamp(1.85rem, 1.2rem + 2.3vw, 2.85rem); line-height: 1.1; letter-spacing: -0.025em; overflow-wrap: anywhere; text-wrap: balance; }
  .hero__lede { margin-top: 12px; max-width: 46ch; text-wrap: pretty; color: rgba(226, 238, 255, 0.84); font-size: 1rem; }

  .hero .search { margin-top: 26px; width: min(540px, 100%); height: 56px; padding-left: 18px; border-radius: var(--r-md); --field: rgba(255, 255, 255, 0.1); --field-line: rgba(255, 255, 255, 0.26); color: #fff; backdrop-filter: blur(10px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 14px 30px -18px rgba(0, 0, 0, 0.6); }
  .hero .search:focus-within { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(119, 191, 255, 0.28); background: rgba(255, 255, 255, 0.14); }
  .hero .search__icon, .hero .search input::placeholder { color: rgba(226, 238, 255, 0.72); }
  .hero .search__kbd { border-color: rgba(255, 255, 255, 0.28); color: rgba(226, 238, 255, 0.8); }
  .hero .search .btn { height: 42px; padding: 0 20px; border-radius: var(--r-sm); }

  .hero__stats { display: flex; flex-wrap: wrap; gap: 22px 0; margin-top: 32px; }
  .stat { padding-right: 30px; margin-right: 30px; border-right: 1px solid rgba(255, 255, 255, 0.16); min-width: 0; }
  .stat:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
  .stat dt { font-size: 0.82rem; font-weight: 500; color: rgba(226, 238, 255, 0.78); }
  .stat dd { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
  .stat__n { font-family: var(--font-display); font-weight: 300; font-size: 2.3rem; line-height: 1.05; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
  .stat__note { display: inline-flex; align-items: center; font-size: 0.8rem; color: rgba(226, 238, 255, 0.78); }
  .hero .dot--open { color: var(--sky); }
  .hero .dot--claimed { color: #ffd37a; }
  .hero .dot--resolved { color: #7df0b4; }

  @container page (max-width: 860px) {
    .hero__photo { position: relative; inset: auto; width: 100%; height: 150px; -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent); mask-image: linear-gradient(180deg, #000 45%, transparent); }
    .hero__copy { padding: 4px 22px 26px; margin-top: -36px; max-width: none; }
    .hero__photo figcaption { right: 14px; bottom: 44px; }
    .hero__stats { margin-top: 26px; }
    .stat { padding-right: 20px; margin-right: 20px; }
    .stat__n { font-size: 1.9rem; }
  }
  @container page (max-width: 520px) {
    .hero__stats { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 0; }
    .stat { padding-right: 12px; margin-right: 12px; }
    .stat__note { font-size: 0.74rem; line-height: 1.3; }
    .hero .search { height: 52px; }
  }

  /* ----- Management ----- */
  .kpis {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin-bottom: 20px;
    background: var(--line-solid); border: 1px solid var(--line-solid); border-radius: var(--r-lg);
    overflow: hidden; box-shadow: var(--shadow-1);
  }
  .kpi { --kpi: var(--accent); position: relative; padding: 20px 22px 18px; background: var(--card); }
  .kpi::before { content: ""; position: absolute; left: 22px; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--kpi); }
  .kpi--lost { --kpi: var(--lost); }
  .kpi--found { --kpi: var(--found); }
  .kpi--open { --kpi: var(--accent); }
  .kpi--claimed { --kpi: #f2b84b; }
  .kpi--resolved { --kpi: #34c985; }
  .kpi dt { font-size: 0.84rem; font-weight: 500; color: var(--text-2); }
  .kpi dd { margin-top: 6px; font-family: var(--font-display); font-weight: 300; font-size: 2.4rem; line-height: 1.05; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
  .kpi.is-alert { background: linear-gradient(var(--claimed-soft), var(--claimed-soft)), var(--card); }
  .kpi.is-alert::before { width: calc(100% - 44px); }
  .kpi.is-alert dd { color: var(--claimed-text); font-weight: 400; }
  @container page (max-width: 860px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi:last-child { grid-column: 1 / -1; }
    .kpi { padding: 18px 18px 16px; }
    .kpi::before { left: 18px; }
  }

  /* ----- Authentication ----- */
  .auth { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr); }
  .auth__story { position: relative; isolation: isolate; overflow: hidden; color: #fff; background: #040d3a; }
  .auth__photo { position: absolute; inset: 0; z-index: -2; }
  .auth__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 42% 60%; filter: saturate(0.8) contrast(1.05) brightness(0.9); animation: hero-in 1400ms var(--ease) both; }
  .auth__story::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background:
      linear-gradient(180deg, rgba(3, 12, 54, 0.55) 0%, rgba(3, 25, 91, 0.3) 38%, rgba(2, 8, 36, 0.94) 100%),
      linear-gradient(120deg, rgba(25, 81, 252, 0.55), rgba(3, 25, 91, 0.5));
    mix-blend-mode: multiply;
  }
  .auth__story::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(2, 8, 36, 0.35) 0%, transparent 30%, rgba(2, 8, 36, 0.6) 100%); }
  .auth__story-inner { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 52px 44px; max-width: 780px; }
  .auth__brand { display: inline-flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; align-self: flex-start; }
  .auth__brand:hover { text-decoration: none; }
  .auth__brand .brand__sub { color: rgba(226, 238, 255, 0.78); font-size: 0.78rem; }
  .auth__brand .brand__name { font-size: 1.12rem; }
  .auth__headline { font-family: var(--font-display); font-weight: 300; font-size: clamp(2.5rem, 1.3rem + 3.6vw, 4.3rem); line-height: 1.04; letter-spacing: -0.03em; }
  .auth__lede { margin-top: 18px; max-width: 42ch; font-size: 1.05rem; color: rgba(232, 241, 255, 0.86); }
  .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 38px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, 0.2); }
  .steps li { display: flex; gap: 11px; font-size: 0.84rem; line-height: 1.4; color: rgba(226, 238, 255, 0.78); }
  .steps strong { display: block; margin-bottom: 2px; font-weight: 600; color: #fff; }
  .steps__n { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); font: 600 0.74rem var(--font-display); color: #fff; }

  .auth__panel {
    position: relative; display: flex; flex-direction: column; min-width: 0; padding: 28px 40px 24px;
    background: radial-gradient(520px 320px at 85% 0%, var(--auth-glow), transparent 70%), var(--auth-panel);
  }
  .auth__tools { position: absolute; top: 22px; right: 24px; z-index: 5; }
  .auth__form { width: min(400px, 100%); margin: auto; padding: 64px 0 36px; }
  .auth__title { font-weight: 500; font-size: clamp(1.7rem, 1.3rem + 1vw, 2.1rem); letter-spacing: -0.02em; }
  .auth__subtitle { margin: 8px 0 26px; color: var(--text-2); }
  .auth__switch { margin-top: 24px; color: var(--text-2); }
  .auth__switch a { font-weight: 600; }
  .auth__legal { text-align: center; font-size: 0.78rem; color: var(--text-3); }
  .auth-body .field--tight { margin-bottom: 12px; }

  @media (max-width: 900px) {
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth__story-inner { min-height: 0; padding: 22px 20px 26px; gap: 40px; }
    .auth__headline { font-size: 2.2rem; }
    .auth__lede { font-size: 0.98rem; margin-top: 12px; }
    .steps { display: none; }
    .auth__panel { padding: 8px 20px 22px; }
    .auth__form { padding: 28px 0 24px; margin: 0 auto; }
    .auth__tools { top: 18px; right: 16px; }
  }
}

/* ==========================================================================
   6. MOTION
   ========================================================================== */
@layer motion {
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes hero-in { from { opacity: 0; transform: scale(1.05); } to { opacity: 1; transform: none; } }
  @keyframes toast-in { from { opacity: 0; transform: translateX(18px) scale(0.98); } to { opacity: 1; transform: none; } }
  @keyframes page-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @media (max-width: 560px) { @keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } } }

  .page-content > *, .auth__form > section:not([hidden]) { animation: page-enter 280ms var(--ease) both; }
  .tickets .ticket, .items-grid .item-card { animation: page-enter 300ms var(--ease) both; }
  .tickets .ticket:nth-child(2), .items-grid .item-card:nth-child(2) { animation-delay: 35ms; }
  .tickets .ticket:nth-child(3), .items-grid .item-card:nth-child(3) { animation-delay: 70ms; }
  .items-grid .item-card:nth-child(4) { animation-delay: 105ms; }
  .items-grid .item-card:nth-child(5) { animation-delay: 140ms; }

  /* Fallback for browsers without View Transitions: fade colours briefly. */
  html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
    transition: background-color 320ms ease, background-image 320ms ease, border-color 320ms ease, color 320ms ease, fill 320ms ease, stroke 320ms ease, box-shadow 320ms ease !important;
  }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 340ms; animation-timing-function: ease; }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .scroll-area { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; }
    .item-card:hover, .ticket:hover, .btn:hover { transform: none; }
    .item-card:hover .item-card__media img { transform: none; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  }
}
