
/* ================================================================== типографика

   Inter вариативный: один файл покрывает всю шкалу начертаний.
   Подключён локально — внешних запросов страница не делает. */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/static/fonts/inter-cyrillic-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/static/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F,
                   U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* METHOD Office — тёмная рабочая среда.
   Чёрная основа, металлический акцент из логотипа, холодное свечение интерфейса.
   Движение служит ориентации: подсказывает иерархию и подтверждает действие. */

:root {
    /* основа */
    --void:       #06070A;
    --bg:         #0A0C11;
    --surface:    #0F1218;
    --surface-2:  #141822;
    --surface-3:  #1B2130;
    --line:       rgba(255,255,255,.07);
    --line-2:     rgba(255,255,255,.045);
    --line-hot:   rgba(255,255,255,.14);

    /* текст */
    --ink:        #E9EDF3;
    --ink-2:      #9AA6B6;
    --ink-3:      #6B7787;
    --ink-4:      #4A5464;

    /* фирменный металл */
    --gold:       #D9B871;
    --gold-2:     #B8934D;
    --gold-3:     #8A6E38;
    --gold-glow:  rgba(217,184,113,.18);

    /* холодный контур */
    --cyan:       #38D6C8;
    --cyan-dim:   #1E8C84;
    --violet:     #7C6BFF;
    --violet-dim: #4B3FA8;

    /* состояния */
    --ok:         #3DD68C;
    --ok-bg:      rgba(61,214,140,.10);
    --warn:       #F0B44B;
    --warn-bg:    rgba(240,180,75,.10);
    --err:        #F26B76;
    --err-bg:     rgba(242,107,118,.10);
    --info-bg:    rgba(56,214,200,.09);

    --radius:     6px;
    --radius-lg:  10px;
    --sidebar:    244px;

    --shadow:     0 1px 2px rgba(0,0,0,.5);
    --shadow-md:  0 8px 28px rgba(0,0,0,.55);
    --shadow-lg:  0 28px 70px rgba(0,0,0,.7);
    --glow-gold:  0 0 0 1px rgba(217,184,113,.28), 0 0 22px -4px rgba(217,184,113,.35);
    --glow-cyan:  0 0 0 1px rgba(56,214,200,.30), 0 0 24px -6px rgba(56,214,200,.45);

    --ease:       cubic-bezier(.22,.68,.32,1);
    --ease-out:   cubic-bezier(.16,1,.3,1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--void); }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Контекстные альтернативы и одноширинные цифры: колонки сумм не пляшут. */
    font-feature-settings: 'cv05' 1, 'cv08' 1, 'ss03' 1, 'tnum' 0;
    font-variation-settings: 'opsz' 20;
    overflow-x: hidden;
}

/* Амбиентное свечение фона — медленное, почти незаметное, даёт глубину чёрному. */
body::before {
    content: '';
    position: fixed;
    inset: -20%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(46% 38% at 14% 8%,  rgba(217,184,113,.055), transparent 70%),
        radial-gradient(40% 34% at 88% 22%, rgba(56,214,200,.045),  transparent 70%),
        radial-gradient(44% 40% at 62% 96%, rgba(124,107,255,.045), transparent 70%);
    animation: drift 34s var(--ease) infinite alternate;
}
@keyframes drift {
    0%   { transform: translate3d(0,0,0)      scale(1);    }
    50%  { transform: translate3d(2%,-1.5%,0) scale(1.06); }
    100% { transform: translate3d(-2%,1.5%,0) scale(1.02); }
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.012em; color: var(--ink); }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p  { margin: 0 0 10px; }
a  { color: var(--cyan); text-decoration: none; transition: color .16s var(--ease); }
a:hover { color: #6FEDE0; text-decoration: none; }
small { font-size: 12px; }
::selection { background: rgba(217,184,113,.28); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #2A3244; background-clip: content-box; }

/* ------------------------------------------------------------------ каркас */

.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
    width: var(--sidebar);
    flex: 0 0 var(--sidebar);
    background: linear-gradient(180deg, #080A0E 0%, #0B0E14 100%);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 20;
}

.brand {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--line-2);
    position: relative;
}
.brand::after {
    content: '';
    position: absolute; left: 18px; right: 18px; bottom: -1px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-3), transparent);
    opacity: .55;
}
.brand-name {
    font-size: 18px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
    background: linear-gradient(120deg, #F3E3BE 0%, var(--gold) 34%, #8A6E38 58%, var(--gold) 82%, #F3E3BE 100%);
    background-size: 260% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    animation: sheen 9s linear infinite;
}
@keyframes sheen { to { background-position: 260% 0; } }
.brand-sub {
    font-size: 10px; color: var(--ink-3); letter-spacing: .18em;
    text-transform: uppercase; margin-top: 4px;
}

.nav { padding: 12px 10px; flex: 1; }
.nav-group { margin-bottom: 16px; }
.nav-label {
    font-size: 9.5px; text-transform: uppercase; letter-spacing: .16em;
    color: var(--ink-4); padding: 8px 10px 6px; font-weight: 600;
}
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 11px; border-radius: var(--radius);
    color: var(--ink-2); font-size: 13.5px; text-decoration: none;
    position: relative; overflow: hidden;
    transition: color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.nav a::before {
    content: ''; position: absolute; left: 0; top: 50%;
    width: 2px; height: 0; border-radius: 2px;
    background: linear-gradient(180deg, var(--gold), var(--gold-3));
    transform: translateY(-50%);
    transition: height .24s var(--ease-out);
}
.nav a:hover { background: rgba(255,255,255,.035); color: var(--ink); transform: translateX(2px); }
.nav a:hover::before { height: 60%; }
.nav a.active {
    background: linear-gradient(90deg, rgba(217,184,113,.11), rgba(217,184,113,.02));
    color: #fff; font-weight: 500;
}
.nav a.active::before { height: 68%; }
.nav a .ico {
    width: 17px; text-align: center; font-size: 12.5px; opacity: .75;
    transition: opacity .18s var(--ease), transform .3s var(--ease-out);
}
.nav a:hover .ico { opacity: 1; transform: scale(1.14); }
.nav a.active .ico { opacity: 1; color: var(--gold); }
.nav a .count {
    margin-left: auto; font-size: 10.5px; padding: 1px 7px; border-radius: 10px;
    background: rgba(255,255,255,.07); color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.nav a .count.alert {
    background: var(--err-bg); color: var(--err);
    box-shadow: 0 0 0 1px rgba(242,107,118,.25);
    animation: pulse-soft 2.4s var(--ease) infinite;
}
@keyframes pulse-soft {
    0%,100% { box-shadow: 0 0 0 1px rgba(242,107,118,.25); }
    50%     { box-shadow: 0 0 0 1px rgba(242,107,118,.5), 0 0 14px -3px rgba(242,107,118,.55); }
}

.sidebar-foot { border-top: 1px solid var(--line-2); padding: 12px 14px; font-size: 12px; }
.sidebar-foot a { color: var(--ink-2); }
.sidebar-foot a:hover { color: var(--gold); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: rgba(10,12,17,.78);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--line);
    padding: 13px 26px;
    display: flex; align-items: center; gap: 16px;
    position: sticky; top: 0; z-index: 30;
}
.topbar h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .actions { display: flex; gap: 8px; align-items: center; }

.content { padding: 22px 26px 70px; flex: 1; animation: page-in .42s var(--ease-out) both; }
.content.wide { padding-left: 18px; padding-right: 18px; }
@keyframes page-in {
    from { opacity: 0; transform: translateY(9px); }
    to   { opacity: 1; transform: none; }
}

/* Ступенчатое появление верхнеуровневых блоков страницы. */
.content > * { animation: rise .5s var(--ease-out) both; }
.content > *:nth-child(1) { animation-delay: .02s; }
.content > *:nth-child(2) { animation-delay: .07s; }
.content > *:nth-child(3) { animation-delay: .12s; }
.content > *:nth-child(4) { animation-delay: .17s; }
.content > *:nth-child(5) { animation-delay: .22s; }
.content > *:nth-child(n+6) { animation-delay: .26s; }
@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ поверхности */

.card {
    background: linear-gradient(180deg, var(--surface) 0%, #0C0F15 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    position: relative;
    transition: border-color .24s var(--ease), box-shadow .24s var(--ease), transform .24s var(--ease);
}
.card::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 1px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(90deg, transparent 8%, rgba(255,255,255,.10) 50%, transparent 92%);
    pointer-events: none;
}
.card:hover { border-color: var(--line-hot); }
.card + .card { margin-top: 16px; }
.card-head {
    padding: 13px 17px; border-bottom: 1px solid var(--line-2);
    display: flex; align-items: center; gap: 10px;
}
.card-head h2 { flex: 1; }
.card-body { padding: 17px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-main { grid-template-columns: minmax(0,2fr) minmax(0,1fr); align-items: start; }
.grid-side { grid-template-columns: minmax(0,1fr) minmax(0,2fr); align-items: start; }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }

/* ------------------------------------------------------------------ кнопки */

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; font-size: 13px; font-weight: 500;
    border: 1px solid var(--line-hot); border-radius: var(--radius);
    background: var(--surface-2); color: var(--ink);
    cursor: pointer; text-decoration: none; white-space: nowrap;
    font-family: inherit; line-height: 1.4;
    position: relative; overflow: hidden;
    transition: background .18s var(--ease), border-color .18s var(--ease),
                transform .14s var(--ease), box-shadow .22s var(--ease), color .18s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: rgba(255,255,255,.22); transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0) scale(.985); }
