/* ========================================================================
   Scan Manager UI — v3 premium layer
   Loaded after app.css. Re-tunes the palette to a blue-tinted graphite
   (Linear / Vercel style) and adds the component kit used by the
   resources/views/components/ui/* Blade components.
   ======================================================================== */

:root {
    /* Exact brand palette from the marketing site (welcome.blade.php) */
    --shell: #060c18;              /* site --bg */
    --canvas: #080e1e;             /* site --bg-header */
    --surface-base: #070f1f;       /* inputs */
    --surface: #0c1728;            /* site --bg-card */
    --surface-alt: #080e1e;
    --surface-elevated: #111f38;   /* site --bg-card-el */
    --surface-hover: #12223d;
    --surface-overlay: #162a48;
    --border: #162d4a;             /* site --border */
    --border-strong: #1f3b5e;
    --border-subtle: #0e2038;      /* site --border-sub */
    --border-focus: rgba(56, 189, 248, .6);

    --text: #eef4ff;               /* site --text-pri */
    --text-secondary: #c8d8ea;
    --text-muted: #9fb3cc;         /* site --text-sec */
    --text-light: #6b84a3;         /* site --text-muted */

    --brand-accent: #38bdf8;       /* logo tile colour */
    --brand-accent-strong: #0284c7;/* site --accent-dk */
    --brand-accent-subtle: rgba(56, 189, 248, .12);
    --on-accent: #060c18;
    --hairline-hi: inset 0 1px 0 rgba(255, 255, 255, .03);
    --elev-1: 0 1px 2px rgba(0, 0, 0, .35);
    --elev-2: 0 16px 40px -16px rgba(0, 0, 0, .7);
    --radius-card: 14px;           /* site --radius */
}

[data-bs-theme=dark] {
    --bs-body-bg: var(--shell);
    --bs-body-color: var(--text);
    --bs-secondary-color: var(--text-muted);
    --bs-border-color: var(--border);
}

body {
    background: var(--shell);
    font-size: 14px;
    letter-spacing: -.003em;
}

/* ── Shell ── */
.tg-sidebar { background: var(--shell); }
.tg-sidebar-brand .brand-icon {
    background: #38bdf8;
    box-shadow: 0 4px 14px -4px rgba(56,189,248,.55);
}
.tg-sidebar-nav a { color: var(--text-muted); font-size: .84rem; }
.tg-sidebar-nav a:hover { background: var(--surface); color: var(--text); }
.tg-sidebar-nav a.active {
    background: var(--brand-accent-subtle);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(56,189,248,.22);
}
.tg-sidebar-footer .user-info { background: var(--surface); border-color: var(--border); }
.tg-main { background: var(--shell); }
.tg-canvas {
    background:
        radial-gradient(1100px 380px at 80% -160px, rgba(56,189,248,.055), transparent 70%),
        var(--canvas);
    border-color: var(--border-subtle);
    padding: 2rem 2.5rem 4rem;
}
@media (max-width: 991.98px) { .tg-canvas { padding: 1.25rem 1rem 3rem; } }
/* One shared content column: every page element aligns to the same left/right edge */
.tg-canvas-inner { max-width: 1320px; margin-left: auto; margin-right: auto; }

/* Older components pick up the new surfaces */
.tg-card, .tg-table-wrapper, .tg-form-card, .tg-shortcut,
.row:has(> [class*="col"] > .stat-card) {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: var(--elev-1);
}
.tg-shortcut:hover { background: var(--surface-hover); }
.form-control, .form-select { background-color: var(--surface-base); border-color: var(--border-strong); }
.form-control:focus, .form-select:focus { background-color: var(--surface-base); }
.btn-secondary, .btn-light { --bs-btn-bg: var(--surface-elevated); --bs-btn-hover-bg: var(--surface-overlay); }

