/* Settings-style pages (Support desk, Settings) and the Audit log: a section
   list down the side, calm solid panels with a titled strip on top. */

:root { --panel-bg: rgba(19, 21, 56, .82); --panel-head: rgba(255, 255, 255, .035); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --panel-bg: rgba(255, 255, 255, .86); --panel-head: rgba(70, 70, 160, .04); } }
:root[data-theme="light"] { --panel-bg: rgba(255, 255, 255, .86); --panel-head: rgba(70, 70, 160, .04); }

/* ---------- Layout: section list + content ---------- */

.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; padding-top: 6px; }
.settings-body { display: flex; flex-direction: column; gap: 18px; max-width: 1120px; min-width: 0; animation: fade-up var(--t-slow) var(--ease-out) both; }

.subnav { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 2px; }
.subnav a {
    display: flex; flex-direction: column; gap: 1px; padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--muted); font-weight: 600; line-height: 1.3;
    transition: color var(--t-fast), background var(--t-fast), box-shadow var(--t);
}
.subnav a small { font-size: 11.5px; font-weight: 500; color: var(--faint); }
.subnav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.subnav a.active { color: var(--text); background: var(--nebula-soft); box-shadow: inset 2px 0 0 var(--accent); }
.subnav a.active small { color: var(--muted); }

@media (max-width: 960px) {
    .settings { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .subnav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 6px; padding-bottom: 2px; }
    .subnav::-webkit-scrollbar { display: none; }
    .subnav a { flex: none; padding: 7px 12px; border: 1px solid var(--border); white-space: nowrap; }
    .subnav a small { display: none; }
    .subnav a.active { box-shadow: inset 0 0 0 1px var(--accent); }
}

/* ---------- Panels ---------- */

.panel {
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-bg); overflow: hidden;
    box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-sm);
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap;
    padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--panel-head);
}
.panel-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.panel-head h2 { font-size: 15.5px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; max-width: 76ch; }
.panel-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.panel-body.flush { padding: 0; gap: 0; }
.panel-body .table th { background: transparent; position: static; }
.panel-body.flush .table th, .panel-body.flush .table td { padding: 12px 20px; }

/* Cards from other views dropped into these pages take the same look: solid,
   no pointer spotlight, and their heading becomes the strip. */
.settings .card { background: var(--panel-bg); backdrop-filter: none; -webkit-backdrop-filter: none; padding: 18px 20px; }
.settings .card::before, .settings .card::after { display: none; }
.settings .card > h2:first-child, .settings .card > .card-head:first-child {
    margin: -18px -20px 4px; padding: 14px 20px; font-size: 15.5px;
    border-bottom: 1px solid var(--border); background: var(--panel-head);
    border-radius: var(--radius) var(--radius) 0 0;
}
.settings .card > .card-head:first-child h2 { font-size: 15.5px; }

/* One setting per row: what it does, then its control. */
.setting { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; padding-bottom: 0; }
.setting-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.setting-text span { color: var(--muted); font-size: 12.5px; line-height: 1.5; max-width: 72ch; }
.setting-control { flex: none; padding-top: 1px; }
.setting-sub { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); transition: opacity var(--t); }
.setting-sub.off { opacity: .5; }
.num-input { width: 84px; }

.save-bar {
    position: sticky; bottom: 14px; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 12px 10px 16px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface-solid); box-shadow: var(--shadow-sm); transition: border-color var(--t), box-shadow var(--t);
}
.save-bar.dirty { border-color: rgba(var(--accent-rgb), .5); box-shadow: var(--shadow), 0 0 0 1px rgba(var(--accent-rgb), .2); }

/* ---------- Support desk: status strip ---------- */

