/* Flow 8: Settings page (settings.js). */
.st-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 20px; align-items: start; }
.st-nav { position: sticky; top: 16px; }
.st-nav ul { display: grid; gap: 4px; margin: 0; padding: 8px; list-style: none; border-radius: 18px; background: var(--glass-bg); box-shadow: var(--glass-shadow); }
.st-nav a { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 11px 12px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.main-content .st-nav a:not(.btn) { color: var(--ink); }
.st-nav a:hover { background: var(--hover-bg); }
.st-nav a[aria-current="page"] { background: var(--brand-500); color: #fff; }
.main-content .st-nav a[aria-current="page"], .main-content .st-nav a[aria-current="page"] strong, .main-content .st-nav a[aria-current="page"] small { color: #fff; }
.st-nav a .lucide { width: 19px; height: 19px; margin-top: 1px; color: var(--link); }
.st-nav a[aria-current="page"] .lucide { color: #fff; }
.st-nav a span { display: grid; gap: 1px; min-width: 0; }
.st-nav strong { font-size: .9rem; }
.st-nav small { font-size: .74rem; line-height: 1.3; }
.st-nav__select { display: none; }

.st-main { display: grid; gap: 16px; min-width: 0; }
.st-main__head { display: flex; align-items: center; gap: 12px; }
.st-main__head h2 { margin: 0; font-size: 1.45rem; }
.st-main__head p { margin: 2px 0 0; }
.st-main__icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 13px; background: var(--brand-500); color: #fff; }
.st-main__icon .lucide { width: 21px; height: 21px; }
.st-panel { position: relative; display: grid; gap: 16px; min-width: 0; }
.st-panel > [data-content], .st-stack { display: grid; gap: 16px; min-width: 0; }
.st-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.st-fieldset:disabled { opacity: .92; }
.st-fieldset:disabled input, .st-fieldset:disabled select, .st-fieldset:disabled textarea, .st-fieldset:disabled button { cursor: not-allowed; }
.st-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.st-card { display: grid; gap: 14px; }
.main-content .st-card .btn { margin-top: 0; }
.main-content .st-card .field { margin-bottom: 0; }
.st-card__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.st-card__head h2 { margin: 0; font-size: 1.15rem; }
.main-content .grid > .card h2, .st-card__head h2 { margin-bottom: 0; }
.st-card__head p { margin: 4px 0 0; color: var(--muted) !important; font-size: .86rem; max-width: 70ch; }
.st-card__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.st-sub { margin: 4px 0 6px; font-size: .84rem; font-weight: 750; color: var(--ink); }
.st-version { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .84rem; color: var(--muted); }
.st-version .lucide { width: 16px; height: 16px; flex: none; }
.st-panel .mz-notice { margin: 0; }
.mz-table small, .st-card small { display: block; }
.st-card .mz-who small, .st-device small { display: block; }

.st-savebar { position: sticky; bottom: 14px; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 12px 18px; border: 1px solid var(--brand-200); border-radius: 16px; background: var(--panel-bg); box-shadow: 0 16px 40px rgba(45, 13, 54, .22); }
.st-savebar p { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink) !important; font-weight: 650; }
.st-savebar .lucide { width: 16px; height: 16px; color: var(--c2); }
.st-savebar .row { gap: 8px; }

/* Profile */
.st-avatar { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.st-avatar__pic { width: 88px; height: 88px; font-size: 1.7rem; box-shadow: 0 0 0 4px var(--hover-bg); }
.st-avatar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.st-avatar__actions .mz-help, .st-avatar__actions .mz-error { flex-basis: 100%; margin: 0; }
.st-avatar label.btn { cursor: pointer; }
.st-avatar label.btn:focus-within, .st-avatar label.btn:focus-visible { outline: 3px solid var(--info); outline-offset: 3px; }
.st-meter { height: 6px; overflow: hidden; border-radius: 99px; background: var(--tone-muted-bg); }
.st-meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--danger); transition: width .2s, background .2s; }
.st-meter span[data-score="2"] { background: var(--warning); }
.st-meter span[data-score="3"] { background: var(--c3); }
.st-meter span[data-score="4"] { background: var(--success); }
.st-rules { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: .82rem; color: var(--muted); }
.st-rules li::before { content: "○"; margin-right: 6px; }
.st-rules li.is-met { color: var(--tone-good); font-weight: 650; }
.st-rules li.is-met::before { content: "✓"; }
.st-devices { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.st-device { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.st-device__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--hover-bg); color: var(--link); }
.st-device__icon .lucide { width: 19px; height: 19px; }
.st-device strong { color: var(--ink); }

/* Organisation */
.st-depts { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.st-dept { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); }
.st-dept h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 1.02rem; }
.st-dept__main > p { margin: 2px 0 10px; }
.st-dept__managers { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.st-dept__managers strong { font-size: .86rem; }
.st-dept__managers small { font-size: .74rem; color: var(--muted); }
.st-dept__note { display: flex; align-items: flex-start; gap: 7px; margin: 10px 0 0; font-size: .82rem; color: var(--muted) !important; }
.st-dept__note .lucide { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.st-dept__side { display: grid; justify-items: end; align-content: space-between; gap: 10px; }
.st-dept__side .row { gap: 6px; justify-content: flex-end; }
.st-dept__side .mz-switch { font-size: .84rem; text-align: right; }
.st-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.st-chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: .76rem; font-weight: 650; white-space: nowrap; }
.st-chip--admin { background: var(--tone-live-bg); color: var(--tone-live); }
.st-chip--btn { border: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; cursor: pointer; }
.st-chip--btn:hover { border-color: var(--brand-200); background: var(--hover-bg); }
.st-matrix th[scope="row"] strong { display: block; }
.st-matrix th[scope="row"] { position: static; background: transparent; color: var(--ink); font-size: .86rem; letter-spacing: 0; }
.st-access { font-size: .78rem; font-weight: 650; white-space: nowrap; }
.st-access--none { color: var(--muted); }
.st-access--view { color: var(--tone-info); }
.st-access--test { color: var(--c1); }
.st-access--edit { color: var(--tone-warn); }
.st-access--create { color: var(--tone-good); }
.st-grants td { text-align: center; }
.st-grants th[scope="row"] { position: static; background: transparent; color: var(--ink); }
.st-radio input { width: 18px; height: 18px; accent-color: var(--brand-500); cursor: pointer; }

/* SLA */
.st-prio td, .st-prio th { vertical-align: top; }
.st-prio th[scope="row"] { position: static; background: transparent; }
.st-dur { display: flex; gap: 6px; }
.st-dur input, .st-dur select, .st-panel select, .st-panel input:not([type="checkbox"]):not([type="radio"]) { min-height: 38px; padding: 7px 10px; border: 1px solid var(--field-border); border-radius: 9px; background: var(--field-bg); color: var(--ink); font: inherit; font-size: .88rem; }
.st-dur input { width: 80px; }
.st-panel select option { background: var(--solid-bg); color: var(--ink); }
.st-panel .mz-table select { max-width: 100%; }
.st-hours { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.st-days { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; }
.st-days legend { margin-bottom: 6px; font-size: .88rem; font-weight: 650; }
.st-day { position: relative; cursor: pointer; }
.st-day input { position: absolute; opacity: 0; }
.st-day span { display: block; padding: 7px 11px; border: 1px solid var(--field-border); border-radius: 10px; font-size: .84rem; font-weight: 650; color: var(--muted); }
.st-day input:checked + span { border-color: var(--brand-500); background: var(--brand-500); color: #fff; }
.st-day input:focus-visible + span { outline: 3px solid var(--info); outline-offset: 2px; }
.st-holidays { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.st-holidays li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--surface-2); font-size: .88rem; }
.st-holidays li > span { display: flex; align-items: center; gap: 8px; }
.st-holidays .lucide { width: 15px; height: 15px; color: var(--link); }
.st-holiday-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.st-rules-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.st-rule { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.st-rule.is-dragging { opacity: .5; }
.st-rule.is-over { border-color: var(--brand-500); box-shadow: 0 0 0 2px var(--brand-200); }
.st-rule__head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.st-rule__grip { align-self: center; color: var(--muted); cursor: grab; }
.st-rule__grip .lucide { width: 18px; height: 18px; }
.st-rule__n { align-self: center; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-500); color: #fff; font-size: .74rem; font-weight: 800; }
.st-rule__name { flex: 1 1 200px; }
.st-rule__name input { width: 100%; font-weight: 650; }
.st-rule__move { display: flex; gap: 2px; margin-left: auto; }
.st-inline { gap: 3px !important; font-size: .74rem !important; font-weight: 700 !important; color: var(--muted); }
.st-conds { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.st-cond { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.st-cond__join { width: 40px; font-size: .72rem; font-weight: 800; color: var(--link); text-align: right; }
.st-cond input { flex: 1 1 140px; }
.st-rule > .btn { justify-self: start; }
.st-rules-foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.st-esc { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 20px; }
.st-chain { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: chain; }
.st-chain li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: .84rem; font-weight: 650; }
.st-chain li .lucide { width: 15px; height: 15px; }
.st-chain li + li::before { content: "→"; margin-right: 4px; color: var(--muted); }
.st-chain .mz-check { font-size: .84rem; font-weight: 650; }
.st-suffix { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.st-suffix input { width: 120px; }
.st-test { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.st-test__out { padding: 16px; border: 1px dashed var(--field-border); border-radius: 16px; }
.st-result { display: grid; gap: 10px; }
.st-result .eyebrow { margin: 0; }
.st-result__prio { margin: 0; }
.st-result__prio .mz-badge { font-size: .95rem; padding: 6px 12px; }

/* Templates */
.st-var { padding: 0 3px; border-radius: 4px; background: var(--tone-good-bg); color: var(--tone-good); }
.st-var--missing { background: var(--tone-warn-bg); color: var(--tone-warn); }

/* Billing */
.st-balance { margin: 0; font-size: 2.4rem; font-weight: 800; letter-spacing: -.04em; color: var(--ink) !important; }
.st-reconcile { display: flex; align-items: flex-start; gap: 7px; margin: 0; font-size: .82rem; color: var(--muted) !important; }
.st-reconcile .lucide { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--tone-good); }
.st-lowbal { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.st-plan { margin: 0; color: var(--ink) !important; }
.st-plan strong { font-size: 1.5rem; }
.st-limit { display: grid; gap: 5px; }
.st-limit__head { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; font-weight: 650; color: var(--ink); }
.st-limit small { font-size: .76rem; }
.st-opening td { font-weight: 700; color: var(--muted); }
.st-neg { color: var(--ink); }
.st-pos { color: var(--tone-good); font-weight: 700; }
.st-presets { margin: 0; padding: 0; border: 0; }
.st-presets legend { margin-bottom: 6px; font-size: .88rem; font-weight: 650; }

/* Telephony */
.st-conns { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.st-conn { display: grid; align-content: start; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.st-conn__head { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; }
.st-conn__head strong { display: block; color: var(--ink); font-size: .92rem; }
.st-conn__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--hover-bg); color: var(--link); }
.st-conn__icon .lucide { width: 18px; height: 18px; }
.st-conn .btn { justify-self: start; }
.st-conn__test p { margin: 0; }
.st-ok, .st-warn { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0 0; font-size: .82rem; font-weight: 600; }
.st-ok { color: var(--tone-good) !important; }
.st-warn { color: var(--tone-warn) !important; }
.st-ok .lucide, .st-warn .lucide { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.st-ok small { display: inline; }
.st-panel .mz-help .lucide { width: 13px; height: 13px; vertical-align: -2px; }

@media (max-width: 1180px) {
  .st-shell { grid-template-columns: 1fr; }
  .st-nav { position: static; }
  .st-nav ul { display: flex; overflow-x: auto; scrollbar-width: thin; }
  .st-nav li { flex: none; }
  .st-nav a { grid-template-columns: 18px auto; padding: 9px 12px; }
  .st-nav small { display: none; }
  .st-nav strong { white-space: nowrap; }
}
@media (max-width: 900px) {
  .st-dept { grid-template-columns: 1fr; }
  .st-dept__side { justify-items: start; }
  .st-dept__side .row { justify-content: flex-start; }
  .st-dept__side .mz-switch { text-align: left; }
}
@media (max-width: 640px) {
  .st-nav ul { display: none; }
  .st-nav__select { display: grid; }
  .st-nav__select select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--field-border); border-radius: 12px; background: var(--field-bg); color: var(--ink); font-weight: 650; }
  .st-device { grid-template-columns: 40px 1fr; }
  .st-device .btn { grid-column: 2; justify-self: start; }
  .st-cond__join { width: auto; text-align: left; }
  .st-cond select, .st-cond input { flex: 1 1 100%; }
  .st-rule__move { margin-left: 0; }
  .st-balance { font-size: 2rem; }
  .st-savebar { bottom: 8px; }
}
.st-panel .mz-table code, .st-panel .mz-table td:nth-child(2) { white-space: nowrap; }
