:root {
    --bg: #f3f5fa;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --border: #e6eaf2;
    --text: #1d2533;
    --muted: #71798a;
    --brand: #3b6ef0;
    --brand-dark: #2b54c0;
    --sidebar: #131a2b;
    --sidebar-2: #1c2740;
    --sidebar-text: #c4ccdc;
    --green: #1f9d57;
    --red: #e03b3b;
    --orange: #ef8a17;
    --navy: #2b3a55;
    --blue: #3b6ef0;
    --light: #eef3fd;
    --grey: #71798a;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(20,30,60,.06), 0 4px 16px rgba(20,30,60,.06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", "Inter", system-ui, -apple-system, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 26px 0 12px; color: var(--text); }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--brand-dark); }

/* ===== Каркас: боковое меню + контент ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px;
    font-size: 20px; font-weight: 700; color: #fff;
    border-bottom: 1px solid var(--sidebar-2);
}
.sidebar .brand .logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, #3b6ef0, #6f9bff); display: inline-block; }
.sidebar .nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar .nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6b7690; padding: 14px 12px 6px; }
.sidebar .nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 9px;
    color: var(--sidebar-text); font-size: 14px; text-decoration: none;
}
.sidebar .nav a .ic { width: 20px; text-align: center; font-size: 15px; opacity: .9; }
.sidebar .nav a:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.sidebar .nav a.active { background: var(--brand); color: #fff; }

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

.topbar {
    height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 5;
}
.header-search { flex: 1; max-width: 460px; margin: 0; }
.header-search input {
    width: 100%; padding: 9px 14px; border: 1px solid var(--border); border-radius: 20px;
    background: var(--surface-2); font-size: 13px;
}
.header-search input:focus { outline: none; border-color: var(--brand); background: #fff; }
.topbar .spacer { flex: 1; }
.user-box { display: flex; align-items: center; gap: 14px; }
.user-name { font-weight: 600; color: var(--text); }
a.user-name:hover { color: var(--brand); }
.user-role { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 1px 9px; }
.logout-form { margin: 0; }
.btn-link { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.btn-link:hover { color: var(--brand); text-decoration: underline; }

.page, .app-main { padding: 26px 30px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ===== Кнопки ===== */
.btn-primary {
    background: var(--brand); color: #fff; border: none; border-radius: 9px;
    padding: 9px 18px; font-size: 14px; cursor: pointer; font-weight: 500;
    transition: background .15s;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-small {
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
    border-radius: 7px; padding: 5px 11px; font-size: 12.5px; cursor: pointer;
}
.btn-small:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: #fff; border-color: #f3c6c6; color: var(--red); }
.btn-danger:hover { background: #fdecec; border-color: var(--red); color: var(--red); }
.btn-link-dark { align-self: center; color: var(--muted); font-size: 13px; }
.btn-link-dark:hover { color: var(--brand); }

input, select, textarea {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,110,240,.12); }

/* ===== Карточки и таблицы ===== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.soon { font-size: 11px; color: #fff; background: var(--muted); border-radius: 8px; padding: 1px 8px; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 22px; }
.data-table th, .data-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table thead th { background: var(--surface-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }

.lead { font-size: 15px; color: var(--muted); }
.muted { color: var(--muted); }

/* ===== Формы ===== */
.form-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; background: var(--surface); padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-inline label, .login-form label, .task-form label, .filter-bar label { display: flex; flex-direction: column; font-size: 12.5px; gap: 5px; color: var(--muted); }
.form-inline input, .form-inline select { color: var(--text); }

/* ===== Алерты ===== */
.alert-error { background: #fdecec; color: var(--red); border: 1px solid #f5c6c2; border-radius: 9px; padding: 11px 14px; margin-bottom: 14px; }
.alert-ok { background: #e9f7ef; color: var(--green); border: 1px solid #bfe6cf; border-radius: 9px; padding: 11px 14px; margin-bottom: 14px; }

/* ===== Дашборд ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 18px 0 8px; }
.stat { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.stat:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); transition: .15s; }
.stat .stat-ic { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: var(--light); }
.stat-num { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-lbl { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stat-warn .stat-ic { background: #fdecec; } .stat-warn .stat-num { color: var(--red); }
.stat-accent .stat-ic { background: #e9f0ff; } .stat-accent .stat-num { color: var(--brand); }

/* ===== Бейджи статусов / приоритеты ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; color: #fff; }
.st-new { background: #64748b; }
.st-progress { background: var(--brand); }
.st-hold { background: var(--orange); }
.st-done { background: var(--green); }
.st-cancel { background: #9aa3b2; }
.pr-high { color: var(--red); font-weight: 600; }
.pr-low { color: var(--muted); }
.pr-normal { color: var(--text); }

/* ===== Файлы ===== */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.search-bar input { flex: 1; max-width: 420px; }
.breadcrumbs { margin: 6px 0 16px; font-size: 14px; color: var(--muted); }
.breadcrumbs .sep { color: #c2c8d4; margin: 0 7px; }
.folder-list { list-style: none; padding: 0; margin: 0 0 16px; }
.folder-list li { padding: 5px 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form input[type=file] { font-size: 12px; max-width: 180px; }
.lock { margin-left: 6px; }
.spacer { flex: 1; }

/* ===== Задачи ===== */
.filter-bar { display: flex; gap: 14px; align-items: end; margin-bottom: 16px; flex-wrap: wrap; }
.task-form { display: flex; flex-direction: column; gap: 12px; background: var(--surface); padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); max-width: 820px; }
.task-form textarea, .comment-form textarea { width: 100%; }
.task-form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.task-form-row label { flex: 1; min-width: 150px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 10px 0 14px; font-size: 14px; color: var(--muted); }
.task-desc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; white-space: pre-wrap; margin-bottom: 18px; box-shadow: var(--shadow); }
.task-actions { display: flex; gap: 24px; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 20px; }
.task-actions label { display: flex; flex-direction: column; font-size: 12.5px; gap: 5px; }

/* Канбан */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.kanban-head { color: #fff; border-radius: 8px; padding: 7px 12px; font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; }
.kanban-head .cnt { background: rgba(255,255,255,.3); border-radius: 10px; padding: 0 8px; }
.kanban-body { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; min-height: 30px; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; box-shadow: var(--shadow); cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-col.drop-target { outline: 2px dashed var(--brand); outline-offset: -2px; background: var(--light); }
.card-title { display: block; font-weight: 600; margin-bottom: 5px; }
.card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.card-move { display: flex; gap: 5px; }
.card-move select { flex: 1; font-size: 12px; padding: 4px; }

/* Метки / чек-лист / вложения / комментарии */
.labels-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.lbl { color: #fff; border-radius: 20px; padding: 2px 8px 2px 11px; font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.lbl-x { display: inline; margin: 0; }
.lbl-x button { background: none; border: none; color: #fff; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.label-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); }
.checklist { list-style: none; padding: 0; margin: 0 0 10px; }
.checklist li { display: flex; align-items: center; gap: 9px; padding: 4px 0; }
.check-toggle { background: none; border: none; font-size: 18px; cursor: pointer; padding: 0; line-height: 1; }
.checklist .done { text-decoration: line-through; color: var(--muted); }
.attach-list, .note-list, .srch { list-style: none; padding: 0; margin: 0 0 12px; }
.attach-list li { padding: 4px 0; }
.comment-list { list-style: none; padding: 0; margin: 0 0 16px; }
.comment-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.comment-head { font-size: 13px; margin-bottom: 4px; }
.comment-text { white-space: pre-wrap; }
.comment-form { display: flex; flex-direction: column; gap: 8px; max-width: 760px; }

/* Уведомления */
.bell { position: relative; font-size: 19px; text-decoration: none; }
.bell:hover { text-decoration: none; }
.bell-badge { position: absolute; top: -7px; right: -10px; background: var(--red); color: #fff; font-size: 11px; border-radius: 9px; padding: 0 5px; font-weight: 600; }
.note-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 12px; box-shadow: var(--shadow); }
.note-list li.unread { border-left: 4px solid var(--brand); font-weight: 600; }
.note-list li.read { opacity: .65; }
.note-time { font-weight: normal; white-space: nowrap; color: var(--muted); }
.srch li { padding: 8px 0; border-bottom: 1px solid var(--border); }

/* ===== Логин ===== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #131a2b, #2b54c0); }
.login-card { background: #fff; border-radius: 16px; padding: 36px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card h1 { margin: 0 0 4px; font-size: 23px; }
.login-card .subtitle { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form input { padding: 10px 12px; }
.login-form .btn-primary { margin-top: 6px; }

/* ===== Адаптив ===== */
/* ===== Командная палитра ===== */
.cmdk-overlay { position: fixed; inset: 0; background: rgba(10,15,25,.45); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 100; }
.cmdk { width: 560px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,.35); overflow: hidden; }
.cmdk-input { width: 100%; border: none; border-bottom: 1px solid var(--border); padding: 16px 18px; font-size: 16px; border-radius: 0; }
.cmdk-input:focus { outline: none; box-shadow: none; }
.cmdk-list { max-height: 50vh; overflow-y: auto; }
.cmdk-item { padding: 11px 18px; cursor: pointer; }
.cmdk-item.sel, .cmdk-item:hover { background: var(--light); }

/* ===== Автодополнение в шапке ===== */
.ac-box { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); z-index: 50; overflow: hidden; }
.ac-item { display: block; padding: 9px 14px; color: var(--text); }
.ac-item:hover { background: var(--light); text-decoration: none; }

/* ===== Сортировка колонок ===== */
.data-table thead th a { color: inherit; }
.data-table thead th a:hover { color: var(--brand); }
.sort-ind { opacity: .6; font-size: 11px; }

/* ===== Календарь ===== */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 0; font-weight: 600; }
.cal-cell { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-height: 90px; padding: 6px; }
.cal-cell.other { background: var(--surface-2); opacity: .6; }
.cal-cell.today { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(59,110,240,.15); }
.cal-day { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.cal-task { display: block; font-size: 12px; padding: 2px 5px; border-radius: 5px; margin-bottom: 3px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-nav { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }

/* ===== Тёмная тема ===== */
html[data-theme="dark"] {
    --bg: #0f1420;
    --surface: #171d2b;
    --surface-2: #1e2638;
    --border: #2a3346;
    --text: #e6eaf2;
    --muted: #9aa6bd;
    --light: #1e2940;
    --navy: #cdd6e6;
}
html[data-theme="dark"] body { color: var(--text); }
html[data-theme="dark"] .data-table thead th { color: var(--muted); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: var(--surface-2); color: var(--text); }
html[data-theme="dark"] .login-card { background: #171d2b; }
html[data-theme="dark"] .header-search input { background: var(--surface-2); color: var(--text); }

/* ===== Аватары ===== */
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.theme-toggle { background: none; border: none; cursor: pointer; font-size: 17px; padding: 0; color: var(--muted); }
.theme-toggle:hover { color: var(--brand); }

@media (max-width: 860px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: column; }
    .sidebar .nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar .nav-group { display: none; }
    .kanban { grid-template-columns: 1fr 1fr; }
    .page, .app-main { padding: 18px 16px; }
    .header-search { max-width: none; }
}

/* ===== Телефоны (узкие экраны) ===== */
@media (max-width: 640px) {
    .page, .app-main { padding: 14px 12px; }
    h1 { font-size: 22px; }
    h2 { font-size: 18px; }

    /* Шапка: переносим элементы, поиск на всю ширину, прячем длинные подписи */
    .topbar { flex-wrap: wrap; gap: 8px; }
    .header-search { order: 3; flex-basis: 100%; }
    .user-name, .user-role { display: none; }

    /* Сайдбар-меню — горизонтальная прокрутка иконок */
    .sidebar .nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .sidebar .nav a { white-space: nowrap; }

    /* Таблицы — горизонтальная прокрутка вместо разъезжания */
    .data-table { display: block; overflow-x: auto; white-space: nowrap; }

    /* Доска — одна колонка */
    .kanban { grid-template-columns: 1fr; }

    /* Формы в строку — складываем в столбец */
    .task-form-row { flex-direction: column; align-items: stretch; }
    .filter-bar { flex-wrap: wrap; }
    .filter-bar select, .filter-bar input, .task-form input, .task-form select, .task-form textarea { width: 100%; box-sizing: border-box; }

    /* Меню действий папки — раскрывается снизу, не уезжает за экран */
    .folder-row { width: auto; display: flex; justify-content: space-between; }
    .folder-menu-wrap { position: static; }
    .folder-popup { position: static; left: auto; top: auto; min-width: 0; margin-top: 6px; width: 100%; }

    /* Крупнее тап-таргеты */
    .btn-small, .menu-link { padding: 8px 12px; }
}

/* ---- Папки: компактный список; действия — во всплывающем меню справа ---- */
.folder-list { display: flex; flex-direction: column; gap: 2px; list-style: none; padding: 0; margin: 0 0 12px; }
.folder-row { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 8px; width: fit-content; }
.folder-row:hover { background: var(--light); }
.folder-name { font-weight: 500; }
.folder-name a { text-decoration: none; color: var(--text); }
.folder-name a:hover { color: var(--brand); }
.ficon { border: none; background: transparent; cursor: pointer; font-size: 17px; line-height: 1; width: 28px; height: 28px; border-radius: 7px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.ficon:hover { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

/* Всплывающее меню действий — выезжает СПРАВА от кнопки */
.folder-menu-wrap { position: relative; display: inline-flex; }
.folder-popup { position: absolute; left: calc(100% + 8px); top: -6px; z-index: 50; min-width: 250px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
    padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.folder-popup[hidden] { display: none; }  /* иначе display:flex перекрывает атрибут hidden */
.popup-form { display: flex; gap: 6px; align-items: center; }
.popup-form .rename-input { flex: 1; min-width: 0; }
.popup-form .btn-small { white-space: nowrap; }
.rename-input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.menu-link { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.menu-link:hover { background: var(--light); }
.menu-link.danger { color: var(--red); border-color: var(--red); }
.menu-link.danger:hover { background: #fde8e8; }

.section-head { display: flex; align-items: center; gap: 8px; }
.section-head h2 { margin: 0; }

/* Зона перетаскивания файла */
.dropzone { border: 2px dashed var(--border); border-radius: 10px; padding: 14px 18px; text-align: center; color: var(--muted); cursor: pointer; font-size: 14px; transition: all .15s; }
.dropzone:hover { border-color: var(--brand); color: var(--brand); }
.dropzone.drag { border-color: var(--brand); background: var(--light); color: var(--brand); }
.dropzone.has-file { border-style: solid; border-color: var(--green); color: var(--text); }

/* Простые горизонтальные диаграммы (отчёты) */
.chart { display: flex; flex-direction: column; gap: 8px; max-width: 720px; margin-bottom: 22px; }
.chart-row { display: flex; align-items: center; gap: 10px; }
.chart-lbl { width: 150px; flex-shrink: 0; font-size: 13px; text-align: right; color: var(--muted); }
.chart-track { flex: 1; background: var(--surface-2); border-radius: 6px; height: 18px; overflow: hidden; }
.chart-bar { display: block; height: 100%; border-radius: 6px; min-width: 2px; background: var(--brand); }
.chart-bar.st-new { background: var(--muted); }
.chart-bar.st-progress { background: var(--brand); }
.chart-bar.st-hold { background: var(--orange); }
.chart-bar.st-done { background: var(--green); }
.chart-bar.st-cancel { background: var(--red); }
.chart-val { width: 130px; flex-shrink: 0; font-size: 13px; font-weight: 600; }

/* Проекты: участники, файлы, объявления */
.chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 8px 0 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2, #f1f3f5); border: 1px solid var(--border, #dee2e6); border-radius: 16px; padding: 4px 12px; font-size: 13px; }
.chip-x { background: none; border: none; color: var(--red, #c92a2a); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 0 0 2px; }
.chip-x:hover { font-weight: 700; }
.file-list { list-style: none; padding: 0; margin: 8px 0 14px; }
.file-list li { padding: 5px 0; border-bottom: 1px solid var(--border, #eee); }
.ann-card { border: 1px solid var(--border, #dee2e6); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.ann-card > div:last-child { white-space: pre-wrap; margin-top: 4px; }
.nav-sub { font-size: 13px; padding-top: 4px !important; padding-bottom: 4px !important; opacity: .85; }
.nav-sub .ic { color: var(--orange, #e8a33d); }
.nav-sub:hover { opacity: 1; }
.activity-feed { list-style: none; padding: 0; margin: 8px 0; }
.activity-feed li { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border, #eee); }
.activity-feed .act-ic { width: 20px; flex-shrink: 0; }
.activity-feed .act-text { flex: 1; }
.activity-feed .act-when { flex-shrink: 0; font-size: 12px; }

/* ===== Производство: лист явки и выработка ===== */
.sh-missing td { background: color-mix(in srgb, var(--red) 9%, transparent); }
.sh-missing .sh-name { color: var(--red); font-weight: 600; }
.sh-sub td { background: color-mix(in srgb, var(--orange) 10%, transparent); }
.sh-role { font-size: 12px; color: var(--muted); }
.sh-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sh-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.sh-head h1 { margin: 0; }
.sh-num { font-variant-numeric: tabular-nums; text-align: right; }


/* ===== Терминал бригадира (настенный экран в цехе) ===== */
.term { font-size: 20px; padding: 18px; max-width: 1100px; margin: 0 auto; }
.term-top { display: flex; justify-content: space-between; align-items: center; gap: 16px;
            border-bottom: 2px solid var(--border); padding-bottom: 12px; margin-bottom: 18px; }
.term-date { font-size: 26px; font-weight: 600; }
.term-brig { color: var(--muted); }
.term-q { padding: 8px 16px; border-radius: 20px; font-size: 17px; background: var(--surface); border: 1px solid var(--border); }
.term-q.ok { color: var(--green); }
.term-q.warn { color: var(--red); font-weight: 600; }
.term-step { margin-bottom: 18px; }
.term-lbl { font-size: 17px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.term-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.term-grid-wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); max-height: 320px; overflow-y: auto; }
.term-btn { min-height: 74px; font-size: 20px; padding: 10px 12px; border-radius: 12px;
            border: 2px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
            display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.term-btn:active { transform: scale(.98); }
.term-btn.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); font-weight: 600; }
.term-sub { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; }
.term-count { display: flex; gap: 10px; align-items: stretch; }
.term-pm { min-width: 78px; min-height: 74px; font-size: 24px; border-radius: 12px;
           border: 2px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.term-count input { flex: 1; font-size: 40px; text-align: center; border: 2px solid var(--border);
                    border-radius: 12px; background: var(--surface); color: var(--text); }
.term-send { width: 100%; min-height: 86px; font-size: 26px; font-weight: 600; border: 0; border-radius: 14px;
             background: var(--brand); color: #fff; cursor: pointer; margin-top: 6px; }
.term-send:disabled { background: var(--grey); cursor: default; }
.term-msg { min-height: 30px; font-size: 19px; margin-top: 10px; }
.term-msg.ok { color: var(--green); }
.term-msg.err { color: var(--red); }
.term-log { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 14px; }
.term-log ul { list-style: none; padding: 0; margin: 0; font-size: 17px; color: var(--muted); }
.term-log li { padding: 5px 0; border-bottom: 1px solid var(--border); }
.term-empty { text-align: center; padding: 80px 20px; }
.term-big { font-size: 34px; font-weight: 600; margin-bottom: 12px; }

.term-switch { margin-left: 12px; font-size: 16px; }
