:root {
    --bg: #f3f6fb;
    --ink: #101828;
    --muted: #667085;
    --line: #dde5f0;
    --panel: #ffffff;
    --accent: #1265d8;
    --accent-dark: #0d4fa9;
    --success: #147b4d;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
    --shadow-soft: 0 10px 28px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, #ffffff) 0%, #f8fbff 22%, var(--bg) 58%, #eef3f9 100%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
}
a { color: var(--accent); text-decoration: none; }
.shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 270px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.04), transparent 28%),
        linear-gradient(180deg, #0b1220 0%, #131b2e 58%, #0f172a 100%);
    color: #f9fafb;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: 18px 0 45px rgba(15, 23, 42, .08);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--accent); border-radius: 8px; font-weight: 800; }
.brand small { display: block; color: #aab3c2; margin-top: 2px; }
.menu-check, .menu-open, .menu-close { display: none; }
nav { display: grid; gap: 6px; }
nav a, .logout {
    color: #d8dee8;
    padding: 12px 12px;
    border-radius: 8px;
    font-weight: 650;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
nav a:hover, .logout:hover { background: rgba(255,255,255,.10); color: #fff; transform: translateX(2px); }
nav a.active {
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 72%, #1f2937), rgba(255,255,255,.10));
    color: #fff;
    box-shadow: inset 3px 0 0 rgba(255,255,255,.65), 0 10px 24px rgba(0,0,0,.12);
}
.logout { margin-top: 0; }
.main { flex: 1; min-width: 0; padding: 18px 38px 34px; overflow-x: hidden; }
.auth-main {
    width: 100%;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        linear-gradient(120deg, color-mix(in srgb, var(--accent) 88%, #111827), rgba(17,24,39,.94)),
        url("https://images.unsplash.com/photo-1551434678-e076c223a692?auto=format&fit=crop&w=1600&q=75") center/cover;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 24;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 16px;
    padding: 8px 0 10px;
    background: linear-gradient(180deg, rgba(248,251,255,.96), rgba(248,251,255,.86));
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(221,229,240,.72);
}
.topbar h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
.topbar p { margin: 5px 0 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { background: rgba(255,255,255,.82); border: 1px solid rgba(221,229,240,.9); border-radius: 8px; padding: 10px 14px; box-shadow: var(--shadow-soft); backdrop-filter: blur(10px); }
.notification-menu { position: relative; }
.notification-menu summary {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(221,229,240,.9);
    border-radius: 8px;
    background: rgba(255,255,255,.86);
    cursor: pointer;
    list-style: none;
    box-shadow: 0 8px 24px rgba(20, 32, 54, .06);
}
.notification-menu summary::-webkit-details-marker { display: none; }
.bell { color: var(--accent); font-weight: 900; }
.notification-count {
    position: absolute;
    top: -6px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #d92d20;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}
.notification-panel {
    position: absolute;
    top: 50px;
    right: 0;
    width: 330px;
    z-index: 60;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 10px;
}
.notification-head { display: flex; justify-content: space-between; align-items: center; padding: 8px; }
.notification-item { display: grid; gap: 4px; padding: 10px; border-radius: 8px; color: var(--ink); }
.notification-item:hover, .notification-item.unread { background: #f3f7ff; }
.notification-item span { color: var(--muted); font-size: 13px; }
.panel {
    position: relative;
    overflow: hidden;
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(221,229,240,.92);
    border-radius: 8px;
    padding: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 78%, #fff), transparent 70%);
    opacity: .85;
}
.panel h2 { margin: 0 0 16px; font-size: 18px; letter-spacing: 0; }
.panel > p.muted {
    margin-top: -6px;
    line-height: 1.6;
}
.main > .panel + .panel, .utility-panel { margin-top: 18px; }
.grid > .panel { margin-top: 0; }
.narrow { max-width: 520px; }
.wide { width: 100%; max-width: none; }
.grid { display: grid; gap: 22px; }
.grid.two { grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); align-items: start; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.compact { gap: 14px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metrics.report-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 22px; }
.metric { background: rgba(255,255,255,.92); border: 1px solid rgba(221,229,240,.92); border-radius: 8px; padding: 20px; box-shadow: var(--shadow-soft); }
.metric span { color: var(--muted); }
.metric strong { display: block; font-size: 30px; margin-top: 8px; }
.form { display: grid; gap: 16px; }
.form h2:not(:first-child) {
    margin-top: 12px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
label { display: grid; gap: 7px; color: #344054; font-weight: 700; }
input, select, textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px 13px;
    font: inherit;
    color: var(--ink);
    background: rgba(255,255,255,.96);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
select {
    appearance: none;
    padding-right: 42px;
    background-image:
        linear-gradient(45deg, transparent 50%, #475467 50%),
        linear-gradient(135deg, #475467 50%, transparent 50%),
        linear-gradient(180deg, #f8fafc, #eef4fb);
    background-position:
        calc(100% - 21px) 50%,
        calc(100% - 15px) 50%,
        100% 0;
    background-size:
        6px 6px,
        6px 6px,
        38px 100%;
    background-repeat: no-repeat;
    cursor: pointer;
}
select:hover {
    border-color: color-mix(in srgb, var(--accent) 40%, #cbd5e1);
    background-color: #fff;
}
select:focus {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--accent-dark) 50%),
        linear-gradient(135deg, var(--accent-dark) 50%, transparent 50%),
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, #fff), #eef4fb);
}
select option {
    color: var(--ink);
    background: #fff;
}
select[data-enhanced-select="1"] {
    position: absolute;
    width: 1px !important;
    min-width: 1px !important;
    height: 1px !important;
    min-height: 1px !important;
    opacity: 0;
    pointer-events: none;
}
.select-ui {
    position: relative;
    width: 100%;
}
.select-ui-button {
    position: relative;
    width: 100%;
    min-height: 46px;
    display: block;
    text-align: left;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px 42px 12px 13px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,255,.98));
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    box-shadow: none;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.select-ui-button::after {
    content: "";
    position: absolute;
    right: 17px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--accent-dark);
    border-bottom: 2px solid var(--accent-dark);
    transform: translateY(-62%) rotate(45deg);
    transition: transform .18s ease;
}
.select-ui-button:hover,
.select-ui.is-open .select-ui-button {
    background: #fff;
    border-color: color-mix(in srgb, var(--accent) 46%, #cbd5e1);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 11%, transparent);
}
.select-ui-button:hover {
    transform: none;
}
.select-ui.is-open .select-ui-button::after {
    transform: translateY(-35%) rotate(225deg);
}
.select-ui-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 7px);
    z-index: 90;
    display: none;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
    border-radius: 8px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 18px 42px rgba(15, 23, 42, .16);
}
.select-ui.is-open .select-ui-menu {
    display: grid;
    gap: 4px;
}
.select-ui-option {
    width: 100%;
    min-height: 40px;
    display: block;
    text-align: left;
    border: 0;
    border-radius: 8px;
    padding: 10px 12px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-weight: 650;
    box-shadow: none;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}
.select-ui-option:hover,
.select-ui-option.is-selected {
    background: color-mix(in srgb, var(--accent) 11%, #fff);
    color: var(--accent-dark);
    transform: none;
}
.select-ui-option.is-selected {
    box-shadow: inset 3px 0 0 var(--accent);
}
.select-ui.is-disabled .select-ui-button {
    background: #f1f5f9;
    color: #667085;
    cursor: not-allowed;
    box-shadow: none;
}
input[type="date"][data-enhanced-date="1"] {
    position: absolute;
    width: 1px !important;
    min-width: 1px !important;
    height: 1px !important;
    min-height: 1px !important;
    opacity: 0;
    pointer-events: none;
}
.date-ui {
    position: relative;
    width: 100%;
}
.date-ui-button {
    position: relative;
    width: 100%;
    min-height: 46px;
    display: block;
    text-align: left;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px 44px 12px 13px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,255,.98));
    color: var(--ink);
    font: inherit;
    font-weight: 750;
    box-shadow: none;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.date-ui-button::after {
    content: "";
    position: absolute;
    right: 15px;
    top: 50%;
    width: 17px;
    height: 17px;
    border: 2px solid var(--accent-dark);
    border-radius: 5px;
    transform: translateY(-50%);
    opacity: .9;
}
.date-ui-button::before {
    content: "";
    position: absolute;
    right: 18px;
    top: calc(50% - 5px);
    width: 11px;
    height: 2px;
    background: var(--accent-dark);
    z-index: 1;
}
.date-ui-button:hover,
.date-ui.is-open .date-ui-button {
    background: #fff;
    border-color: color-mix(in srgb, var(--accent) 46%, #cbd5e1);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 11%, transparent);
}
.date-ui-button:hover {
    transform: none;
}
.date-ui.is-empty .date-ui-button {
    color: #667085;
}
.date-ui-panel {
    position: absolute;
    left: 0;
    top: calc(100% + 7px);
    z-index: 95;
    display: none;
    width: 320px;
    max-width: min(320px, calc(100vw - 36px));
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
    border-radius: 8px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 18px 42px rgba(15, 23, 42, .16);
}
.date-ui.is-open .date-ui-panel {
    display: grid;
    gap: 12px;
}
.date-ui-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px 34px;
    gap: 8px;
    align-items: center;
}
.date-ui-head strong {
    font-size: 14px;
    color: var(--ink);
}
.date-ui-head button,
.date-ui-actions button {
    min-height: 34px;
    border-radius: 8px;
    padding: 0;
    background: #eef2f7;
    color: var(--ink);
    box-shadow: none;
}
.date-ui-head button:hover,
.date-ui-actions button:hover {
    background: color-mix(in srgb, var(--accent) 12%, #eef2f7);
    color: var(--accent-dark);
    transform: none;
}
.date-ui-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}
.date-ui-dayname {
    display: grid;
    place-items: center;
    min-height: 28px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}
.date-ui-day {
    min-height: 36px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0;
    background: transparent;
    color: var(--ink);
    font-weight: 700;
    box-shadow: none;
}
.date-ui-day:hover {
    background: color-mix(in srgb, var(--accent) 10%, #fff);
    color: var(--accent-dark);
    transform: none;
}
.date-ui-day.is-muted {
    color: #98a2b3;
}
.date-ui-day.is-today {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.date-ui-day.is-selected {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.date-ui-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding-top: 4px;
    border-top: 1px solid var(--line);
}
.date-ui-actions button {
    min-width: 78px;
    color: var(--accent-dark);
    font-weight: 800;
}
.date-ui.is-disabled .date-ui-button {
    background: #f1f5f9;
    color: #667085;
    cursor: not-allowed;
    box-shadow: none;
}
input::placeholder, textarea::placeholder { color: #98a2b3; }
input:disabled, select:disabled, textarea:disabled {
    background: #f1f5f9;
    color: #667085;
    cursor: not-allowed;
}
input:focus, select:focus, textarea:focus {
    border-color: color-mix(in srgb, var(--accent) 70%, #cbd5e1);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent);
    outline: 0;
}
input[type="color"] { padding: 4px; height: 44px; }
textarea { min-height: 130px; resize: vertical; }
button {
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-weight: 750;
    padding: 12px 16px;
    cursor: pointer;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 22%, transparent);
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
button:hover { background: var(--accent-dark); transform: translateY(-1px); }
button.danger-button { background: #b42318; }
button.danger-button:hover { background: #8f1d13; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.input-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 750;
    padding: 10px 14px;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 18%, transparent);
    transition: transform .18s ease, background .18s ease, color .18s ease;
}
.button:hover { background: var(--accent-dark); color: #fff; transform: translateY(-1px); }
.button.secondary { background: #eef2f7; color: var(--ink); box-shadow: none; }
.button.secondary:hover { background: #dfe7f1; color: var(--ink); }
.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 18px;
    margin-bottom: 18px;
}
.hero-copy {
    min-height: 255px;
    display: grid;
    align-content: center;
    gap: 16px;
    padding: 34px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, #dce5f1);
    border-radius: 8px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, #fff) 0%, rgba(255,255,255,.94) 48%, #fff 100%);
    box-shadow: var(--shadow);
}
.hero-copy h2 {
    max-width: 840px;
    margin: 0;
    font-size: 36px;
    line-height: 1.08;
}
.hero-copy p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}
.ai-status-card {
    display: grid;
    align-content: center;
    gap: 10px;
    min-height: 255px;
    padding: 26px;
    border-radius: 8px;
    color: #fff;
    background:
        linear-gradient(145deg, #101828 0%, color-mix(in srgb, var(--accent) 45%, #111827) 100%);
    box-shadow: var(--shadow);
}
.ai-orbit {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;
    background: rgba(255,255,255,.10);
    font-weight: 900;
}
.ai-status-card span { color: rgba(255,255,255,.72); }
.ai-status-card strong { font-size: 44px; line-height: 1; }
.ai-status-card p { margin: 0; color: rgba(255,255,255,.76); line-height: 1.55; }
.dashboard-metrics { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.metric-modern {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 8px;
}
.metric-modern::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 35%, #14b8a6));
}
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 18px;
}
.command-panel { min-height: 280px; }
.quick-actions { display: grid; gap: 10px; }
.quick-actions a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
    color: var(--ink);
}
.quick-actions a:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: #fff; }
.quick-actions span { color: var(--accent); font-weight: 800; }
.compact-ticket-list { display: grid; gap: 10px; }
.compact-ticket-list a, .compact-ticket-list div {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 5px 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
    color: var(--ink);
}
.compact-ticket-list a:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: #fff; }
.compact-ticket-list .status-dot { grid-row: span 2; align-self: start; }
.compact-ticket-list strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.compact-ticket-list small { color: var(--muted); }
.table-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.table-title h2 { margin: 0; }
.table-title span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; -webkit-overflow-scrolling: touch; background: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.9); }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 720px; }
th, td { text-align: left; padding: 14px 15px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, #fff); }
tbody tr:last-child td { border-bottom: 0; }
th { color: #475467; font-size: 12px; text-transform: uppercase; background: linear-gradient(180deg, #fbfdff, #f4f7fb); letter-spacing: .04em; }
.badge, .status-dot {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, #fff);
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 750;
}
.status-dot { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.ticket-link { font-weight: 800; }
.subtext { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.search-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    margin: 0 0 16px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
}
.actions { min-width: 360px; }
.inline-form { display: inline-grid; grid-template-columns: minmax(118px, 1fr) auto; gap: 8px; align-items: center; margin: 4px 0; }
.inline-form input, .inline-form select { height: 38px; padding: 7px 9px; }
.inline-form button { height: 38px; padding: 0 12px; }
.agent-actions { min-width: 180px; }
.inline-action-form { display: inline-flex; margin: 3px 4px 3px 0; }
.inline-action-form button { height: 38px; padding: 0 12px; }
.row-editor { min-width: 260px; }
.row-editor summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border-radius: 8px;
    background: #eef2f7;
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}
.row-editor summary::-webkit-details-marker { display: none; }
.row-editor summary:hover { background: #dfe7f1; }
.row-editor[open] summary { margin-bottom: 12px; }
.row-editor-form {
    display: grid;
    gap: 10px;
    min-width: 280px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
}
.row-delete-form { margin-top: 10px; }
.row-delete-form button { width: 100%; }
.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pagination a {
    min-width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-weight: 750;
    box-shadow: var(--shadow-soft);
}
.pagination a.active, .pagination a:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.muted { color: var(--muted); }
.alert { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid; background: #fff; box-shadow: var(--shadow-soft); }
.alert.error { color: var(--danger); border-color: #f4b7b0; }
.alert.success { color: var(--success); border-color: #a9dfc5; }
.auth-card { width: min(980px, 100%); display: grid; grid-template-columns: 1fr 380px; gap: 28px; align-items: center; color: #fff; }
.auth-copy h1 { font-size: 46px; line-height: 1.05; margin: 8px 0 14px; }
.auth-copy p { color: rgba(255,255,255,.82); font-size: 18px; max-width: 620px; }
.auth-card .panel { color: var(--ink); }
.auth-card .panel {
    background: rgba(255,255,255,.96);
    border-color: rgba(255,255,255,.72);
    box-shadow: 0 24px 70px rgba(2, 6, 23, .28);
}
.eyebrow { color: var(--accent); font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: .08em; }
.auth-copy .eyebrow { color: rgba(255,255,255,.9); }
.ticket-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 11%, #fff), rgba(255,255,255,.94));
}
.ticket-head h2 { margin: 4px 0; }
.ticket-head p { margin: 6px 0 0; color: var(--muted); }
.status { background: #eef4ff; color: var(--accent-dark); border: 1px solid color-mix(in srgb, var(--accent) 18%, #dbeafe); border-radius: 999px; padding: 8px 12px; }
.thread { display: grid; gap: 12px; margin-bottom: 16px; }
.message { background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 8px; padding: 17px; box-shadow: var(--shadow-soft); }
.message p { white-space: pre-wrap; }
.message small { color: var(--muted); }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.attachments a { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #f8fafc; color: var(--ink); transition: border-color .16s ease, background .16s ease; }
.attachments a:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: #fff; }
.attachments span { color: var(--muted); margin-left: 6px; }
.checks { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.checks label { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fbfdff; transition: border-color .16s ease, background .16s ease; }
.checks label:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: #fff; }
.checks input { width: auto; }
.checks.vertical { grid-template-columns: 1fr; align-content: start; }
.template-editor { display: grid; gap: 14px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.template-editor h2, .template-card h3 { margin: 0; }
.template-editor p { margin: -8px 0 0; }
.template-card { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fbfdff; }
.report-filter { margin-bottom: 22px; }
.ai-panel { margin-bottom: 16px; }
.ai-panel button {
    background: linear-gradient(135deg, #101828, color-mix(in srgb, var(--accent) 48%, #101828));
}
button:disabled { cursor: not-allowed; opacity: .55; }
button:disabled:hover { transform: none; }
@media (max-width: 980px) {
    .shell { display: block; }
    .sidebar {
        width: 100%;
        min-height: auto;
        position: sticky;
        top: 0;
        z-index: 30;
        padding: 14px;
        gap: 12px;
    }
    .brand { padding: 0 4px 8px; }
    .brand > div {
        min-width: 0;
        flex: 1;
    }
    .menu-open {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        gap: 4px;
        flex: 0 0 auto;
        margin-left: auto;
        border: 1px solid rgba(255,255,255,.16);
        border-radius: 8px;
        background: rgba(255,255,255,.08);
        cursor: pointer;
    }
    .menu-open span {
        width: 18px;
        height: 2px;
        display: block;
        background: #fff;
        border-radius: 999px;
    }
    nav {
        display: none;
        position: absolute;
        top: calc(100% - 2px);
        left: 14px;
        right: 14px;
        z-index: 40;
        gap: 6px;
        max-height: calc(100vh - 92px);
        overflow-y: auto;
        padding: 12px;
        border: 1px solid rgba(255,255,255,.14);
        border-radius: 8px;
        background: #111827;
        box-shadow: 0 22px 48px rgba(15, 23, 42, .28);
    }
    .menu-check:checked + nav { display: grid; }
    .menu-close {
        width: 38px;
        height: 38px;
        display: grid;
        place-items: center;
        justify-self: end;
        border-radius: 8px;
        background: rgba(255,255,255,.08);
        color: #fff;
        font-weight: 900;
        cursor: pointer;
    }
    nav a, .logout {
        white-space: nowrap;
        background: rgba(255,255,255,.06);
    }
    .main { padding: 4px 22px 22px; }
    .topbar {
        top: 0;
        margin: 0 -22px 14px;
        padding: 6px 22px 8px;
    }
    .grid.two, .grid.three, .auth-card { grid-template-columns: 1fr; }
    .metrics, .metrics.report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-hero, .dashboard-grid { grid-template-columns: 1fr; }
    .hero-copy, .ai-status-card { min-height: auto; }
    .wide, .narrow { max-width: none; }
    .actions { min-width: 300px; }
}
@media (max-width: 620px) {
    body { font-size: 14px; }
    .main, .auth-main { padding: 0 14px 14px; }
    .sidebar { padding: 6px 10px; }
    .brand {
        gap: 10px;
        align-items: center;
        padding-bottom: 6px;
    }
    .brand-mark {
        width: 32px;
        height: 32px;
    }
    .brand strong {
        display: block;
        max-width: calc(100vw - 92px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    nav a, .logout {
        padding: 10px 11px;
        font-size: 13px;
    }
    .panel {
        padding: 14px;
        box-shadow: 0 10px 28px rgba(20, 32, 54, .08);
    }
    .panel h2 {
        font-size: 17px;
    }
    .metrics, .metrics.report-metrics, .checks { grid-template-columns: 1fr; }
    .metric {
        padding: 16px;
    }
    .metric strong {
        font-size: 26px;
    }
    .dashboard-hero {
        gap: 12px;
    }
    .hero-copy {
        padding: 20px;
    }
    .hero-copy h2 {
        font-size: 27px;
        line-height: 1.16;
    }
    .hero-copy p {
        font-size: 14px;
    }
    .ai-status-card {
        padding: 18px;
    }
    .ai-status-card strong {
        font-size: 34px;
    }
    .compact-ticket-list a, .compact-ticket-list div {
        grid-template-columns: 1fr;
    }
    .compact-ticket-list .status-dot {
        grid-row: auto;
        justify-self: start;
    }
    .compact-ticket-list strong {
        white-space: normal;
    }
    .ticket-head { align-items: flex-start; flex-direction: column; }
    .topbar {
        top: 0;
        margin: 0 -14px 10px;
        padding: 5px 14px 7px;
        align-items: center;
        flex-direction: row;
    }
    .topbar h1 {
        font-size: 21px;
        line-height: 1.18;
    }
    .topbar p { margin-top: 2px; }
    .top-actions { width: auto; justify-content: flex-end; margin-left: auto; }
    .user-chip {
        max-width: calc(100vw - 90px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .notification-panel { left: 0; right: auto; width: calc(100vw - 32px); }
    .table-title { align-items: stretch; flex-direction: column; }
    .table-title .button { width: 100%; }
    .search-bar { grid-template-columns: 1fr; }
    .search-bar button, .search-bar .button, .form-actions button, .form-actions .button { width: 100%; }
    .input-action { grid-template-columns: 1fr; }
    .input-action .button { width: 100%; }
    input, select, textarea, button, .button {
        min-height: 44px;
    }
    .grid {
        gap: 14px;
    }
    .grid.compact {
        gap: 12px;
    }
    .inline-form {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        margin: 8px 0;
    }
    .inline-form input, .inline-form select, .inline-form button {
        width: 100%;
        height: 42px;
    }
    .actions {
        min-width: 260px;
    }
    .pagination {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
    }
    .pagination a {
        width: 100%;
    }
    table { display: block; overflow-x: auto; white-space: nowrap; }
    .ticket-table { border: 0; overflow: visible; }
    .ticket-table table, .ticket-table thead, .ticket-table tbody, .ticket-table tr, .ticket-table td { display: block; min-width: 0; width: 100%; }
    .ticket-table thead { display: none; }
    .ticket-table tr { border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 12px; padding: 6px 0; }
    .ticket-table td { border-bottom: 0; padding: 9px 12px; white-space: normal; }
    .ticket-table td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; margin-bottom: 3px; }
    .auth-card {
        gap: 18px;
    }
    .auth-copy h1 { font-size: 34px; }
    .auth-copy p {
        font-size: 15px;
    }
    .thread {
        gap: 10px;
    }
    .message {
        padding: 13px;
    }
    .attachments a {
        width: 100%;
        overflow-wrap: anywhere;
    }
    .date-ui-panel {
        left: 50%;
        transform: translateX(-50%);
        width: calc(100vw - 28px);
    }
    .date-ui-head button {
        min-height: 34px;
    }
    .date-ui-day {
        min-height: 34px;
    }
    .date-ui-actions button {
        min-height: 36px;
        width: auto;
    }
}