/* ── Page header ── */
.sm-page-header { margin-bottom: 1.75rem; }
.sm-crumbs {
    display: flex; align-items: center; flex-wrap: wrap; gap: .35rem;
    font-size: .78rem; color: var(--text-light); margin-bottom: .9rem;
}
.sm-crumbs a { color: var(--text-muted); text-decoration: none; }
.sm-crumbs a:hover { color: var(--text); }
.sm-crumbs .bi-chevron-right { font-size: .62rem; opacity: .6; }
.sm-page-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; }
.sm-page-header-main { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.sm-page-icon {
    width: 46px; height: 46px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 13px;
    font-size: 1.25rem;
    color: var(--brand-accent);
    background: linear-gradient(160deg, rgba(56,189,248,.16), rgba(56,189,248,.03));
    border: 1px solid rgba(56,189,248,.22);
    box-shadow: 0 8px 24px -12px rgba(56,189,248,.5), inset 0 1px 0 rgba(255,255,255,.08);
}
.sm-page-header-text { min-width: 0; }
.sm-eyebrow { font-size: .75rem; font-weight: 600; color: var(--brand-accent); margin-bottom: .2rem; }
.sm-page-title {
    font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15;
    margin: 0; color: #fff; overflow-wrap: anywhere;
}
.sm-page-subtitle { margin: .3rem 0 0; color: var(--text-muted); font-size: .875rem; }
.sm-page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ── Buttons (refined sizing) ── */
.btn { border-radius: 9px; font-weight: 560; letter-spacing: -.01em; }
.btn-primary {
    background-image: none;
    box-shadow: 0 6px 18px -8px rgba(56,189,248,.7);
    border: none;
    font-weight: 650;
}
.btn-secondary, .btn-ghost {
    box-shadow: var(--hairline-hi);
}
.sm-icon-btn {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    cursor: pointer;
    padding: 0;
}
.sm-icon-btn:hover { background: var(--surface-overlay); color: var(--text); }
.sm-icon-btn.is-danger:hover { background: var(--danger-subtle); color: var(--danger-text); }
.sm-icon-btn.is-primary:hover { background: var(--info-subtle); color: var(--info-text); }
.sm-icon-btn.is-success:hover { background: var(--success-subtle); color: var(--success-text); }

/* ── Table card ── */
.sm-table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--elev-1);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.sm-table-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.25rem .85rem;
}
.sm-section-title { font-size: .95rem; font-weight: 650; margin: 0; letter-spacing: -.015em; color: var(--text); }
.sm-section-meta { font-size: .78rem; color: var(--text-light); margin-top: .15rem; }
.sm-table-card-head-actions { display: flex; gap: .5rem; align-items: center; }

.sm-toolbar {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(56,189,248,.02), transparent);
}
.sm-table-card-head + .sm-toolbar { border-top: 1px solid var(--border); }
.sm-toolbar form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
.sm-toolbar .form-control, .sm-toolbar .form-select {
    min-height: 34px; height: 34px; padding-top: .3rem; padding-bottom: .3rem;
    font-size: .835rem; border-radius: 9px;
    background-color: var(--surface-base);
}
.sm-toolbar .form-select { width: auto; min-width: 150px; padding-right: 2rem; }
.sm-toolbar .btn { min-height: 34px; padding-top: .3rem; padding-bottom: .3rem; font-size: .82rem; }
.sm-search { position: relative; flex: 1 1 260px; min-width: 200px; }
.sm-search > .bi {
    position: absolute; left: .7rem; top: 50%; transform: translateY(-50%);
    color: var(--text-light); font-size: .85rem; pointer-events: none;
}
.sm-search .form-control { padding-left: 2rem; width: 100%; }
.sm-toolbar-clear { font-size: .8rem; color: var(--text-muted); text-decoration: none; padding: 0 .35rem; }
.sm-toolbar-clear:hover { color: var(--text); }
.sm-toolbar-spacer { flex: 1; }
.sm-toolbar-count { font-size: .78rem; color: var(--text-light); white-space: nowrap; }

.sm-table-scroll { overflow-x: auto; }
.sm-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; color: var(--text); font-size: .855rem; }
.sm-table thead th {
    position: sticky; top: 0; z-index: 1;
    background: var(--surface);
    padding: .65rem 1rem;
    font-size: .74rem; font-weight: 500; color: var(--text-light);
    text-align: left; white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.sm-table tbody td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}
.sm-table tbody tr:last-child td { border-bottom: none; }
.sm-table tbody tr { transition: background var(--transition); }
.sm-table tbody tr:hover { background: rgba(56,189,248,.035); }
.sm-table th:first-child, .sm-table td:first-child { padding-left: 1.25rem; }
.sm-table th:last-child, .sm-table td:last-child { padding-right: 1.25rem; }
.sm-table .num { text-align: right; }
.sm-table .muted { color: var(--text-muted); }
.sm-table .nowrap { white-space: nowrap; }
.sm-table .row-actions { text-align: right; white-space: nowrap; width: 1%; }
.sm-table .row-actions > * { opacity: .55; transition: opacity var(--transition); }
.sm-table tbody tr:hover .row-actions > *,
.sm-table .row-actions > *:focus-within,
.sm-table .row-actions > *:focus { opacity: 1; }
.sm-table .row-actions form { display: inline; }
.sm-table .row-actions .btn-action { width: auto; height: 30px; padding: 0 .6rem; background: transparent; border-color: transparent; }
.sm-table .row-actions .btn-action:hover { background: var(--surface-overlay); }
.sm-table td.empty-cell { padding: 0; }
.sm-table input[type=checkbox] { cursor: pointer; }

