/* VN Studio: the Spatial look. Depth comes from layered panels and soft shadows; colours and
   edges meet WCAG contrast (text 4.5:1, buttons and fields 3:1), as measured in the style test. */

:root {
  --page: #ECEEF5;
  --panel: #FFFFFF;
  --ink: #1C1B22;
  --muted: #55535F;
  --edge: #8F8B99;
  --line: #E3E1EC;
  --accent: #4338CA;
  --accent-dark: #312E81;
  --night: #1E1B4B;
  --lilac: #C9A7FF;
  --wait: #FEF3C7; --wait-ink: #78350F;
  --good: #DCFCE7; --good-ink: #14532D;
  --info: #E0E7FF; --info-ink: #312E81;
  --bad: #FEE2E2; --bad-ink: #7F1D1D;
  --lift-1: 0 1px 2px rgba(30, 27, 75, 0.06), 0 8px 20px rgba(30, 27, 75, 0.08);
  --lift-2: 0 1px 2px rgba(30, 27, 75, 0.08), 0 18px 40px rgba(30, 27, 75, 0.16);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
p { margin: 0; }
.serif { font-family: "Literata", Georgia, serif; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- layout: side menu on wide screens, top bar on phones --- */
.app { min-height: 100vh; display: flex; }
.side { flex: 0 0 248px; background: var(--night); color: #E8E5FF; padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #FFFFFF; font-weight: 700; text-decoration: none; padding: 0 6px; }
.brand:hover { color: #FFFFFF; }
.mark { width: 34px; height: 34px; border-radius: 9px; background: var(--lilac); color: var(--night); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu a { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #D9D5F5; text-decoration: none; }
.menu a:hover { background: #2A2660; color: #FFFFFF; }
.menu a[aria-current="page"] { background: #3A3570; color: #FFFFFF; font-weight: 700; }
.count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #F59E0B; color: #1C1B22; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.who { margin-top: auto; border-top: 1px solid #3A3570; padding: 12px 8px 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #D9D5F5; }
.who strong { color: #FFFFFF; }
.linklike { background: none; border: 0; padding: 0; color: var(--lilac); font: inherit; font-weight: 600; cursor: pointer; text-align: left; min-height: 32px; }
.top { display: none; }
main { flex: 1; min-width: 0; padding: 28px clamp(16px, 4vw, 40px) 56px; display: flex; flex-direction: column; gap: 22px; max-width: 1240px; }

@media (max-width: 799px) {
  .app { flex-direction: column; }
  .side { display: none; }
  .top { display: block; background: var(--night); color: #FFFFFF; position: sticky; top: 0; z-index: 5; }
  .top-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; }
  .top details > summary { list-style: none; min-height: 44px; padding: 0 14px; border: 1px solid #3A3570; border-radius: 10px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
  .top details > summary::-webkit-details-marker { display: none; }
  .top details[open] > summary { background: #3A3570; }
  .top .menu { padding: 4px 12px 14px; }
  .top-right { display: flex; gap: 8px; align-items: center; }
  .top-count { min-width: 44px; height: 44px; border-radius: 10px; background: #F59E0B; color: #1C1B22; font-weight: 700; display: grid; place-items: center; text-decoration: none; }
  .top-menu { position: absolute; left: 0; right: 0; top: 100%; background: var(--night); box-shadow: var(--lift-2); }
}

/* --- panels with depth --- */
.panel { background: var(--panel); border-radius: var(--radius); padding: 22px; box-shadow: var(--lift-1); display: flex; flex-direction: column; gap: 12px; }
.panel.lifted { box-shadow: var(--lift-2); }
.stack { position: relative; padding-bottom: 12px; }
.stack::before, .stack::after { content: ""; position: absolute; left: 24px; right: 24px; bottom: 0; height: 40px; border-radius: 20px; background: #F7F8FC; box-shadow: var(--lift-1); }
.stack::after { left: 12px; right: 12px; bottom: 6px; background: #FBFBFE; }
.stack > .panel { position: relative; z-index: 1; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.tile { background: var(--panel); border-radius: 16px; padding: 18px; box-shadow: var(--lift-1); display: flex; flex-direction: column; gap: 4px; }
.tile .big { font-size: 26px; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.list > * + * { border-top: 1px solid var(--line); }
.list > * { padding: 12px 0; }

.card { display: flex; flex-direction: column; gap: 12px; padding: 22px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--lift-1); color: var(--ink); text-decoration: none; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--lift-2); }
.cover { height: 110px; border-radius: 14px; background: #2E2A5C; color: #E8E5FF; display: flex; align-items: flex-end; padding: 12px; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; }

/* --- chips, bars --- */
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #F1F0EC; color: #3B3944; }
.chip.wait { background: var(--wait); color: var(--wait-ink); }
.chip.good { background: var(--good); color: var(--good-ink); }
.chip.info { background: var(--info); color: var(--info-ink); }
.chip.bad { background: var(--bad); color: var(--bad-ink); }
.bar { height: 10px; border-radius: 4px; background: #E6E8F0; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }

/* --- buttons and fields --- */
.button, button.primary, button.secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.button, button.primary { border: 0; background: var(--accent); color: #FFFFFF; box-shadow: 0 6px 16px rgba(67, 56, 202, 0.30); }
.button:hover, button.primary:hover { background: var(--accent-dark); color: #FFFFFF; }
.button.secondary, button.secondary { background: #FFFFFF; color: var(--ink); border: 1px solid var(--edge); box-shadow: none; }
.button.secondary:hover, button.secondary:hover { background: #F6F5FB; color: var(--ink); }
button.danger { border: 1px solid #B91C1C; background: #FFFFFF; color: #991B1B; min-height: 44px; padding: 0 16px; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-weight: 600; font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="file"], select, textarea {
  min-height: 46px; padding: 10px 14px; border: 1px solid var(--edge); border-radius: 12px; background: #FFFFFF; color: var(--ink); font: inherit; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #A5B4FC; outline-offset: 2px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.two { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

/* --- tabs: one row that scrolls sideways on phones --- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tabs a { flex: 0 0 auto; white-space: nowrap; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid #D9D7E3; background: #FFFFFF; color: #3B3944; text-decoration: none; display: inline-flex; align-items: center; font-size: 14px; }
.tabs a[aria-current="page"] { background: var(--night); border-color: var(--night); color: #FFFFFF; font-weight: 700; }

/* --- tables --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; }
td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }

/* --- field problems --- */
.field-error { color: var(--bad-ink); font-size: 13px; font-weight: 600; }
[aria-invalid="true"] { border: 2px solid #B91C1C !important; background: #FFF8F8 !important; }

/* --- messages --- */
.flash { padding: 12px 16px; border-radius: 14px; background: var(--info); color: var(--info-ink); font-weight: 600; box-shadow: var(--lift-1); }
.error { padding: 12px 14px; border-radius: 12px; background: var(--bad); color: var(--bad-ink); font-weight: 600; }
.empty { padding: 26px; border-radius: var(--radius); border: 2px dashed #CFCDE0; color: var(--muted); text-align: center; background: rgba(255, 255, 255, 0.5); }
details.output summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details.output pre { white-space: pre-wrap; font: 14px/1.5 "Literata", Georgia, serif; background: #F6F5FB; padding: 12px; border-radius: 12px; max-height: 320px; overflow: auto; }

/* --- signed-out pages --- */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-form { order: 1; flex: 999 1 520px; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-form > div { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
.auth-brand { order: 2; flex: 1 1 380px; background: var(--night); color: #F4F2FF; padding: clamp(28px, 6vw, 64px) clamp(20px, 5vw, 56px); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-brand h1 { font-family: "Literata", Georgia, serif; font-weight: 600; font-size: clamp(28px, 4vw, 42px); }
.auth-brand p { color: #D9D5F5; font-size: 17px; }
.switcher { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 4px; padding: 4px; background: #E2E4EE; border-radius: 12px; }
.switcher a { min-height: 44px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.switcher a[aria-current="page"] { background: #FFFFFF; color: var(--ink); box-shadow: var(--lift-1); }
.code-input { letter-spacing: 0.4em; font-size: 20px; }
