:root {
    --navy-950: #10283f;
    --navy-900: #173550;
    --navy-800: #214563;
    --blue-600: #1976a8;
    --blue-100: #e8f4fa;
    --accent-hover: #146b99;
    --accent-soft: #e8f4fa;
    --brand-accent: #2b83a8;
    --nav-active: #245878;
    --nav-indicator: #58b4d3;
    --auth-glow: #e8f3f7;
    --ink: #162431;
    --text: #344555;
    --muted: #71808e;
    --line: #dfe6eb;
    --surface: #ffffff;
    --background: #f4f7f9;
    --red: #d54444;
    --amber: #d48817;
    --green: #26835f;
    --violet: #7456a8;
    --shadow: 0 1px 2px rgba(20, 38, 54, .04), 0 8px 30px rgba(20, 38, 54, .04);
    --radius: 12px;
}

body.theme-forest {
    --navy-950: #17362f; --navy-900: #214b41; --navy-800: #2d5e52;
    --blue-600: #17866f; --blue-100: #e5f5f0; --accent-hover: #10735e;
    --accent-soft: #e5f5f0; --brand-accent: #269b80; --nav-active: #286454;
    --nav-indicator: #63c9ad; --auth-glow: #e3f3ed;
}
body.theme-violet {
    --navy-950: #302342; --navy-900: #44325d; --navy-800: #574270;
    --blue-600: #7957b8; --blue-100: #f0eafa; --accent-hover: #6846a6;
    --accent-soft: #f0eafa; --brand-accent: #8a68c7; --nav-active: #5a4178;
    --nav-indicator: #b596e8; --auth-glow: #eee8f7;
}
body.theme-graphite {
    --navy-950: #462637; --navy-900: #5b3045; --navy-800: #704057;
    --blue-600: #c14f78; --blue-100: #fbeaf1; --accent-hover: #aa3e65;
    --accent-soft: #fbeaf1; --brand-accent: #d06489; --nav-active: #6b354e;
    --nav-indicator: #ef9fbb; --auth-glow: #f8e8ef;
}
body.theme-sunset {
    --navy-950: #3b2926; --navy-900: #523833; --navy-800: #684942;
    --blue-600: #b56335; --blue-100: #faeee7; --accent-hover: #9e5029;
    --accent-soft: #faeee7; --brand-accent: #c87545; --nav-active: #714a3e;
    --nav-indicator: #e0a17c; --auth-glow: #f7ebe4;
}
body.theme-sand {
    --navy-950: #35372a; --navy-900: #484b37; --navy-800: #5a5e43;
    --blue-600: #c08b2c; --blue-100: #fbf3df; --accent-hover: #a97722;
    --accent-soft: #fbf3df; --brand-accent: #d09a38; --nav-active: #5b5d3d;
    --nav-indicator: #e1bd69; --auth-glow: #f8f0dc;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; color: var(--text); background: var(--background); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
svg { display: block; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; width: 250px; flex-direction: column; color: #dfeaf2; background: var(--navy-950); }
.brand { display: flex; height: 84px; align-items: center; gap: 12px; padding: 0 24px; color: #fff; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; color: #fff; background: var(--brand-accent); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.brand-mark svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.1; }
.brand strong { font-size: 18px; letter-spacing: .2px; }
.brand small { margin-top: 3px; color: #9bb2c2; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; }

.main-nav { flex: 1; padding: 14px 14px; overflow-y: auto; }
.nav-heading { display: block; margin: 18px 12px 8px; color: #718fa4; font-size: 10px; font-weight: 700; letter-spacing: 1.25px; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; margin: 3px 0; padding: 10px 12px; border-radius: 8px; color: #b7c9d5; font-size: 14px; font-weight: 550; transition: background .16s ease, color .16s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: var(--nav-active); box-shadow: inset 3px 0 0 var(--nav-indicator); }
.nav-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item-label { min-width: 0; flex: 1; }
.nav-counter { display: inline-grid; min-width: 22px; height: 22px; place-items: center; padding: 0 6px; border: 2px solid var(--navy-950); border-radius: 999px; color: #fff; background: #d94a4a; font-size: 10px; font-weight: 800; line-height: 1; }
.nav-item.active .nav-counter { border-color: var(--nav-active); }
.main-nav .nav-item:first-of-type svg { fill: currentColor; stroke: none; }

.sidebar-user { display: flex; align-items: center; gap: 10px; min-height: 78px; margin: 0 14px 14px; padding: 13px 10px; border-top: 1px solid rgba(255,255,255,.09); }
.avatar { display: grid; flex: 0 0 auto; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: #fff; background: var(--brand-accent); font-size: 12px; font-style: normal; font-weight: 700; }
.avatar-soft { color: #1e6689; background: #e4f1f6; }
.sidebar-user-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.sidebar-user-copy strong { overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy small { color: #86a1b3; font-size: 11px; }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 7px; color: #92aabb; }
.icon-button:hover { color: #fff; background: rgba(255,255,255,.07); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.main-area { min-height: 100vh; margin-left: 250px; }
.topbar { display: flex; min-height: 84px; align-items: center; gap: 18px; padding: 16px clamp(22px, 3vw, 42px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.topbar > div { flex: 1; }
.topbar h1 { margin: 1px 0 0; color: var(--ink); font-size: 23px; line-height: 1.25; }
.eyebrow { display: block; color: #7c8995; font-size: 10px; font-weight: 700; letter-spacing: 1.15px; text-transform: uppercase; }
.menu-button { display: none; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.menu-button svg { width: 21px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.page-content { max-width: 1600px; margin: 0 auto; padding: 30px clamp(22px, 3vw, 42px) 54px; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 9px 17px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 700; transition: .15s ease; }
.button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.button-primary { color: #fff; background: var(--blue-600); box-shadow: 0 3px 10px rgba(25,118,168,.16); }
.button-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.button-light { color: var(--navy-900); background: #fff; }
.button-light:hover { background: #eef6f9; }
.button-ghost { color: #526473; border-color: var(--line); background: #fff; box-shadow: none; }
.button-ghost:hover { color: var(--ink); border-color: #bdcbd5; }
.button-block { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: .48; transform: none; }

.alert { margin-bottom: 18px; padding: 12px 15px; border: 1px solid; border-radius: 8px; font-size: 13px; }
.alert-success { color: #21684e; border-color: #b9dfd0; background: #eef9f5; }
.alert-error { color: #9f3737; border-color: #ebc7c7; background: #fff3f3; }
.alert-info { color: #275f7a; border-color: #beddea; background: #eff8fc; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-heading h2, .panel-heading h3 { margin: 3px 0 0; color: var(--ink); font-size: 18px; }
.panel-heading h3 { font-size: 15px; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.panel-heading-padded { margin: 0; padding: 24px 26px; border-bottom: 1px solid var(--line); }
.text-link { align-self: center; color: #29769c; font-size: 12px; font-weight: 700; }
.text-link span { margin-left: 3px; }

.welcome-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding: 24px 28px; border-radius: var(--radius); color: #e6f0f5; background: linear-gradient(118deg, var(--navy-900), #245879); box-shadow: 0 10px 28px rgba(21,51,75,.13); }
.welcome-panel .eyebrow { color: #9fc4d5; }
.welcome-panel h2 { margin: 4px 0; color: #fff; font-size: 23px; }
.welcome-panel p { margin: 0; color: #c4d6e1; font-size: 13px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 0 13px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(20,38,54,.08); }
.stat-icon { display: grid; grid-row: span 3; width: 42px; height: 42px; place-items: center; border-radius: 10px; }
.stat-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stat-value { color: var(--ink); font-size: 25px; font-weight: 750; line-height: 1; }
.stat-label { margin-top: 4px; color: var(--ink); font-size: 13px; font-weight: 700; }
.stat-card small { grid-column: 2; margin-top: 2px; color: var(--muted); font-size: 11px; }
.stat-blue .stat-icon { color: #176e99; background: #e7f4fa; }
.stat-red .stat-icon { color: var(--red); background: #fff0ef; }
.stat-amber .stat-icon { color: var(--amber); background: #fff6e7; }
.stat-violet .stat-icon { color: var(--violet); background: #f3eefb; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(260px, .9fr); gap: 22px; }
.panel-large, .project-panel { padding: 23px 24px; }
.ticket-list { margin: 0 -24px -23px; }
.ticket-row { display: grid; grid-template-columns: 10px minmax(180px, 1fr) auto 116px; align-items: center; gap: 13px; min-height: 66px; padding: 12px 24px; border-top: 1px solid #edf0f2; }
.ticket-row:hover { background: #f8fafb; }
.ticket-main { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.ticket-main strong { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.ticket-main small, .ticket-row time { color: var(--muted); font-size: 10px; }
.ticket-meta { display: flex; min-width: 0; align-items: center; gap: 5px; overflow: hidden; line-height: 18px; white-space: nowrap; }
.ticket-meta > span { flex: 0 0 auto; }
.ticket-meta > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ticket-meta > i { flex: 0 0 auto; color: #a0abb3; font-style: normal; }
.ticket-row time { text-align: right; }
.priority-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #92a0aa; }
.priority-urgent { background: #dc4444; box-shadow: 0 0 0 3px #ffeaea; }
.priority-high { background: #e58a1f; }
.priority-normal { background: #3d8db3; }
.priority-low { background: #8b99a4; }

.badge { display: inline-flex; width: max-content; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-new { color: #12678f; background: #e6f4fa; }
.status-needs_info { color: #7b5520; background: #fff2d8; }
.status-planned { color: #5d4b92; background: #f0ecfb; }
.status-in_progress { color: #9a5b13; background: #ffeed9; }
.status-ready_for_test { color: #266b5a; background: #e6f5ef; }
.status-closed { color: #4e616d; background: #eaf0f3; }
.status-rejected { color: #8e3c3c; background: #fbeaea; }
.badge-active { color: #24694e; background: #e6f5ee; }
.badge-muted { color: #64727c; background: #edf1f3; }

.project-list { display: flex; flex-direction: column; gap: 4px; }
.project-list a { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 11px; padding: 9px 8px; border-radius: 8px; }
.project-list a:hover { background: #f5f8f9; }
.project-list a > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.project-list strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.project-list small { color: var(--muted); font-size: 10px; }
.project-list a > span:last-child { color: #91a0aa; }
.project-monogram { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 9px; color: #286f91; background: #e9f4f8; font-size: 13px; font-weight: 800; text-transform: uppercase; }

.empty-state { padding: 64px 24px; text-align: center; }
.empty-state h2, .empty-state h3 { margin: 10px 0 5px; color: var(--ink); }
.empty-state p { max-width: 460px; margin: 0 auto 18px; color: var(--muted); font-size: 13px; }
.empty-icon { display: grid; width: 44px; height: 44px; margin: 0 auto; place-items: center; border-radius: 50%; color: #257797; background: #e9f5f9; font-size: 20px; font-weight: 700; }
.compact-empty { padding: 28px 20px 36px; }

.view-tabs { display: flex; gap: 6px; margin-bottom: 15px; }
.view-tabs a { padding: 8px 13px; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.view-tabs a.active { color: var(--navy-900); background: #dfeef4; }
.filter-panel { margin-bottom: 18px; padding: 20px; }
.filter-form { display: grid; grid-template-columns: minmax(190px, 1.6fr) repeat(6, minmax(110px, 1fr)) auto; align-items: end; gap: 12px; }
.filter-actions { display: flex; gap: 7px; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.field > span:first-child { color: #415260; font-size: 11px; font-weight: 700; }
.field > span b { color: var(--red); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #ccd7de; border-radius: 7px; outline: none; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s; }
.field input, .field select { height: 42px; padding: 0 11px; font-size: 13px; }
.field textarea { min-height: 120px; padding: 11px 12px; resize: vertical; font-size: 13px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #4a97b8; box-shadow: 0 0 0 3px rgba(47,136,175,.11); }
.field input::placeholder, .field textarea::placeholder { color: #9aa7b0; }
.field > small { color: var(--muted); font-size: 10px; }
.file-field { position: relative; display: block; min-height: 82px; border: 1px dashed #aac5d2; border-radius: 9px; color: #3b6679; background: #f3f9fb; cursor: pointer; transition: border-color .15s, background .15s; }
.file-field:hover { border-color: #5b9bb7; background: #edf7fa; }
.file-field > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop-copy { display: grid; grid-template-columns: 38px 1fr; align-items: center; min-height: 80px; padding: 13px 16px; column-gap: 12px; }
.file-drop-copy i { display: grid; grid-row: span 2; width: 38px; height: 38px; place-items: center; border-radius: 9px; color: #fff; background: #3b89a8; font-size: 20px; font-style: normal; }
.file-drop-copy strong { color: var(--ink); font-size: 12px; }
.file-drop-copy small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.file-field-compact { min-height: 62px; }
.file-field-compact .file-drop-copy { min-height: 60px; padding: 10px 13px; }
.file-field-compact .file-drop-copy i { width: 32px; height: 32px; }
.input-with-icon { position: relative; }
.input-with-icon svg { position: absolute; top: 12px; left: 11px; width: 18px; fill: none; stroke: #87959f; stroke-width: 1.7; stroke-linecap: round; }
.input-with-icon input { padding-left: 36px; }

.table-panel { overflow: hidden; }
.table-summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px 21px; border-bottom: 1px solid var(--line); }
.table-summary strong { color: var(--ink); font-size: 13px; }
.table-summary span { color: var(--muted); font-size: 10px; }
.responsive-table { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 16px; color: #778691; background: #f8fafb; font-size: 9px; font-weight: 800; letter-spacing: .75px; text-align: left; text-transform: uppercase; white-space: nowrap; }
.table-sort { display: inline-flex; align-items: center; gap: 6px; color: inherit; }
.table-sort span { color: #9ba8b1; font-size: 11px; line-height: 1; }
.table-sort:hover, .table-sort.active { color: var(--blue-600); }
.table-sort.active span { color: var(--blue-600); }
td { padding: 14px 16px; border-top: 1px solid #e9eef1; color: #3c4e5c; font-size: 12px; vertical-align: middle; }
tbody tr:hover td { background: #fbfcfd; }
.ticket-title-cell { min-width: 260px; }
.ticket-title-line { display: flex; align-items: center; gap: 7px; }
.ticket-title-cell a { display: block; min-width: 0; color: var(--ink); font-weight: 700; }
.ticket-title-cell a:hover { color: #1b779e; }
.ticket-title-cell small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.ticket-row-new td { background: #fffaf5; }
.ticket-row-new:hover td { background: #fff5ea; }
.ticket-new-indicator { display: inline-grid; width: 18px; height: 18px; flex: 0 0 18px; place-items: center; border-radius: 50%; color: #fff; background: #d94a4a; box-shadow: 0 0 0 3px #fde8e8; font-size: 11px; font-weight: 850; line-height: 1; }
.project-chip { color: #425b6b; font-weight: 650; white-space: nowrap; }
.department-chip-list { display: flex; max-width: 260px; flex-wrap: wrap; gap: 5px; }
.department-chip { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border: 1px solid #cfe0e7; border-radius: 999px; color: #2c677f; background: #edf7fa; font-size: 9px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.department-chip-muted { border-color: #dce2e6; color: #788791; background: #f4f6f7; }
.project-with-icon, .project-inline { display: inline-flex; align-items: center; gap: 7px; line-height: 1; vertical-align: middle; }
.project-icon { display: inline-grid; flex: 0 0 auto; width: 32px; height: 32px; place-items: center; border-radius: 7px; object-fit: contain; background: #fff; }
.project-icon-fallback { color: var(--blue-600); background: var(--accent-soft); font-size: 11px; font-weight: 800; }
.project-icon-small { width: 24px; height: 24px; border-radius: 6px; font-size: 9px; }
.project-icon-tiny { display: inline-grid; width: 17px; height: 17px; border-radius: 4px; font-size: 7px; vertical-align: middle; }
.project-icon-dashboard { width: 32px; height: 32px; border-radius: 8px; }
.project-icon-admin { width: 32px; height: 32px; border-radius: 8px; }
.project-icon-preview { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.priority-label { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.muted-cell { color: var(--muted); white-space: nowrap; }
.actions-cell { width: 1%; text-align: right; white-space: nowrap; }
.table-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 12px; }
.inline-action-form { display: inline; margin: 0; }
.table-action { color: #247798; font-size: 11px; font-weight: 750; white-space: nowrap; }
.table-action:hover { color: #145a78; text-decoration: underline; }
.table-action-button { padding: 0; border: 0; background: transparent; }
.table-action-danger { color: #b34242; }
.table-action-danger:hover { color: #8f2929; }
.table-subcopy { display: block; max-width: 340px; margin-top: 3px; color: var(--muted); font-size: 10px; }
.awaiting-copy { color: #8a5d19; font-weight: 700; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.user-cell > span { display: flex; flex-direction: column; }
.user-cell strong { color: var(--ink); }
.user-cell small { color: var(--muted); font-size: 10px; }

.form-page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; align-items: start; gap: 22px; }
.form-panel { padding: 25px 27px; }
.form-stack { display: flex; flex-direction: column; gap: 17px; }
.form-grid { display: grid; gap: 14px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 5px; }
.admin-form-grid { max-width: 1080px; }
.field-small { max-width: 180px; }
.switch-field { display: flex; align-items: flex-start; gap: 11px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafb; cursor: pointer; }
.switch-field > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-field > span { display: grid; grid-template-columns: 38px 1fr; column-gap: 11px; flex: 1; }
.switch-field i { position: relative; grid-row: span 2; width: 38px; height: 22px; margin-top: 1px; border-radius: 999px; background: #aebbc4; transition: .16s ease; }
.switch-field i::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; content: ''; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: .16s ease; }
.switch-field input:checked + span i { background: var(--blue-600); }
.switch-field input:checked + span i::after { transform: translateX(16px); }
.switch-field strong { color: var(--ink); font-size: 12px; }
.switch-field small { color: var(--muted); font-size: 10px; }
.reporter-fields { margin: 4px 0; padding: 20px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafb; }
.reporter-fields legend { padding: 0 6px; color: var(--ink); font-size: 13px; font-weight: 750; }
.reporter-fields > p { margin: 0 0 15px; color: var(--muted); font-size: 11px; }
.reporter-fields > .field { margin-bottom: 14px; }
.department-assignment-fieldset { padding-bottom: 16px; }
.department-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.department-choice { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 11px 12px; border: 1px solid #d6e1e6; border-radius: 8px; background: #fff; cursor: pointer; }
.department-choice:hover { border-color: #9fc4d3; background: #f7fbfc; }
.department-choice > input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--blue-600); }
.department-choice > span { display: flex; min-width: 0; flex-direction: column; }
.department-choice strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.department-choice small { color: var(--muted); font-size: 9px; }
.department-choice-muted { opacity: .68; }
.form-aside { display: flex; flex-direction: column; gap: 14px; }
.tip-card { padding: 20px; border: 1px solid #cfe0e7; border-radius: 11px; color: #3f5867; background: #edf7fa; }
.tip-card h3 { margin: 8px 0 7px; color: var(--ink); font-size: 14px; }
.tip-card p, .tip-card li { font-size: 11px; line-height: 1.6; }
.tip-card p { margin: 0; }
.tip-card ul { margin: 5px 0 0; padding-left: 17px; }
.tip-icon { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; color: #fff; background: var(--blue-600); font-size: 12px; font-weight: 800; }
.muted-tip { border-color: var(--line); background: #fff; }

.ticket-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 25px; margin-bottom: 20px; padding: 23px 25px; }
.ticket-number-row { display: flex; align-items: center; gap: 12px; }
.back-link { color: #557180; font-size: 11px; font-weight: 700; }
.ticket-header h2 { max-width: 900px; margin: 10px 0 5px; color: var(--ink); font-size: 21px; line-height: 1.35; }
.ticket-header p { margin: 0; color: var(--muted); font-size: 11px; }
.ticket-header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.ticket-header-actions form { margin: 0; }
.priority-box { min-height: 39px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; font-weight: 700; }
.reply-pill { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 750; }
.reply-reporter { color: #76511b; background: #fff0ce; }
.reply-support { color: #295f7b; background: #e4f2f8; }
.ticket-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 20px; }
.ticket-thread, .ticket-sidebar { display: flex; flex-direction: column; gap: 15px; }
.message-card { padding: 22px 24px; }
.message-card header { display: flex; align-items: center; gap: 11px; padding-bottom: 17px; border-bottom: 1px solid #edf1f3; }
.message-card header > span:last-child { display: flex; flex-direction: column; }
.message-card header strong { color: var(--ink); font-size: 12px; }
.message-card header small { color: var(--muted); font-size: 10px; }
.message-body { padding-top: 18px; color: #354755; font-size: 13px; line-height: 1.75; }
.attachment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 18px; padding-top: 16px; border-top: 1px solid #edf1f3; }
.attachment-card { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.attachment-card:hover { border-color: #a9c7d4; background: #f3f9fb; }
.attachment-card > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.attachment-card strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-card small { color: var(--muted); font-size: 9px; }
.attachment-card img { width: 48px; height: 42px; border-radius: 5px; object-fit: cover; background: #e8eef1; }
.image-attachment { cursor: zoom-in; }
.file-icon { display: grid; flex: 0 0 auto; width: 42px; height: 42px; place-items: center; border-radius: 6px; color: #2f718f; background: #e6f2f7; font-size: 9px; font-weight: 800; }
.internal-message { border-color: #ddd3ed; background: #fbf9fe; }
.internal-message header { border-bottom-color: #ebe4f4; }
.internal-badge { width: max-content; margin-left: auto; padding: 4px 8px; border-radius: 999px; color: #684f8d; background: #eee7f8; font-size: 9px; font-weight: 750; }
.comment-placeholder { display: flex; align-items: center; gap: 16px; padding: 20px 23px; border-style: dashed; box-shadow: none; }
.comment-placeholder-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 9px; color: #48829d; background: #edf6fa; font-weight: 800; letter-spacing: 1px; }
.comment-placeholder h3 { margin: 0 0 3px; color: var(--ink); font-size: 13px; }
.comment-placeholder p { margin: 0; color: var(--muted); font-size: 11px; }
.comment-form-card { padding: 22px 24px; }
.comment-form-card .panel-heading { margin-bottom: 15px; }
.comment-options { display: flex; align-items: center; gap: 20px; }
.comment-submit-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.internal-option { color: #654b86; }
.image-lightbox[hidden] { display: none; }
body.lightbox-open { overflow: hidden; }
.image-lightbox { position: fixed; inset: 0; z-index: 1000; display: grid; padding: 24px; place-items: center; }
.image-lightbox-backdrop { position: absolute; inset: 0; background: rgba(10, 20, 29, .78); backdrop-filter: blur(3px); }
.image-lightbox-dialog { position: relative; z-index: 1; display: flex; width: min(1180px, 100%); max-height: calc(100vh - 48px); flex-direction: column; overflow: hidden; border: 1px solid rgba(255, 255, 255, .16); border-radius: 12px; background: #fff; box-shadow: 0 28px 80px rgba(0, 0, 0, .34); }
.image-lightbox-header, .image-lightbox-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 16px; }
.image-lightbox-header { border-bottom: 1px solid var(--line); }
.image-lightbox-header strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.image-lightbox-close { display: grid; flex: 0 0 auto; width: 34px; height: 34px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #526473; background: #fff; font-size: 23px; line-height: 1; cursor: pointer; }
.image-lightbox-close:hover { color: var(--ink); border-color: #bdcbd5; background: #f5f8f9; }
.image-lightbox-stage { display: flex; min-height: 260px; flex: 1 1 auto; align-items: center; justify-content: center; overflow: auto; padding: 18px; background: #18232b; cursor: zoom-in; }
.image-lightbox-stage img { display: block; max-width: 100%; max-height: calc(100vh - 190px); object-fit: contain; }
.image-lightbox-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.image-lightbox-footer .button { min-height: 36px; padding: 7px 12px; font-size: 11px; white-space: nowrap; }
.closed-thread-note { display: flex; align-items: center; gap: 14px; padding: 19px 22px; box-shadow: none; }
.closed-thread-note > span { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: #34745d; background: #e7f5ef; font-weight: 800; }
.closed-thread-note h3 { margin: 0 0 3px; color: var(--ink); font-size: 13px; }
.closed-thread-note p { margin: 0; color: var(--muted); font-size: 11px; }
.workflow-card { padding: 20px; border-color: #cbdfe8; }
.workflow-card .panel-heading { margin-bottom: 14px; }
.details-card, .history-card { padding: 20px; }
.details-card .panel-heading, .history-card .panel-heading { margin-bottom: 12px; }
.details-card dl { margin: 0; }
.details-card dl > div { display: grid; grid-template-columns: 105px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid #edf1f3; }
.details-card dt { color: var(--muted); font-size: 10px; }
.details-card dd { margin: 0; color: var(--ink); font-size: 11px; font-weight: 650; overflow-wrap: anywhere; }
.details-card dd small { display: block; color: var(--muted); font-size: 9px; font-weight: 400; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pagination > div { display: flex; gap: 8px; }
.pagination .button { min-height: 36px; padding: 7px 13px; font-size: 11px; }
.history-list { display: flex; flex-direction: column; }
.history-item { position: relative; display: grid; grid-template-columns: 12px 1fr; gap: 9px; min-height: 45px; }
.history-item::before { position: absolute; top: 13px; bottom: -3px; left: 4px; width: 1px; content: ''; background: #dce5ea; }
.history-item:last-child::before { display: none; }
.history-item i { z-index: 1; width: 9px; height: 9px; margin-top: 4px; border: 2px solid #fff; border-radius: 50%; background: #4b91ae; box-shadow: 0 0 0 1px #99bccb; }
.history-item div { display: flex; flex-direction: column; }
.history-item strong { color: #40535f; font-size: 10px; }
.history-item small { color: var(--muted); font-size: 9px; }

.project-admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; padding: 22px; }
.project-admin-card { position: relative; display: flex; align-items: flex-start; gap: 11px; padding: 18px 18px 18px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s, opacity .15s; }
.project-admin-card.dragging { opacity: .42; border-color: var(--blue-600); box-shadow: 0 10px 24px rgba(20,38,54,.12); }
.project-drag-handle { flex: 0 0 auto; width: 24px; height: 42px; padding: 0; border: 0; color: #9aa8b2; background: transparent; font-size: 20px; line-height: 1; cursor: grab; }
.project-drag-handle:active { cursor: grabbing; }
.project-admin-main { min-width: 0; flex: 1; }
.project-admin-main .badge { float: right; }
.project-admin-main h3 { margin: 3px 0 1px; color: var(--ink); font-size: 14px; }
.project-admin-main a { display: block; overflow: hidden; color: #377d9c; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.project-admin-main p { margin: 12px 0 0; color: var(--muted); font-size: 10px; }
.project-edit { display: inline-block; margin-top: 10px; }
.panel-actions, .project-card-actions, .project-move-buttons { display: flex; align-items: center; gap: 8px; }
.project-card-actions { justify-content: space-between; margin-top: 10px; }
.project-edit { margin-top: 0; }
.project-move-buttons button { display: grid; width: 26px; height: 26px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 6px; color: #60717e; background: #fff; }
.project-move-buttons button:hover { color: var(--blue-600); border-color: #b9cad4; }
.project-icon-fieldset > p { margin: 11px 0 0; }
.project-icon-editor { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 16px; }
.project-icon-editor .file-field { width: 100%; }
.remove-icon { margin-top: 9px; }

.settings-stack { display: flex; flex-direction: column; gap: 22px; }
.settings-panel { width: 100%; max-width: 1080px; padding: 26px; }
.settings-system-panel { border-top: 3px solid var(--blue-600); }
.password-settings-form { max-width: 560px; }
.notification-preference-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.notification-preference-option { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 13px; min-height: 76px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.notification-preference-option:hover { border-color: #b8cbd6; box-shadow: var(--shadow); }
.notification-preference-option:has(input:focus-visible) { outline: 3px solid var(--accent-soft); border-color: var(--blue-600); }
.notification-preference-option > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.notification-switch { position: relative; display: block; width: 42px; height: 24px; border-radius: 999px; background: #c7d1d8; transition: background .15s; }
.notification-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(20,38,54,.22); transition: transform .15s; }
.notification-preference-option input:checked + .notification-switch { background: var(--blue-600); }
.notification-preference-option input:checked + .notification-switch::after { transform: translateX(18px); }
.notification-preference-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.notification-preference-copy strong { color: var(--ink); font-size: 12px; }
.notification-preference-copy small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.mandatory-notifications { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.mandatory-notifications-heading { display: flex; flex-direction: column; margin-bottom: 10px; }
.mandatory-notifications-heading strong { color: var(--ink); font-size: 12px; }
.mandatory-notifications-heading small { color: var(--muted); font-size: 10px; }
.notification-option-locked { cursor: default; background: #f7f9fa; }
.notification-option-locked:hover { border-color: var(--line); box-shadow: none; }
.notification-lock { display: grid; width: 30px; height: 30px; place-items: center; justify-self: center; border-radius: 50%; color: #277653; background: #e5f4ec; font-size: 13px; font-weight: 800; }
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.theme-option { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.theme-option:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.theme-option > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-option:has(input:checked) { border-color: var(--blue-600); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-preview { display: grid; grid-template-columns: 34% 1fr; height: 96px; overflow: hidden; border: 1px solid rgba(20,38,54,.09); border-radius: 8px; }
.theme-sidebar { padding: 10px 8px; }
.theme-sidebar i { display: block; width: 18px; height: 18px; border-radius: 5px; }
.theme-content { display: flex; flex-direction: column; gap: 8px; padding: 13px; }
.theme-content i { width: 52%; height: 10px; border-radius: 4px; }
.theme-content b { display: block; width: 100%; height: 15px; border-radius: 4px; background: rgba(255,255,255,.86); box-shadow: 0 1px 4px rgba(20,38,54,.08); }
.theme-content b:last-child { width: 74%; }
.theme-copy { display: flex; flex-direction: column; }
.theme-copy strong { color: var(--ink); font-size: 13px; }
.theme-copy small { color: var(--muted); font-size: 10px; }
.theme-check { position: absolute; right: 22px; bottom: 18px; display: none; width: 21px; height: 21px; place-items: center; border-radius: 50%; color: #fff; background: var(--blue-600); font-size: 11px; font-weight: 800; }
.theme-option:has(input:checked) .theme-check { display: grid; }

.mail-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 210px)); gap: 13px; margin-bottom: 18px; }
.mail-summary-card { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.mail-summary-card > div { display: flex; flex-direction: column; }
.mail-summary-card strong { color: var(--ink); font-size: 20px; line-height: 1.1; }
.mail-summary-card small { color: var(--muted); font-size: 10px; }
.mail-status-dot { width: 11px; height: 11px; border-radius: 50%; }
.mail-status-dot.sent { background: #2a9369; box-shadow: 0 0 0 4px #e6f5ee; }
.mail-status-dot.failed { background: #d44b4b; box-shadow: 0 0 0 4px #fbeaea; }
.mail-status-dot.pending { background: #d49427; box-shadow: 0 0 0 4px #fff2dc; }
.mail-status { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 750; }
.mail-sent { color: #21694e; background: #e6f5ee; }
.mail-failed { color: #943a3a; background: #fbeaea; }
.mail-pending { color: #7f581d; background: #fff1d8; }
.mail-subject-cell { min-width: 260px; max-width: 420px; }
.mail-error-cell { max-width: 250px; color: #9b4a4a; font-size: 10px; }
.mail-error-cell span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-note { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }

.auth-body { min-height: 100vh; background: radial-gradient(circle at 20% 0, var(--auth-glow) 0, transparent 36%), var(--background); }
.auth-body::after { position: fixed; right: -150px; bottom: -180px; width: 480px; height: 480px; border: 75px solid rgba(30,90,120,.04); border-radius: 50%; content: ''; pointer-events: none; }
.auth-shell { position: relative; z-index: 1; display: flex; width: min(92%, 440px); min-height: 100vh; margin: auto; flex-direction: column; justify-content: center; padding: 40px 0; }
.brand-auth { height: auto; align-self: center; margin-bottom: 25px; padding: 0; }
.brand-auth strong { color: var(--navy-900); }
.brand-auth small { color: #7d929f; }
.auth-card { padding: 33px 35px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 16px 45px rgba(22,53,78,.09); }
.auth-card-wide { width: 560px; margin-left: -60px; }
.auth-heading { margin-bottom: 24px; text-align: center; }
.auth-kicker, .setup-step { color: #2f7d9e; font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.setup-step { width: max-content; margin: 0 auto 10px; padding: 5px 9px; border-radius: 999px; background: #eaf5f9; }
.auth-heading h1 { margin: 5px 0 7px; color: var(--ink); font-size: 25px; }
.auth-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-field button { position: absolute; top: 3px; right: 4px; display: grid; width: 35px; height: 35px; place-items: center; border: 0; color: #80909b; background: transparent; }
.password-field button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.check-field { display: flex; align-items: center; gap: 9px; color: #50616e; font-size: 11px; cursor: pointer; }
.check-field input { width: 16px; height: 16px; accent-color: var(--blue-600); }
.auth-help { margin: 19px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.auth-link { color: var(--blue-600); font-weight: 750; }
.auth-link:hover { text-decoration: underline; }
.auth-footer { margin: 20px 0 0; color: #85939d; font-size: 10px; text-align: center; }
.sidebar-backdrop { display: none; }

@media (max-width: 1250px) {
    .filter-form { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
    .filter-actions { grid-column: span 1; }
    .project-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1020px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .main-area { margin-left: 0; }
    .menu-button { display: grid; }
    .menu-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(10,25,38,.45); }
    .menu-open .sidebar-backdrop { display: block; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .project-list { display: grid; grid-template-columns: repeat(2, 1fr); }
    .ticket-detail-grid { grid-template-columns: minmax(0, 1fr) 290px; }
    .form-page-grid { grid-template-columns: 1fr; }
    .form-aside { display: grid; grid-template-columns: repeat(2, 1fr); }
    .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .notification-preference-list { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .topbar { min-height: 74px; padding: 12px 16px; }
    .topbar h1 { font-size: 19px; }
    .topbar-action { width: 42px; padding: 0; }
    .topbar-action svg { width: 19px; }
    .topbar-action { font-size: 0; }
    .page-content { padding: 20px 14px 40px; }
    .welcome-panel { align-items: flex-start; flex-direction: column; padding: 21px; }
    .welcome-panel h2 { font-size: 20px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 15px; }
    .stat-icon { width: 36px; height: 36px; }
    .stat-value { font-size: 21px; }
    .stat-card small { display: none; }
    .ticket-row { grid-template-columns: 8px minmax(0, 1fr) auto; padding: 12px 17px; }
    .ticket-row time { display: none; }
    .project-list { grid-template-columns: 1fr; }
    .filter-form { grid-template-columns: 1fr 1fr; }
    .search-field { grid-column: span 2; }
    .filter-actions { grid-column: span 2; }
    .form-grid-2, .form-grid-3, .department-choice-grid { grid-template-columns: 1fr; }
    .form-panel { padding: 20px 17px; }
    .form-aside { grid-template-columns: 1fr; }
    .ticket-header { flex-direction: column; padding: 19px; }
    .ticket-header-actions { width: 100%; justify-content: space-between; }
    .ticket-detail-grid { grid-template-columns: 1fr; }
    .project-admin-grid { grid-template-columns: 1fr; padding: 14px; }
    .attachment-grid { grid-template-columns: 1fr; }
    .mail-summary-grid { grid-template-columns: repeat(3, 1fr); }
    .comment-options { align-items: flex-start; flex-direction: column; gap: 10px; }
    .comment-submit-actions { width: 100%; margin-left: 0; }
    .comment-submit-actions .button { flex: 1; }
    .image-lightbox { padding: 12px; }
    .image-lightbox-dialog { max-height: calc(100vh - 24px); }
    .image-lightbox-stage { min-height: 200px; padding: 10px; }
    .image-lightbox-stage img { max-height: calc(100vh - 190px); }
    .image-lightbox-footer { align-items: stretch; flex-direction: column; gap: 9px; }
    .image-lightbox-footer .button { width: 100%; }
    .panel-heading-padded { align-items: flex-start; flex-direction: column; padding: 20px; }
    .panel-actions { width: 100%; flex-wrap: wrap; }
    .project-icon-editor { grid-template-columns: 1fr; }
    .pagination { align-items: flex-start; flex-direction: column; }
    .auth-card { padding: 28px 23px; }
    .auth-card-wide { width: auto; margin-left: 0; }
}

@media (max-width: 430px) {
    .stats-grid { grid-template-columns: 1fr; }
    .filter-form { grid-template-columns: 1fr; }
    .search-field, .filter-actions { grid-column: auto; }
    .filter-actions .button { flex: 1; }
    .ticket-row { grid-template-columns: 8px 1fr; }
    .ticket-row .badge { display: none; }
    .mail-summary-grid { grid-template-columns: 1fr; }
    .theme-grid { grid-template-columns: 1fr; }
}