/* Identity cell: avatar/icon + two lines */
.sm-ident { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.sm-ident-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sm-ident-title { font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32ch; }
a.sm-ident-title:hover { color: var(--brand-accent); }
.sm-ident-sub { font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40ch; }
.sm-cell-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px; font-size: .95rem;
    background: var(--surface-elevated); border: 1px solid var(--border);
    color: var(--text-muted);
}
.sm-mono { font-family: var(--font-mono); font-size: .8rem; color: var(--text-secondary); letter-spacing: 0; }
.sm-code {
    font-family: var(--font-mono); font-size: .76rem;
    padding: .12rem .45rem; border-radius: 6px;
    background: var(--surface-elevated); border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* Table footer + pagination */
.sm-table-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: .7rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: .8rem; color: var(--text-light);
}
.sm-table-foot nav { margin-left: auto; }
.sm-table-foot .pagination { margin: 0; }
.sm-table-foot nav > .d-flex.justify-content-between.flex-fill { display: none !important; }
.sm-table-foot nav > div.d-none.flex-sm-fill { display: flex !important; align-items: center; gap: 1rem; justify-content: space-between; flex: 1; }
.sm-table-foot p.small { margin: 0; color: var(--text-light); }
.sm-table-foot p.small .fw-semibold { color: var(--text-secondary); }
.pagination .page-link { background: transparent; border-color: var(--border); min-width: 32px; text-align: center; }
.pagination .page-item.active .page-link { background: rgba(56,189,248,.14); border-color: rgba(56,189,248,.4); color: var(--brand-accent); }

/* ── Avatar ── */
.sm-avatar {
    --av-h: 199;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    border-radius: 50%;
    font-weight: 650; letter-spacing: .01em;
    color: hsl(var(--av-h) 90% 82%);
    background: linear-gradient(150deg, hsl(var(--av-h) 55% 30%), hsl(var(--av-h) 60% 18%));
    box-shadow: inset 0 0 0 1px hsl(var(--av-h) 70% 60% / .35), inset 0 1px 0 rgba(255,255,255,.12);
    user-select: none;
}
.sm-avatar-sm { width: 26px; height: 26px; font-size: .64rem; }
.sm-avatar-md { width: 32px; height: 32px; font-size: .72rem; }
.sm-avatar-lg { width: 48px; height: 48px; font-size: .95rem; }
.sm-avatar-xl { width: 64px; height: 64px; font-size: 1.2rem; }
.sm-avatar-square { border-radius: 10px; }
.sm-avatar-xl.sm-avatar-square { border-radius: 16px; }

/* ── Status pill refinements ── */
.tg-badge { font-size: .72rem; font-weight: 550; padding: .18rem .55rem .18rem .5rem; letter-spacing: 0; }
.tg-badge-primary { background: var(--info-subtle); color: var(--info-text); border-color: rgba(56,189,248,.22); }

/* ── Forms ── */
.sm-form { max-width: 1040px; }
.sm-form-section {
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    gap: 1.5rem 2.5rem;
    padding: 1.75rem 0;
    border-top: 1px solid var(--border);
}
.sm-form-section:first-child { border-top: none; padding-top: .25rem; }
@media (max-width: 991.98px) { .sm-form-section { grid-template-columns: 1fr; gap: 1rem; } }
.sm-form-section-intro h2 { font-size: .95rem; font-weight: 650; letter-spacing: -.015em; margin: 0 0 .35rem; color: var(--text); }
.sm-form-section-intro p { font-size: .83rem; color: var(--text-muted); margin: 0; line-height: 1.55; }
.sm-form-section-icon {
    width: 34px; height: 34px; margin-bottom: .75rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; font-size: 1rem;
    color: var(--brand-accent); background: var(--brand-accent-subtle);
    border: 1px solid rgba(56,189,248,.2);
}
.sm-form-section-body {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--elev-1);
    padding: 1.35rem 1.4rem .4rem;
}
.sm-form-section-body > .row { --bs-gutter-x: 1rem; }
.sm-form-section-body .form-label,
.sm-form .form-label { font-size: .8rem; font-weight: 550; color: var(--text-secondary); margin-bottom: .4rem; }
.sm-form-section-body .form-control,
.sm-form-section-body .form-select { min-height: 38px; font-size: .875rem; border-radius: 9px; }
.sm-form-section-body .mb-3 { margin-bottom: 1.1rem !important; }
.sm-form-section-body .form-text { margin-top: .35rem; }
.sm-form-section-body textarea.form-control { min-height: 110px; }
.sm-optional { font-weight: 400; color: var(--text-light); font-size: .75rem; margin-left: .25rem; }
.sm-hint { font-size: .78rem; color: var(--text-light); margin-top: .35rem; }

.sm-form-actions {
    position: sticky; bottom: .75rem; z-index: 5;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    margin-top: 1.5rem;
    padding: .7rem .75rem .7rem 1.1rem;
    border-radius: 14px;
    background: rgba(12, 23, 40, .88);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
    border: 1px solid var(--border-strong);
    box-shadow: var(--elev-2);
}
.sm-form-actions-hint { font-size: .8rem; color: var(--text-muted); }
.sm-form-actions-hint .bi { color: var(--text-light); margin-right: .25rem; }
.sm-form-actions-buttons { display: flex; gap: .5rem; margin-left: auto; }

/* Toggle-style checkboxes inside form sections */
.sm-form-section-body .form-switch .form-check-input { width: 2.2em; height: 1.2em; }
.sm-check-card {
    display: flex; gap: .75rem; align-items: flex-start;
    padding: .8rem .9rem; margin-bottom: .6rem;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-base);
}
.sm-check-card .form-check-input { margin-top: .2rem; flex-shrink: 0; }

