/* DRONOSFERA Service Management v16 — профессиональный UI */
:root {
    --orange: #f97316;
    --orange-dark: #ea580c;
    --orange-soft: #fff7ed;
    --navy: #0f1f36;
    --navy-dark: #08111f;
    --navy-mid: #14283f;
    --sky: #0ea5e9;
    --green: #10b981;
    --teal: #0f766e;
    --purple: #7c3aed;
    --red: #dc2626;
    --amber: #f59e0b;
    --bg: #eef2f7;
    --bg-soft: #f5f7fa;
    --bg-card: #ffffff;
    --text: #0f172a;
    --text-2: #334155;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --border: #e4e8ef;
    --border-strong: #d0d7e2;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --sidebar-w: 250px;
    --topbar-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 13.5px;
    line-height: 1.45;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--orange); }
code { background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; font-size: 12px; font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; }
pre.code-block { background: #0f172a; color: #cbd5e1; padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.55; }
h1, h2, h3, h4 { margin: 0 0 6px; color: var(--navy); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.muted { color: var(--text-muted); }
.text-danger { color: var(--red); }
hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

/* ============ APP SHELL ============ */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
    color: #e2e8f0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column;
    border-right: 1px solid rgba(0,0,0,.15);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

.sidebar-brand {
    display: flex; align-items: center; justify-content: center;
    padding: 18px 16px; margin: 12px 12px;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
    text-decoration: none;
    transition: transform 0.15s;
}
.sidebar-brand:hover { transform: translateY(-1px); }
.sidebar-logo { max-width: 100%; height: 46px; width: auto; display: block; }

.sidebar-nav { flex: 1; padding: 4px 8px 16px; }
.nav-group { padding: 8px 4px 4px; }
.nav-group-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 5px 10px; cursor: pointer; user-select: none;
    color: rgba(255,255,255,.45); transition: color 0.12s;
}
.nav-group-header:hover { color: rgba(255,255,255,.75); }
.nav-group-label { text-transform: uppercase; letter-spacing: 0.8px; font-size: 10px; font-weight: 700; }
.nav-group-chevron { transition: transform 0.15s; opacity: 0.55; }
.nav-group.is-collapsed .nav-group-chevron { transform: rotate(-90deg); }
.nav-group.is-collapsed .nav-list { display: none; }
.nav-list { list-style: none; padding: 0; margin: 2px 0 0; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px; border-radius: 7px;
    color: rgba(255,255,255,.75); margin-bottom: 1px; font-size: 13px;
    transition: all 0.1s; text-decoration: none; line-height: 1.3;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item--active {
    background: linear-gradient(90deg, rgba(249,115,22,.20), rgba(249,115,22,.06));
    color: white; box-shadow: inset 2px 0 0 var(--orange);
}
.nav-icon { width: 16px; flex-shrink: 0; font-size: 13px; opacity: 0.95; }
.nav-label { font-weight: 500; }

/* ============ TOPBAR ============ */
.app-main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; height: var(--topbar-h); flex-shrink: 0;
    background: white; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 17px; margin: 0; color: var(--navy); font-weight: 600; letter-spacing: -0.01em; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-version { font-size: 10.5px; color: var(--text-faint); font-family: ui-monospace, monospace; padding: 2px 6px; background: var(--bg-soft); border-radius: 4px; }
.sidebar-toggle { display: none; background: var(--bg-soft); border: 1px solid var(--border); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 16px; color: var(--navy); }

.user-menu { position: relative; }
.user-chip {
    display: flex; align-items: center; gap: 9px;
    padding: 5px 10px 5px 5px; background: var(--bg-soft);
    border: 1px solid var(--border); border-radius: 999px;
    cursor: pointer; transition: all 0.12s;
}
.user-chip:hover { border-color: var(--orange); background: var(--orange-soft); }
.user-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--orange), var(--orange-dark));
    color: white; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}
.user-info { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--navy); }
.user-role { font-size: 10.5px; color: var(--text-muted); }
.user-caret { font-size: 10px; color: var(--text-muted); margin-left: 2px; }
.user-menu.is-open .user-chip { border-color: var(--orange); }
.user-dropdown {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px;
    background: white; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 100;
}
.user-dropdown-email { padding: 6px 10px; font-size: 11.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; word-break: break-all; }
.user-dropdown a { display: block; padding: 8px 12px; border-radius: 7px; color: var(--text); font-size: 13px; }
.user-dropdown a:hover { background: var(--bg-soft); color: var(--orange); }

.app-content { padding: 18px 22px; flex: 1; }
.app-footer { display: none; }

