:root {
  color-scheme: dark;
  --ink: #f4f6fb;
  --muted: #9297aa;
  --faint: #62677a;
  --canvas: #070810;
  --sidebar: #0d0f1b;
  --surface: #111420;
  --surface-2: #171a28;
  --line: #252939;
  --line-strong: #353a4d;
  --blue: #5b8ff9;
  --blue-soft: #16284d;
  --cyan: #59c3d8;
  --green: #54cf91;
  --amber: #f0b45a;
  --radius: 11px;
  --sidebar-width: 244px;
  font-family: "Golos Text", "Segoe UI", Arial, sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --ink: #171a25;
  --muted: #626879;
  --faint: #8b91a0;
  --canvas: #f5f7fb;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --line: #dfe4ed;
  --line-strong: #cbd2de;
  --blue-soft: #e8efff;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue), transparent 35%); outline-offset: 2px; }

.skip-link { position: fixed; left: 14px; top: 10px; z-index: 99; transform: translateY(-160%); padding: 9px 12px; border-radius: 7px; color: white; background: #245bb6; }
.skip-link:focus { transform: none; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar-width); padding: 24px 15px 15px; background: var(--sidebar); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 11px; }
.brand > span:last-child { display: flex; align-items: baseline; gap: 5px; }
.brand strong { font-size: 22px; letter-spacing: -.04em; }
.brand small { color: var(--muted); font-size: 13px; }
.brand-mark { position: relative; width: 29px; height: 29px; transform: rotate(-12deg); }
.brand-mark i { position: absolute; display: block; width: 16px; height: 7px; border-radius: 8px; background: var(--blue); }
.brand-mark i:nth-child(1) { left: 1px; top: 4px; }
.brand-mark i:nth-child(2) { right: 0; top: 11px; background: var(--cyan); }
.brand-mark i:nth-child(3) { left: 3px; bottom: 2px; background: var(--green); }
.primary-nav { display: grid; gap: 5px; margin-top: 38px; }
.nav-item, .theme-toggle { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; width: 100%; min-height: 44px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.nav-item:hover, .theme-toggle:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active { background: var(--blue-soft); color: #8bb0ff; }
.nav-icon { display: grid; place-items: center; width: 20px; font-size: 19px; }
.nav-item em { padding: 3px 5px; border-radius: 4px; color: var(--faint); background: var(--surface-2); font: 650 9px/1 Arial, sans-serif; text-transform: uppercase; letter-spacing: .05em; }
.sidebar-foot { display: grid; gap: 8px; margin-top: auto; }
.theme-toggle { grid-template-columns: 28px 1fr; }
.account { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; padding: 12px 10px 4px; border-top: 1px solid var(--line); }
.account .avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--blue-soft); color: #8bb0ff; font-weight: 700; }
.account strong, .account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account strong { font-size: 12px; font-weight: 600; }
.account small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--amber); }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 13px; min-height: 68px; padding: 0 38px; border-bottom: 1px solid var(--line); }
.environment { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.environment span { padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 6px; }
.environment i { color: var(--green); font-style: normal; }
.help-button, .menu-button { border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; }
.help-button { width: 32px; height: 32px; border-radius: 50%; color: var(--muted); }
.menu-button { display: none; margin-right: auto; padding: 8px 11px; border-radius: 7px; }
.page { width: min(1180px, 100%); margin: 0 auto; padding: 44px 42px 80px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 34px; }
.page-head h1 { margin: 0; font-size: clamp(27px, 3vw, 39px); line-height: 1.16; letter-spacing: -.04em; }
.page-head p { max-width: 660px; margin: 10px 0 0; color: var(--muted); line-height: 1.6; }
.page-tag { flex: 0 0 auto; padding: 7px 10px; border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 12px; }

.route { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.route-step { position: relative; min-height: 118px; padding: 22px 25px; border-right: 1px solid var(--line); }
.route-step:last-child { border-right: 0; }
.route-step.is-current::after { content: ""; position: absolute; inset: auto 24px 0; height: 3px; background: var(--blue); }
.route-step span { display: block; margin-bottom: 18px; color: var(--faint); font-size: 12px; }
.route-step strong { display: block; font-size: 15px; }
.route-step small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .75fr); gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-body h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.panel-body { padding: 22px; }
.settings-list { display: grid; margin: 0; }
.settings-list div { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.settings-list div:last-child { border-bottom: 0; }
.settings-list dt { color: var(--muted); font-size: 13px; }
.settings-list dd { margin: 0; font-size: 13px; font-weight: 600; text-align: right; }
.button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.button:hover { border-color: var(--blue); }
.button.primary { border-color: var(--blue); background: var(--blue); color: #071229; font-weight: 700; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.dropzone { display: grid; place-items: center; min-height: 250px; padding: 32px; border: 1px dashed var(--line-strong); border-radius: 9px; background: color-mix(in srgb, var(--surface-2), transparent 42%); text-align: center; }
.dropzone-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 15px; border-radius: 13px; background: var(--blue-soft); color: #8bb0ff; font-size: 24px; }
.dropzone strong { font-size: 15px; }
.dropzone p { max-width: 390px; margin: 8px auto 17px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.file-name { display: block; min-height: 18px; margin-top: 12px; color: var(--green); font-size: 12px; }
.empty-state { display: grid; place-items: center; min-height: 360px; padding: 45px; text-align: center; }
.empty-symbol { display: grid; place-items: center; width: 76px; height: 76px; margin-bottom: 23px; border: 1px solid var(--line-strong); border-radius: 24px; background: var(--surface-2); color: var(--blue); font-size: 31px; }
.empty-state h2 { margin: 0; font-size: 20px; }
.empty-state p { max-width: 500px; margin: 10px 0 22px; color: var(--muted); line-height: 1.55; }
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metric { padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 13px; font-size: 25px; letter-spacing: -.03em; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--muted); font-weight: 500; }
.table td:last-child, .table th:last-child { text-align: right; }
.status { display: inline-flex; align-items: center; gap: 7px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.toast { position: fixed; z-index: 60; right: 24px; bottom: 24px; max-width: 360px; padding: 12px 15px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface-2); color: var(--ink); box-shadow: 0 12px 35px rgba(0,0,0,.3); opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.is-visible { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-101%); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(0,0,0,.28); }
  .sidebar.is-open { transform: none; }
  .workspace { margin-left: 0; }
  .menu-button { display: inline-block; }
  .topbar { padding: 0 22px; }
  .page { padding: 34px 22px 70px; }
  .work-grid { grid-template-columns: 1fr; }
  .metric-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .environment span { display: none; }
  .page-head { display: block; }
  .page-tag { display: inline-block; margin-top: 16px; }
  .route { grid-template-columns: 1fr; }
  .route-step { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .route-step:last-child { border-bottom: 0; }
  .route-step.is-current::after { inset: 16px auto 16px 0; width: 3px; height: auto; }
  .metric-row { grid-template-columns: 1fr; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .table-wrap { overflow-x: auto; }
  .table { min-width: 620px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