/* Danger zone */
.sm-danger-zone {
    margin-top: 2rem;
    border: 1px solid rgba(239,68,68,.28);
    border-radius: var(--radius-card);
    background: linear-gradient(180deg, rgba(239,68,68,.06), rgba(239,68,68,.02));
    padding: 1.1rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.sm-danger-zone h3 { font-size: .9rem; font-weight: 650; margin: 0 0 .2rem; color: var(--danger-text); }
.sm-danger-zone p { margin: 0; font-size: .82rem; color: var(--text-muted); }

/* ── Panels & description lists (detail pages) ── */
.sm-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--elev-1);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.sm-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .95rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.sm-panel-body { padding: 1.15rem 1.25rem; }
.sm-dl { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; margin: 0; }
.sm-dl > dt, .sm-dl > dd {
    padding: .7rem 1.25rem; margin: 0;
    border-bottom: 1px solid var(--border);
    font-size: .855rem;
}
.sm-dl > dt { color: var(--text-muted); font-weight: 500; }
.sm-dl > dd { color: var(--text); overflow-wrap: anywhere; }
.sm-dl > dt:nth-last-child(2), .sm-dl > dd:last-child { border-bottom: none; }

/* Identity hero for detail pages */
.sm-identity {
    display: flex; align-items: center; gap: 1.1rem;
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background:
        radial-gradient(500px 200px at 0% 0%, rgba(56,189,248,.10), transparent 70%),
        var(--surface);
    box-shadow: var(--elev-1);
    flex-wrap: wrap;
}
.sm-identity-text { flex: 1; min-width: 220px; }
.sm-identity-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -.025em; margin: 0; color: #fff; }
.sm-identity-meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .35rem; font-size: .83rem; color: var(--text-muted); }
.sm-identity-meta .bi { color: var(--text-light); margin-right: .3rem; }
.sm-identity-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── KPI cards ── */
.sm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .9rem; margin-bottom: 1.5rem; }
.sm-kpi {
    position: relative;
    padding: 1rem 1.1rem 1.05rem;
    border-radius: var(--radius-card);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--elev-1);
    overflow: hidden;
}
.sm-kpi::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56,189,248,.25), transparent);
}
.sm-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sm-kpi-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.sm-kpi-icon {
    width: 28px; height: 28px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .85rem; color: var(--text-muted);
    background: var(--surface-elevated); border: 1px solid var(--border);
}
.sm-kpi-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.035em; margin-top: .45rem; line-height: 1.1; font-variant-numeric: tabular-nums; color: #fff; }
.sm-kpi-hint { font-size: .76rem; color: var(--text-light); margin-top: .3rem; }
.sm-kpi .tg-progress { margin-top: .7rem; height: 4px; }
.sm-kpi-accent .sm-kpi-icon { color: var(--brand-accent); background: var(--brand-accent-subtle); border-color: rgba(56,189,248,.25); }
.sm-kpi-success .sm-kpi-icon { color: var(--success-text); background: var(--success-subtle); border-color: rgba(34,197,94,.25); }
.sm-kpi-warning .sm-kpi-icon { color: var(--warning-text); background: var(--warning-subtle); border-color: rgba(245,158,11,.25); }
.sm-kpi-danger .sm-kpi-icon { color: var(--danger-text); background: var(--danger-subtle); border-color: rgba(239,68,68,.25); }
.sm-kpi-accent { background: radial-gradient(240px 120px at 100% 0%, rgba(56,189,248,.08), transparent 70%), var(--surface); }