.desk-status {
    --tone: var(--ok);
    display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; padding: 16px 20px;
    border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--tone) 34%, var(--border));
    background: linear-gradient(100deg, color-mix(in srgb, var(--tone) 13%, transparent), transparent 55%), var(--panel-bg);
}
.desk-status.is-closed { --tone: var(--danger); }
.desk-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--tone); box-shadow: 0 0 0 5px color-mix(in srgb, var(--tone) 20%, transparent); }
.desk-status.is-open .desk-dot { animation: pulse 2.4s infinite; }
.desk-now { display: flex; flex-direction: column; gap: 2px; flex: 1 1 240px; min-width: 0; }
.desk-now strong { font-size: 17px; letter-spacing: -.01em; }
.desk-now span { color: var(--muted); font-size: 13px; }
.desk-facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0; }
.desk-facts dt { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.desk-facts dd { margin: 2px 0 0; font-weight: 600; font-size: 13px; }

/* ---------- Support desk: weekly hours ---------- */

.day-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.day-row, .day-scale { display: grid; grid-template-columns: 190px 250px minmax(80px, 1fr) 64px; align-items: center; gap: 16px; }
.day-row { padding: 9px 0; border-bottom: 1px solid var(--border); }
.day-row:last-child { border-bottom: 0; }
.day-name { gap: 10px; }
.day-row.off .day-name > span.cap { color: var(--muted); }
.day-times { display: inline-flex; align-items: center; gap: 8px; }
.day-times input { padding: 6px 10px; font-variant-numeric: tabular-nums; }
.day-closed { font-size: 13px; }
.day-save { display: flex; justify-content: flex-end; }
.day-bar { position: relative; display: block; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.day-bar i { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: var(--nebula); transition: left var(--t) var(--ease-out), width var(--t) var(--ease-out); }
.day-row.today .day-bar { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .22); }
.day-scale { color: var(--faint); font: 600 10.5px/1 var(--mono); }
.day-scale > div { grid-column: 3; display: flex; justify-content: space-between; }
@media (max-width: 1180px) {
    .day-row { grid-template-columns: minmax(150px, 190px) minmax(0, 1fr) 64px; }
    .day-row .day-bar, .day-scale { display: none; }
}
@media (max-width: 560px) {
    .day-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
    .day-times, .day-closed { grid-column: 1; }
}

/* ---------- Support desk: closures ---------- */

.closure-list { list-style: none; margin: 0; padding: 0; }
.closure-list li { display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.closure-list li:last-child { border-bottom: 0; }
.closure-list li.off .closure-main { opacity: .55; }
.closure-swatch { flex: none; align-self: stretch; width: 4px; border-radius: 99px; background: var(--accent); }
.closure-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.closure-msg {
    margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 86ch;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.closure-actions { flex: none; display: flex; gap: 4px; }
@media (max-width: 760px) { .closure-list li { flex-wrap: wrap; } .closure-actions { width: 100%; padding-left: 18px; } }

/* ---------- Audit log ---------- */

.audit { padding-top: 6px; }
.table-scroll { overflow-x: auto; }
.audit-table { min-width: 720px; }
.audit-table th, .audit-table td { padding: 11px 20px; }
.audit-table th { background: transparent; position: static; }
.audit-when { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 13px; }
.audit-when span { display: block; }
.audit-when small { color: var(--faint); font-size: 11.5px; }
.audit-who { white-space: nowrap; font-weight: 600; }
.audit-action { display: inline-block; font: 600 11.5px/1 var(--mono); color: var(--muted); padding: 5px 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.audit-what { width: 100%; overflow-wrap: anywhere; }
.audit-what .pill { margin-left: 8px; }
.audit-table tr.undone .audit-what > span:first-child { text-decoration: line-through; color: var(--muted); }
.audit-table td.right { white-space: nowrap; }

.pages-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel-bg);
}
.pages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.page-num {
    min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid transparent; background: none;
    font: inherit; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); cursor: pointer;
    transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.page-num:hover { color: var(--text); background: var(--surface-2); }
.page-num.on { color: var(--text); background: var(--nebula-soft); border-color: var(--border-strong); }
.pages-gap { color: var(--faint); padding: 0 2px; }
