/* ============================================================
   ГРАФИТ И СВЕТ — монохромный люкс
   Обсидиановые поверхности, волосяные границы света,
   серебряные градиенты. См. DESIGN_PHILOSOPHY.md
   ============================================================ */

@font-face {
  font-family: "Inter Var";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #09090B;
  --surface: #101013;
  --surface-2: #17171B;
  --field: rgba(255, 255, 255, .03);
  --ink: #F4F4F6;
  --silver: #C9C9D4;
  --slate: #A9A9B4;
  --muted: #82828C;
  --faint: #5C5C66;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .15);
  --ok: #7EE2A8;
  --err: #F87171;
  --err-bg: rgba(248, 113, 113, .09);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-btn: 14px;
  --shadow-sm: inset 0 1px 0 rgba(255, 255, 255, .04), 0 4px 18px rgba(0, 0, 0, .35);
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 14px 44px rgba(0, 0, 0, .5);
  --shadow-lg: 0 32px 90px rgba(0, 0, 0, .7);
  --focus: rgba(255, 255, 255, .65);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0; color: var(--ink); background: var(--bg);
  font: 14px/1.6 "Inter Var", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* аврора — фиксированный слой света под содержимым
   (не background-attachment: fixed — он глючит на mobile Safari) */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1100px 560px at 78% -10%, rgba(216, 198, 176, .075), transparent 60%),
    radial-gradient(940px 540px at -12% 28%, rgba(196, 182, 166, .045), transparent 55%),
    radial-gradient(820px 500px at 55% 115%, rgba(206, 192, 176, .05), transparent 60%),
    linear-gradient(180deg, rgba(9, 9, 11, .45), rgba(9, 9, 11, .72)),
    url("/static/bg-landscape.jpg") center top / cover no-repeat;
}
/* зерно света — едва заметная плёнка поверх обсидиана */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .03;
}
::selection { background: #E7E7EC; color: #0B0B0D; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .13); border-radius: 8px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .24); background-clip: content-box; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* --- Шапка: чёрное стекло --- */
header {
  background: rgba(9, 9, 11, .72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  color: var(--ink); padding: 15px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand .logo {
  width: 30px; height: 30px; color: #FFF; flex: none;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, .35));
}
header h1 {
  margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em;
  background: linear-gradient(180deg, #FFFFFF 25%, #9E9EAB 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
header .sub {
  color: var(--muted); font-size: 11.5px; display: block; margin-top: 2px;
  letter-spacing: .02em;
}
/* марка Invoice Online в шапке приложения */
header h1.wordmark {
  font-size: 13.5px; font-weight: 660; letter-spacing: .18em; text-transform: uppercase;
  background: none; -webkit-background-clip: initial; background-clip: initial;
  color: #ECEAE6; line-height: 1.3;
}
.brand .logo-io { width: 33px; height: 22px; filter: drop-shadow(0 0 8px rgba(255, 253, 248, .28)); }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.save-state { font-size: 12px; color: var(--muted); min-width: 110px; text-align: right; }

main { max-width: 1280px; margin: 0 auto; padding: 30px 26px 88px; }

/* --- Вкладки: заявка / счёт / УПД --- */
.tabs {
  display: flex; gap: 5px; margin-bottom: 24px; padding: 5px;
  background: linear-gradient(180deg, #131318 0%, #0E0E11 100%);
  border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow-sm);
}
.tab {
  flex: 1; justify-content: center; background: none; color: var(--muted);
  box-shadow: none; border: 1px solid transparent; border-radius: 12px;
  padding: 11px 16px; font-weight: 550; font-size: 13.5px; letter-spacing: .01em;
}
.tab:not(.active):hover {
  background: rgba(255, 255, 255, .045); color: var(--silver);
  filter: none; box-shadow: none;
}
.tab.active {
  background: linear-gradient(180deg, #FFFFFF 0%, #D6D6DD 100%); color: #0B0B0D;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 4px 20px rgba(255, 255, 255, .12);
}
.tab.active:hover { filter: brightness(1.04); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: paneIn .28s var(--ease-out, cubic-bezier(.16, 1, .3, 1)); }
@keyframes paneIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.upd-tablewrap { margin-top: 16px; }
.upd-tablewrap table { min-width: 720px; }

/* --- Карточки-секции: полированный графит --- */
section {
  background: linear-gradient(180deg, #131318 0%, #0E0E11 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; margin-bottom: 22px; box-shadow: var(--shadow-sm);
  transition: border-color .25s, box-shadow .25s;
}
section:hover { border-color: rgba(255, 255, 255, .12); box-shadow: var(--shadow); }
h2 {
  margin: 0 0 18px; font-size: 12.5px; font-weight: 600; color: var(--silver);
  letter-spacing: .15em; text-transform: uppercase;
  display: flex; align-items: center; gap: 12px;
}
.step {
  flex: none; width: 27px; height: 27px; border-radius: 50%;
  background: radial-gradient(120% 120% at 50% 18%, rgba(255, 255, 255, .16), rgba(255, 255, 255, .04));
  border: 1px solid var(--line-strong); color: var(--silver);
  font-size: 12.5px; font-weight: 650; letter-spacing: 0;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 2px 10px rgba(0, 0, 0, .3);
}
.badge {
  background: rgba(255, 255, 255, .06); color: var(--silver);
  border: 1px solid var(--line-strong); letter-spacing: .04em;
  border-radius: 20px; font-size: 11px; font-weight: 600; padding: 2px 11px;
  text-transform: none;
}
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: stretch; }
textarea {
  flex: 1 1 340px; min-height: 130px; padding: 12px 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; resize: vertical;
  background: var(--field);
  transition: border-color .2s, box-shadow .2s;
}
textarea::placeholder, input::placeholder { color: var(--faint); }
textarea:focus {
  border-color: rgba(255, 255, 255, .35); outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .06);
}
.filebox { flex: 1 1 340px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
p.hint { margin: 0 0 14px; }

/* --- Кнопки: свет как действие (белые, скругление как у «Войти») --- */
button {
  background: linear-gradient(180deg, #FFFFFF 0%, #D9D8DC 100%);
  color: #0B0B0D; border: 0; border-radius: var(--radius-btn);
  padding: 10px 18px; font: inherit; font-weight: 650; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 3px rgba(0, 0, 0, .5);
  transition: filter .18s, box-shadow .18s, transform .05s, background .18s,
    border-color .18s, color .18s;
}
button svg { width: 16px; height: 16px; flex: none; }
button:hover {
  filter: brightness(1.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 4px 22px rgba(255, 255, 255, .16);
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: wait; box-shadow: none; }
button.ghost, a.ghost {
  background: rgba(255, 255, 255, .05); color: #DEDDE2;
  border: 1px solid var(--line-strong); font-weight: 500; box-shadow: none;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  border-radius: var(--radius-btn); padding: 10px 16px; font-size: 14px;
  transition: background .18s, border-color .18s;
}
button.ghost:hover, a.ghost:hover {
  background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .26);
  filter: none;
}
button.danger {
  background: none; border: 0; color: var(--err); font-size: 13px;
  padding: 6px 10px; font-weight: 500; border-radius: 6px; box-shadow: none;
}
button.danger:hover { background: var(--err-bg); filter: none; box-shadow: none; }
button.danger svg { width: 14px; height: 14px; }
button.icon {
  background: none; border: 0; color: var(--slate); padding: 6px;
  border-radius: 6px; box-shadow: none;
}
button.icon:hover { background: rgba(255, 255, 255, .07); filter: none; box-shadow: none; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
#status { font-size: 13px; color: var(--slate); }
#status.err { color: var(--err); white-space: pre-wrap; }
#status.ok { color: var(--ok); }
.spinner {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, .18); border-top-color: #FFF;
  border-radius: 50%; animation: spin .8s linear infinite; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Загрузка файлов --- */
.dropzone {
  border: 1.5px dashed rgba(255, 255, 255, .17); border-radius: 14px;
  background:
    radial-gradient(420px 150px at 50% 0%, rgba(255, 255, 255, .045), transparent 70%),
    rgba(255, 255, 255, .015);
  padding: 26px 16px; text-align: center; cursor: pointer; color: var(--slate);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.dropzone strong { color: var(--ink); font-weight: 600; }
.dropzone .hint { margin-top: 0; }
.dropzone-ico {
  width: 34px; height: 34px; color: var(--slate); opacity: .85;
  transition: color .2s, transform .2s;
}
.dropzone:hover .dropzone-ico, .dropzone.dragover .dropzone-ico {
  color: var(--ink); transform: translateY(-1px);
}
.dropzone:hover, .dropzone.dragover {
  border-color: rgba(255, 255, 255, .45);
  background:
    radial-gradient(420px 150px at 50% 0%, rgba(255, 255, 255, .09), transparent 70%),
    rgba(255, 255, 255, .03);
  box-shadow: 0 0 30px rgba(255, 255, 255, .05);
}
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.thumb {
  position: relative; width: 76px; height: 76px; border-radius: 10px;
  border: 1px solid var(--line); overflow: hidden; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted); text-align: center; padding: 2px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .rm {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(9, 9, 11, .78); color: #FFF;
  border: 1px solid rgba(255, 255, 255, .2); padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: none;
}
.thumb .rm svg { width: 10px; height: 10px; }
.thumb .rm:hover { background: var(--err); border-color: transparent; filter: none; }

/* --- Таблица позиций --- */
.tablewrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: 12px;
  background: #0B0B0E;
}
table { border-collapse: collapse; width: 100%; min-width: 1050px; }
th, td { border: 1px solid rgba(255, 255, 255, .055); padding: 4px 6px; }
th {
  background: var(--surface-2); color: #96969F; font-size: 10.5px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  padding: 11px 6px; position: sticky; top: 0; border-color: var(--line);
}
tbody tr:nth-child(even) { background: rgba(255, 255, 255, .014); }
tbody tr:hover { background: rgba(255, 255, 255, .045); }
td input {
  width: 100%; border: 1px solid transparent; border-radius: 5px;
  padding: 5px 6px; font: inherit; background: transparent; color: var(--ink);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
td input:focus {
  border-color: rgba(255, 255, 255, .4); background: #09090B; outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .07);
}
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
col.c-num { width: 34px; } col.c-art { width: 140px; } col.c-qty { width: 64px; }
col.c-unit { width: 56px; } col.c-price { width: 110px; } col.c-sum { width: 110px; }
col.c-shop { width: 130px; } col.c-url { width: 150px; } col.c-del { width: 36px; }
tfoot td {
  font-weight: 700; background: var(--surface-2); color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.params { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin: 18px 0 4px; }
.params label {
  display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px;
  letter-spacing: .06em; text-transform: uppercase;
}
.params input, .params select {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: var(--field); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.params input:focus, .params select:focus {
  border-color: rgba(255, 255, 255, .35); outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .06);
}
.params .w-narrow { width: 90px; }
.markup-box { display: flex; flex-direction: column; gap: 8px; }
.markup-box > label { margin-bottom: 0; }
.markup-tier { display: flex; gap: 8px; align-items: center; }
.markup-tier span { color: var(--muted); font-size: 13px; }
.markup-tier .tier-from { width: 110px; }
.markup-tier .tier-value { width: 76px; }
.markup-tier .tier-kind {
  width: 58px; padding: 6px 6px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--field); color: var(--ink); font: inherit;
}
.markup-tier .tier-kind:focus { border-color: rgba(255, 255, 255, .35); outline: none; }
.invoice-markup { margin-top: 14px; }
.history-select {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); font: inherit; max-width: 320px;
}
.history-select:focus { border-color: rgba(255, 255, 255, .35); outline: none; }
.markup-foot { display: flex; gap: 12px; align-items: center; }
.markup-foot .hint { margin-top: 0; }
.params label.check {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: 13px; color: var(--ink); margin-bottom: 0;
  letter-spacing: 0; text-transform: none;
  padding: 9px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--field); transition: background .18s, border-color .18s;
}
.params label.check:hover { background: rgba(255, 255, 255, .06); border-color: var(--line-strong); }
.params label.check input { accent-color: #E9E9EF; width: 15px; height: 15px; cursor: pointer; }

/* --- Готовые файлы --- */
.files { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
a.file {
  display: block; padding: 14px 18px; border: 1px solid var(--line-strong);
  border-radius: 14px; text-decoration: none; color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
  transition: background .18s, border-color .18s, transform .15s, box-shadow .18s;
}
a.file:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, .11), rgba(255, 255, 255, .05));
  border-color: rgba(255, 255, 255, .3); transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 12px 30px rgba(0, 0, 0, .5);
}
a.file span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 3px; }

/* --- Панель «Мои заявки» --- */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .62);
  z-index: 40; backdrop-filter: blur(5px); animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 340px; max-width: 90vw;
  background: linear-gradient(180deg, #121216 0%, #0C0C0F 100%);
  border-right: 1px solid var(--line);
  z-index: 50; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slidein .22s cubic-bezier(.2, .7, .3, 1);
}
@keyframes slidein { from { transform: translateX(-100%); } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; }
.drawer-tabs {
  display: flex; gap: 6px; padding: 10px 12px 0;
}
.drawer-tab {
  flex: 1; justify-content: center; background: none; color: var(--muted);
  box-shadow: none; border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 10px; font-weight: 550; font-size: 12.5px;
}
.drawer-tab:not(.active):hover {
  background: rgba(255, 255, 255, .045); color: var(--silver);
  filter: none; box-shadow: none;
}
.drawer-tab.active {
  background: linear-gradient(180deg, #FFFFFF 0%, #D6D6DD 100%); color: #0B0B0D;
  border-color: transparent;
}
.request-list { overflow-y: auto; padding: 10px; }
.doc-card { cursor: default; }
.doc-links { display: flex; gap: 6px; flex-shrink: 0; }
.doc-link {
  font-size: 12px; padding: 4px 10px; border: 1px solid var(--line-strong);
  border-radius: 8px; color: var(--silver); text-decoration: none;
  transition: background .18s, border-color .18s;
}
.doc-link:hover { background: rgba(255, 255, 255, .07); color: var(--ink); }
.request-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  margin-bottom: 8px; cursor: pointer; display: flex; gap: 8px;
  justify-content: space-between; align-items: flex-start;
  transition: background .18s, border-color .18s;
}
.request-card:hover { background: rgba(255, 255, 255, .04); border-color: var(--line-strong); }
.request-card.active { border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .06); }
.request-card .title { font-weight: 600; color: var(--ink); }
.request-card .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* --- Счёт: реквизиты компаний --- */
.companies { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .companies { grid-template-columns: 1fr; } }
fieldset.company, fieldset.assets {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 12px;
  margin: 0; min-width: 0; background: rgba(255, 255, 255, .015);
}
fieldset.company legend, fieldset.assets legend {
  font-weight: 600; color: var(--silver); padding: 0 8px; font-size: 11px;
  letter-spacing: .13em; text-transform: uppercase;
}
.company-select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: var(--surface-2); color: var(--ink); margin-bottom: 12px;
  transition: border-color .2s;
}
.company-select:focus { border-color: rgba(255, 255, 255, .35); outline: none; }
.company-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; }
.company-grid label { font-size: 11px; color: var(--muted); display: block; }
.company-grid input {
  width: 100%; margin-top: 4px; padding: 7px 10px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
  background: var(--field); transition: border-color .2s, box-shadow .2s;
}
.company-grid input:focus {
  border-color: rgba(255, 255, 255, .35); outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .05);
}
.company-grid label:nth-child(1), .company-grid label:nth-child(4),
.company-grid label:nth-child(5) { grid-column: 1 / -1; }