/* ── Empty state ── */
.sm-empty { text-align: center; padding: 3.5rem 1.5rem; }
.sm-empty-art { position: relative; width: 84px; height: 84px; margin: 0 auto 1.1rem; }
.sm-empty-ring {
    position: absolute; inset: 0; border-radius: 50%;
    background: radial-gradient(circle, rgba(56,189,248,.14), transparent 70%);
    border: 1px dashed rgba(56,189,248,.25);
}
.sm-empty-icon {
    position: absolute; inset: 18px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px;
    background: linear-gradient(160deg, var(--surface-overlay), var(--surface-elevated));
    border: 1px solid var(--border-strong);
    color: var(--brand-accent); font-size: 1.3rem;
    box-shadow: var(--elev-2);
}
.sm-empty-title { font-weight: 650; font-size: .95rem; color: var(--text); }
.sm-empty-text { margin: .35rem auto 0; max-width: 34ch; font-size: .84rem; color: var(--text-muted); }
.sm-empty-actions { margin-top: 1.1rem; display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

/* ── Segmented status filter (links) ── */
.sm-segment {
    display: inline-flex; gap: 2px; padding: 3px;
    border-radius: 10px; background: var(--surface-base); border: 1px solid var(--border);
}
.sm-segment a {
    padding: .3rem .7rem; border-radius: 7px;
    font-size: .8rem; font-weight: 550; color: var(--text-muted); text-decoration: none;
}
.sm-segment a:hover { color: var(--text); }
.sm-segment a.active { background: var(--surface-overlay); color: #fff; box-shadow: var(--hairline-hi), 0 1px 2px rgba(0,0,0,.4); }

/* ── Callout ── */
.sm-callout {
    display: flex; gap: .75rem; align-items: flex-start;
    padding: .85rem 1rem; border-radius: 12px;
    background: var(--info-subtle); border: 1px solid rgba(56,189,248,.22);
    color: var(--text-secondary); font-size: .84rem;
}
.sm-callout > .bi { color: var(--info-text); font-size: 1rem; margin-top: .05rem; }
.sm-callout-warning { background: var(--warning-subtle); border-color: rgba(245,158,11,.25); }
.sm-callout-warning > .bi { color: var(--warning-text); }
.sm-callout-success { background: var(--success-subtle); border-color: rgba(34,197,94,.25); }
.sm-callout-success > .bi { color: var(--success-text); }
.sm-callout-danger { background: var(--danger-subtle); border-color: rgba(239,68,68,.25); }
.sm-callout-danger > .bi { color: var(--danger-text); }

/* Flash alerts sit inside the canvas width */
.tg-canvas-inner > .alert { border-radius: 12px; }

/* ── Floating selection bar (bulk actions) ── */
.sm-selection-bar {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    z-index: 1030;
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem .55rem .5rem 1rem;
    border-radius: 14px;
    background: rgba(17, 31, 56, .94);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    backdrop-filter: saturate(160%) blur(16px);
    border: 1px solid var(--border-strong);
    box-shadow: 0 24px 48px -12px rgba(0,0,0,.8), var(--hairline-hi);
    animation: sm-rise 180ms cubic-bezier(.2,0,0,1);
}
@media (min-width: 992px) { .sm-selection-bar { left: calc(50% + var(--sidebar-width) / 2); } }
.sm-selection-count { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.sm-selection-count #selected-count { color: var(--brand-accent); }
.sm-selection-divider { width: 1px; height: 20px; background: var(--border-strong); }
@keyframes sm-rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .sm-selection-bar { animation: none; } }

/* Modal polish */
.modal-content { box-shadow: 0 30px 80px -20px rgba(0,0,0,.85); }
.modal-header { padding: 1.1rem 1.35rem; }
.modal-header .modal-title { font-size: 1rem; font-weight: 650; letter-spacing: -.015em; }
.modal-body { padding: 1.25rem 1.35rem; }
.modal-footer { padding: .85rem 1.35rem; background: rgba(56,189,248,.02); }

/* ── One-time secret reveal ── */
.sm-reveal {
    border-radius: 14px;
    border: 1px solid rgba(245,158,11,.3);
    background: linear-gradient(180deg, rgba(245,158,11,.08), rgba(245,158,11,.02));
    padding: 1rem 1.1rem;
}
.sm-reveal-head { display: flex; gap: .75rem; align-items: center; margin-bottom: .8rem; }
.sm-reveal-icon {
    width: 34px; height: 34px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--warning-subtle); color: var(--warning-text); border: 1px solid rgba(245,158,11,.3);
}
.sm-reveal-sub { font-size: .8rem; color: var(--text-muted); }
.sm-reveal-key {
    display: flex; align-items: center; gap: .75rem;
    padding: .55rem .55rem .55rem .9rem;
    border-radius: 10px; background: var(--surface-base); border: 1px solid var(--border-strong);
}
.sm-reveal-key code { flex: 1; font-family: var(--font-mono); font-size: .85rem; color: var(--text); word-break: break-all; }

/* ── Lookup bar ── */
.sm-lookup {
    position: relative;
    display: flex; align-items: center; gap: .5rem;
    padding: .45rem;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    box-shadow: var(--elev-2);
    max-width: 720px;
}
.sm-lookup:focus-within { border-color: var(--border-focus); box-shadow: var(--elev-2), var(--focus-ring); }
.sm-lookup > .bi { position: absolute; left: 1.15rem; color: var(--text-light); font-size: 1.05rem; pointer-events: none; }
.sm-lookup .form-control {
    flex: 1; border: none; background: transparent; box-shadow: none !important;
    font-size: 1rem; padding: .65rem .5rem .65rem 2.4rem; min-height: 46px;
}
.sm-lookup .btn { padding: .6rem 1.1rem; }
.sm-segment a { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.sm-count {
    min-width: 18px; padding: 0 .35rem; border-radius: 999px;
    font-size: .68rem; font-weight: 650; line-height: 18px; text-align: center;
    background: var(--surface-overlay); color: var(--text-secondary);
}
.sm-count.is-danger { background: var(--danger-subtle); color: var(--danger-text); }
.sm-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.sm-toolbar > form { flex: 1 1 auto; }
.sm-panel-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: .8rem 1.25rem;
    border-top: 1px solid var(--border);
    background: rgba(56,189,248,.02);
}
.sm-panel .sm-dl > dt, .sm-panel .sm-dl > dd { display: flex; align-items: center; }
.sm-panel .sm-dl > dd.text-end { justify-content: flex-end; }
.sm-table tr.sm-subrow td { padding-top: 0; }
.sm-details { font-size: .8rem; }
.sm-details summary { color: var(--text-muted); cursor: pointer; padding: .2rem 0; }
.sm-details pre { margin: .5rem 0 0; white-space: pre-wrap; word-break: break-all; max-height: 240px; overflow: auto; }

/* Wide form section (full-width body, e.g. editable tables) */
.sm-form-section-wide { grid-template-columns: 1fr; gap: 1rem; }
.sm-form-section-wide .sm-form-section-intro p { max-width: 60ch; }
.sm-table-inputs thead th { background: var(--surface); }
.sm-table-inputs tbody td { padding: .5rem .5rem; }
.sm-table-inputs tbody td:first-child { padding-left: 1rem; }
.sm-table-inputs .form-control-sm, .sm-table-inputs .form-select-sm { min-height: 34px; font-size: .82rem; border-radius: 8px; }
.sm-table-inputs tbody tr:hover { background: transparent; }
.sm-zone-known {
    display: flex; flex-wrap: wrap; gap: .35rem; align-items: center;
    padding: .75rem 1rem; border-top: 1px solid var(--border);
    font-size: .8rem; color: var(--text-muted);
}

/* Checklist (multi-select checkboxes) */
.sm-checklist {
    max-height: 300px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--surface-base);
}
.sm-checklist > .form-check {
    margin: 0 !important;
    padding: .65rem .9rem .65rem 2.4rem;
    border-bottom: 1px solid var(--border);
}
.sm-checklist > .form-check:last-child { border-bottom: none; }
.sm-checklist > .form-check:hover { background: rgba(56,189,248,.04); }
.sm-checklist .form-check-label { font-size: .85rem; cursor: pointer; }
.sm-checklist .form-check-label strong { font-weight: 600; }
.sm-form-section-stack { grid-template-columns: 1fr; gap: .9rem; }
.sm-form-section-stack .sm-form-section-intro { display: flex; align-items: center; gap: .75rem; }
.sm-form-section-stack .sm-form-section-intro .sm-form-section-icon { margin-bottom: 0; }
.sm-form-section-stack .sm-form-section-intro h2 { margin: 0; }
.sm-form-section-stack .sm-form-section-intro p { margin-left: auto; text-align: right; }
.sm-secret {
    font-family: var(--font-mono); font-size: .78rem; word-break: break-all;
    padding: .7rem .8rem; border-radius: 10px;
    background: var(--surface-base); border: 1px solid var(--border-strong); color: var(--text-secondary);
}
.sm-color-field { display: flex; align-items: center; gap: .6rem; max-width: 260px; }
.sm-color-field .form-control-color { width: 46px; height: 38px; padding: 4px; border-radius: 10px; flex-shrink: 0; }
.sm-logo-current {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: .75rem; border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface-base);
}
.sm-logo-current img { max-height: 60px; max-width: 200px; object-fit: contain; }
.sm-email-preview { border-radius: 12px; overflow: hidden; border: 1px solid var(--border-strong); box-shadow: 0 18px 40px -20px rgba(0,0,0,.8); }
@media (min-width: 1200px) { .sm-sticky-panel { position: sticky; top: 1rem; } }

