/* Кабинет «Апостиль»: те же цвета и шрифт, что на сайте. */
:root {
  color-scheme: light;
  --bg: #f7f8f2;
  --surface: #ffffff;
  --surface-2: #eef1e7;
  --ink: #173b32;
  --ink-2: #566359;
  --line: #dce2d8;
  --green: #214c3d;
  --green-2: #123329;
  --green-soft: #e9efdf;
  --deep: #122e28;
  --lime: #d9f279;
  --lime-2: #cbe863;
  --lime-soft: #f0f5dd;
  --sand: #fff4df;
  --sand-ink: #7a5310;
  --red: #b3261e;
  --red-soft: #fdecea;
  --on-deep: #c2d1c5;
  --font: "Onest", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --r-control: 12px;
  --r-card: 20px;
  --r-panel: 28px;
  --shadow: 0 14px 44px rgba(24, 61, 49, .07);
  --side-w: 252px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: clip; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: clamp(30px, 3.4vw, 42px); line-height: 1.12; font-weight: 500; letter-spacing: -.04em; text-wrap: balance; }
h2 { font-size: 21px; line-height: 1.25; font-weight: 500; letter-spacing: -.025em; }
h3 { font-size: 16px; line-height: 1.35; font-weight: 600; letter-spacing: -.01em; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.boot { padding: 48px 24px; text-align: center; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.small { font-size: 14px; line-height: 1.45; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 40; padding: 12px 18px; background: var(--ink); color: #fff; border-radius: var(--r-control); text-decoration: none; }
.skip-link:focus { top: 12px; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border: 1.5px solid var(--green); border-radius: var(--r-control); background: var(--green); color: #fff; font-size: 15px; font-weight: 500; line-height: 1.25; text-align: center; text-decoration: none; cursor: pointer; transition: background-color .15s ease, border-color .15s ease; }
.btn:hover { background: var(--green-2); border-color: var(--green-2); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.lime { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.btn.lime:hover { background: var(--lime-2); border-color: var(--lime-2); }
.btn.ghost { background: transparent; color: var(--ink); border-color: #cad3c6; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--red); border-color: #e5c0bc; }
.btn.danger:hover { background: var(--red-soft); }
.btn.solid-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.btn.wide { width: 100%; }
.link { color: var(--green); font-weight: 500; text-underline-offset: 3px; }

/* Метки */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: 13px; font-weight: 500; line-height: 1.35; white-space: nowrap; }
.badge.good { background: #dff1cf; color: #1f5a2c; }
.badge.warn { background: var(--sand); color: var(--sand-ink); }
.badge.bad { background: var(--red-soft); color: var(--red); }
.badge.info { background: var(--green-soft); color: var(--green); }
.badge.solid { background: var(--ink); color: #fff; }

/* Вход */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100dvh; }
.auth-side { display: grid; align-content: space-between; gap: 40px; padding: clamp(28px, 5vw, 64px); background: var(--deep); color: #fff; }
.auth-side h1 { max-width: 12em; font-size: clamp(34px, 4.2vw, 56px); }
.auth-side p { max-width: 30em; color: var(--on-deep); }
.auth-points { display: grid; gap: 12px; color: var(--on-deep); }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points .icon { color: var(--lime); }
.auth-main { display: grid; place-items: center; padding: clamp(24px, 5vw, 64px) 20px; }
.auth-form { display: grid; gap: 18px; width: min(420px, 100%); }
.auth-form h2 { font-size: 30px; letter-spacing: -.035em; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand svg { width: 37px; height: 37px; flex: none; }
.brand span { display: grid; line-height: 1.15; }
.brand b { font-size: 21px; font-weight: 600; letter-spacing: -.8px; }
.brand small { font-size: 11px; opacity: .75; margin-top: 3px; }

/* Поля */
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label, .field-label { font-size: 14px; font-weight: 500; }
.field-hint { font-size: 13px; color: var(--ink-2); }
.field-error { font-size: 14px; font-weight: 500; color: var(--red); }
.input { width: 100%; min-height: 48px; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--r-control); background: var(--surface); font-size: 16px; line-height: 1.35; }
.input:hover { border-color: #b9c4b6; }
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.input[aria-invalid="true"] { border-color: var(--red); }
textarea.input { min-height: 92px; resize: vertical; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23173b32' stroke-width='1.7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; cursor: pointer; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--green); flex: none; }
.form-error { padding: 12px 14px; border-radius: 12px; background: var(--red-soft); color: #7a1a14; font-size: 15px; }
.form-note { padding: 12px 14px; border-radius: 12px; background: var(--lime-soft); font-size: 15px; }

/* Оболочка */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 28px; height: 100dvh; padding: 24px 16px 18px; background: var(--deep); color: #fff; overflow-y: auto; }
.side .brand { padding: 0 8px; }
.side nav { display: grid; gap: 3px; }
.side-link { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 9px 12px; border: 0; border-radius: var(--r-control); background: none; color: var(--on-deep); font-size: 15.5px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; width: 100%; }
.side-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-link[aria-current="page"] { background: var(--lime); color: var(--ink); }
.side :focus-visible { outline-color: var(--lime); }
.side-foot { display: grid; gap: 3px; margin-top: auto; }
.side-user { display: grid; padding: 10px 12px; font-size: 14px; color: var(--on-deep); line-height: 1.35; overflow-wrap: anywhere; }
.side-user b { color: #fff; font-weight: 500; }
.content { width: 100%; max-width: 1140px; margin-inline: auto; padding: clamp(24px, 3.4vw, 44px) clamp(20px, 3.4vw, 44px) 72px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-content: start; }
.topbar { display: none; }
.tabbar { display: none; }

/* Шапка страницы */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.page-head > div:first-child { display: grid; gap: 6px; min-width: 0; flex: 1 1 18rem; }
.section-title { font-size: 25px; letter-spacing: -.03em; }
.crumb { font-size: 14px; color: var(--ink-2); text-decoration: none; }
.crumb:hover { color: var(--ink); text-decoration: underline; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.subtabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.subtabs a { flex: none; padding: 10px 14px; border-bottom: 2px solid transparent; font-size: 15px; font-weight: 500; color: var(--ink-2); text-decoration: none; }
.subtabs a:hover { color: var(--ink); }
.subtabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--green); }

/* Карточки */
.card { display: grid; gap: 14px; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.card-head > div:first-child { min-width: 0; flex: 1 1 14rem; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.stack { display: grid; gap: 16px; }
.empty { display: grid; gap: 10px; justify-items: start; padding: 28px 22px; border: 1px dashed #c6d0c1; border-radius: var(--r-card); color: var(--ink-2); }
.empty h2 { color: var(--ink); }

/* Главный блок обзора */
.focus { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; padding: clamp(22px, 3vw, 34px); border-radius: var(--r-panel); background: var(--deep); color: #fff; }
.focus-label { font-size: 14px; color: var(--on-deep); }
.focus-main { display: grid; gap: 10px; align-content: start; min-width: 0; }
.focus-main h2 { font-size: clamp(23px, 2.6vw, 31px); line-height: 1.18; letter-spacing: -.035em; }
.focus-main .btn { justify-self: start; }
.focus-date { color: var(--lime); font-weight: 500; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-self: end; }
.metric { display: grid; gap: 2px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .07); }
.metric b { font-size: 26px; font-weight: 500; line-height: 1.1; letter-spacing: -.03em; }
.metric span { font-size: 13px; line-height: 1.25; color: var(--on-deep); overflow-wrap: anywhere; }

/* Списки */
.rows { display: grid; }
.row { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px 16px; padding-block: 11px; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; padding-top: 0; }
.row:last-child { padding-bottom: 0; }
.row > div:first-child { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.row-side { flex: none; text-align: right; font-size: 14px; color: var(--ink-2); }
.row-side.late { color: var(--red); font-weight: 500; }
.row a { text-decoration: none; }
.row a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Статусы университета */
.stepper { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.stepper li { display: grid; gap: 7px; align-content: start; font-size: 12.5px; line-height: 1.25; color: var(--ink-2); }
.stepper li::before { content: ""; height: 6px; border-radius: 4px; background: var(--surface-2); }
.stepper .done::before { background: var(--green); }
.stepper .current::before { background: var(--lime-2); box-shadow: inset 0 0 0 1px #a9c94d; }
.stepper .current { color: var(--ink); font-weight: 600; }
.stepper .done { color: var(--ink); }
.stage-line { display: none; font-size: 15px; }
.stage-line b { font-weight: 600; }
.mini-track { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin-top: 7px; }
.mini-track i { height: 4px; border-radius: 3px; background: var(--surface-2); }
.mini-track .done { background: var(--green); }
.mini-track .current { background: var(--lime-2); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 20px; font-size: 15px; line-height: 1.4; }
.facts dt { font-size: 13px; color: var(--ink-2); }
.facts dd { font-weight: 500; overflow-wrap: anywhere; }
.facts dd small { display: block; font-size: 13.5px; font-weight: 400; color: var(--ink-2); }
.facts .late { color: var(--red); }
.answer { padding: 12px 14px; border-radius: 12px; font-size: 15px; background: var(--surface-2); }
.answer.good { background: #e7f4dc; }
.answer.warn { background: var(--sand); }
.answer.bad { background: var(--red-soft); }
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; border-radius: 14px; background: var(--bg); }
details.history summary { cursor: pointer; font-size: 15px; font-weight: 500; }
details.history ol { display: grid; gap: 10px; margin-top: 12px; padding-left: 14px; border-left: 2px solid var(--line); }
details.history li { font-size: 14.5px; line-height: 1.4; }
details.history time { display: block; font-size: 13px; color: var(--ink-2); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* План */
.progress { display: grid; gap: 6px; }
.progress-bar { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress-bar i { display: block; height: 100%; border-radius: 6px; background: var(--green); }
.timeline { display: grid; gap: 26px; }
.month { display: grid; gap: 10px; }
.month h2 { font-size: 18px; }
.plan-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); min-width: 0; }
.plan-item.done { background: transparent; }
.plan-item.done .plan-title { color: var(--ink-2); text-decoration: line-through; }
.plan-item.overdue { border-color: #e5c0bc; }
.plan-mark { display: grid; place-items: center; flex: none; width: 24px; height: 24px; color: var(--ink-2); }
.plan-mark input { width: 20px; height: 20px; margin: 0; accent-color: var(--green); cursor: pointer; }
.plan-mark input:disabled { cursor: not-allowed; }
.plan-body { display: grid; gap: 3px; min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.plan-title { font-weight: 500; line-height: 1.35; }
.plan-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 14px; color: var(--ink-2); }
.plan-meta .late { color: var(--red); font-weight: 500; }

/* Экзамены и документы */
.exam-name { font-size: 25px; font-weight: 500; letter-spacing: -.03em; line-height: 1.15; }
.doc-group { display: grid; gap: 12px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); min-width: 0; }
.doc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.doc-head > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.upload { position: relative; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload input:focus-visible + .btn { outline: 3px solid var(--green); outline-offset: 2px; }
.doc-file { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); min-width: 0; }
.doc-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; min-width: 0; }
.doc-name { min-width: 0; font-weight: 500; overflow-wrap: anywhere; text-underline-offset: 3px; }
.doc-comment { padding: 9px 12px; border-radius: 10px; background: var(--sand); font-size: 14.5px; }

/* Таблица клиентов */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.4; }
.data-table th { padding: 12px 16px; font-size: 13px; font-weight: 500; color: var(--ink-2); text-align: left; white-space: nowrap; }
.data-table td { padding: 13px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table a { font-weight: 500; text-decoration: none; }
.data-table a:hover { text-decoration: underline; text-underline-offset: 3px; }
.data-table small { display: block; color: var(--ink-2); font-size: 13.5px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .input { flex: 1 1 14rem; max-width: 26rem; min-height: 44px; }

/* Окна */
dialog.modal { width: min(600px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 90px rgba(7, 30, 40, .3); }
dialog.modal::backdrop { background: rgba(9, 41, 35, .5); opacity: var(--backdrop, 1); }
.modal-body { display: grid; gap: 16px; padding: 24px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-close { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 22px; line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--surface-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 60; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 15px; box-shadow: var(--shadow); animation: toast-in .28s cubic-bezier(.2, .7, .2, 1); }
.toast.error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 1180px) {
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  .data-table tr { margin-bottom: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
  .data-table td { padding: 3px 0; border: 0; }
  .data-table td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-2); }
}
@media (max-width: 1040px) {
  .grid-2, .focus { grid-template-columns: minmax(0, 1fr); }
  .metrics { align-self: start; }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .side { display: none; }
  .topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); background: var(--bg); border-bottom: 1px solid var(--line); }
  .topbar .brand svg { width: 32px; height: 32px; }
  .topbar .brand b { font-size: 19px; }
  .topbar .brand small { font-size: 10px; }
  .topbar-link { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); color: var(--ink); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; min-height: 50px; padding: 5px 2px; border-radius: 10px; color: var(--ink-2); font-size: 11.5px; font-weight: 500; line-height: 1.2; text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--ink); background: var(--lime-soft); }
  .content { padding: 20px 16px 104px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { gap: 18px; padding: 22px 20px 26px; }
  .auth-side h1 { font-size: 30px; }
  .auth-points { display: none; }
  .auth-main { align-items: start; padding-block: 28px 40px; }
  .stepper { display: none; }
  .stage-line { display: grid; gap: 6px; }
}
@media (max-width: 560px) {
  .metric { padding: 10px; }
  .metric span { font-size: 12px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .quick { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 18px; }
  .head-actions, .head-actions .btn { width: 100%; }
  .row { flex-direction: column; }
  .row-side { text-align: left; }
  .modal-actions .btn { flex: 1 1 100%; }
  .copy-row { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media print {
  .side, .topbar, .tabbar, .toast, .head-actions, .card-actions, .quick { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