.btn:focus-visible { outline: none; box-shadow: var(--glow-cyan); }

/* Блик, пробегающий по главной кнопке при наведении. */
.btn-primary {
    background: linear-gradient(135deg, var(--gold-2), var(--gold-3));
    border-color: rgba(217,184,113,.5); color: #14100A; font-weight: 600;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    border-color: rgba(217,184,113,.75); box-shadow: var(--glow-gold);
}
.btn-primary::after, .btn-teal::after {
    content: ''; position: absolute; top: 0; bottom: 0; left: -70%; width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.42), transparent);
    transform: skewX(-18deg); opacity: 0;
}
.btn-primary:hover::after, .btn-teal:hover::after { animation: swipe .72s var(--ease-out); }
@keyframes swipe {
    0%   { left: -70%; opacity: 0; }
    18%  { opacity: 1; }
    100% { left: 130%; opacity: 0; }
}

.btn-teal {
    background: linear-gradient(135deg, var(--cyan-dim), #14635E);
    border-color: rgba(56,214,200,.45); color: #EAFFFC; font-weight: 600;
}
.btn-teal:hover { background: linear-gradient(135deg, var(--cyan), var(--cyan-dim)); color: #06231F; box-shadow: var(--glow-cyan); }

.btn-danger { color: var(--err); border-color: rgba(242,107,118,.3); background: rgba(242,107,118,.06); }
.btn-danger:hover { background: rgba(242,107,118,.14); border-color: rgba(242,107,118,.5); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 5px 9px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-link {
    border: none; background: none; padding: 0; color: var(--cyan);
    font-size: 13px; cursor: pointer; font-family: inherit;
    transition: color .16s var(--ease);
}
.btn-link:hover { color: #6FEDE0; text-decoration: underline; }

/* ------------------------------------------------------------------ формы */

label { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; letter-spacing: .01em; }
.field { margin-bottom: 13px; }
.field-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.45; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=search], input[type=url],
input[type=tel], select, textarea {
    width: 100%; padding: 8px 11px; font-size: 13.5px; font-family: inherit;
    color: var(--ink); background: #0B0E14;
    border: 1px solid var(--line-hot); border-radius: var(--radius);
    line-height: 1.4;
    transition: border-color .18s var(--ease), box-shadow .22s var(--ease), background .18s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-4); }
input:hover, select:hover, textarea:hover { border-color: rgba(255,255,255,.2); }
input:focus, select:focus, textarea:focus {
    outline: none; background: #0D1119;
    border-color: rgba(56,214,200,.55);
    box-shadow: 0 0 0 3px rgba(56,214,200,.10), 0 0 20px -8px rgba(56,214,200,.6);
}
textarea { min-height: 78px; resize: vertical; }
select {
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%236B7787' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px;
}
option { background: #0D1119; color: var(--ink); }
input[type=file] { color: var(--ink-2); font-size: 12.5px; }
input[type=file]::file-selector-button {
    background: var(--surface-3); color: var(--ink); border: 1px solid var(--line-hot);
    border-radius: var(--radius); padding: 5px 11px; margin-right: 10px;
    font-family: inherit; font-size: 12px; cursor: pointer;
    transition: background .18s var(--ease);
}
input[type=file]::file-selector-button:hover { background: #232B3B; }

input[type=checkbox] {
    appearance: none; width: 15px; height: 15px; border-radius: 4px;
    border: 1px solid var(--line-hot); background: #0B0E14; cursor: pointer;
    position: relative; flex: 0 0 15px;
    transition: background .16s var(--ease), border-color .16s var(--ease);
}
input[type=checkbox]:checked {
    background: linear-gradient(135deg, var(--gold), var(--gold-3));
    border-color: var(--gold-2);
}
input[type=checkbox]:checked::after {
    content: ''; position: absolute; left: 4.5px; top: 1px;
    width: 4px; height: 8px; border: solid #14100A;
    border-width: 0 2px 2px 0; transform: rotate(42deg);
    animation: check-in .2s var(--ease-out);
}
@keyframes check-in { from { transform: rotate(42deg) scale(.4); opacity: 0; } to { transform: rotate(42deg) scale(1); opacity: 1; } }
input[type=checkbox]:focus-visible { box-shadow: var(--glow-cyan); outline: none; }

.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 9px; }
.check input { margin: 2px 0 0; }
.check label { margin: 0; font-weight: 400; font-size: 13px; color: var(--ink); cursor: pointer; }

fieldset { border: none; margin: 0; padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 15px; }
.form-grid .full { grid-column: 1 / -1; }

/* ------------------------------------------------------------------ таблицы */

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
    color: var(--ink-4); font-weight: 600; padding: 10px 15px;
    border-bottom: 1px solid var(--line); background: rgba(255,255,255,.015); white-space: nowrap;
}
.table td { padding: 11px 15px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .16s var(--ease); position: relative; }
.table tbody tr:hover { background: rgba(255,255,255,.028); }
.table tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--gold-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .muted { color: var(--ink-3); }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------------ метки */

.tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; font-size: 11px; font-weight: 500;
    border-radius: 20px; background: rgba(255,255,255,.055); color: var(--ink-2);
    border: 1px solid var(--line); white-space: nowrap; letter-spacing: .01em;
}
.tag-ok   { background: var(--ok-bg);   color: var(--ok);   border-color: rgba(61,214,140,.24); }
.tag-warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(240,180,75,.24); }
.tag-err  { background: var(--err-bg);  color: var(--err);  border-color: rgba(242,107,118,.24); }
.tag-info { background: var(--info-bg); color: var(--cyan); border-color: rgba(56,214,200,.24); }
.tag-gold { background: var(--gold-glow); color: var(--gold); border-color: rgba(217,184,113,.3); }
.tag-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.tag-live::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
    display: inline-block; animation: blink 1.9s var(--ease) infinite;
}
@keyframes blink { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }

.pill {
    display: inline-block; padding: 2px 10px; border-radius: 4px;
    font-size: 11px; font-weight: 600; color: #F4F7FB;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
}

.avatar {
    width: 27px; height: 27px; border-radius: 50%; flex: 0 0 27px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 10.5px; font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
    transition: transform .22s var(--ease-out), box-shadow .22s var(--ease);
}
.avatar:hover { transform: scale(1.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3), 0 0 16px -4px currentColor; }
.avatar-lg { width: 44px; height: 44px; flex-basis: 44px; font-size: 15px; }

.muted { color: var(--ink-3); }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.strike { text-decoration: line-through; opacity: .5; }
.gold { color: var(--gold); }

/* ------------------------------------------------------------------ показатели */

.metrics { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); }
.metric {
    background: linear-gradient(165deg, var(--surface-2) 0%, #0B0E14 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg); padding: 15px 17px;
    position: relative; overflow: hidden;
    transition: transform .28s var(--ease-out), border-color .28s var(--ease), box-shadow .28s var(--ease);
}
.metric::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,.05), transparent 55%);
}
.metric:hover { transform: translateY(-3px); border-color: var(--line-hot); box-shadow: var(--shadow-md); }
.metric .label {
    font-size: 10px; text-transform: uppercase; letter-spacing: .13em;
    color: var(--ink-4); font-weight: 600; margin-bottom: 8px;
}
.metric .value {
    font-size: 27px; font-weight: 650; letter-spacing: -.028em; line-height: 1.05;
    color: #F2F5F9; font-variant-numeric: tabular-nums;
}
.metric .value.sm { font-size: 17px; letter-spacing: -.015em; }
.metric .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.45; }