/* ── Centered single-card screens ── */
.sm-center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: radial-gradient(800px 400px at 50% 0%, rgba(56,189,248,.08), transparent 70%), var(--shell); }
.sm-center-card { width: 100%; max-width: 480px; padding: .5rem 2rem 2rem; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--elev-2); text-align: center; }
.sm-center-text { font-size: .875rem; color: var(--text-muted); margin: 0 0 .75rem; }

/* ── Stepper ── */
.sm-stepper {
    display: inline-flex; padding: .55rem .9rem; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--elev-1);
    margin-bottom: 1.5rem;
}
.sm-stepper .step-dot { width: 24px; height: 24px; font-size: .7rem; border-width: 1px; }
.sm-stepper .step-line { width: 36px; flex: none; }

/* ── Drop zone ── */
.sm-dropzone {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
    padding: 2.5rem 1.5rem;
    border-radius: 14px;
    border: 1.5px dashed rgba(56,189,248,.35);
    background: radial-gradient(400px 160px at 50% 0%, rgba(56,189,248,.08), transparent 70%), var(--surface-base);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}
.sm-dropzone:hover, .sm-dropzone:focus-within { border-color: var(--brand-accent); }
.sm-dropzone.has-files { border-style: solid; border-color: rgba(34,197,94,.5); }
.sm-dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.sm-dropzone-icon {
    width: 52px; height: 52px; margin-bottom: .5rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px; font-size: 1.5rem; color: var(--brand-accent);
    background: var(--brand-accent-subtle); border: 1px solid rgba(56,189,248,.28);
}
.sm-dropzone-title { font-weight: 650; font-size: .95rem; color: var(--text); }
.sm-dropzone-title u { color: var(--brand-accent); text-decoration-color: rgba(56,189,248,.4); text-underline-offset: 3px; }
.sm-dropzone-sub { font-size: .8rem; color: var(--text-muted); max-width: 46ch; }