/* ============ FLASHES ============ */
.flash-stack { padding: 12px 22px 0; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); font-weight: 500; font-size: 13px; }
.flash--success { background: #ecfdf5; border-color: #6ee7b7; color: #065f46; }
.flash--info    { background: #eff6ff; border-color: #93c5fd; color: #1e3a8a; }
.flash--warning { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.flash--danger  { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }

/* ============ CARDS ============ */
.card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; box-shadow: var(--shadow-sm); margin-bottom: 14px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 12px; }
.card-header h2, .card-header h3 { margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.section-title { font-size: 11.5px; color: var(--text-muted); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }
.link { color: var(--orange); font-weight: 500; font-size: 12.5px; }
.link:hover { color: var(--orange-dark); }

/* ============ KPI ============ */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi-card {
    display: block; background: white; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 14px; text-decoration: none; color: var(--text);
    transition: all 0.15s; box-shadow: var(--shadow-sm); min-width: 0;
}
.kpi-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.kpi-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 24px; font-weight: 700; color: var(--navy); margin: 4px 0 2px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi-value--compact { font-size: 18px; }
.kpi-value-sm { font-size: 12.5px; font-weight: 600; margin: 6px 0 2px; }
.kpi-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-card--primary { border-color: rgba(249,115,22,.4); }
.kpi-card--primary .kpi-value { color: var(--orange-dark); }
.kpi-card--ok { border-color: rgba(16,185,129,.35); }
.kpi-card--ok .kpi-value { color: var(--green); }
.kpi-card--warn { border-color: var(--amber); background: #fffdf5; }
.kpi-card--warn .kpi-value { color: #92400e; }
.kpi-card--danger { border-color: var(--red); background: #fff5f5; }
.kpi-card--danger .kpi-value { color: var(--red); }

/* ============ LAYOUT ============ */
.dashboard-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card--span-2 { grid-column: span 2; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1200px) { .dashboard-row { grid-template-columns: repeat(2, 1fr); } .card--span-2 { grid-column: span 2; } }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .dashboard-row { grid-template-columns: 1fr; } .card--span-2 { grid-column: span 1; } }

/* ============ TABLES ============ */
.app-content > .card { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 600px; }
.data-table thead th { background: var(--bg-soft); color: var(--text-muted); font-weight: 600; text-align: left; padding: 8px 10px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tbody td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg-soft); }
.data-table--sm tbody td { padding: 6px 8px; font-size: 12px; }
.data-table .row-active { background: var(--orange-soft) !important; }
.data-table .row-warn { background: #fffbeb; }

/* ============ BADGES ============ */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; background: #e2e8f0; color: var(--navy); line-height: 1.5; }
.badge--ok     { background: #d1fae5; color: #065f46; }
.badge--info   { background: #dbeafe; color: #1e3a8a; }
.badge--warn   { background: #fef3c7; color: #92400e; }
.badge--danger { background: #fee2e2; color: #991b1b; }
.badge--muted  { background: #e2e8f0; color: var(--text-muted); }
.badge--xs     { padding: 1px 6px; font-size: 9.5px; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 7px;
    border: 1px solid var(--border-strong); background: white; color: var(--text);
    cursor: pointer; font-weight: 500; font-size: 13px;
    text-decoration: none; transition: all 0.12s;
    line-height: 1.4;
}
.btn:hover { border-color: var(--orange); color: var(--orange); }
.btn-primary { background: linear-gradient(135deg, var(--orange), var(--orange-dark)); color: white; border: 1px solid transparent; font-weight: 600; }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(249,115,22,.35); transform: translateY(-1px); color: white; border-color: transparent; }
.btn-ghost { background: white; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn-link { background: none; border: none; color: var(--navy); cursor: pointer; font-size: 13px; padding: 3px 6px; }
.btn-link:hover { color: var(--orange); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ============ TABS ============ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 14px; color: var(--text-muted); border-bottom: 2px solid transparent; font-weight: 500; font-size: 13px; transition: all 0.12s; }
.tab:hover { color: var(--navy); }
.tab--active { color: var(--orange); border-bottom-color: var(--orange); }

/* ============ TOOLBAR ============ */
.page-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.page-toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-row input, .filter-row select { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 7px; background: white; font-size: 12.5px; min-height: 32px; }
.filter-row input[type=search] { min-width: 220px; }
.filter-row .btn { padding: 6px 12px; min-height: 32px; }

/* Новый layout: action row + filter bar в одну строку */
.page-action-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.tabs--inline { border-bottom: 0; }
.tabs--inline .tab {
    padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
    background: white; color: var(--text-muted); font-weight: 500;
}
.tabs--inline .tab:hover { color: var(--navy); border-color: var(--border-strong); }
.tabs--inline .tab--active {
    background: var(--orange-soft); border-color: var(--orange); color: var(--orange-dark);
    border-bottom-color: var(--orange);
}

.filter-bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
    background: white; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px 10px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
    overflow-x: auto;
}
.filter-bar input, .filter-bar select {
    padding: 7px 11px; border: 1px solid var(--border-strong); border-radius: 7px;
    background: white; font-size: 13px; min-height: 34px; min-width: 0; flex-shrink: 0;
}
.filter-bar input[type=search] { flex: 1; min-width: 260px; max-width: 420px; }
.filter-bar select { min-width: 130px; }
.filter-bar .btn { min-height: 34px; flex-shrink: 0; }

/* Card на полный экран без отступов внутри */
.card--flat {
    padding: 0; overflow: hidden;
}
.card--flat .data-table { min-width: 100%; }

/* Кликабельные строки таблицы */
.data-table--clickable tbody tr { cursor: pointer; transition: background 0.1s; }
.data-table--clickable tbody tr:hover { background: var(--orange-soft); }

/* ============ FORMS ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-grid label, .login-form label, label.form-field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.form-grid input, .form-grid select, .form-grid textarea,
.login-form input, label.form-field input,
form input[type=text], form input[type=password], form input[type=email],
form input[type=number], form input[type=date], form input[type=datetime-local],
form input[type=search], form input[type=file], form input[type=url],
form select, form textarea {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border-strong);
    border-radius: 7px; background: white; font-size: 13px; color: var(--text);
    font-family: inherit; text-transform: none; letter-spacing: normal; font-weight: 400;
    transition: border-color 0.12s, box-shadow 0.12s;
}
form input:focus, form select:focus, form textarea:focus {
    outline: none; border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}
form textarea { resize: vertical; min-height: 60px; line-height: 1.5; }
form label > input, form label > select, form label > textarea { margin-top: 2px; }

/* ============ DRONE / OBJECT SUMMARIES ============ */
.drone-summary { display: grid; gap: 6px; font-size: 12.5px; padding: 6px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.drone-summary div { padding: 3px 0; }
.kv-list { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.kv-list li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.kv-list li:last-child { border-bottom: 0; }
.kv-list li span:first-child { color: var(--text-muted); }

/* ============ MODAL ============ */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal[hidden] { display: none; }
.modal-shadow { position: absolute; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }
.modal-body {
    position: relative; background: white; border-radius: var(--radius-lg);
    padding: 22px 24px; max-width: 640px; width: 100%; max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-body--lg { max-width: 1100px; }
.modal-body h2 { margin-top: 0; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.modal--wide { padding: 30px; }
.modal-close {
    position: absolute; top: 14px; right: 16px;
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: var(--text-muted); width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.12s;
}
.modal-close:hover { background: var(--bg-soft); color: var(--red); }

/* Ticket detail layout в модалке */
.ticket-detail-header { padding-right: 50px; margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.ticket-detail-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.ticket-detail-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.ticket-detail-main { min-width: 0; }
.ticket-detail-side { background: var(--bg-soft); padding: 14px; border-radius: var(--radius); font-size: 12.5px; }
.ticket-detail-side .section-title:first-child { margin-top: 0; }
@media (max-width: 900px) { .ticket-detail-body { grid-template-columns: 1fr; } .modal--wide { padding: 16px; } }

/* ============ LOGIN ============ */
.page-login { background: linear-gradient(135deg, #0f172a 0%, var(--navy) 100%); min-height: 100vh; }
.login-shell { display: grid; grid-template-columns: 440px 1fr; min-height: 100vh; }
.login-card { background: white; padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.login-brand { text-align: center; margin-bottom: 30px; }
.login-logo { max-width: 260px; height: auto; display: block; margin: 0 auto 12px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-hint { text-align: center; margin-top: 18px; font-size: 11.5px; }
.login-bg { background: url('login-bg.jpg') center/cover no-repeat, linear-gradient(135deg, var(--navy) 0%, var(--orange) 100%); position: relative; }
.login-bg-overlay { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(30,58,95,.88), rgba(249,115,22,.45)); padding: 60px 50px; display: flex; flex-direction: column; justify-content: center; color: white; }
.login-bg-overlay h2 { color: white; font-size: 30px; margin-bottom: 18px; }
.login-bg-overlay ul { list-style: none; padding: 0; font-size: 14.5px; line-height: 1.9; }
.login-bg-overlay li::before { content: "▲ "; color: white; opacity: 0.7; margin-right: 6px; }
@media (max-width: 800px) { .login-shell { grid-template-columns: 1fr; } .login-bg { display: none; } }

/* ============ KANBAN ============ */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.kanban-col { background: var(--bg-soft); border-radius: var(--radius); padding: 10px; min-height: 200px; border: 1px solid var(--border); }
.kanban-col-header { font-size: 11px; font-weight: 700; padding: 4px 8px 10px; display: flex; justify-content: space-between; color: var(--navy); text-transform: uppercase; letter-spacing: 0.4px; }
.kanban-list { display: flex; flex-direction: column; gap: 6px; }
.kanban-card { display: block; background: white; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); text-decoration: none; color: var(--text); transition: all 0.1s; cursor: pointer; }
.kanban-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--orange); }
.kanban-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.kanban-num { font-size: 10.5px; color: var(--text-muted); font-family: ui-monospace, Consolas, monospace; }
.kanban-card-title { font-size: 12.5px; font-weight: 500; line-height: 1.35; margin-bottom: 5px; }
.kanban-card-meta { display: flex; gap: 7px; font-size: 11px; color: var(--text-muted); flex-wrap: wrap; }
@media (max-width: 1200px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .kanban { grid-template-columns: 1fr; } }

/* ============ TICKET CARD ============ */
.tickets-layout .ticket-card { max-height: calc(100vh - 180px); overflow-y: auto; }
.ticket-meta { display: grid; gap: 5px; font-size: 12.5px; padding: 6px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.ticket-meta > div { padding: 2px 0; }
.ticket-desc { padding: 10px 12px; background: var(--bg-soft); border-radius: 8px; font-size: 13px; line-height: 1.55; margin-bottom: 10px; }
.ticket-status-form { margin-bottom: 10px; }
.subtask-list { list-style: none; padding: 0; margin: 0 0 6px; }
.subtask-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12.5px; }
.subtask-item--done .subtask-title { text-decoration: line-through; color: var(--text-muted); }
.subtask-toggle, .checklist-toggle { background: none; border: none; font-size: 15px; cursor: pointer; padding: 0; color: var(--navy); }
.subtask-done, .item-done { text-decoration: line-through; color: var(--text-muted); }
.checklist { list-style: none; padding: 0; margin: 0 0 10px; }
.checklist li { display: flex; gap: 6px; align-items: center; padding: 3px 0; font-size: 12.5px; }
.inline-form { display: flex; gap: 6px; margin-bottom: 10px; }
.inline-form input { flex: 1; }
.comments-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; padding-right: 2px; }
.comment { padding: 9px 11px; border-radius: 8px; background: var(--bg-soft); border-left: 3px solid var(--navy); }
.comment--internal { background: #fffbeb; border-left-color: var(--amber); }
.comment-head { display: flex; gap: 6px; align-items: baseline; font-size: 11.5px; margin-bottom: 4px; flex-wrap: wrap; }
.comment-body { font-size: 13px; line-height: 1.55; }
.comment-form textarea { width: 100%; }
.history-list { list-style: none; padding: 0; margin: 0; font-size: 11.5px; max-height: 180px; overflow-y: auto; }
.history-list li { padding: 3px 0; border-bottom: 1px dashed var(--border); }

/* ============ ARTICLE / KB ============ */
.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li a, .article-item { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); margin-bottom: 4px; border: 1px solid transparent; text-decoration: none; }
.article-list li a:hover { background: var(--bg-soft); }
.article-list li a.is-active { background: var(--orange-soft); border-color: var(--orange); }
.article-list li a strong { display: block; font-weight: 600; font-size: 13px; }
.article-list li a span.muted { display: block; font-size: 11.5px; margin-top: 3px; }
.article-meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.article-summary { font-size: 13px; font-style: italic; color: var(--text-muted); padding: 10px 12px; background: var(--bg-soft); border-radius: 7px; margin-bottom: 12px; }
.article-body { line-height: 1.7; font-size: 13.5px; padding: 6px 0; white-space: pre-wrap; }

/* ============ MAP ============ */
.map-card { overflow: hidden; }
.map-drone { background: var(--orange); color: white; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; box-shadow: 0 4px 10px rgba(0,0,0,.25); border: 2px solid white; }
.map-drone--fixed_wing { background: var(--navy); }
.map-drone--vtol { background: var(--teal); }
.map-base { background: var(--navy); color: white; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 17px; box-shadow: 0 4px 10px rgba(0,0,0,.25); border: 2px solid white; }
.map-toggle { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; background: white; border: 1px solid var(--border-strong); border-radius: 7px; font-size: 12.5px; cursor: pointer; user-select: none; }
.map-toggle:hover { border-color: var(--orange); }
.map-toggle input { margin: 0; }
.map-legend { display: flex; gap: 5px; flex-wrap: wrap; }
.legend-pill { color: white; font-size: 10.5px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.leaflet-control-attribution { display: none !important; }

/* ============ SCHEMATIC ============ */
.schematic-viewer { position: relative; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-height: 320px; display: flex; align-items: center; justify-content: center; cursor: crosshair; user-select: none; margin-bottom: 12px; }
.schematic-image { max-width: 100%; height: auto; display: block; pointer-events: none; }
.schematic-placeholder { padding: 28px; text-align: center; }
.schematic-marker { position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; box-shadow: 0 3px 8px rgba(0,0,0,.3); border: 2px solid white; cursor: pointer; text-decoration: none; font-size: 13px; }
.schematic-marker:hover { transform: translate(-50%, -50%) scale(1.2); z-index: 5; }
.schematic-marker--resolved { opacity: 0.5; }
.marker-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.marker-item { background: var(--bg-soft); padding: 9px 11px; border-radius: 8px; border-left: 3px solid var(--text-muted); font-size: 12.5px; }
.marker-item--critical, .marker-item--danger { border-left-color: var(--red); background: #fff5f5; }
.marker-item--warning { border-left-color: var(--amber); background: #fffbeb; }
.marker-item--resolved { border-left-color: var(--green); }
.marker-head { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.marker-icon { font-size: 15px; }
.marker-desc, .marker-rec { font-size: 12.5px; margin: 4px 0; line-height: 1.5; }
.marker-meta { font-size: 11px; margin-top: 5px; }
.schematic-howto { padding: 14px 0; }
.schematic-howto ol { padding-left: 20px; line-height: 1.7; font-size: 13px; }

/* ============ BASE CARD ============ */
.base-card { transition: all 0.12s; }
.base-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.base-card--active { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(249,115,22,.18); }

/* ============ ALERT LIST ============ */
.alert-list { list-style: none; padding: 0; margin: 6px 0; }
.alert-item { padding: 8px 12px; border-left: 3px solid var(--text-muted); background: var(--bg-soft); border-radius: 0 7px 7px 0; margin-bottom: 5px; font-size: 12.5px; }
.alert-item--critical, .alert-item--danger { border-color: var(--red); background: #fff5f5; }
.alert-item--warning { border-color: var(--amber); background: #fffbeb; }
.alert-item--info { border-color: var(--sky); background: #eff6ff; }

/* ============ STRATEGY ============ */
.strategy-list dt { font-size: 14px; color: var(--navy); margin-top: 12px; }
.strategy-list dd { margin: 4px 0 0 0; font-size: 13px; color: var(--text); line-height: 1.55; }
.checklist-pre { white-space: pre-wrap; font-family: -apple-system, system-ui, sans-serif; font-size: 12px; background: var(--bg-soft); padding: 8px 12px; border-radius: 7px; margin: 4px 0 0; }
details summary { cursor: pointer; color: var(--navy); font-size: 12px; }

/* ============ MOBILE ============ */
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: -260px; transition: left 0.2s; z-index: 100; box-shadow: var(--shadow-lg); width: 260px; }
    .sidebar.is-open { left: 0; }
    .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 90; }
    .sidebar.is-open ~ .sidebar-backdrop, .sidebar-backdrop.is-visible { display: block; }
    .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .form-grid { grid-template-columns: 1fr; }
    .topbar-title { font-size: 15px; }
    .user-info { display: none; }
    .user-chip { padding: 4px 6px; }
    .app-content { padding: 14px 12px; }
    .card { padding: 12px 14px; }
    .data-table { min-width: 480px; font-size: 12px; }
    .data-table thead th, .data-table tbody td { padding: 7px 8px; }
    .kpi-value { font-size: 20px; }
    .page-toolbar { flex-direction: column; align-items: stretch; }
    .filter-row { width: 100%; }
    .filter-row input[type=search] { min-width: 0; flex: 1; }
    .page-toolbar-right { width: 100%; }
    .tickets-layout .ticket-card { max-height: none; }
}

@media (max-width: 600px) {
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .modal-body { padding: 18px 16px; }
}

/* Print-friendly */
@media print {
    .sidebar, .topbar-right, .page-toolbar, .modal { display: none !important; }
    .app-shell { display: block; }
    .app-content { padding: 0; }
    .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}