/* Верхняя световая полоса — цвет кодирует характер показателя. */
.metric::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--ink-4), transparent);
    opacity: .5; transition: opacity .28s var(--ease);
}
.metric:hover::before { opacity: 1; }
.metric.accent::before { background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .85; }
.metric.cyan::before   { background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: .85; }
.metric.warn::before   { background: linear-gradient(90deg, transparent, var(--warn), transparent); opacity: .9; }
.metric.danger::before { background: linear-gradient(90deg, transparent, var(--err), transparent); opacity: .9; }
.metric.danger .value  { color: #FF9AA2; }
.metric.warn .value    { color: #FFD08A; }
.metric.accent .value  { color: #F0DDB4; }

/* ------------------------------------------------------------------ вкладки */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a, .tabs button {
    padding: 9px 15px; font-size: 13.5px; color: var(--ink-2);
    border: none; border-bottom: 2px solid transparent; background: none;
    cursor: pointer; text-decoration: none; font-family: inherit;
    position: relative; transition: color .18s var(--ease);
}
.tabs a::after, .tabs button::after {
    content: ''; position: absolute; left: 50%; right: 50%; bottom: -1px; height: 2px;
    background: linear-gradient(90deg, var(--gold-3), var(--gold), var(--gold-3));
    transition: left .28s var(--ease-out), right .28s var(--ease-out);
}
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs a:hover::after, .tabs button:hover::after { left: 20%; right: 20%; }
.tabs a.active, .tabs button.active { color: #fff; font-weight: 600; }
.tabs a.active::after, .tabs button.active::after { left: 0; right: 0; }
.tabs .count { color: var(--ink-4); font-size: 11.5px; margin-left: 5px; }

/* ------------------------------------------------------------------ канбан */

.board { display: flex; gap: 13px; align-items: flex-start; overflow-x: auto; padding: 4px 0 18px; min-height: 60vh; }
.column {
    flex: 0 0 292px; width: 292px;
    background: linear-gradient(180deg, rgba(255,255,255,.028), rgba(255,255,255,.012));
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    display: flex; flex-direction: column; max-height: calc(100vh - 226px);
    animation: col-in .5s var(--ease-out) both;
    transition: border-color .22s var(--ease), box-shadow .22s var(--ease);
}
.column:nth-child(1) { animation-delay: .03s; }
.column:nth-child(2) { animation-delay: .08s; }
.column:nth-child(3) { animation-delay: .13s; }
.column:nth-child(4) { animation-delay: .18s; }
.column:nth-child(5) { animation-delay: .23s; }
.column:nth-child(6) { animation-delay: .28s; }
.column:nth-child(7) { animation-delay: .33s; }
.column:nth-child(n+8) { animation-delay: .38s; }
@keyframes col-in { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }

.column-head {
    padding: 11px 13px 9px; border-bottom: 1px solid var(--line-2);
    position: sticky; top: 0; z-index: 2;
    background: rgba(13,16,22,.92);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.column-head .name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12.5px; color: var(--ink); }
.column-head .bar { width: 3px; height: 15px; border-radius: 2px; flex: 0 0 3px; box-shadow: 0 0 10px -1px currentColor; }
.column-head .n { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.column-head .sum { font-size: 11px; color: var(--ink-3); margin-top: 4px; font-variant-numeric: tabular-nums; }
.column-body { padding: 9px; overflow-y: auto; flex: 1; min-height: 70px; }
.column.drop-target {
    border-color: rgba(56,214,200,.6);
    box-shadow: inset 0 0 40px -18px rgba(56,214,200,.7), 0 0 0 1px rgba(56,214,200,.25);
}
.column.drop-target .column-body { background: rgba(56,214,200,.03); }

.deal {
    background: linear-gradient(165deg, var(--surface-2), #0C0F15);
    border: 1px solid var(--line);
    border-radius: var(--radius); padding: 11px 12px; margin-bottom: 9px;
    cursor: grab; display: block; color: inherit; position: relative; overflow: hidden;
    transition: transform .2s var(--ease-out), border-color .2s var(--ease),
                box-shadow .24s var(--ease), background .2s var(--ease);
}
.deal::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
    background: linear-gradient(180deg, var(--gold), transparent);
    opacity: 0; transition: opacity .22s var(--ease);
}
.deal:hover {
    transform: translateY(-2px); border-color: var(--line-hot);
    box-shadow: var(--shadow-md); text-decoration: none;
}
.deal:hover::before { opacity: .9; }
.deal:active { cursor: grabbing; }
.deal.dragging { opacity: .35; transform: scale(.97) rotate(-.8deg); }
.deal .t { font-weight: 600; font-size: 12.8px; line-height: 1.35; margin-bottom: 5px; color: var(--ink); }
.deal .c { font-size: 11.5px; color: var(--ink-3); margin-bottom: 7px; }
.deal .m { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); }
.deal .amount { font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ лента и списки */

.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
    display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line-2);
    animation: fade-in .4s var(--ease-out) both;
}
.feed li:last-child { border-bottom: none; }
.feed .body { flex: 1; min-width: 0; }
.feed .meta { font-size: 11px; color: var(--ink-4); margin-top: 3px; }
.feed .text { font-size: 13px; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
@keyframes fade-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

.list { list-style: none; margin: 0; padding: 0; }
.list > li {
    padding: 11px 17px; border-bottom: 1px solid var(--line-2);
    display: flex; gap: 11px; align-items: center;
    transition: background .16s var(--ease), padding-left .18s var(--ease);
}
.list > li:last-child { border-bottom: none; }
.list > li:hover { background: rgba(255,255,255,.028); padding-left: 20px; }

.empty { padding: 34px 18px; text-align: center; color: var(--ink-4); font-size: 13px; }
.empty strong { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 5px; font-weight: 600; }

/* ------------------------------------------------------------------ сообщения */

.flash {
    padding: 11px 15px; border-radius: var(--radius); margin-bottom: 17px;
    font-size: 13.5px; border: 1px solid;
    display: flex; gap: 9px; align-items: flex-start;
    animation: flash-in .44s var(--ease-out) both;
    position: relative; overflow: hidden;
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.flash::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: currentColor;
}
.flash-ok   { background: var(--ok-bg);   border-color: rgba(61,214,140,.28);  color: var(--ok); }
.flash-err  { background: var(--err-bg);  border-color: rgba(242,107,118,.28); color: var(--err); }
.flash-warn { background: var(--warn-bg); border-color: rgba(240,180,75,.28);  color: var(--warn); }

.notice {
    background: linear-gradient(90deg, rgba(56,214,200,.07), rgba(56,214,200,.015));
    border-left: 2px solid var(--cyan-dim);
    padding: 11px 15px; border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 12.8px; color: var(--ink-2); margin-bottom: 15px; line-height: 1.55;
}

/* ------------------------------------------------------------------ модальные окна */

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(3,4,7,.72);
    backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
    display: none; z-index: 100; padding: 44px 16px; overflow-y: auto;
}
.modal-backdrop.open { display: block; animation: fade .22s var(--ease) both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: linear-gradient(180deg, #12161E 0%, #0B0E14 100%);
    border: 1px solid var(--line-hot);
    border-radius: 12px; box-shadow: var(--shadow-lg);
    max-width: 640px; margin: 0 auto; position: relative;
    animation: modal-in .34s var(--ease-out) both;
}
.modal::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 1px;
    border-radius: 12px 12px 0 0;
    background: linear-gradient(90deg, transparent, rgba(217,184,113,.55), transparent);
}
@keyframes modal-in {
    from { opacity: 0; transform: translateY(20px) scale(.975); }
    to   { opacity: 1; transform: none; }
}
.modal.wide { max-width: 860px; }
.modal-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-body { padding: 22px; }
.modal-foot {
    padding: 13px 22px; border-top: 1px solid var(--line);
    display: flex; justify-content: flex-end; gap: 9px;
    background: rgba(255,255,255,.018); border-radius: 0 0 12px 12px;
}
.modal-close {
    border: none; background: none; font-size: 22px; line-height: 1;
    color: var(--ink-4); cursor: pointer; padding: 0 4px;
    transition: color .18s var(--ease), transform .24s var(--ease-out);
}
.modal-close:hover { color: var(--err); transform: rotate(90deg); }

/* ------------------------------------------------------------------ вход */

.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--void); padding: 24px; position: relative; overflow: hidden;
}
.login-page::before {
    content: ''; position: absolute; inset: -30%;
    background:
        radial-gradient(38% 34% at 26% 26%, rgba(217,184,113,.13), transparent 68%),
        radial-gradient(34% 30% at 74% 68%, rgba(56,214,200,.10), transparent 68%),
        radial-gradient(30% 28% at 52% 96%, rgba(124,107,255,.09), transparent 68%);
    animation: drift 26s var(--ease) infinite alternate;
}
/* Тонкая сетка — «инженерный» фон, почти на пороге видимости. */
.login-page::after {
    content: ''; position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(circle at 50% 50%, #000 10%, transparent 72%);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 10%, transparent 72%);
}
.login-box {
    background: linear-gradient(180deg, rgba(20,24,33,.92), rgba(10,12,17,.96));
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--line-hot);
    border-radius: 14px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 404px; padding: 38px 34px 30px;
    position: relative; z-index: 1;
    animation: modal-in .55s var(--ease-out) both;
}
.login-box::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 1px; border-radius: 14px 14px 0 0;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .name {
    font-size: 30px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
    background: linear-gradient(120deg, #F7EBD0 0%, var(--gold) 32%, #8A6E38 55%, var(--gold) 78%, #F7EBD0 100%);
    background-size: 260% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    animation: sheen 7s linear infinite;
}
.login-brand .sub { font-size: 10.5px; color: var(--ink-3); letter-spacing: .2em; margin-top: 7px; text-transform: uppercase; }
.login-note { margin-top: 20px; font-size: 11.5px; color: var(--ink-4); text-align: center; line-height: 1.6; }

/* ------------------------------------------------------------------ прочее */

.progress { height: 6px; background: rgba(255,255,255,.06); border-radius: 4px; overflow: hidden; }
.progress > span {
    display: block; height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, var(--gold-3), var(--gold));
    box-shadow: 0 0 12px -2px var(--gold-glow);
    animation: grow 1s var(--ease-out) both;
    transform-origin: left;
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.bar-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.bar-row .name { width: 196px; flex: 0 0 196px; font-size: 13px; color: var(--ink-2); }
.bar-row .track { flex: 1; height: 22px; background: rgba(255,255,255,.045); border-radius: 4px; overflow: hidden; }
.bar-row .fill {
    height: 100%; border-radius: 4px;
    animation: grow .9s var(--ease-out) both; transform-origin: left;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.bar-row .val { width: 138px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }

.kv { display: grid; grid-template-columns: 152px 1fr; gap: 8px 15px; font-size: 13.5px; }
.kv dt { color: var(--ink-4); font-size: 12px; }
.kv dd { margin: 0; color: var(--ink); }

.divider { height: 1px; background: var(--line); margin: 17px 0; border: none; }

.filters { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; padding: 10px 0 16px; }
.filters input[type=search], .filters select { width: auto; min-width: 158px; }

.drag-handle { cursor: grab; color: var(--ink-4); user-select: none; padding: 0 3px; transition: color .18s var(--ease); }
.drag-handle:hover { color: var(--gold); }
.stage-row.dragging { opacity: .4; }

details.inline-form > summary {
    cursor: pointer; font-size: 13px; color: var(--cyan);
    padding: 7px 0; list-style: none; transition: color .18s var(--ease);
}
details.inline-form > summary::-webkit-details-marker { display: none; }
details.inline-form > summary::before { content: '＋ '; }
details.inline-form[open] > summary::before { content: '− '; }
details.inline-form > summary:hover { color: #6FEDE0; }

/* Появление при прокрутке — вешается скриптом. */
.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }

@media (max-width: 1100px) {
    .grid-2, .grid-3, .grid-4, .grid-main, .grid-side { grid-template-columns: minmax(0,1fr); }
    .form-grid { grid-template-columns: minmax(0,1fr); }
}


/* ================================================================== мобильная версия
   Телефон — не уменьшенный десктоп. Меню уезжает за край, таблицы становятся
   карточками, органы управления дорастают до пальца. */

.nav-toggle { display: none; }
.nav-close  { display: none; }
.nav-scrim  { display: none; }

@media (max-width: 900px) {
    :root { --sidebar: 290px; }

    /* Меню выезжает поверх содержимого, а не сжимает его. */
    .sidebar {
        position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
        width: var(--sidebar); height: 100dvh;
        transform: translateX(-100%);
        transition: transform .28s var(--ease-out);
        box-shadow: none;
        padding-bottom: env(safe-area-inset-bottom);
    }
    body.nav-open .sidebar { transform: none; box-shadow: 24px 0 60px rgba(0,0,0,.6); }
    body.nav-open { overflow: hidden; }

    .nav-scrim {
        display: block; position: fixed; inset: 0; z-index: 50;
        background: rgba(3,4,7,.66);
        backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
        opacity: 0; pointer-events: none; transition: opacity .28s var(--ease);
    }
    body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }

    .nav-toggle {
        display: flex; flex-direction: column; justify-content: center; gap: 4px;
        width: 40px; height: 40px; flex: 0 0 40px; padding: 0 9px;
        background: var(--surface-2); border: 1px solid var(--line-hot);
        border-radius: var(--radius); cursor: pointer;
    }
    .nav-toggle span {
        display: block; height: 2px; border-radius: 2px; background: var(--ink-2);
        transition: transform .26s var(--ease-out), opacity .2s var(--ease);
    }
    body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
    body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    .nav-close {
        display: block; position: absolute; top: 14px; right: 12px;
        width: 38px; height: 38px; font-size: 24px; line-height: 1;
        background: none; border: none; color: var(--ink-3); cursor: pointer;
    }

    .nav a { padding: 11px 12px; font-size: 15px; }   /* палец, а не курсор */
    .nav a .ico { font-size: 14px; }

    .topbar { padding: 10px 14px; gap: 12px; }
    .topbar h1 { font-size: 17px; }
    .topbar .actions { gap: 6px; }
    .topbar .actions .btn { padding: 7px 11px; font-size: 12.5px; }

    .content, .content.wide { padding: 16px 14px 56px; }

    .grid-2, .grid-3, .grid-4, .grid-main, .grid-side { grid-template-columns: minmax(0,1fr); }
    .form-grid { grid-template-columns: minmax(0,1fr); }
    .metrics { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
    .metric { padding: 13px 14px; }
    .metric .value { font-size: 23px; }

    /* Поле ввода мельче 16px заставляет iOS увеличивать страницу при фокусе. */
    input[type=text], input[type=email], input[type=password], input[type=number],
    input[type=date], input[type=datetime-local], input[type=search], input[type=url],
    input[type=tel], select, textarea { font-size: 16px; padding: 10px 12px; }

    .btn { padding: 9px 14px; }
    .btn-sm { padding: 7px 11px; font-size: 12.5px; }

    /* Фильтры складываются в столбец и занимают всю ширину. */
    .filters { gap: 8px; }
    .filters input[type=search], .filters select { width: 100%; min-width: 0; flex: 1 1 100%; }
    .filters .btn { width: 100%; justify-content: center; }

    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tabs a, .tabs button { white-space: nowrap; padding: 10px 13px; }

    /* Канбан листается по колонкам с прилипанием. */
    .board { gap: 10px; scroll-snap-type: x mandatory; padding-bottom: 12px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
    .column { flex-basis: 84vw; width: 84vw; max-height: none; scroll-snap-align: center; }
    .column-body { max-height: 62vh; }

    /* Модальное окно — лист, выезжающий снизу. */
    .modal-backdrop { padding: 0; }
    .modal, .modal.wide {
        max-width: 100%; min-height: 100dvh; border-radius: 0;
        display: flex; flex-direction: column;
        animation: sheet-in .3s var(--ease-out) both;
    }
    .modal::before { display: none; }
    @keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
    .modal-head { position: sticky; top: 0; z-index: 2; background: #12161E; }
    .modal-body { flex: 1; overflow-y: auto; padding: 18px 16px; }
    .modal-foot {
        position: sticky; bottom: 0; background: #0E1218;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        border-radius: 0;
    }
    .modal-foot .btn { flex: 1; justify-content: center; }

    .kv { grid-template-columns: minmax(0,1fr); gap: 2px 0; }
    .kv dt { margin-top: 8px; }
    .bar-row { flex-wrap: wrap; }
    .bar-row .name { width: 100%; flex-basis: 100%; margin-bottom: 4px; }
    .bar-row .val { width: auto; flex: 0 0 auto; }
    .uptime { height: 26px; }
}

/* Таблицы разворачиваются в карточки: подпись поля подставляет скрипт из заголовка. */
@media (max-width: 720px) {
    .table-wrap { overflow-x: visible; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table thead { display: none; }
    .table tr {
        border: 1px solid var(--line); border-radius: var(--radius-lg);
        margin: 0 12px 10px; padding: 4px 0;
        background: linear-gradient(165deg, var(--surface-2), #0C0F15);
    }
    .table tbody tr:hover td:first-child { box-shadow: none; }
    .table td {
        border: none; padding: 7px 14px;
        display: flex; align-items: flex-start; gap: 12px; text-align: left;
    }
    .table td.num { text-align: left; justify-content: flex-start; }
    .table td::before {
        content: attr(data-label);
        flex: 0 0 40%; max-width: 40%;
        font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
        color: var(--ink-4); font-weight: 600; padding-top: 2px;
    }
    .table td:empty { display: none; }
    .table td[data-label=""]::before { display: none; }
    /* Первая ячейка — заголовок карточки. */
    .table td:first-child {
        display: block; padding: 11px 14px 8px; font-size: 14.5px;
        border-bottom: 1px solid var(--line-2); margin-bottom: 4px;
    }
    .table td:first-child::before { display: none; }
    .card-body.tight .table tr:first-child { margin-top: 10px; }

    .list > li { flex-wrap: wrap; padding: 12px 14px; }
    .list > li:hover { padding-left: 14px; }
    .feed li { padding: 12px 0; }
}

@media (max-width: 420px) {
    .metrics { grid-template-columns: minmax(0,1fr); }
    .column { flex-basis: 90vw; width: 90vw; }
    .content, .content.wide { padding: 14px 12px 48px; }
    .table tr { margin: 0 8px 9px; }
}

/* Уважаем системную настройку: движение отключается полностью. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .reveal { opacity: 1; transform: none; }
}

@media print {
    body::before, .sidebar, .topbar .actions, .btn, .filters { display: none !important; }
    body, .card, .metric { background: #fff !important; color: #000 !important; }
}

/* ------------------------------------------------------------------ полоса доступности */

.uptime { display: flex; gap: 2px; align-items: flex-end; height: 30px; flex-wrap: nowrap; overflow: hidden; }
.uptime i {
    flex: 1 1 4px; min-width: 3px; max-width: 9px; height: 100%;
    border-radius: 2px; display: block;
    animation: bar-in .4s var(--ease-out) both;
}
.uptime i.up   { background: linear-gradient(180deg, var(--ok), #227a52); }
.uptime i.down { background: linear-gradient(180deg, var(--err), #8a2f38); box-shadow: 0 0 10px -2px var(--err); }
.uptime i:hover { filter: brightness(1.35); }
@keyframes bar-in { from { transform: scaleY(.15); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 480px) {
    /* Вход на телефоне: карточка во всю ширину, поля крупные, без лишних полей. */
    .login-page { padding: 0; align-items: stretch; }
    .login-box {
        max-width: 100%; border-radius: 0; border-left: none; border-right: none;
        padding: 12vh 24px calc(32px + env(safe-area-inset-bottom));
        display: flex; flex-direction: column; justify-content: center;
    }
    .login-brand .name { font-size: 26px; letter-spacing: .16em; }
    .login-box .btn { padding: 13px; font-size: 15px; }
}

/* ================================================================== премиальный слой

   Три приёма, которые отличают дорогой интерфейс от просто тёмного:
   зерно (чёрный перестаёт быть плоской заливкой и не полосит на градиентах),
   огранка (световая грань по верхнему краю поверхностей),
   отклик на курсор (панель «чувствует» указатель мягким пятном света). */

/* ------------------------------------------------------------------ иконки */

.icon-sprite { display: none; }

.ico {
    width: 17px; height: 17px; flex: 0 0 17px;
    fill: none; stroke: currentColor;
    stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
    opacity: .72;
    transition: opacity .2s var(--ease), transform .32s var(--ease-out), stroke-width .2s var(--ease);
}
.nav a:hover .ico { opacity: 1; transform: translateY(-1px) scale(1.06); }
.nav a.active .ico { opacity: 1; stroke: var(--gold); stroke-width: 1.8; }
.foot-actions .ico { width: 14px; height: 14px; flex-basis: 14px; }

/* ------------------------------------------------------------------ знак */

.brand { display: flex; align-items: center; gap: 12px; }
.brand-text { min-width: 0; }
.logo-mark {
    width: 38px; height: 38px; flex: 0 0 38px;
    filter: drop-shadow(0 2px 10px rgba(217,184,113,.22));
    transition: transform .5s var(--ease-out), filter .4s var(--ease);
}
.brand:hover .logo-mark {
    transform: rotate(-4deg) scale(1.05);
    filter: drop-shadow(0 3px 16px rgba(217,184,113,.42));
}

.foot-actions { margin-top: 10px; gap: 14px; }
.foot-actions a, .foot-actions .btn-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--ink-3); font-size: 12.5px;
}
.foot-actions a:hover, .foot-actions .btn-link:hover { color: var(--gold); text-decoration: none; }

/* ------------------------------------------------------------------ зерно */

/* Плёночное зерно поверх всего: снимает бандинг на градиентах и добавляет
   поверхности физичность. Плотность подобрана так, чтобы его не было видно
   как узор — только как фактуру. */
body::after {
    content: '';
    /* Плёнка лежит поверх всего — включая меню и модальные окна,
       иначе фактура обрывается на границе панелей. */
    position: fixed; inset: 0; z-index: 9999;
    pointer-events: none; opacity: .034;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

/* ------------------------------------------------------------------ огранка и свет */

.card, .metric, .modal, .login-box, .column {
    /* Пятно света идёт за курсором; координаты подставляет скрипт. */
    --mx: 50%; --my: -20%;
}

.card::after {
    content: ''; position: absolute; inset: 0; border-radius: inherit;
    pointer-events: none; opacity: 0;
    background: radial-gradient(340px circle at var(--mx) var(--my),
                rgba(217,184,113,.09), transparent 62%);
    transition: opacity .45s var(--ease);
}
.card:hover::after { opacity: 1; }

.metric::after {
    background:
        radial-gradient(240px circle at var(--mx) var(--my), rgba(217,184,113,.11), transparent 60%),
        radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,.05), transparent 55%);
}

.card, .metric, .modal {
    box-shadow:
        0 1px 0 0 rgba(255,255,255,.045) inset,
        0 1px 2px rgba(0,0,0,.5),
        0 10px 34px -18px rgba(0,0,0,.9);
}
.card:hover {
    box-shadow:
        0 1px 0 0 rgba(255,255,255,.075) inset,
        0 2px 4px rgba(0,0,0,.45),
        0 22px 52px -26px rgba(0,0,0,.95);
}

/* ------------------------------------------------------------------ огранённый текст */

h1 {
    font-size: 21px; font-weight: 620; letter-spacing: -.021em;
    background: linear-gradient(180deg, #FFFFFF 0%, #C3CDDA 130%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
h2 { font-weight: 600; letter-spacing: -.012em; }

.metric .value {
    font-weight: 600; letter-spacing: -.035em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(175deg, #FFFFFF 0%, #AFBBC9 120%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.metric.accent .value {
    background: linear-gradient(175deg, #FBF0D8 0%, var(--gold) 78%, #A5854A 120%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.metric.danger .value { background: linear-gradient(175deg, #FFC4C9, #E0555F 120%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.metric.warn .value   { background: linear-gradient(175deg, #FFE0AE, #D9982F 120%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.metric.cyan .value   { background: linear-gradient(175deg, #C7FBF4, #21A79B 120%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.metric .label, .nav-label, .table th {
    font-variation-settings: 'opsz' 14;
}

/* Суммы и даты — одноширинными цифрами, чтобы колонки стояли ровно. */
.mono, .num, .table .num, .metric .value, .kv dd, .deal .amount { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ грань кнопок */

.btn-primary {
    box-shadow:
        0 1px 0 0 rgba(255,255,255,.32) inset,
        0 -1px 0 0 rgba(0,0,0,.22) inset,
        0 6px 18px -8px rgba(217,184,113,.55);
    text-shadow: 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover {
    box-shadow:
        0 1px 0 0 rgba(255,255,255,.42) inset,
        0 -1px 0 0 rgba(0,0,0,.2) inset,
        0 10px 26px -8px rgba(217,184,113,.7);
}
.btn-teal {
    box-shadow:
        0 1px 0 0 rgba(255,255,255,.22) inset,
        0 6px 18px -8px rgba(56,214,200,.5);
}

/* Тонкая золотая грань по верхнему краю карточек — как фаска на металле. */
.card::before, .modal::before {
    background: linear-gradient(90deg,
        transparent 4%, rgba(217,184,113,.32) 34%, rgba(255,255,255,.16) 50%,
        rgba(217,184,113,.32) 66%, transparent 96%);
}

/* ------------------------------------------------------------------ таблицы */

.table th {
    font-size: 10px; letter-spacing: .12em; font-weight: 650;
    background: linear-gradient(180deg, rgba(255,255,255,.028), transparent);
}
.table tbody tr { transition: background .18s var(--ease), box-shadow .18s var(--ease); }
.table tbody tr:hover { background: rgba(255,255,255,.032); }

/* ------------------------------------------------------------------ вход как витрина */

.login-box { padding: 42px 38px 32px; }
.login-box .logo-mark { width: 56px; height: 56px; flex-basis: 56px; margin: 0 auto 16px; display: block; }
.login-brand .name { font-size: 29px; font-weight: 700; }
.login-brand .sub { font-size: 10px; letter-spacing: .26em; }

/* Тонкая золотая рамка, обходящая карточку по кругу. */
.login-box::after {
    content: ''; position: absolute; inset: -1px; border-radius: 15px;
    pointer-events: none; padding: 1px;
    background: conic-gradient(from var(--angle, 0deg),
        transparent 0%, rgba(217,184,113,.55) 12%, transparent 28%,
        transparent 55%, rgba(56,214,200,.35) 66%, transparent 82%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    animation: rotate-border 9s linear infinite;
}
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes rotate-border { to { --angle: 360deg; } }

.login-page .divider-line {
    height: 1px; margin: 22px 0 18px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
}

/* ------------------------------------------------------------------ мелочи */

.tag { font-weight: 550; letter-spacing: .005em; }
.pill { text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.avatar { box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 2px 8px rgba(0,0,0,.4); }
.empty strong { font-weight: 600; letter-spacing: -.01em; }

/* Фокус виден всегда и выглядит намеренно, а не как сброс браузера. */
a:focus-visible, button:focus-visible, .btn:focus-visible, [tabindex]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(217,184,113,.55);
    border-radius: var(--radius);
}

@media (prefers-reduced-motion: reduce) {
    body::after { display: none; }
    .login-box::after { animation: none; }
}

/* ================================================================== палитра команд

   Cmd+K открывает единое окно перехода: разделы и живой поиск по данным.
   Ищет сервер, права учитываются на его стороне — в выдачу не попадает то,
   чего пользователю видеть не положено. */

.palette-trigger {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 11px 7px 10px; margin-left: auto;
    background: rgba(255,255,255,.035); border: 1px solid var(--line);
    border-radius: var(--radius); color: var(--ink-3);
    font-family: inherit; font-size: 12.5px; cursor: pointer;
    transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.palette-trigger:hover { border-color: var(--line-hot); color: var(--ink-2); background: rgba(255,255,255,.06); }
.palette-trigger .ico { width: 15px; height: 15px; flex-basis: 15px; }
.palette-trigger span { min-width: 84px; text-align: left; }

kbd {
    font-family: inherit; font-size: 10.5px; line-height: 1;
    padding: 3px 5px; border-radius: 4px;
    background: rgba(255,255,255,.07); border: 1px solid var(--line-hot);
    color: var(--ink-3);
}

.palette-backdrop {
    position: fixed; inset: 0; z-index: 200; display: none;
    background: rgba(3,4,7,.7);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    padding: 12vh 16px 16px;
}
.palette-backdrop.open { display: block; animation: fade .18s var(--ease) both; }

.palette {
    max-width: 620px; margin: 0 auto;
    background: linear-gradient(180deg, #141922 0%, #0B0E14 100%);
    border: 1px solid var(--line-hot); border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden; position: relative;
    animation: palette-in .26s var(--ease-out) both;
}
.palette::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(217,184,113,.5), transparent);
}
@keyframes palette-in {
    from { opacity: 0; transform: translateY(-12px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.palette-input { display: flex; align-items: center; gap: 11px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.palette-input .ico { width: 18px; height: 18px; flex-basis: 18px; opacity: .5; }
.palette-input input {
    flex: 1; border: none; background: none; padding: 0;
    font-size: 16px; color: var(--ink);
}
.palette-input input:focus { outline: none; box-shadow: none; background: none; }
.palette-input input::-webkit-search-cancel-button { display: none; }

.palette-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-group {
    font-size: 9.5px; text-transform: uppercase; letter-spacing: .14em;
    color: var(--ink-4); font-weight: 650; padding: 10px 12px 5px;
}
.palette-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: var(--radius);
    cursor: pointer; color: var(--ink);
}
.palette-item .ico { width: 16px; height: 16px; flex-basis: 16px; opacity: .55; }
.palette-item .t { flex: 1; min-width: 0; font-size: 13.5px; }
.palette-item .t small { display: block; color: var(--ink-4); font-size: 11.5px; margin-top: 1px; }
.palette-item .badge { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; }
.palette-item.on {
    background: linear-gradient(90deg, rgba(217,184,113,.14), rgba(217,184,113,.03));
    box-shadow: inset 2px 0 0 var(--gold);
}
.palette-item.on .ico { opacity: 1; stroke: var(--gold); }
.palette-empty { padding: 26px 16px; text-align: center; color: var(--ink-4); font-size: 13px; }

.palette-foot {
    display: flex; gap: 14px; align-items: center;
    padding: 10px 16px; border-top: 1px solid var(--line);
    background: rgba(255,255,255,.02); font-size: 11px; color: var(--ink-4);
}
.palette-foot span { display: flex; align-items: center; gap: 4px; }

@media (max-width: 900px) {
    .palette-trigger span, .palette-trigger kbd { display: none; }
    .palette-trigger { margin-left: auto; padding: 8px; }
    .palette-backdrop { padding: 0; }
    .palette { max-width: 100%; min-height: 100dvh; border-radius: 0; border: none; }
    .palette-results { max-height: calc(100dvh - 140px); }
    .palette-foot { position: sticky; bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}

/* ================================================================== графики

   Рисуются на сервере готовой геометрией. Цвет несут только столбцы,
   подписи и значения остаются текстовыми токенами — светлый оттенок серии
   нечитаем как текст. Данные продублированы таблицей: график не единственный
   способ их получить. */

.chart { margin: 0; }
.chart-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chart-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.chart-note { font-size: 11.5px; color: var(--ink-4); }
.chart-legend { display: flex; gap: 14px; }
.chart-legend .key { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); }
.chart-legend .key i { width: 9px; height: 9px; border-radius: 2px; display: block; }

.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }

.chart-svg .grid { stroke: rgba(255,255,255,.07); stroke-width: 1; }
.chart-svg .axis { fill: var(--ink-4); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart-svg .axis.name { fill: var(--ink-2); font-size: 12px; }
.chart-svg .value { fill: var(--ink-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

.chart-svg .bar {
    transition: opacity .18s var(--ease), filter .18s var(--ease);
    /* Столбцы вырастают из нулевой линии при появлении графика. */
    transform-origin: center bottom;
    animation: bar-grow .62s var(--ease-out) both;
}
.chart-svg .bar:hover { filter: brightness(1.18); }
.chart-svg:hover .bar:not(:hover) { opacity: .55; }
@keyframes bar-grow { from { transform: scaleY(.02); opacity: .3; } to { transform: none; opacity: 1; } }

/* Воронка растёт вбок, поэтому и оживает вбок. */
.chart-funnel .chart-svg .bar { transform-origin: left center; animation-name: bar-grow-x; }
@keyframes bar-grow-x { from { transform: scaleX(.02); opacity: .3; } to { transform: none; opacity: 1; } }

.chart-table { margin-top: 12px; }
.chart-table > summary {
    cursor: pointer; font-size: 12px; color: var(--ink-3);
    list-style: none; padding: 4px 0;
}
.chart-table > summary::-webkit-details-marker { display: none; }
.chart-table > summary::before { content: '▸ '; }
.chart-table[open] > summary::before { content: '▾ '; }
.chart-table > summary:hover { color: var(--cyan); }
.chart-table .table { margin-top: 6px; }
.chart-table .table th, .chart-table .table td { padding: 6px 10px; font-size: 12.5px; }

@media (prefers-reduced-motion: reduce) {
    .chart-svg .bar { animation: none; }
}

/* ================================================================== переходы между страницами

   Браузер сам сшивает уходящую и приходящую страницы: содержимое сменяется
   мягко, а шапка и меню остаются на месте — взгляд не теряет опору.
   Там, где механизм не поддержан, работает прежнее появление снизу вверх. */

@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) { animation-duration: .26s; }

::view-transition-old(root) {
    animation: vt-out .2s var(--ease) both;
}
::view-transition-new(root) {
    animation: vt-in .3s var(--ease-out) both;
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in  { from { opacity: 0; transform: translateY(10px); } }

/* Меню и шапка переносятся между страницами как один и тот же объект. */
.sidebar { view-transition-name: app-nav; }
.topbar  { view-transition-name: app-top; }
::view-transition-group(app-nav),
::view-transition-group(app-top) { animation-duration: .26s; }
::view-transition-old(app-nav), ::view-transition-new(app-nav),
::view-transition-old(app-top), ::view-transition-new(app-top) { animation: none; }

/* Когда переходы работают, собственное появление содержимого не нужно —
   иначе движение удваивается. */
@supports (view-transition-name: none) {
    .content { animation: none; }
    .content > * { animation: none; opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* Ссылка профиля живёт в подвале меню — активное состояние ей задаётся отдельно,
   правила .nav туда не достают. */
.foot-actions a.active { color: var(--gold); }
.foot-actions a.active .ico { opacity: 1; stroke: var(--gold); }