/* --- Печать и подпись --- */
fieldset.assets { margin-top: 16px; }
.asset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .asset-row { grid-template-columns: 1fr; } }
.asset {
  display: flex; gap: 14px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  background: rgba(255, 255, 255, .01);
}
.asset-preview {
  flex: none; width: 108px; height: 78px; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
  /* светлый шахматный фон — печать и подпись обычно тёмные, их видно */
  background:
    conic-gradient(#D8D8DE 90deg, #F4F4F6 90deg 180deg, #D8D8DE 180deg 270deg, #F4F4F6 270deg)
    0 0 / 16px 16px;
}
.asset-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.asset-empty {
  font-size: 11px; color: var(--silver); background: rgba(9, 9, 11, .72);
  padding: 2px 8px; border-radius: 5px;
}
.asset-info strong { display: block; font-size: 13px; color: var(--ink); margin-bottom: 8px; }
.asset-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Кнопки small и меню пользователя --- */
button.small, a.small { padding: 7px 13px; font-size: 12.5px; border-radius: 11px; }
.user-menu {
  display: flex; align-items: center; gap: 10px; margin-left: 12px;
  padding-left: 16px; border-left: 1px solid var(--line);
}
.user-name { color: var(--silver); font-size: 13px; font-weight: 600; }
header .user-menu a.ghost, header .user-menu button.ghost { text-decoration: none; }

/* --- Страница входа: ночная дымка --- */
.auth-body {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 115% at 50% 38%, transparent 30%, rgba(4, 3, 3, .74) 100%),
    radial-gradient(1140px 640px at 64% 40%, rgba(189, 168, 143, .16), transparent 62%),
    radial-gradient(800px 440px at 22% 24%, rgba(148, 134, 120, .12), transparent 60%),
    radial-gradient(1500px 860px at 44% 62%, rgba(114, 102, 90, .10), transparent 66%),
    radial-gradient(900px 480px at 30% 4%, rgba(0, 0, 0, .52), transparent 62%),
    linear-gradient(168deg, #0D0C0B 0%, #151311 46%, #090808 100%);
}
.auth-body::after { content: none; } /* фон логина рисует себя сам */
.auth-body::before { opacity: .05; } /* зерно чуть плотнее — как плёнка */

header.auth-topbar {
  padding: 24px clamp(22px, 4vw, 46px);
  background: none; border-bottom: 0; position: static;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  justify-content: flex-start;
}
.brandmark {
  display: inline-flex; align-items: center; gap: 13px;
  color: #D3D1CC; text-decoration: none;
}
.brandmark .logo-io { width: 39px; height: 26px; filter: none; }
.brandmark-name {
  font-size: 13px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  color: #CFCDC8;
}

.auth-hero {
  flex: 1; width: 100%; max-width: 1230px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 468px);
  gap: clamp(30px, 6vw, 100px); align-items: center; align-content: center;
  padding: 10px clamp(22px, 4vw, 46px) 76px;
}
section.auth-intro {
  max-width: 580px; background: none; border: 0; border-radius: 0;
  padding: 0; margin: 0; box-shadow: none;
}
section.auth-intro:hover { border-color: transparent; box-shadow: none; }
.auth-globe {
  width: 62px; height: 40px; color: #AFAAA2; margin-bottom: 28px;
  filter: drop-shadow(0 0 14px rgba(225, 210, 190, .14));
}
.auth-intro h1 {
  margin: 0 0 18px; font-size: clamp(34px, 4.5vw, 55px); line-height: 1.09;
  font-weight: 640; letter-spacing: -.022em; text-wrap: balance;
  background: linear-gradient(180deg, #F4F2ED 25%, #B7B3AB 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-intro p { margin: 0; font-size: 15.5px; line-height: 1.6; color: #98938B; max-width: 36ch; }

.auth-card {
  display: flex; flex-direction: column; gap: 18px; width: 100%;
  background: linear-gradient(180deg, rgba(23, 21, 19, .9), rgba(13, 12, 11, .93));
  backdrop-filter: blur(26px) saturate(120%);
  -webkit-backdrop-filter: blur(26px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, .09); border-radius: 26px;
  box-shadow: 0 42px 110px rgba(0, 0, 0, .66), inset 0 1px 0 rgba(255, 255, 255, .07);
  padding: clamp(26px, 3.2vw, 38px);
  animation: rise .4s cubic-bezier(.16, 1, .3, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.auth-field { display: flex; flex-direction: column; gap: 9px; }
.auth-label { font-size: 14px; font-weight: 560; color: #E6E4DF; letter-spacing: .01em; }
.auth-field input {
  width: 100%; padding: 14px 16px; font: inherit; font-size: 15px; color: var(--ink);
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 13px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.auth-field input:focus {
  border-color: rgba(255, 255, 255, .38); outline: none;
  background: rgba(255, 255, 255, .06);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .06);
}
.auth-pass { position: relative; }
.auth-pass input { padding-right: 52px; }
.auth-eye {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 38px; height: 38px; padding: 0; border-radius: 11px;
  background: none; border: 0; box-shadow: none; color: #8F8B84;
  display: inline-flex; align-items: center; justify-content: center;
}
.auth-eye:hover { background: rgba(255, 255, 255, .07); color: #DBD8D2; filter: none; box-shadow: none; }
.auth-eye:active { transform: translateY(calc(-50% + 1px)); }
.auth-eye svg { width: 20px; height: 20px; }
.auth-submit {
  margin-top: 8px; width: 100%; justify-content: center;
  padding: 14px 18px; font-size: 16px; border-radius: 14px;
}
.auth-error {
  background: var(--err-bg); color: var(--err); border: 1px solid rgba(248, 113, 113, .25);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px;
}

@media (max-width: 940px) {
  .auth-hero { grid-template-columns: 1fr; gap: 42px; align-content: start; padding-top: 4vh; }
  .auth-intro h1 { font-size: clamp(31px, 8vw, 42px); }
  .auth-card { max-width: 520px; }
}

/* --- Админка --- */
.admin-main {
  max-width: 900px; margin: 28px auto; padding: 0 24px;
  display: flex; flex-direction: column; gap: 20px;
}
.card {
  background: linear-gradient(180deg, #131318 0%, #0E0E11 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 18px; }
.admin-create { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.admin-create input[type="text"], .admin-create input[type="password"] {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--field); font-size: 14px; color: var(--ink); font-family: inherit;
  transition: border-color .2s;
}
.admin-create input:focus { border-color: rgba(255, 255, 255, .35); outline: none; }
.admin-create label.checkbox {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--slate);
}
.admin-create label.checkbox input { accent-color: #E9E9EF; }
.users-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 0; }
.users-table th, .users-table td {
  text-align: left; padding: 11px 8px; border: 0;
  border-bottom: 1px solid var(--line);
}
.users-table th {
  font-size: 10.5px; text-transform: uppercase; color: var(--muted);
  letter-spacing: .09em; background: none; position: static;
}
.users-table tbody tr:hover { background: rgba(255, 255, 255, .03); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tag {
  background: rgba(255, 255, 255, .06); color: var(--silver);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 7px; font-size: 11px;
}

/* --- Почта --- */
.drawer-wide { width: min(560px, 96vw); }
.drawer-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.mail-list {
  display: flex; flex-direction: column; gap: 10px; padding: 0 18px 18px;
  overflow-y: auto;
}
.mail-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px;
  background: rgba(255, 255, 255, .02);
  transition: border-color .18s;
}
.mail-card:hover { border-color: var(--line-strong); }
.mail-subject { font-weight: 600; font-size: 14px; color: var(--ink); }
.mail-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.mail-atts { font-size: 12px; color: var(--slate); margin-top: 6px; }
.mail-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mail-reply { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.mail-reply textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px; font: inherit; font-size: 13px; resize: vertical;
  background: var(--field); color: var(--ink);
}
.mail-reply-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* --- Настройки почты (личный кабинет) --- */
.settings-body { overflow-y: auto; padding: 14px 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.settings-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.settings-field select {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); font: inherit;
}
.settings-field select:focus { border-color: rgba(255, 255, 255, .35); outline: none; }
fieldset.settings-group {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px;
  margin: 0; min-width: 0; background: rgba(255, 255, 255, .015);
}
fieldset.settings-group legend {
  font-weight: 600; color: var(--silver); padding: 0 8px; font-size: 11px;
  letter-spacing: .1em; text-transform: uppercase;
}
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.settings-grid label { font-size: 11px; color: var(--muted); display: block; }
.settings-grid input:not([type="checkbox"]) {
  width: 100%; margin-top: 4px; padding: 8px 10px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
  background: var(--field); transition: border-color .2s;
}
.settings-grid input:focus { border-color: rgba(255, 255, 255, .35); outline: none; }
.settings-grid label.check-inline {
  display: flex; align-items: center; gap: 8px; align-self: end; padding-bottom: 8px;
  color: var(--silver);
}
.settings-grid label.check-inline input { accent-color: #E9E9EF; width: 15px; height: 15px; margin: 0; }
.settings-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.settings-actions .hint { margin-top: 0; }
