/* ============================================================
   Пластифабрика CRM — единая тема интерфейса
   ============================================================ */

:root {
    --bg: #f6f2e9;
    --bg-soft: #fbf8f1;
    --panel: #ffffff;
    --panel-2: #fffdf8;
    --ink: #21352b;
    --ink-2: #3f5547;
    --muted: #7b8a7d;
    --muted-2: #a1ada2;
    --line: #e9e2d5;
    --line-strong: #ddd3c2;

    --accent: #fd8b29;
    --accent-2: #ffa451;
    --accent-dark: #d96f0d;
    --accent-soft: #fff0e2;
    --accent-ink: #b85b0a;

    --nav: #20392f;
    --nav-2: #2b4a3c;
    --nav-ink: #e7efe7;
    --nav-muted: #9db3a4;

    --ok: #62bd3f;
    --ok-soft: #eef8e9;
    --warn: #d88912;
    --warn-soft: #fdf3df;
    --danger: #d35a45;
    --danger-soft: #fdece8;
    --info: #3f8fd6;
    --info-soft: #e9f2fc;
    --violet: #7a5af8;
    --violet-soft: #f0ecff;

    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --shadow-sm: 0 2px 4px rgba(41, 55, 43, .05);
    --shadow: 0 18px 40px -28px rgba(41, 55, 43, .45), 0 3px 8px rgba(41, 55, 43, .05);
    --shadow-lg: 0 30px 70px -30px rgba(32, 57, 47, .45);
    --ring: 0 0 0 3px rgba(253, 139, 41, .24);
    --sidebar-w: 256px;
    --topbar-h: 68px;
    --font: "Comfortaa", "Montserrat", "Trebuchet MS", "Segoe UI", "Roboto", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

/* Единая базовая геометрия иконок. Без этого SVG вне .btn/.nav-item
   растягивался до размеров по умолчанию и ломал сетку интерфейса. */
.icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    display: inline-block;
    vertical-align: -0.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
p { margin: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c6d2dc; border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #a9bac7; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------
   Каркас приложения
   ------------------------------------------------------------ */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--nav) 0%, #0b2227 100%);
    color: var(--nav-ink);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    padding: 18px 12px 14px;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 4px 10px 18px;
    color: #fff;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(145deg, var(--accent-2), #0b6a61);
    display: grid;
    place-items: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 8px 18px -8px rgba(0, 0, 0, .6);
    flex: 0 0 auto;
}

.brand-mark svg { width: 22px; height: 22px; }

.brand-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.brand-sub {
    font-size: 11px;
    color: var(--nav-muted);
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-top: 2px;
}

.nav { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; }

.nav-group-title {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--nav-muted);
    padding: 16px 12px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 9px;
    color: var(--nav-ink);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    transition: background .15s, color .15s;
    text-decoration: none;
}

.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }

.nav-item.active {
    background: linear-gradient(90deg, rgba(18, 163, 148, .26), rgba(18, 163, 148, .08));
    color: #fff;
    box-shadow: inset 2px 0 0 var(--accent-2);
}