/* ── Numbered steps list ── */
.sm-steps-list { list-style: none; margin: 0; padding: .5rem 1.25rem 1rem; }
.sm-steps-list li { display: flex; gap: .8rem; padding: .65rem 0; font-size: .84rem; color: var(--text-muted); }
.sm-steps-list li > span {
    width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700; color: var(--brand-accent);
    background: var(--brand-accent-subtle); border: 1px solid rgba(56,189,248,.28);
}
.sm-steps-list strong { display: block; color: var(--text); font-weight: 600; }

/* ── Ticket stub (ticket detail) ── */
.sm-ticket {
    position: relative;
    display: flex;
    max-width: 760px;
    margin-bottom: 1.5rem;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    background:
        radial-gradient(500px 220px at 0% 0%, rgba(56,189,248,.16), transparent 70%),
        linear-gradient(135deg, #0f1e35, var(--surface));
    box-shadow: var(--elev-2);
}
.sm-ticket-main { flex: 1; padding: 1.5rem 1.6rem; min-width: 0; }
.sm-ticket-event { font-size: .8rem; font-weight: 600; color: var(--brand-accent); }
.sm-ticket-uid { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em; color: #fff; margin-top: .25rem; }
.sm-ticket-stub {
    position: relative;
    width: 150px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 3.2rem; color: rgba(255,255,255,.85);
    border-left: 2px dashed rgba(255,255,255,.14);
    background: linear-gradient(160deg, rgba(56,189,248,.12), rgba(56,189,248,.02));
}
.sm-ticket-stub::before, .sm-ticket-stub::after {
    content: ''; position: absolute; left: -12px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--canvas); border: 1px solid var(--border-strong);
}
.sm-ticket-stub::before { top: -12px; }
.sm-ticket-stub::after { bottom: -12px; }
@media (max-width: 575.98px) { .sm-ticket-stub { width: 90px; font-size: 2.2rem; } .sm-ticket-uid { font-size: 1.15rem; } }

/* ── Conversation thread ── */
.sm-thread { position: relative; display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.25rem; }
.sm-thread::before {
    content: ''; position: absolute; left: 15px; top: 36px; bottom: 16px; width: 1px;
    background: linear-gradient(180deg, var(--border-strong), transparent);
}
.sm-msg { position: relative; display: flex; gap: .9rem; align-items: flex-start; }
.sm-msg > .sm-avatar { position: relative; z-index: 1; box-shadow: 0 0 0 4px var(--canvas), inset 0 0 0 1px hsl(var(--av-h) 70% 60% / .35); }
.sm-msg-body {
    flex: 1; min-width: 0;
    padding: .95rem 1.1rem 1.05rem;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--elev-1);
}
.sm-msg.is-staff .sm-msg-body {
    background: linear-gradient(180deg, rgba(56,189,248,.07), rgba(56,189,248,.02)), var(--surface);
    border-color: rgba(56,189,248,.25);
}
.sm-msg-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.sm-msg-time { margin-left: auto; font-size: .76rem; color: var(--text-light); }
.sm-msg-meta { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }
.sm-msg-subject { font-size: 1rem; font-weight: 650; margin: .8rem 0 .4rem; letter-spacing: -.015em; }
.sm-msg-text { white-space: pre-wrap; line-height: 1.7; font-size: .875rem; color: var(--text-secondary); margin-top: .5rem; }
.sm-composer {
    border-radius: 14px; border: 1px solid var(--border-strong);
    background: var(--surface); box-shadow: var(--elev-2); overflow: hidden;
}
.sm-composer:focus-within { border-color: var(--border-focus); }
.sm-composer textarea.form-control {
    border: none; background: transparent; box-shadow: none !important;
    padding: 1rem 1.1rem; resize: vertical; min-height: 120px;
}
.sm-composer-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: .65rem .75rem .65rem 1.1rem; border-top: 1px solid var(--border); background: rgba(56,189,248,.02);
}

/* ── Billing ── */
.sm-plan-card {
    height: 100%;
    display: flex; flex-direction: column;
    padding: 1.4rem 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(56,189,248,.3);
    background:
        radial-gradient(420px 220px at 100% 0%, rgba(56,189,248,.22), transparent 65%),
        radial-gradient(380px 220px at 0% 100%, rgba(56,189,248,.08), transparent 65%),
        linear-gradient(160deg, #0f1e35, var(--surface));
    box-shadow: var(--elev-2);
    min-height: 220px;
}
.sm-plan-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sm-plan-label { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.sm-plan-name { font-size: 2.2rem; font-weight: 750; letter-spacing: -.04em; color: #fff; margin: .4rem 0 1.25rem; }
.sm-meters { display: flex; flex-direction: column; gap: 1.25rem; }
.sm-meter-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; color: var(--text-secondary); margin-bottom: .5rem; }
.sm-meter-value { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.sm-meter .tg-progress { height: 6px; }
.sm-meter-figures { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.sm-meter-figures > div {
    display: flex; flex-direction: column; font-size: .76rem; color: var(--text-muted);
    padding: .75rem .9rem; border-radius: 10px; background: var(--surface-base); border: 1px solid var(--border);
}
.sm-meter-figures > div > span { font-size: 1.3rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sm-feature-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.sm-feature-list li {
    display: flex; align-items: center; gap: .65rem;
    padding: .8rem 1.25rem; border-bottom: 1px solid var(--border); font-size: .86rem; color: var(--text-muted);
}
.sm-feature-list li .bi { color: var(--text-light); }
.sm-feature-list li.is-on { color: var(--text); }
.sm-feature-list li.is-on .bi { color: var(--success-text); }
.sm-feature-state { margin-left: auto; font-size: .75rem; color: var(--text-light); }
.sm-feature-list li.is-on .sm-feature-state { color: var(--success-text); }

/* ── Pricing ── */
.sm-pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; align-items: stretch; }
.sm-price-card {
    position: relative;
    display: flex; flex-direction: column;
    padding: 1.6rem 1.5rem 1.4rem;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--elev-1);
}
.sm-price-card.is-featured {
    border-color: rgba(56,189,248,.5);
    background:
        radial-gradient(420px 220px at 50% -40px, rgba(56,189,248,.18), transparent 70%),
        linear-gradient(180deg, #0f1e35, var(--surface));
    box-shadow: 0 0 0 4px rgba(56,189,248,.07), 0 30px 70px -30px rgba(56,189,248,.45);
}
.sm-price-card.is-current { border-color: rgba(34,197,94,.45); }
.sm-price-ribbon {
    position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
    padding: .2rem .75rem; border-radius: 999px;
    font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--on-accent); background: linear-gradient(180deg, #7dd3fc, var(--brand-accent));
    box-shadow: 0 6px 16px -6px rgba(56,189,248,.8);
    white-space: nowrap;
}
.sm-price-name { font-size: .95rem; font-weight: 650; color: var(--text-secondary); }
.sm-price-amount { font-size: 2.5rem; font-weight: 750; letter-spacing: -.045em; color: #fff; margin: .4rem 0 .25rem; font-variant-numeric: tabular-nums; }
.sm-price-amount span { font-size: .85rem; font-weight: 500; letter-spacing: 0; color: var(--text-muted); margin-left: .25rem; }
.sm-price-desc { font-size: .84rem; color: var(--text-muted); min-height: 2.8em; margin-bottom: 1.1rem; }
.sm-price-cta { margin-bottom: 1.25rem; }
.sm-price-features { list-style: none; padding: 1.1rem 0 0; margin: 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .6rem; }
.sm-price-features li { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--text); }
.sm-price-features li .bi { color: var(--success-text); font-size: 1rem; }
.sm-price-features li.is-off { color: var(--text-light); }
.sm-price-features li.is-off .bi { color: var(--text-light); }
.sm-feature-list { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.sm-feature-state { white-space: nowrap; }
.sm-rate { display: flex; align-items: center; gap: .6rem; }
.sm-rate .tg-progress { flex: 1; height: 5px; }
.sm-rate > span { font-size: .8rem; font-weight: 600; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Revenue hero ── */
.sm-revenue-hero {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
    padding: 1.5rem 1.6rem;
    border-radius: 18px;
    border: 1px solid rgba(34,197,94,.22);
    background:
        radial-gradient(520px 240px at 0% 0%, rgba(34,197,94,.14), transparent 70%),
        radial-gradient(420px 240px at 100% 100%, rgba(56,189,248,.12), transparent 70%),
        var(--surface);
    box-shadow: var(--elev-2);
}
.sm-revenue-main { display: flex; flex-direction: column; gap: .25rem; }
.sm-revenue-value { font-size: 2.9rem; font-weight: 750; letter-spacing: -.05em; color: #fff; line-height: 1.05; font-variant-numeric: tabular-nums; }
.sm-revenue-split { display: flex; gap: .75rem; flex-wrap: wrap; }
.sm-revenue-split > div {
    display: flex; flex-direction: column; font-size: .76rem; color: var(--text-muted);
    padding: .75rem 1rem; border-radius: 12px; background: rgba(6,12,24,.5); border: 1px solid var(--border); min-width: 170px;
}
.sm-revenue-split > div > span { font-size: 1.2rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.sm-table td > br + small, .sm-table td small.text-muted { font-size: .76rem; }

/* Legacy page headers match the new component */
.page-header { border-bottom: none; padding-bottom: 0; margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; color: #fff; }
.tg-breadcrumb { font-size: .78rem; }
/* Legacy cards headings */
.tg-card .card-body > h5.fw-bold, .tg-card .card-body > h6.fw-bold { font-size: .95rem; font-weight: 650 !important; letter-spacing: -.015em; }
.tg-card .card-body > h5.fw-bold > .bi:first-child, .tg-card .card-body > h6.fw-bold > .bi:first-child { color: var(--text-light) !important; }