.nav-item .icon { width: 18px; height: 18px; opacity: .85; flex: 0 0 auto; }
.nav-item.active .icon { opacity: 1; color: #5ee0ce; }
.nav-item .nav-count {
    margin-left: auto;
    font-size: 11px;
    background: rgba(255, 255, 255, .1);
    padding: 1px 7px;
    border-radius: 20px;
    color: #d9ecea;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 10px 4px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    font-size: 11.5px;
    color: var(--nav-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 26px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-titles { min-width: 0; }
.topbar-title { font-size: 18px; font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 10px 5px 5px;
    border-radius: 30px;
    border: 1px solid var(--line);
    background: var(--panel);
    cursor: pointer;
    position: relative;
}

.user-chip:hover { border-color: var(--line-strong); background: var(--bg-soft); }
.user-chip .avatar { width: 30px; height: 30px; font-size: 12px; }
.user-meta { line-height: 1.15; text-align: left; }
.user-name { font-size: 12.5px; font-weight: 600; }
.user-role { font-size: 10.5px; color: var(--muted); }

.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 210px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    z-index: 60;
}

.dropdown.open { display: block; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 9px 10px;
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
    color: var(--ink);
}
.dropdown-item:hover { background: var(--bg-soft); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-sep { height: 1px; background: var(--line); margin: 5px 0; }

/* Уведомления в шапке */
.notification-wrap { position: relative; flex: 0 0 auto; }
.notification-btn { position: relative; width: 36px; height: 36px; border-radius: 10px; }
.notification-btn .icon { width: 18px; height: 18px; }
.notification-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: 8px;
    background: var(--danger);
    color: #fff;
    border: 1.5px solid var(--panel);
    font-size: 9px;
    font-weight: 700;
    line-height: 11px;
    text-align: center;
    box-sizing: border-box;
}
.notification-badge.badge-double {
    min-width: 15px;
    height: 15px;
    line-height: 12px;
}
.notification-badge.badge-triple {
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    line-height: 14px;
    font-size: 9.5px;
}
.notification-badge[hidden] { display: none; }
.notification-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 390px;
    max-width: calc(100vw - 24px);
    max-height: min(620px, calc(100vh - 100px));
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: none;
    overflow: hidden;
    z-index: 70;
}
.notification-panel.open { display: flex; flex-direction: column; }
.notification-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
}
.notification-panel-title { font-size: 14px; font-weight: 700; }
.notification-panel-actions { display: flex; gap: 4px; flex-shrink: 0; }
.notification-icon.task { background: var(--accent-soft); color: var(--accent-ink); }
.notification-panel-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.notification-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px; }
.notification-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 12.5px; }
.notification-item {
    display: flex;
    gap: 10px;
    padding: 11px;
    border-radius: 9px;
    cursor: pointer;
    position: relative;
}
.notification-item:hover { background: var(--bg-soft); }
.notification-item.unread { background: #f7fbfa; }
.notification-item.unread:hover { background: #eef8f5; }
.notification-item.processed { opacity: .68; }
.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.notification-icon.order { background: var(--info-soft); color: #2459b5; }
.notification-icon .icon { width: 16px; height: 16px; }
.notification-body { min-width: 0; flex: 1; }
.notification-item-title { font-size: 12.8px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.notification-unread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.notification-item-message { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.notification-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.notification-meta strong { color: var(--ink); font-weight: 600; }
.notification-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.notification-processed-label { font-size: 11px; color: var(--ok); display: inline-flex; align-items: center; gap: 4px; }
.notification-time { flex: 0 0 auto; font-size: 10.5px; color: var(--muted); white-space: nowrap; margin-left: auto; }

.hamburger.btn { display: none; }

.view {
    padding: 24px 26px 46px;
    max-width: 1560px;
    width: 100%;
    margin: 0 auto;
}

/* ------------------------------------------------------------
   Кнопки, поля, бейджи
   ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--line-strong);
    background: var(--panel);
    color: var(--ink-2);
    border-radius: 9px;
    padding: 8px 13px;
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
    white-space: nowrap;
    line-height: 1.25;
    text-decoration: none;
}
.btn:hover { background: var(--bg-soft); border-color: #c2ced9; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary {
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(15, 139, 126, .8);
}
.btn-primary:hover { background: linear-gradient(180deg, #15b3a2, #0d7d71); border-color: var(--accent-dark); color: #fff; }

.btn-danger { color: var(--danger); border-color: #f0c7c7; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: #eaa9a9; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--line); }

.btn-soft { background: var(--accent-soft); color: var(--accent-ink); border-color: #ccece6; }
.btn-soft:hover { background: #d8f1ec; border-color: #b3e3da; }

.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-sm .icon { width: 14px; height: 14px; }

.btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    color: var(--muted);
    border-color: transparent;
    background: transparent;
}
.btn-icon:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--line); }
.btn-icon.is-active { background: var(--accent-soft); color: var(--accent-ink); border-color: #ffd6b0; }
.btn-icon .icon { width: 16px; height: 16px; }

.btn-link {
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--accent-ink);
    font-weight: 550;
    cursor: pointer;
    font-size: 13px;
}
.btn-link:hover { text-decoration: underline; }

.input, .select, .textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    background: #fff;
    border-radius: 9px;
    padding: 8px 11px;
    font-size: 13.5px;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
    min-height: 37px;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.textarea { min-height: 86px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7c8f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }

.input-sm { min-height: 30px; padding: 4px 8px; font-size: 12.5px; border-radius: 7px; }

.search-box { position: relative; min-width: 220px; }
.search-box .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-2); pointer-events: none; }
.search-box .input { padding-left: 32px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd6df; border-radius: 20px; transition: .2s; cursor: pointer; }
.switch span:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span:before { transform: translateX(16px); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2.5px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--bg-soft);
    color: var(--ink-2);
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.4;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: #077a55; }
.badge.warn { background: var(--warn-soft); color: #925e05; }
.badge.danger { background: var(--danger-soft); color: #ad2b2b; }
.badge.info { background: var(--info-soft); color: #2459b5; }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.violet { background: var(--violet-soft); color: #5b3fd0; }
.badge.muted { background: #f1f4f7; color: var(--muted); }
.badge.outline { background: transparent; border-color: var(--line-strong); color: var(--muted); }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-weight: 650;
    font-size: 12.5px;
    color: #fff;
    background: linear-gradient(135deg, #2c8f84, #0f5f59);
    flex: 0 0 auto;
    letter-spacing: .02em;
}

.pill { padding: 2px 8px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* ------------------------------------------------------------
   Страницы, карточки, KPI
   ------------------------------------------------------------ */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head-text { min-width: 0; }
.page-title { font-size: 23px; font-weight: 700; letter-spacing: -.025em; }
.page-desc { color: var(--muted); font-size: 13px; margin-top: 3px; max-width: 760px; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 18px; }
.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-body.tight { padding: 12px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 15px 16px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    min-width: 0;
}
.kpi:before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); opacity: .8; }
.kpi.kpi-info:before { background: var(--info); }
.kpi.kpi-warn:before { background: var(--warn); }
.kpi.kpi-danger:before { background: var(--danger); }
.kpi.kpi-violet:before { background: var(--violet); }
.kpi.kpi-ok:before { background: var(--ok); }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 550; }
.kpi-top .icon { width: 15px; height: 15px; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -.03em; margin-top: 7px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-note { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.kpi-note .up { color: var(--ok); font-weight: 600; }
.kpi-note .down { color: var(--danger); font-weight: 600; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; margin-top: 18px; }

.chart-bars { display: flex; align-items: flex-end; gap: 14px; height: 210px; padding: 12px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; height: 100%; justify-content: flex-end; }
.bar-track { width: 100%; max-width: 52px; flex: 1; display: flex; align-items: flex-end; }
.bar {
    width: 100%;
    border-radius: 7px 7px 3px 3px;
    background: linear-gradient(180deg, var(--accent-2), #0c746a);
    min-height: 3px;
    position: relative;
    transition: filter .15s;
    cursor: default;
}
.bar:hover { filter: brightness(1.08); }
.bar-tooltip {
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: #fff;
    font-size: 10.5px;
    padding: 3px 7px;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s;
    z-index: 2;
}
.bar:hover .bar-tooltip { opacity: 1; }
.bar-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bar-value { font-size: 10.5px; color: var(--muted-2); }

.status-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.status-chip {
    border: 1px solid var(--line);
    background: var(--panel-2);
    border-radius: 9px;
    padding: 8px 11px;
    min-width: 108px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.status-chip:hover { border-color: #bcd7d3; background: var(--accent-soft); }
.status-chip .label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.status-chip .value { font-size: 17px; font-weight: 680; margin-top: 2px; }
.status-chip .sum { font-size: 11px; color: var(--muted-2); }

.top-list { display: flex; flex-direction: column; }
.top-item { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.top-item:last-child { border-bottom: 0; }
.top-thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: var(--bg-soft); border: 1px solid var(--line); flex: 0 0 auto; }
.top-thumb.placeholder { display: grid; place-items: center; color: var(--muted-2); }
.top-thumb .icon { width: 17px; height: 17px; }
.top-info { min-width: 0; flex: 1; }
.top-name { font-size: 13px; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-meta { font-size: 11px; color: var(--muted); }
.top-sum { font-size: 13px; font-weight: 620; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   Таблицы
   ------------------------------------------------------------ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.toolbar .search-box { flex: 0 1 300px; }
.toolbar .select { width: auto; min-width: 150px; }
.toolbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Компактная панель фильтров: открывается иконкой в тулбаре */
.filter-panel {
    padding: 13px 18px 15px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fffdf8, #fbf8f1);
}
.filter-panel[hidden] { display: none; }
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 10px 12px;
    align-items: end;
}
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-field > label {
    font-size: 10.5px;
    font-weight: 650;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .055em;
}
.filter-field .input, .filter-field .select { min-height: 33px; padding: 5px 9px; font-size: 12.5px; }
.filter-range { display: flex; align-items: center; gap: 5px; min-width: 0; }
.filter-range .input { min-width: 0; }
.filter-range .muted { flex: 0 0 auto; }
.filter-footer { display: flex; align-items: center; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.filter-badge {
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 20px;
    display: inline-grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}
.filter-badge[hidden] { display: none; }
.btn-icon .filter-badge { position: absolute; top: -3px; right: -3px; }
.btn-icon.has-filter-badge { position: relative; overflow: visible; }
.filter-panel .btn .icon { width: 14px; height: 14px; }

.table-wrap { overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 650;
    padding: 10px 12px;
    background: var(--panel-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}
table.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr { transition: background .1s; }
table.table tbody tr:hover { background: #f8fbfb; }
table.table tbody tr.clickable { cursor: pointer; }
table.table td.num, table.table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.table td.actions, table.table th.actions { text-align: right; white-space: nowrap; width: 1%; }
table.table .row-actions { display: inline-flex; gap: 2px; opacity: .55; transition: opacity .12s; }
table.table tbody tr:hover .row-actions { opacity: 1; }
table.table .cell-main { font-weight: 560; color: var(--ink); }
table.table .cell-sub { font-size: 11.5px; color: var(--muted); }
table.table .cell-stack { display: flex; flex-direction: column; gap: 1px; }

.editable { position: relative; cursor: text; border-radius: 5px; }
.editable:hover { box-shadow: inset 0 -1px 0 var(--accent-2); }
.editable.editing { padding: 0; box-shadow: none; }
.editable input, .editable select { width: 100%; min-width: 70px; border: 1px solid var(--accent); border-radius: 6px; padding: 3px 6px; font-size: 13px; outline: none; background: #fff; box-shadow: var(--ring); }
.editable .edit-hint { display: none; }
tr:hover .editable[data-editable]:after {
    content: "";
}

.table-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
    flex-wrap: wrap;
}
.table-footer .total { font-weight: 650; color: var(--ink); }

.empty {
    padding: 46px 20px;
    text-align: center;
    color: var(--muted);
}
.empty .empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
}
.empty .empty-icon .icon { width: 24px; height: 24px; }
.empty h4 { color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.empty p { font-size: 12.5px; max-width: 420px; margin: 0 auto 14px; }

.skeleton { background: linear-gradient(90deg, #eef2f5 25%, #f7f9fb 37%, #eef2f5 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton-line { height: 13px; margin: 10px 0; }
.skeleton-card { height: 96px; }

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(15, 139, 126, .2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px; color: var(--muted); }

/* ------------------------------------------------------------
   Модальные окна, drawer, тосты
   ------------------------------------------------------------ */
.modal-backdrop, .drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 28, 36, .42);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn .14s ease;
}
.drawer-backdrop { justify-content: flex-end; padding: 0; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--panel);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    animation: modalIn .16s cubic-bezier(.2, .8, .3, 1);
}
.modal.wide { max-width: 880px; }
.modal.narrow { max-width: 420px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-head { padding: 17px 20px 13px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; }
.modal-head h3 { font-size: 16px; }
.modal-head .modal-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-head .btn-icon { margin-left: auto; margin-top: -3px; margin-right: -6px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }

.drawer {
    width: min(560px, 100%);
    height: 100%;
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: drawerIn .18s cubic-bezier(.2, .8, .3, 1);
}
.drawer.wide { width: min(760px, 100%); }
@keyframes drawerIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; }
.drawer-head h3 { font-size: 17px; }
.drawer-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.drawer-head .btn-icon { margin-left: auto; }
.drawer-body { padding: 18px 20px 28px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 11px; color: var(--muted); }
.field input[type="color"] { width: 100%; height: 37px; padding: 3px; cursor: pointer; }
.field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.field .error-text { font-size: 11px; color: var(--danger); }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(211, 63, 63, .12); }
.form-section { grid-column: 1 / -1; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section-title { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 9px; }

#toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: #102a31;
    color: #f1f8f7;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    max-width: 380px;
    animation: toastIn .18s ease;
}
.toast .icon { width: 17px; height: 17px; margin-top: 1px; flex: 0 0 auto; }
.toast.ok .icon { color: #6ee7bc; }
.toast.error { background: #7f1d1d; }
.toast.error .icon { color: #fecaca; }
.toast.warn { background: #78350f; }
.toast.warn .icon { color: #fde68a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------
   Канбан
   ------------------------------------------------------------ */
.kanban {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 12px;
    align-items: flex-start;
    min-height: 420px;
}
.kanban-col {
    flex: 0 0 290px;
    background: #f1f5f7;
    border: 1px solid var(--line);
    border-radius: 13px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
    min-height: 220px;
}
.kanban-col.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.kanban-head { padding: 11px 13px 9px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.kanban-head .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.kanban-head .name { font-size: 12.5px; font-weight: 650; }
.kanban-head .count { margin-left: auto; font-size: 11px; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 0 7px; border-radius: 20px; }
.kanban-sum { font-size: 11px; color: var(--muted); }
.kanban-body { padding: 9px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 90px; }
.kanban-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 11px;
    cursor: grab;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, transform .15s, border-color .15s;
}
.kanban-card:hover { box-shadow: var(--shadow); border-color: #cfdedd; transform: translateY(-1px); }
.kanban-card.dragging { opacity: .45; cursor: grabbing; }
.kanban-card .kc-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.kanban-card .kc-id { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.kanban-card .kc-date { font-size: 10.5px; color: var(--muted-2); }
.kanban-card .kc-client { font-size: 13px; font-weight: 620; margin-top: 4px; line-height: 1.3; }
.kanban-card .kc-items { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kanban-card .kc-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }
.kanban-card .kc-sum { font-size: 13px; font-weight: 680; }
.kanban-card .kc-paid { font-size: 10.5px; color: var(--muted); }
.kanban-add { border: 1px dashed var(--line-strong); background: transparent; color: var(--muted); border-radius: 9px; padding: 7px; font-size: 12px; cursor: pointer; }
.kanban-add:hover { border-color: var(--accent); color: var(--accent-ink); background: #fff; }

/* ------------------------------------------------------------
   Товары
   ------------------------------------------------------------ */
.goods-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.goods-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 13px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s, transform .15s, border-color .15s;
    cursor: pointer;
}
.goods-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #cfdedd; }
.goods-thumb { aspect-ratio: 4 / 3; width: 100%; flex: 0 0 auto; background: #f1f6f6; display: grid; place-items: center; overflow: hidden; position: relative; }
.goods-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }
.goods-thumb .icon { width: 34px; height: 34px; color: #a9c3c0; }
.goods-thumb .image-hint { position: absolute; inset: auto 8px 8px auto; background: rgba(15, 42, 48, .75); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 20px; }

/* товары таблицей */
.goods-table td { vertical-align: middle; }
.goods-table td.num, .goods-table th.num { white-space: nowrap; }
.goods-row-thumb { width: 52px; }
.goods-row-thumb img, .goods-row-thumb .icon { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; display: block; }
.goods-row-thumb .icon { padding: 9px; background: linear-gradient(145deg, #fff0e2, #eaf8e6); color: #fd8b29; }

/* изображение и файл модели в форме товара */
.goods-media-grid { display: grid; grid-template-columns: 190px 1fr; gap: 14px; align-items: center; }
.goods-media-image { height: 110px; border: 1px dashed var(--line); border-radius: 10px; background: var(--panel-2); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; overflow: hidden; position: relative; color: var(--muted); font-size: 11.5px; padding: 0; }
.goods-media-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.goods-media-image span { position: relative; background: rgba(255, 255, 255, .85); padding: 2px 8px; border-radius: 20px; max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goods-media-image .icon { width: 26px; height: 26px; }
.goods-media-image.invalid { border-color: var(--danger); border-style: solid; color: var(--danger); }
.printer-info:empty { display: none; }
@media (max-width: 720px) { .goods-media-grid { grid-template-columns: 1fr; } }
.goods-info { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.goods-name { font-size: 13.5px; font-weight: 650; line-height: 1.3; }
.goods-meta { font-size: 11.5px; color: var(--muted); }
.goods-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; gap: 6px; }
.goods-price { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.goods-price small { font-size: 10.5px; color: var(--muted); font-weight: 500; }
.goods-card .row-actions { opacity: 0; transition: opacity .12s; }
.goods-card:hover .row-actions { opacity: 1; }

.detail-head { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.detail-image {
    width: 168px;
    height: 168px;
    border-radius: 14px;
    background: #f1f6f6;
    border: 1px solid var(--line);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
}
.detail-image img { width: 100%; height: 100%; object-fit: contain; }
.detail-image .icon { width: 40px; height: 40px; color: #a9c3c0; }
.detail-image .upload-hint { position: absolute; inset: auto 0 0 0; background: rgba(15, 42, 48, .72); color: #fff; font-size: 10.5px; text-align: center; padding: 5px; opacity: 0; transition: opacity .15s; }
.detail-image:hover .upload-hint { opacity: 1; }
.detail-main { flex: 1; min-width: 240px; }
.detail-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.detail-stats { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 14px; }
.detail-stat .label { font-size: 11px; color: var(--muted); }
.detail-stat .value { font-size: 18px; font-weight: 680; margin-top: 1px; }

.price-table { width: 100%; font-size: 12.5px; border-collapse: collapse; }
.price-table td { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.price-table tr:last-child td { border-bottom: 0; }
.price-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; }
.price-table tr.total td { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 700; font-size: 14px; padding-top: 10px; }
.price-table tr.profit td { color: var(--ok); font-weight: 650; }

/* ------------------------------------------------------------
   Файлы
   ------------------------------------------------------------ */
.files-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 16px; align-items: start; }
.folder-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.folder-panel-head { padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.folder-panel-options { display: flex; align-items: flex-start; gap: 7px; padding: 9px 13px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; cursor: pointer; }
.folder-panel-options input { flex: 0 0 auto; margin: 2px 0 0; }
.folder-list { padding: 6px; max-height: 68vh; overflow-y: auto; }
.folder-item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); border: 0; background: transparent; width: 100%; text-align: left; }
.folder-item:hover { background: var(--bg-soft); }
.folder-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.folder-item .icon { width: 15px; height: 15px; color: var(--muted); flex: 0 0 auto; }
.folder-item.active .icon { color: var(--accent); }
.folder-item .count { margin-left: auto; font-size: 10.5px; color: var(--muted); }
.folder-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.folder-title { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 8px 9px 3px; font-weight: 650; }
.folder-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.folder-actions .badge .icon { width: 12px; height: 12px; }

.dropzone {
    border: 1.5px dashed var(--line-strong);
    border-radius: 11px;
    padding: 18px;
    text-align: center;
    color: var(--muted);
    background: var(--panel-2);
    transition: border-color .15s, background .15s;
    margin-bottom: 14px;
}
.dropzone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .icon { width: 24px; height: 24px; color: var(--accent); margin-bottom: 5px; }
.dropzone .dz-title { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.dropzone .dz-sub { font-size: 11.5px; margin-top: 2px; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.file-card { border: 1px solid var(--line); border-radius: 11px; background: var(--panel); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, border-color .15s; }
.file-card:hover { box-shadow: var(--shadow); border-color: #cfdedd; }
.file-preview { height: 106px; background: #f2f6f7; display: grid; place-items: center; overflow: hidden; position: relative; }
.file-preview img { width: 100%; height: 100%; object-fit: contain; }
.file-preview .file-ext { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 4px 9px; border-radius: 7px; }
.file-preview .icon { width: 34px; height: 34px; color: #9fb5c4; }
.file-preview .img-pill { position: absolute; top: 6px; left: 6px; background: rgba(15, 42, 48, .7); color: #fff; font-size: 9.5px; padding: 1px 6px; border-radius: 20px; }
.file-body { padding: 9px 10px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.file-name { font-size: 12px; font-weight: 600; line-height: 1.3; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file-meta { font-size: 10.5px; color: var(--muted); }
.file-actions { display: flex; gap: 2px; margin-top: 6px; }
.file-actions .btn-icon { width: 26px; height: 26px; }
.file-actions .icon { width: 14px; height: 14px; }

.breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 11px; }
.breadcrumb .sep { color: var(--muted-2); }
.breadcrumb a, .breadcrumb button { color: var(--accent-ink); }
.folder-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.folder-chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 3px 10px; font-size: 12px; cursor: pointer; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.folder-chip:hover { border-color: #bcd7d3; background: var(--accent-soft); }
.folder-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.folder-chip .icon { width: 12px; height: 12px; }

/* ------------------------------------------------------------
   Финансы, счета, реклама, отчёты, справочники
   ------------------------------------------------------------ */
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.summary .label { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.summary .label .icon { width: 14px; height: 14px; }
.summary .value { font-size: 20px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.summary.income .value { color: var(--ok); }
.summary.expense .value { color: var(--danger); }

.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 14px; }
.account-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.account-card:before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), #63d8c7); }
.account-card.personal:before { background: linear-gradient(90deg, var(--violet), #b9a8ff); }
.account-card .name { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.account-card .bank { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.account-card .amount { font-size: 23px; font-weight: 720; margin-top: 12px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.account-card .purpose { font-size: 11.5px; color: var(--muted); margin-top: 4px; min-height: 17px; }
.account-card .progress { height: 6px; border-radius: 20px; background: #eef2f5; overflow: hidden; margin-top: 11px; }
.account-card .progress > span { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--accent), #4dd0bd); }
.account-card .progress-meta { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.account-card .acc-actions { display: flex; gap: 4px; margin-top: 10px; justify-content: flex-end; }
.account-card .formula { font-size: 11px; color: var(--muted); background: var(--bg-soft); border-radius: 6px; padding: 5px 7px; margin-top: 9px; }

.report-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.metric-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.metric-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin-bottom: 6px; }
.metric-group label { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 12.5px; cursor: pointer; }

.dict-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.dict-list { padding: 6px; }
.dict-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 12.5px; border: 0; background: transparent; width: 100%; text-align: left; color: var(--ink-2); }
.dict-item:hover { background: var(--bg-soft); }
.dict-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.dict-item .count { margin-left: auto; font-size: 10.5px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 0 6px; }
.dict-values { display: flex; flex-direction: column; gap: 7px; }
.dict-value { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; background: #fff; }
.dict-value .val { font-size: 13px; font-weight: 550; flex: 1; min-width: 0; }
.dict-value .order { font-size: 10.5px; color: var(--muted); background: var(--bg-soft); border-radius: 5px; padding: 1px 6px; }
.dict-value.system .val { color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 8px 13px; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 550; }
.tab .icon { width: 15px; height: 15px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }

.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.help-card { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 16px; }
.help-card h4 { font-size: 13.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.help-card h4 .icon { width: 17px; height: 17px; color: var(--accent); }
.help-card p { font-size: 12.5px; color: var(--muted); }
.help-card ul { margin: 8px 0 0; padding-left: 17px; font-size: 12.5px; color: var(--ink-2); }
.help-card li { margin: 3px 0; }
.help-card code { background: var(--bg-soft); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }

.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.info-row:last-child { border-bottom: 0; }
.info-row .k { color: var(--muted); flex: 0 0 150px; }
.info-row .v { flex: 1; min-width: 0; word-break: break-word; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: 0 0 auto; }
.timeline-main { flex: 1; min-width: 0; }
.timeline-title { font-size: 12.5px; font-weight: 550; }
.timeline-meta { font-size: 11px; color: var(--muted); }

.order-lines { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.order-lines th { text-align: left; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 6px 7px; border-bottom: 1px solid var(--line); }
.order-lines td { padding: 7px; border-bottom: 1px solid var(--line); }
.order-lines td.num { text-align: right; font-variant-numeric: tabular-nums; }
.order-lines tr:last-child td { border-bottom: 0; }

.order-total-box { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; display: flex; flex-direction: column; gap: 4px; }
.order-total-row { display: flex; justify-content: space-between; font-size: 12.5px; }
.order-total-row.big { font-size: 16px; font-weight: 700; padding-top: 5px; border-top: 1px solid var(--line-strong); margin-top: 4px; }
.order-total-row .ok { color: var(--ok); }
.order-total-row .danger { color: var(--danger); }

.items-editor { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.items-editor-head, .items-editor-row {
    display: grid;
    grid-template-columns: minmax(160px, 2.2fr) 76px 96px 82px 100px 32px;
    gap: 7px;
    align-items: center;
    padding: 7px 9px;
}
.items-editor-head { background: var(--panel-2); border-bottom: 1px solid var(--line); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.items-editor-row { border-bottom: 1px solid var(--line); }
.items-editor-row:last-child { border-bottom: 0; }
.items-editor-row .input, .items-editor-row .select { min-height: 31px; padding: 4px 7px; font-size: 12.5px; }
.items-editor-row .line-sum { font-size: 12.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.items-editor-foot { padding: 7px 9px; background: var(--panel-2); display: flex; align-items: center; gap: 10px; }
.items-editor-foot .total { margin-left: auto; font-size: 13px; font-weight: 700; }

/* ------------------------------------------------------------
   Вход
   ------------------------------------------------------------ */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--panel); }
.login-visual {
    background: radial-gradient(1200px 600px at 10% 0%, #1b6e64 0%, transparent 55%), linear-gradient(150deg, #0d2a31 0%, #103b41 55%, #0a5b54 100%);
    color: #eaf6f4;
    padding: 48px 54px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.login-visual:after {
    content: "";
    position: absolute;
    width: 560px;
    height: 560px;
    border-radius: 50%;
    border: 1px solid rgba(116, 226, 209, .12);
    right: -190px;
    bottom: -220px;
    box-shadow: 0 0 0 70px rgba(116, 226, 209, .04), 0 0 0 140px rgba(116, 226, 209, .03);
}
.login-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login-brand .brand-mark { width: 44px; height: 44px; }
.login-brand .name { font-size: 18px; font-weight: 700; color: #fff; }
.login-brand .sub { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #8fbeb8; }
.login-hero { position: relative; z-index: 1; max-width: 460px; }
.login-hero h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.03em; margin-bottom: 12px; color: #fff; }
.login-hero p { color: #b6d6d2; font-size: 14px; line-height: 1.6; }
.login-features { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; }
.login-feature { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: #cfe6e2; }
.login-feature .icon { width: 17px; height: 17px; color: #6ee0cf; margin-top: 1px; flex: 0 0 auto; }
.login-foot { font-size: 11px; color: #7fa8a3; position: relative; z-index: 1; }
.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #f7fafb; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; letter-spacing: -.025em; }
.login-card .lead { color: var(--muted); font-size: 13px; margin-top: 4px; margin-bottom: 24px; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--ink-2); }
.login-field .input { min-height: 42px; }
.login-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 18px; }
.login-btn { width: 100%; min-height: 42px; font-size: 14px; }
.login-alert { border-radius: 9px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 16px; display: flex; gap: 8px; align-items: flex-start; }
.login-alert[hidden] { display: none; }
.login-alert.error { background: var(--danger-soft); color: #a52a2a; border: 1px solid #f1c2c2; }
.login-alert.ok { background: var(--ok-soft); color: #087a56; border: 1px solid #bfe9d8; }
.login-alert .icon { width: 16px; height: 16px; margin-top: 1px; }
.login-hint { margin-top: 22px; padding: 11px 13px; background: #fff; border: 1px solid var(--line); border-radius: 10px; font-size: 11.5px; color: var(--muted); }
.login-hint code { background: var(--bg-soft); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.login-mobile-brand { display: none; }

/* ------------------------------------------------------------
   Адаптивность
   ------------------------------------------------------------ */
@media (max-width: 1180px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .files-layout, .dict-layout { grid-template-columns: 230px minmax(0, 1fr); }
}

@media (max-width: 920px) {
    :root { --sidebar-w: 250px; }
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(10, 28, 36, .4); z-index: 35; }
    .main { margin-left: 0; }
    .hamburger.btn { display: inline-flex; }
    .sidebar.open ~ .main .hamburger.btn { display: none; }
    .topbar { padding: 0 16px; }
    .view { padding: 18px 16px 40px; }
    .login-page { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .login-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
    .login-mobile-brand .brand-mark { width: 38px; height: 38px; }
    .login-form-side { min-height: 100vh; }
    .files-layout, .dict-layout { grid-template-columns: 1fr; }
    .folder-list { max-height: 200px; }
    .items-editor-head { display: none; }
    .items-editor-row { grid-template-columns: 1fr 1fr; }
    .items-editor-row .line-sum { text-align: left; }
}

@media (max-width: 640px) {
    .page-head-actions { width: 100%; }
    .page-head-actions .btn { flex: 1; }
    .kpi-grid, .summary-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi { padding: 12px; }
    .kpi-value { font-size: 19px; }
    .form-grid { grid-template-columns: 1fr; }
    .goods-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .detail-image { width: 130px; height: 130px; }
    .toolbar .search-box { flex: 1 1 100%; }
    .toolbar .select { flex: 1; }
    .user-meta { display: none; }
    .topbar-sub { display: none; }
    .notification-panel {
        position: fixed;
        top: calc(var(--topbar-h) + 8px);
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - var(--topbar-h) - 24px);
    }
    .chart-bars { gap: 7px; }
    .bar-label { font-size: 9.5px; }
    .kanban-col { flex-basis: 84vw; }
}

@media print {
    .sidebar, .topbar, .page-head-actions, .toolbar, .row-actions { display: none !important; }
    .main { margin: 0; }
    .view { padding: 0; }
    .card { box-shadow: none; }
}

/* ------------------------------------------------------------
   Фирменный стиль Пластифабрики: тёплый фон, оранжевый акцент,
   зелёные статусы, мягкие карточки и выразительные иконки
   ------------------------------------------------------------ */
body {
    background:
        radial-gradient(900px 500px at 88% -8%, rgba(102, 218, 181, .18), transparent 65%),
        radial-gradient(700px 420px at 4% 100%, rgba(253, 139, 41, .10), transparent 60%),
        var(--bg);
}

.btn-soft { background: var(--accent-soft); color: var(--accent-ink); border-color: #ffd6b0; }
.btn-soft:hover { background: #ffe6cf; border-color: #ffc38d; }
.btn-icon:hover { color: var(--accent-ink); background: var(--accent-soft); border-color: #ffd6b0; }
.btn-icon-sm { width: 24px; height: 24px; border-radius: 7px; }
.btn-icon-sm .icon { width: 13px; height: 13px; }

.card, .kpi, .summary, .account-card, .goods-card, .help-card {
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}
.card { border-color: #ebe4d7; }
.card-head { border-bottom-color: #f0e9dd; }
.page-title { font-weight: 750; letter-spacing: -.03em; }
.tabs { border-bottom-color: #e9e1d3; }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }

.empty .empty-icon {
    background: linear-gradient(145deg, #fff0e2, #eaf8e6);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px #ffe0c2;
}
.empty .empty-icon .icon { width: 26px; height: 26px; }

.goods-thumb { background: linear-gradient(145deg, #fff0e2, #eaf8e6); }
.goods-thumb .icon { width: 42px; height: 42px; color: #fd8b29; opacity: .85; }
.goods-card { transition: transform .16s, box-shadow .16s, border-color .16s; }
.goods-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #ffd6b0; }

.kanban-col { background: #f7f1e6; border-color: #ebe2d3; border-radius: 16px; }
.kanban-card { border-radius: 12px; }
.kanban-card:hover { border-color: #ffd6b0; }
.kanban-add:hover { border-color: var(--accent); color: var(--accent-ink); background: #fffaf3; }
.task-col-actions { margin-left: auto; display: flex; gap: 2px; }
.kanban-head .task-col-actions { margin-left: 2px; }
.task-title { font-size: 13.5px; }
.task-assignee { font-size: 11px; color: var(--muted); font-weight: 600; }
.kc-date.overdue { color: var(--danger); font-weight: 700; }

.table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.table th.sortable:hover { color: var(--accent-ink); }
.table th.sortable .sort-arrow { margin-left: 5px; font-size: 10px; opacity: .35; }
.table th.sortable.sorted .sort-arrow { opacity: 1; color: var(--accent-ink); }
.table th.sorted { color: var(--accent-ink); }

.summary.income .value { color: #4aa52c; }
.badge.ok { background: var(--ok-soft); color: #3f8a25; }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }

/* ============================================================
   Стиль сайта plastifabrika.ru: светлый фон, оранжевый акцент,
   зелёный второй цвет, шрифты Montserrat (текст) и Comfortaa
   (заголовки), кнопки-«таблетки». Шрифты — локально, без CDN.
   ============================================================ */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/montserrat-400-cyr.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/montserrat-400-lat.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/montserrat-500-cyr.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/montserrat-500-lat.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/montserrat-600-cyr.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/montserrat-600-lat.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700 800; font-display: swap; src: url("/assets/fonts/montserrat-800-cyr.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700 800; font-display: swap; src: url("/assets/fonts/montserrat-800-lat.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Comfortaa"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/comfortaa-700-cyr.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Comfortaa"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/comfortaa-700-lat.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
    --bg: #f5f5f5;
    --bg-soft: #faf9f6;
    --panel: #ffffff;
    --panel-2: #fcfbf8;
    --ink: #131313;
    --ink-2: #3b3b3b;
    --muted: #828282;
    --muted-2: #a8a8a8;
    --line: #eae5db;
    --line-strong: #ddd5c6;
    --accent: #fd8b29;
    --accent-2: #ff9d47;
    --accent-dark: #e8761a;
    --accent-soft: #fff1e4;
    --accent-ink: #c4600c;
    --ok: #62bd3f;
    --ok-soft: #eef8e9;
    --font: "Montserrat", "Segoe UI", "Roboto", Arial, sans-serif;
    --font-head: "Comfortaa", "Montserrat", "Segoe UI", Arial, sans-serif;
    --shadow-sm: 0 1px 2px rgba(19, 19, 19, .04);
    --shadow: 0 16px 36px -26px rgba(19, 19, 19, .35), 0 2px 6px rgba(19, 19, 19, .04);
}

body { background: var(--bg); font-weight: 500; }
a { color: var(--accent-ink); }

/* Заголовки — Comfortaa, как на сайте */
.page-title, .topbar-title, .card-head h3, .modal-head h3, .drawer-head h3, .detail-title,
.login-hero h1, .login-card h2, .help-card h4, .kanban-head .kanban-title {
    font-family: var(--font-head);
    font-weight: 700;
    letter-spacing: -.01em;
}
.page-title { font-size: 26px; color: var(--ink); }

/* Меню — светлое, как шапка сайта */
.sidebar {
    background: #fff;
    color: var(--ink);
    border-right: 1px solid var(--line);
}
.brand { padding: 2px 6px 18px; color: var(--ink); }
.brand-logo { display: block; width: 100%; max-width: 212px; height: auto; }
.brand-sub { color: var(--muted); padding-left: 8px; margin-top: 6px; }
.nav-group-title { color: var(--muted); font-weight: 700; letter-spacing: .08em; }
.nav-item { color: #121212; font-weight: 600; border-radius: 40px; padding: 9px 14px; }
.nav-item .icon { opacity: .7; }
.nav-item:hover { background: #f5f5f5; color: #121212; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; }
.nav-item.active .icon { color: var(--accent); opacity: 1; }
.nav-item .nav-count { background: #f0ece4; color: var(--ink-2); }
.sidebar-footer { color: var(--muted); border-top-color: var(--line); }

.topbar { background: rgba(255, 255, 255, .92); border-bottom-color: var(--line); }

/* Кнопки-«таблетки»: заглавные, разрядка, как на сайте */
.btn { border-radius: 40px; font-weight: 600; border-color: var(--line-strong); padding: 8px 16px; }
.btn:not(.btn-icon):not(.btn-sm) { text-transform: uppercase; font-size: 12px; letter-spacing: .05em; }
.btn-sm { border-radius: 40px; padding: 5px 12px; }
.btn-icon { border-radius: 50%; }
.btn:hover { background: #f5f5f5; border-color: var(--line-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 18px -12px rgba(253, 139, 41, .9); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); border-color: #ffd9b8; }
.btn-soft:hover { background: #ffe7d1; border-color: #ffc896; }
.btn-ghost { border-color: transparent; }

/* Поля ввода — мягкие, с бежевой рамкой */
.input, .select, .textarea { border-color: var(--line); border-radius: 12px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }

/* Карточки и таблицы */
.card, .kpi, .summary, .account-card, .goods-card, .help-card { border-color: var(--line); border-radius: 20px; }
.card-head { border-bottom-color: #f1ede5; }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.kanban-col { background: #faf8f4; border-color: var(--line); }
.summary.income .value, .kpi .up { color: #4fa82e; }

/* Вход */
.login-visual { background: #fff; color: var(--ink); border-right: 1px solid var(--line); }
.login-visual:after { border-color: rgba(253, 139, 41, .14); box-shadow: 0 0 0 70px rgba(253, 139, 41, .04), 0 0 0 140px rgba(98, 189, 63, .04); }
.login-brand .brand-logo { max-width: 260px; }
.login-brand .sub { color: var(--muted); }
.login-hero h1 { color: var(--ink); }
.login-hero h1 .accent { color: var(--accent); }
.login-hero p { color: var(--ink-2); }
.login-feature { color: var(--ink-2); }
.login-feature .icon { color: var(--ok); }
.login-foot { color: var(--muted); }
.login-form-side { background: var(--bg); }
.login-mobile-brand .brand-logo { max-width: 200px; }

/* поле пароля / токена с кнопкой «показать» */
.input-eye { position: relative; }
.input-eye .input { padding-right: 42px; }
.input-eye .eye-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-eye .eye-btn.active { color: var(--accent); }

/* ---------- Моделирование ---------- */
.md-prompt { margin-bottom: 16px; }
.md-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.md-prompt .textarea { min-height: 110px; }
.md-prompt .textarea.md-drop { border-color: var(--accent); background: var(--accent-soft); }
.md-prompt .hint, .md-edit .hint { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.md-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.md-files:empty { display: none; }
.md-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 4px 3px 8px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; }
.md-chip .icon { width: 13px; height: 13px; }
.md-chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 1px; display: inline-flex; border-radius: 5px; }
.md-chip-x:hover { background: rgba(0,0,0,.06); }
.md-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.md-actions-left { display: flex; flex-wrap: wrap; gap: 8px; }
.md-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 4px 0 12px; flex-wrap: wrap; }
.md-bar-left { display: flex; align-items: center; gap: 10px; }
.md-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.md-empty { grid-column: 1 / -1; }
.md-card { background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.md-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.md-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.md-preview { border: 1px solid var(--line); border-radius: 9px; background: #fff; height: 210px; padding: 10px; cursor: zoom-in; display: flex; align-items: center; justify-content: center; }
.md-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.md-fields { display: grid; grid-template-columns: auto 1fr; gap: 6px 8px; align-items: center; font-size: 12px; }
.md-fields label { color: var(--muted); }
.md-fields .req { color: var(--danger); margin-left: 2px; }
.md-fields .md-need { border-color: var(--danger); }
.md-note { display: flex; gap: 6px; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.md-note .icon { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.md-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.md-card-actions .btn { justify-content: center; }
.md-card-links { display: flex; gap: 14px; }
.md-card-links .link-btn { border: 0; background: none; padding: 0; color: var(--accent-ink); font-size: 12px; cursor: pointer; text-decoration: underline; }
.md-zoom { display: flex; justify-content: center; background: #fff; }
.md-zoom img { max-width: 100%; max-height: 70vh; }
.md-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.md-edit { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.md-edit-img { border: 1px solid var(--line); border-radius: 9px; background: #fff; display: flex; align-items: center; justify-content: center; padding: 8px; min-height: 180px; }
.md-edit-img img { max-width: 100%; max-height: 220px; }
@media (max-width: 640px) {
    .md-edit { grid-template-columns: 1fr; }
}
.md-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.md-params { border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: var(--bg-soft); }
.md-params > summary { cursor: pointer; padding: 8px 0; font-weight: 600; font-size: 12.5px; }
.md-params[open] { padding-bottom: 10px; }
.md-params-grid { margin-top: 2px; }
.md-params-grid .input { text-align: right; }
.md-params-group { grid-column: 1 / -1; margin-top: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.md-param-check { grid-column: 1 / -1; font-size: 12px; }
.md-fields label.md-sub { padding-left: 14px; }
.md-params-empty { font-size: 12px; color: var(--muted); padding-bottom: 10px; }
.md-reset { border: 0; background: none; padding: 0; margin-top: 8px; color: var(--accent-ink); font-size: 11.5px; cursor: pointer; text-decoration: underline; }
.md-lock .icon { width: 13px; height: 13px; color: var(--muted); }
.md-job:empty { display: none; }
.md-job { border: 1px solid var(--line); border-radius: 9px; padding: 10px; background: #fff; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.md-job-run { display: flex; align-items: center; gap: 8px; color: var(--accent-ink); font-weight: 600; }
.md-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: md-spin .8s linear infinite; flex: none; }
@keyframes md-spin { to { transform: rotate(360deg); } }
.md-job-err { display: flex; gap: 8px; color: var(--danger); line-height: 1.45; }
.md-job-err .icon, .md-job-stale .icon { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.md-job-stale { display: flex; gap: 6px; color: #b45309; font-size: 12px; }
.md-job-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.md-job-facts div { display: flex; flex-direction: column; gap: 2px; background: var(--bg-soft); border-radius: 7px; padding: 6px 8px; }
.md-job-facts span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.md-job-facts b { font-size: 13px; }
.md-job-note { font-size: 11px; color: var(--muted); }
.md-job-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.md-job-actions .btn { justify-content: center; }
.md-viewer { position: relative; height: min(62vh, 560px); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f7f7f9; }
.md-viewer canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.md-viewer canvas:active { cursor: grabbing; }
.md-viewer-hint { position: absolute; left: 10px; bottom: 8px; font-size: 11px; color: var(--muted); background: rgba(255,255,255,.8); padding: 2px 6px; border-radius: 5px; }
.md-attach { display: flex; flex-direction: column; gap: 10px; }
.md-attach-filters { display: grid; grid-template-columns: 1fr 200px; gap: 8px; }
.md-orders { max-height: 46vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.md-order { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font: inherit; color: inherit; }
.md-order:hover { border-color: var(--accent); }
.md-order.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.md-order-main { font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.md-order-sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.md-order-sum { margin-left: auto; color: var(--ink, #222); font-weight: 600; }
.md-attach-qty { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.md-attach-qty .input { width: 110px; }
@media (max-width: 640px) {
    .md-attach-filters { grid-template-columns: 1fr; }
    .md-job-facts { grid-template-columns: 1fr 1fr; }
}
.md-job-actions { display: flex; flex-wrap: wrap; }
.md-job-actions .btn { flex: 1 1 calc(50% - 6px); min-width: 0; white-space: nowrap; padding-left: 6px; padding-right: 6px; }
.md-job-facts span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-tools { display: flex; flex-direction: column; gap: 6px; }
.md-tool { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.md-tool > b { min-width: 130px; }
.md-tool code { font-size: 11px; background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; word-break: break-all; }

/* ---------- Поиск по хранилищу ---------- */
.search-group { margin-bottom: 18px; }
.search-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.search-hits { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.search-hit { display: flex; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 11px; cursor: pointer; font: inherit; color: inherit; min-width: 0; }
.search-hit:hover { border-color: var(--accent); }
.search-hit .icon { width: 16px; height: 16px; flex: none; color: var(--muted); }
.search-hit-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.search-hit .count { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.search-hit .count .icon { width: 13px; height: 13px; }
.file-place { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; margin: 2px 0; color: var(--accent-ink); font-size: 11.5px; cursor: pointer; text-align: left; max-width: 100%; }
.file-place .icon { width: 12px; height: 12px; flex: none; }
.file-place:hover { text-decoration: underline; }
.search-hit-text { display: flex; flex-direction: column; min-width: 0; }
.search-hit-owner { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone[hidden] { display: none; }
.goods-media-two { grid-template-columns: 190px 1fr; align-items: start; }
.goods-media-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.goods-media-label { font-size: 12px; color: var(--muted); }
.goods-media-model canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.goods-media-model.has-model > .icon { display: none; }
.goods-media-model.has-model span { position: absolute; bottom: 6px; }
.goods-model-list { display: flex; flex-wrap: wrap; gap: 6px; }
.goods-model-list:empty { display: none; }
.goods-model-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 4px 3px 8px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; max-width: 100%; }
.goods-model-chip .icon { width: 13px; height: 13px; flex: none; }
.goods-model-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 1px; display: inline-flex; }
@media (max-width: 640px) { .goods-media-two { grid-template-columns: 1fr; } }
.md-card-top-right { display: inline-flex; align-items: center; gap: 6px; }
.md-fold { width: 28px; height: 28px; }
.md-summary { display: none; }
.md-card.collapsed .md-fields,
.md-card.collapsed .md-note,
.md-card.collapsed .md-params,
.md-card.collapsed .md-card-links { display: none; }
.md-card.collapsed .md-summary { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 1px solid var(--line); background: var(--bg-soft); border-radius: 9px; padding: 8px 34px 8px 10px; cursor: pointer; position: relative; font: inherit; color: inherit; }
.md-card.collapsed .md-summary b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-card.collapsed .md-summary span { font-size: 11.5px; color: var(--muted); }
.md-card.collapsed .md-summary .icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.md-card.collapsed .md-preview { height: 150px; }

/* Моделирование: тип изделий для ИИ и колпачки */
.md-target { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; font-size: 12.5px; }
.md-target > label, .md-target-top > label { font-weight: 600; }
.md-target .select { width: auto; min-width: 200px; }
.md-target-top { display: inline-flex; align-items: center; gap: 8px; }
.md-target .hint { flex-basis: 100%; margin: 0; }
.md-param-hint { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; }
.md-cap-info, .md-cap-warn { display: flex; gap: 6px; align-items: flex-start; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.md-cap-info svg, .md-cap-warn svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.md-cap-warn, .md-cap-warn-inline { color: var(--warn, #b45309); }
.md-cap-src { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }
.md-cap-label { margin-top: 10px; font-size: 12px; }
.md-cap-script { font-size: 11.5px; min-height: 90px; white-space: pre; overflow: auto; }
.md-zoom-src { margin-top: 12px; text-align: center; }
.md-zoom-src img { max-height: 260px; }
.md-job-notes { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.md-job-notes li { display: flex; gap: 6px; align-items: flex-start; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.md-job-notes li svg { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.md-job-notes li.warn { color: var(--warn, #b45309); background: color-mix(in srgb, var(--warn, #b45309) 9%, transparent); border-radius: 6px; padding: 5px 7px; font-weight: 500; }

/* Оборудование: статус меняется прямо в таблице */
.eq-status { width: auto; min-width: 150px; height: 30px; padding: 0 28px 0 10px; font-size: 12.5px; font-weight: 600; border-radius: 999px; }
.eq-status-ok { color: var(--ok, #15803d); background-color: color-mix(in srgb, var(--ok, #15803d) 10%, transparent); }
.eq-status-warn { color: var(--warn, #b45309); background-color: color-mix(in srgb, var(--warn, #b45309) 10%, transparent); }
.eq-status-danger { color: var(--danger, #dc2626); background-color: color-mix(in srgb, var(--danger, #dc2626) 10%, transparent); }
.eq-status-muted { color: var(--muted, #64748b); background-color: color-mix(in srgb, var(--muted, #64748b) 10%, transparent); }
.md-thread-table { font-size: 12px; margin-top: 4px; }
.md-thread-table td, .md-thread-table th { padding: 4px 8px; }
.md-cap-src-label { font-weight: 600; font-size: 12px; }

.md-target-top[hidden] { display: none; }

.folder-item.tree-child { padding-left: calc(9px + var(--tree-indent, 18px)); }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-arrow { color: var(--muted); width: 12px; flex: 0 0 auto; text-align: center; }
.goods-folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.goods-folder-grid .search-hit { min-width: 0; }
.goods-folder-grid .search-hit-name { min-width: 0; overflow-wrap: anywhere; }

/* Nested storage folders: expansion is separate from selecting a directory. */
.folder-tree-list { list-style: none; margin: 0; padding: 0; }
.folder-tree-list .folder-tree-list { margin-left: 14px; padding-left: 3px; border-left: 1px solid var(--line); }
.folder-tree-row { display: flex; align-items: center; min-width: 0; border-radius: 8px; }
.folder-tree-row.active { background: var(--accent-soft); color: var(--accent-ink); }
.folder-tree-row .folder-item { flex: 1; min-width: 0; width: auto; padding-left: 4px; }
.folder-tree-row.active .folder-item { color: var(--accent-ink); font-weight: 600; }
.folder-tree-row.active .folder-item .icon { color: var(--accent); }
.tree-toggle, .tree-toggle-placeholder { width: 24px; flex: 0 0 24px; }
.tree-toggle { display: inline-flex; align-items: center; justify-content: center; align-self: stretch; min-height: 30px; border: 0; border-radius: 6px; padding: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.tree-toggle:hover { background: var(--bg-soft); color: var(--accent-ink); }
.tree-toggle:focus-visible, .folder-tree-row .folder-item:focus-visible, .files-breadcrumbs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.folder-tree-divider { height: 1px; margin: 6px 4px; background: var(--line); }
.files-breadcrumbs { overflow-wrap: anywhere; }
.files-breadcrumbs button { border: 0; padding: 2px 0; background: transparent; font: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.files-breadcrumbs button:hover { text-decoration: underline; }
.folder-chip { max-width: 100%; overflow-wrap: anywhere; }
.folder-back { border-style: dashed; }
#files-new-folder[hidden], #files-upload[hidden] { display: none; }

