:root {
    --bg: #202020;
    --bg-soft: #101010;
    --panel: #1b1b1b;
    --panel-strong: #181818;
    --panel-alt: #1c1c1c;
    --line: rgba(255, 255, 255, 0.05);
    --text: #e7e7e7;
    --text-soft: #b8b8b8;
    --muted: #8c8c8c;
    --accent: #c6550e;
    --accent-soft: #d98b58;
    --accent-deep: #8f3c09;
    --danger: #ff6b57;
    --success: #55c987;
    --shadow: 0 9px 18px rgba(0, 0, 0, 0.14);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: #202020;
}
body.portal-staff,
body.portal-customer {
    font-size: 12.5px;
    background: #202020;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 16%, rgba(198, 85, 14, 0.14), transparent 28%),
        radial-gradient(circle at 78% 20%, rgba(198, 85, 14, 0.1), transparent 24%),
        linear-gradient(180deg, #171717 0%, #101010 100%);
}
.auth-page::before,
.auth-page::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}
.auth-page::before {
    z-index: -2;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.34));
}
.auth-page::after {
    z-index: -1;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.26) 100%);
}
.auth-shell {
    width: min(1120px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.24);
    overflow: hidden;
}
.auth-panel {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    min-height: 604px;
}
.auth-panel-compact { display: block; min-height: auto; }
.auth-brand {
    padding: 36px 46px 40px;
    background:
        radial-gradient(circle at top left, rgba(198, 85, 14, 0.16), transparent 34%),
        linear-gradient(180deg, #181818 0%, #101010 100%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 100%;
}
.auth-brand .eyebrow { margin: 0; }
.auth-brand-content {
    margin-top: auto;
    display: grid;
    gap: 8px;
    width: 100%;
}
.auth-brand h1 {
    margin: 0;
    font-size: clamp(2rem, 3.2vw, 2.9rem);
    line-height: 1.04;
    max-width: 11ch;
}
.auth-logo {
    display: block;
    width: min(100%, 520px);
    height: auto;
    max-width: none;
    max-height: none;
    justify-self: start;
    margin: 0 0 4px -12px;
}
.auth-copy, .page-copy, .muted-copy, .panel-heading p, .table-toolbar p, .auth-card-header p { color: var(--text-soft); line-height: 1.7; }
.auth-copy { margin: 0; max-width: 38ch; }
.auth-card {
    padding: 40px 46px;
    background: #101010;
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-page input:not([type="checkbox"]):not([type="radio"]),
.auth-page select,
.auth-page textarea {
    border-radius: 10px;
    padding: 9px 11px;
    min-height: 40px;
}
.auth-page textarea { min-height: 120px; }
.auth-page button,
.auth-page .button-primary,
.auth-page .button-secondary,
.auth-page .button-danger {
    gap: 7px;
    min-height: 38px;
    border-radius: 10px;
    padding: 0 14px;
}
.auth-card-header h1, .auth-card-header h2, .page-hero h1, .panel-heading h2, .composer-card h2, .side-card h2, .stat-value { margin: 0; }
.side-card > h2 + * { margin-top: 16px; }
.auth-card-header {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}
.auth-links {
    margin-top: 16px;
    color: var(--accent-soft);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.auth-link-muted { color: var(--muted); }

.portal-shell {
    display: grid;
    grid-template-columns: 272px 1fr;
    min-height: 100vh;
    background: transparent;
}
body.portal-customer .portal-shell { grid-template-columns: 264px 1fr; }
.sidebar {
    position: sticky;
    top: 0;
    min-height: 100vh;
    padding: 18px 14px 16px;
    background: var(--portal-sidebar-bg, #101010);
    border-right: 1px solid var(--portal-sidebar-line, var(--line));
    box-shadow: 8px 0 22px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    isolation: isolate;
}
.sidebar::before,
.sidebar::after {
    content: "";
    position: absolute;
    inset: -12%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.22;
    will-change: transform;
}
.sidebar::before {
    background:
        radial-gradient(circle at 14% 16%, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.08) 1px, transparent 1.9px),
        radial-gradient(circle at 24% 38%, rgba(198, 85, 14, 0.08) 0, rgba(198, 85, 14, 0.08) 1.2px, transparent 2.2px),
        radial-gradient(circle at 36% 22%, rgba(255, 255, 255, 0.06) 0, rgba(255, 255, 255, 0.06) 1.1px, transparent 2px),
        radial-gradient(circle at 48% 54%, rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px, transparent 1.8px),
        radial-gradient(circle at 62% 18%, rgba(198, 85, 14, 0.06) 0, rgba(198, 85, 14, 0.06) 1.1px, transparent 2px),
        radial-gradient(circle at 76% 42%, rgba(255, 255, 255, 0.07) 0, rgba(255, 255, 255, 0.07) 1.3px, transparent 2.3px),
        radial-gradient(circle at 84% 72%, rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px, transparent 1.8px);
    animation: sidebarParticleDriftA 30s linear infinite;
}
.sidebar::after {
    background:
        radial-gradient(circle at 18% 68%, rgba(255, 255, 255, 0.06) 0, rgba(255, 255, 255, 0.06) 1px, transparent 1.8px),
        radial-gradient(circle at 30% 84%, rgba(198, 85, 14, 0.05) 0, rgba(198, 85, 14, 0.05) 1.1px, transparent 2px),
        radial-gradient(circle at 44% 34%, rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px, transparent 1.8px),
        radial-gradient(circle at 58% 78%, rgba(255, 255, 255, 0.07) 0, rgba(255, 255, 255, 0.07) 1.2px, transparent 2.1px),
        radial-gradient(circle at 68% 58%, rgba(198, 85, 14, 0.05) 0, rgba(198, 85, 14, 0.05) 1px, transparent 1.8px),
        radial-gradient(circle at 82% 26%, rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px, transparent 1.8px),
        radial-gradient(circle at 90% 48%, rgba(255, 255, 255, 0.06) 0, rgba(255, 255, 255, 0.06) 1.1px, transparent 2px);
    opacity: 0.16;
    animation: sidebarParticleDriftB 38s linear infinite;
}
.sidebar > * {
    position: relative;
    z-index: 1;
}
body.portal-customer .sidebar {
    background: var(--portal-sidebar-bg, #101010);
}
.sidebar-brand { margin-bottom: 8px; }
.brand-link { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; }
.brand-name { font-size: 0.94rem; font-weight: 700; color: var(--portal-sidebar-text, var(--text)); }
.brand-kicker, .eyebrow, .thread-type {
    color: var(--accent-soft);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.field-help {
    margin: 6px 0 0;
    color: var(--accent-soft);
    font-size: 0.74rem;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.sidebar-note, .sidebar-insight {
    padding: 10px;
    background: var(--portal-sidebar-panel-bg, #181818);
    border: 1px solid var(--portal-sidebar-line, var(--line));
    border-radius: var(--radius);
}
.sidebar-insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sidebar-insight span { display: block; color: var(--portal-sidebar-muted, var(--muted)); font-size: 0.72rem; }
.sidebar-insight strong { font-size: 1.18rem; display: block; margin-top: 4px; color: var(--portal-sidebar-text, var(--text)); }
.sidebar-nav { display: flex; flex-direction: column; gap: 14px; margin-top: 2px; }
.sidebar-section { display: grid; gap: 7px; }
.sidebar-section-separated { padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-section-label {
    color: var(--portal-sidebar-muted, var(--muted));
    font-size: 0.67rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 0 4px;
}
.sidebar-section-links { display: flex; flex-direction: column; gap: 3px; }
.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 10px 8px 12px;
    min-height: 36px;
    border-radius: var(--radius-sm);
    color: var(--portal-sidebar-soft, var(--text-soft));
    border: 1px solid transparent;
    background: transparent;
    overflow: hidden;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
    font-size: 0.89rem;
}
.sidebar-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2px;
    border-radius: 999px;
    background: transparent;
    transition: background-color 0.18s ease;
}
.sidebar-link-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    width: 100%;
}
.sidebar-link-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--portal-sidebar-muted, var(--muted));
    transition: color 0.18s ease;
}
.sidebar-link-icon svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sidebar-link-label {
    min-width: 0;
    line-height: 1.2;
}
.sidebar-link-meta {
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.sidebar-link-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(198, 85, 14, 0.12);
    border: 1px solid rgba(198, 85, 14, 0.22);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    white-space: nowrap;
}
.sidebar-link:hover {
    background: var(--portal-sidebar-hover-bg, #181818);
    border-color: var(--portal-sidebar-line, var(--line));
    color: var(--portal-sidebar-text, var(--text));
}
.sidebar-link:hover .sidebar-link-icon {
    color: var(--accent-soft);
}
.sidebar-link.active {
    background: var(--portal-sidebar-active-bg, rgba(255, 255, 255, 0.04));
    border-color: var(--portal-sidebar-line, var(--line));
    color: var(--portal-sidebar-text, var(--text));
}
.sidebar-link.active::before {
    background: #c6550e;
}
.sidebar-link.active .sidebar-link-icon {
    color: #c6550e;
}
.sidebar-link-danger { color: #f0cbc2; }
.sidebar-link-danger:hover {
    background: rgba(255, 107, 87, 0.08);
    border-color: rgba(255, 107, 87, 0.16);
}
.sidebar-link-danger.active {
    background: rgba(255, 107, 87, 0.12);
    border-color: rgba(255, 107, 87, 0.2);
}
.sidebar-link-danger.active::before {
    background: var(--danger);
}
.sidebar-link-danger:hover .sidebar-link-icon,
.sidebar-link-danger.active .sidebar-link-icon {
    color: #ff8c7a;
}

.portal-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #202020;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 22px;
    padding: 14px 20px;
    background: var(--portal-topbar-bg, #101010);
    border-bottom: 1px solid var(--portal-topbar-line, var(--line));
}
.topbar-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
    flex: 0 1 auto;
    max-width: 250px;
}
.topbar-kicker {
    color: var(--portal-topbar-muted, var(--muted));
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.topbar-title {
    color: var(--portal-topbar-text, var(--text));
    font-size: 0.96rem;
    line-height: 1.2;
}
.topbar-search {
    flex: 0 1 400px;
    display: flex;
    justify-content: flex-start;
    margin-right: auto;
}
.topbar-search-field {
    position: relative;
    width: min(100%, 390px);
    display: flex;
    align-items: center;
    min-width: 0;
}
.topbar-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--portal-topbar-muted, var(--muted));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}
.topbar-search-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.topbar-search input {
    width: 100%;
    min-width: 0;
    padding-left: 44px;
    background: var(--portal-topbar-panel-bg, #181818);
    border-color: var(--portal-topbar-line, var(--line));
    color: var(--portal-topbar-text, var(--text));
}
.topbar-user-link {
    display: grid;
    gap: 2px;
    justify-items: end;
    min-width: max-content;
    margin: -6px -10px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.topbar-user-link:hover,
.topbar-user-link:focus-visible {
    background: var(--portal-topbar-hover-bg, #181818);
    border-color: var(--portal-topbar-line, var(--line));
    outline: none;
}
.topbar-user-name {
    color: var(--portal-topbar-text, var(--text));
    font-size: 0.88rem;
}
.topbar-user-role {
    color: var(--portal-topbar-muted, var(--muted));
    font-size: 0.74rem;
}

.main {
    flex: 1 1 auto;
    padding: 18px;
    min-width: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(198, 85, 14, 0.10), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.015) 0%, rgba(255, 255, 255, 0) 100%);
}
body.portal-customer .main { padding: 20px 18px; }
.main > .page-hero .page-copy,
.main > .page-hero .muted-copy,
.main > .settings-workspace .settings-local-nav-copy p {
    color: var(--text-soft);
}
.main > .page-hero h1,
.main > .settings-workspace .settings-local-nav-copy h2 {
    color: var(--text);
}
.panel-card,
.side-card,
.composer-card,
.thread-card,
.stat-card,
.bulk-action-bar,
.checkbox-card,
.queue-tab,
.attachment-chip,
.linked-ticket-link,
.attachment-preview-panel,
.attachment-preview-body,
.linked-ticket-link-block {
    color: var(--text);
}
.page-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
}
.page-hero h1 { font-size: clamp(1.4rem, 2.4vw, 2rem); margin-top: 4px; line-height: 1.08; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-hero-ticket { align-items: center; }
.hero-actions-ticket { align-items: center; justify-content: flex-end; }

.settings-workspace {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.settings-local-nav {
    position: sticky;
    top: 92px;
    display: grid;
    gap: 12px;
}
.settings-local-nav-copy {
    display: grid;
    gap: 8px;
}
.settings-local-nav-copy h2 {
    margin: 0;
}
.settings-local-nav-links {
    display: grid;
    gap: 4px;
}
.settings-local-nav-link {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 10px 7px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-soft);
    background: rgba(255, 255, 255, 0.02);
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.settings-local-nav-link:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text);
}
.settings-local-nav-link.is-current,
.settings-local-nav-link[aria-current="location"] {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text);
    box-shadow: inset 2px 0 0 #c6550e;
}
.settings-page-layout {
    display: grid;
    gap: 14px;
    min-width: 0;
    max-width: 100%;
}
.settings-workspace-static {
    grid-template-columns: minmax(0, 1fr);
}
.settings-layout {
    width: 100%;
}
.settings-workspace-main {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}
.settings-layout-main {
    min-width: 0;
}
.settings-form-stack {
    display: grid;
    gap: 14px;
    min-width: 0;
}
.settings-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
    width: 100%;
    min-width: 0;
}
.settings-card-grid > * {
    min-width: 0;
}
.settings-section-card-full {
    margin-top: 0;
}
.settings-inline-note {
    padding-top: 4px;
}
.settings-card-actions {
    align-items: center;
    width: 100%;
    min-width: 0;
    margin-top: 4px;
    padding-bottom: 10px;
}
.settings-card-actions .field-note {
    color: var(--muted);
    font-size: 0.79rem;
    line-height: 1.55;
    flex: 1 1 280px;
    min-width: 0;
}
.ignored-email-summary {
    padding-top: 4px;
}
.ignored-email-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.ignored-email-count {
    color: var(--muted);
    font-size: 0.82rem;
}
.ignored-email-list {
    display: grid;
    gap: 10px;
}
.ignored-email-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
}
.ignored-email-address {
    color: var(--text);
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}
.ignored-email-user {
    display: grid;
    gap: 6px;
    min-width: 0;
}
.ignored-email-user-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.82rem;
}
.ignored-email-remove {
    flex-shrink: 0;
}
.settings-section-card,
.profile-form-section {
    scroll-margin-top: 108px;
}
.settings-section-card {
    min-height: 100%;
    width: 100%;
}
.settings-section-grid {
    align-content: start;
    width: 100%;
    min-width: 0;
}
.settings-section-grid > * {
    min-width: 0;
}
.settings-section-card .panel-heading > *,
.settings-section-card .panel-heading p,
.settings-section-card .field-help,
.settings-section-card .field-note,
.settings-section-card code {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.settings-submit-row {
    justify-content: flex-start;
    margin-top: 4px;
}
.settings-side-meta dd {
    max-width: 18ch;
    overflow-wrap: anywhere;
}

.panel-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 14px; align-items: start; }
.panel-grid-single { grid-template-columns: minmax(0, 1fr); }
.panel-card, .side-card, .composer-card, .thread-card, .stat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 0;
}
.panel-card, .side-card, .composer-card, .thread-card { padding: 14px; }
.panel-heading, .table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}
.panel-heading > * {
    min-width: 0;
}
.table-toolbar-staff {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(520px, 1.2fr);
    align-items: end;
}
.table-toolbar-customer { margin-bottom: 16px; }
.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
}
.bulk-action-bar-copy {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.bulk-action-bar-copy strong {
    font-size: 0.9rem;
}
.bulk-action-count {
    color: var(--muted);
    font-size: 0.82rem;
}
.bulk-action-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.bulk-action-bar-actions .button-secondary:disabled,
.bulk-action-bar-actions .button-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.portal-check {
    appearance: none;
    -webkit-appearance: none;
    display: inline-grid;
    place-content: center;
    box-sizing: border-box;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    max-width: 16px;
    max-height: 16px;
    margin: 0;
    padding: 0;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #121212;
    position: relative;
    cursor: pointer;
    vertical-align: middle;
    align-self: center;
    line-height: 1;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}
.portal-check:hover {
    border-color: rgba(198, 85, 14, 0.32);
}
.portal-check:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(198, 85, 14, 0.16);
    border-color: rgba(198, 85, 14, 0.42);
}
.portal-check:checked {
    background: var(--accent);
    border-color: rgba(198, 85, 14, 0.6);
}
.portal-check:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #fff4eb;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.checkbox-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    cursor: pointer;
}
.checkbox-card span {
    line-height: 1.4;
}

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dashboard-stats-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 18px; }
.stat-card {
    padding: 14px;
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.stat-card-accent {
    background: linear-gradient(180deg, rgba(198, 85, 14, 0.1), #181818 100%);
    border-color: rgba(198, 85, 14, 0.12);
}
.stat-label { display: block; color: var(--muted); margin-bottom: 10px; font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; }
.stat-value { font-size: 1.95rem; }
.stat-link { display: inline-flex; margin-top: 10px; color: var(--accent-soft); font-size: 0.84rem; }

.queue-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.queue-tab, .attachment-chip, .linked-ticket-link {
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--panel-strong);
    color: var(--text-soft);
    font-size: 0.84rem;
}
.attachment-chip-preview {
    border-color: rgba(198, 85, 14, 0.22);
    background: rgba(198, 85, 14, 0.08);
}
.attachment-chip-download {
    border-style: dashed;
}
.queue-tab.active { border-color: rgba(198, 85, 14, 0.18); background: rgba(198, 85, 14, 0.09); color: var(--text); }

.ticket-detail-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) 300px; gap: 12px; align-items: start; }
.ticket-thread-column, .ticket-side-column { display: flex; flex-direction: column; gap: 12px; }
.ticket-detail-customer { grid-template-columns: minmax(0, 1.7fr) 284px; }
.thread-card-origin { border-color: rgba(198, 85, 14, 0.18); }
.thread-card.internal-note summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
    list-style: none;
}
.thread-card.internal-note summary::-webkit-details-marker { display: none; }
.thread-card.internal-note { background: #181818; }
.thread-card.internal-note[open] summary { margin-bottom: 14px; }
.internal-note-head {
    min-width: 0;
    display: grid;
    gap: 4px;
}
.internal-note-label {
    display: block;
    margin: 0;
}
.internal-note-author {
    display: block;
    font-size: 0.96rem;
    line-height: 1.4;
    color: var(--text);
}
.internal-note-helper {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.45;
}
.internal-note-helper-open { display: none; }
.thread-card.internal-note[open] .internal-note-helper-collapsed { display: none; }
.thread-card.internal-note[open] .internal-note-helper-open { display: block; }
.thread-card.internal-note .thread-time {
    flex: 0 0 auto;
    padding-top: 2px;
}
.thread-staff { border-color: rgba(198, 85, 14, 0.2); }
.thread-customer { border-color: rgba(255, 255, 255, 0.06); }
.thread-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}
.thread-author { display: block; font-weight: 700; }
.thread-time { color: var(--muted); font-size: 0.78rem; }
.thread-body { color: var(--text); line-height: 1.62; }
.thread-body-empty { color: var(--muted); font-style: italic; }
.attachment-list, .linked-ticket-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.attachment-preview-open { overflow: hidden; }
.attachment-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: grid;
    place-items: center;
    padding: 20px;
}
.attachment-preview-modal[hidden] { display: none; }
.attachment-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 7, 0.78);
    backdrop-filter: blur(10px);
}
.attachment-preview-panel {
    position: relative;
    width: min(1120px, 100%);
    max-height: calc(100vh - 48px);
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.26);
}
.attachment-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.attachment-preview-header h2 {
    margin: 4px 0 0;
    font-size: 1.05rem;
}
.attachment-preview-body {
    min-height: min(72vh, 680px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #101010;
}
.attachment-preview-image {
    max-width: 100%;
    max-height: min(72vh, 680px);
    object-fit: contain;
}
.attachment-preview-frame {
    width: 100%;
    height: min(72vh, 680px);
    border: 0;
    background: #101010;
}
.linked-ticket-list-stack { flex-direction: column; }
.linked-ticket-link-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    width: 100%;
    border-radius: var(--radius);
}
.linked-ticket-title { font-weight: 700; }
.linked-ticket-subject { color: var(--muted); line-height: 1.5; }

.meta-list { display: grid; gap: 7px; margin: 0; }
.meta-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; text-align: right; }
.meta-list + .form-actions,
.meta-list + .stack-form,
.compact-note-list + .stack-form { margin-top: 14px; }

.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.field-span-2 { grid-column: span 2; }
.stack-form { display: flex; flex-direction: column; gap: 7px; }
.stack-form-tight { margin-top: 12px; }
.field-label { display: block; font-size: 0.74rem; color: var(--text-soft); margin-bottom: 4px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: #151515;
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    min-height: 36px;
    font: inherit;
}
.topbar-search-field > input[type="text"] {
    width: 100%;
    min-width: 0;
    padding-left: 44px;
}
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    color-scheme: dark;
    padding-right: 44px;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.2 1.4L6 6.2L10.8 1.4' fill='none' stroke='%23c6550e' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: 0 0, right 14px center;
    background-size: auto, 12px 8px;
}
select::-ms-expand {
    display: none;
}
select option,
select optgroup {
    background: #151515;
    color: var(--text);
}
select:focus {
    outline: none;
    border-color: rgba(198, 85, 14, 0.28);
    box-shadow: 0 0 0 1px rgba(198, 85, 14, 0.12);
}
.locked-field {
    background: #161616;
    border-color: rgba(198, 85, 14, 0.18);
    color: var(--text-soft);
    cursor: default;
}
.readonly-value {
    width: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    background: #161616;
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
textarea { resize: vertical; min-height: 108px; }
button, .button-primary, .button-secondary, .button-danger {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: 6px;
    min-height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    padding: 0 12px;
    font: inherit;
    font-weight: 700;
    line-height: 1.05;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.button-primary, button.button-primary, button[type="submit"]:not(.button-secondary):not(.button-danger) { background: #c6550e; color: #f4e6dc; }
.button-secondary { background: #181818; border-color: var(--line); color: var(--text); }
.button-danger { background: rgba(255, 107, 87, 0.12); border-color: rgba(255, 107, 87, 0.24); color: #ffb2a7; }
.button-primary:hover, button.button-primary:hover, button[type="submit"]:not(.button-secondary):not(.button-danger):hover { background: #d05e17; }
.button-secondary:hover { background: #1f1f1f; }
.button-danger:hover { background: rgba(255, 107, 87, 0.18); }
.inline-button { width: auto; }
.form-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.compact-actions { gap: 7px; }
.file-input {
    display: grid;
    gap: 8px;
}
.file-input-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    background: transparent;
    min-height: 0;
}
.file-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.file-input-trigger {
    cursor: pointer;
    user-select: none;
}
.file-input-trigger:focus-visible {
    outline: none;
    border-color: rgba(198, 85, 14, 0.28);
    box-shadow: 0 0 0 1px rgba(198, 85, 14, 0.12);
}
.file-input-status {
    min-height: 38px;
    flex: 1 1 220px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: #181818;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}
.file-input-status.has-files {
    border-style: solid;
    border-color: rgba(198, 85, 14, 0.22);
    color: var(--text);
}

.toast-stack {
    position: fixed;
    top: calc(16px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    width: min(540px, calc(100vw - 24px));
    display: grid;
    gap: 10px;
    z-index: 1200;
    pointer-events: none;
}
.flash {
    margin: 0;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(27, 27, 27, 0.96);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(14px);
}
.toast {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease;
}
.toast-dismiss {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    filter: blur(2px);
}
.toast-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}
.toast-message {
    line-height: 1.45;
    color: var(--text);
}
.toast-close {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 999px;
    cursor: pointer;
    flex: 0 0 auto;
    font: inherit;
    font-size: 20px;
    line-height: 1;
    transition: color 0.18s ease, background 0.18s ease;
}
.toast-close:hover,
.toast-close:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}
.flash-success { background: rgba(85, 201, 135, 0.12); border-color: rgba(85, 201, 135, 0.3); }
.flash-error { background: rgba(255, 107, 87, 0.12); border-color: rgba(255, 107, 87, 0.28); }
.flash-info { background: rgba(198, 85, 14, 0.12); border-color: rgba(198, 85, 14, 0.24); }
.flash-warning { background: rgba(255, 185, 87, 0.12); border-color: rgba(255, 185, 87, 0.26); }

.ticket-table-wrap { overflow-x: auto; }
.ticket-table { width: 100%; border-collapse: collapse; }
.ticket-table th, .ticket-table td { padding: 9px 7px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); text-align: left; vertical-align: middle; }
.ticket-table th { color: var(--muted); font-weight: 600; }
.table-select-col {
    width: 30px;
    padding-left: 6px;
    padding-right: 6px;
    text-align: center;
}
.table-row-check {
    vertical-align: middle;
}
.ticket-table tbody tr { transition: background-color 0.18s ease; }
.ticket-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.ticket-row-unread { background: linear-gradient(90deg, rgba(198, 85, 14, 0.1), rgba(198, 85, 14, 0.01) 24%); }
.ticket-primary-cell { display: flex; flex-direction: column; gap: 4px; }
.ticket-primary-top { display: inline-flex; align-items: center; gap: 8px; }
.ticket-unread-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    box-shadow: 0 0 0 4px rgba(198, 85, 14, 0.09);
}
.ticket-number { font-weight: 700; }
.ticket-subject { color: var(--muted); font-size: 0.86rem; line-height: 1.42; }
.empty-state-cell { text-align: center; color: var(--muted); }
.table-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline-flex; }
.inline-form button { min-height: 38px; padding: 0 14px; }

.status-pill, .priority-pill, .role-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.status-open { color: var(--accent-soft); background: rgba(198, 85, 14, 0.12); }
.status-pending { color: #ffd18e; background: rgba(255, 184, 77, 0.12); }
.status-waiting_on_customer { color: #ffdb9f; background: rgba(164, 112, 24, 0.18); }
.status-resolved { color: #aef0c5; background: rgba(85, 201, 135, 0.12); }
.status-closed { color: #cbc4bc; background: rgba(255, 255, 255, 0.06); }
.status-archived { color: #d5cec6; background: rgba(255, 255, 255, 0.08); }
.priority-low { color: #d3cbc2; background: rgba(255, 255, 255, 0.05); }
.priority-normal { color: #f1d0bb; background: rgba(198, 85, 14, 0.1); }
.priority-high { color: #e9b48d; background: rgba(198, 85, 14, 0.18); }
.priority-urgent { color: #ffb2a7; background: rgba(255, 107, 87, 0.14); }
.role-user { color: #ddd7cf; background: rgba(255, 255, 255, 0.05); }
.role-technician { color: #e8b995; background: rgba(198, 85, 14, 0.12); }
.role-admin { color: #aef0c5; background: rgba(85, 201, 135, 0.12); }
.flag-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}
.flag-ignore {
    color: #ffcbc3;
    background: rgba(180, 63, 48, 0.16);
    border-color: rgba(255, 107, 87, 0.34);
}
.user-table-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.customer-ticket-list { display: flex; flex-direction: column; gap: 12px; }
.customer-ticket-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.customer-ticket-card,
.customer-empty-state {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.customer-ticket-card {
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.customer-ticket-card:hover {
    transform: translateY(-2px);
    border-color: rgba(198, 85, 14, 0.18);
}
.customer-ticket-card-unread {
    background: linear-gradient(135deg, rgba(198, 85, 14, 0.09), #1b1b1b 32%);
    border-color: rgba(198, 85, 14, 0.16);
}
.customer-ticket-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}
.customer-ticket-card h3 { margin: 6px 0 0; font-size: 1.02rem; }
.customer-ticket-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.customer-unread-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(198, 85, 14, 0.12);
    color: var(--accent-soft);
    font-size: 0.76rem;
    font-weight: 700;
}
.meta-list-customer div { align-items: center; }

.toolbar-search { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-search-staff {
    align-items: center;
    justify-content: flex-end;
    width: 100%;
}
.toolbar-search-staff input,
.toolbar-search-staff select {
    min-width: 120px;
    flex: 0 1 auto;
    width: auto;
}
.toolbar-search-staff input[name="search"] {
    min-width: 200px;
    width: min(100%, 300px);
    flex: 1 1 300px;
}
.toolbar-search-staff button,
.toolbar-search-staff .inline-button { flex: 0 0 auto; }
.toolbar-search-customer input[name="search"] { min-width: 200px; width: min(100%, 300px); }
.brand-preview { width: 180px; max-height: 56px; object-fit: contain; margin-top: 10px; }
.favicon-preview { width: 36px; height: 36px; object-fit: contain; margin-top: 10px; }
.dashboard-logo-preview {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-top: 10px;
    border-radius: var(--radius);
    background: #181818;
    padding: 8px;
}
.ticket-quick-view { padding: 8px; color: var(--text); }
.field-note {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.5;
}
.profile-form-divider {
    display: grid;
    gap: 6px;
    padding-top: 6px;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.profile-form-divider span {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
}
.profile-form-divider p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}
.profile-address-preview {
    display: grid;
    gap: 8px;
}
.profile-address-line {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #181818;
    color: var(--text);
    line-height: 1.55;
}

.staff-control-form { display: grid; gap: 12px; }
.staff-control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ticket-composer-card { display: grid; gap: 12px; }
.ticket-composer-form { display: grid; gap: 10px; }
.ticket-composer-actions { align-items: center; }
.ticket-composer-help {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.5;
}
.dashboard-chart-grid + .dashboard-chart-grid { margin-top: 24px; }
.chart-card { min-height: 100%; }
.chart-stack-bar {
    display: flex;
    gap: 6px;
    min-height: 12px;
    margin-bottom: 14px;
}
.chart-stack-segment {
    border-radius: 999px;
    min-width: 14px;
}
.chart-stack-segment.status-open,
.chart-legend-dot.status-open { background: rgba(198, 85, 14, 0.95); }
.chart-stack-segment.status-waiting_on_customer,
.chart-legend-dot.status-waiting_on_customer { background: rgba(255, 184, 77, 0.92); }
.chart-stack-segment.status-resolved,
.chart-legend-dot.status-resolved { background: rgba(85, 201, 135, 0.92); }
.chart-stack-segment.status-closed,
.chart-legend-dot.status-closed { background: rgba(214, 208, 200, 0.78); }
.chart-stack-segment.priority-low,
.chart-legend-dot.priority-low { background: rgba(164, 161, 154, 0.72); }
.chart-legend { display: grid; gap: 6px; }
.chart-legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.chart-legend-row:last-child { border-bottom: 0; }
.chart-legend-key {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.chart-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
}
.spark-chart {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    min-height: 170px;
    align-items: end;
}
.spark-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.spark-bar {
    width: 100%;
    max-width: 28px;
    min-height: 10px;
    border-radius: 999px 999px 6px 6px;
    background: linear-gradient(180deg, var(--accent-soft), var(--accent-deep));
}
.spark-value {
    color: var(--muted);
    font-size: 0.74rem;
}
.spark-label {
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.source-stat-list { display: grid; gap: 10px; }
.source-stat-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.source-stat-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}
.source-stat-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-soft));
}
.dashboard-action-list { display: flex; flex-wrap: wrap; gap: 8px; }
.dashboard-action-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) 320px;
    gap: 16px;
    align-items: start;
}
.profile-form-sections {
    display: grid;
    gap: 20px;
}
.profile-form-section {
    display: grid;
    gap: 14px;
}
.profile-form-section[hidden] {
    display: none;
}
.profile-form-section + .profile-form-section {
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.profile-submit-row {
    margin-top: -2px;
}
.section-heading {
    display: grid;
    gap: 6px;
}
.section-heading h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}
.section-heading p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.6;
}
.profile-side-column { gap: 12px; }
.users-page-grid { margin-bottom: 24px; }
.user-record-layout { grid-template-columns: minmax(0, 1.55fr) 300px; }
.user-record-side-column { gap: 14px; }
.create-ticket-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) 284px;
    gap: 14px;
    align-items: start;
}
.create-ticket-side-column { gap: 12px; }
.compact-note-list { display: grid; gap: 8px; }
.compact-note-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #181818;
    color: var(--muted);
    line-height: 1.55;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--accent), var(--accent-deep)); border-radius: 999px; }
::-webkit-scrollbar-track { background: #101010; }

@keyframes sidebarParticleDriftA {
    0% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-8px, 14px, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

@keyframes sidebarParticleDriftB {
    0% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(10px, -16px, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

@media (max-width: 1380px) {
    .dashboard-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
    .portal-shell, body.portal-customer .portal-shell, .ticket-detail-layout, .panel-grid, .auth-panel, .customer-ticket-grid, .create-ticket-layout, .profile-layout, .settings-workspace, .settings-card-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sidebar { position: relative; min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12); }
    .table-toolbar-staff { grid-template-columns: 1fr; }
    .settings-local-nav { position: relative; top: 0; }
    .bulk-action-bar,
    .ignored-email-item,
    .ignored-email-summary-head { flex-direction: column; align-items: stretch; }
    .bulk-action-bar-actions { width: 100%; }
    .settings-card-actions { align-items: stretch; }
}

@media (max-width: 820px) {
    .main, .auth-brand, .auth-card { padding: 20px; }
    .grid-form { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: span 1; }
    .topbar { flex-direction: column; align-items: stretch; padding: 16px 22px; }
    .topbar-search { width: 100%; margin-right: 0; }
    .topbar-search-field { width: 100%; }
    .topbar-user-link { justify-items: start; min-width: 0; margin: -4px 0 0; padding: 6px 0 0; border-radius: 0; border: 0; }
    .page-hero, .panel-heading, .table-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-search { flex-direction: column; }
    .toolbar-search-staff input,
    .toolbar-search-staff select,
    .toolbar-search-customer input[name="search"] { width: 100%; }
    .stats-grid, .dashboard-stats-grid, .staff-control-grid, .spark-chart { grid-template-columns: 1fr; }
    body.portal-customer .main { padding: 20px; }
    .auth-logo { width: min(100%, 320px); margin-left: -8px; }
    .auth-shell { border-radius: 18px; }
    .file-input-row,
    .attachment-preview-header { flex-direction: column; align-items: stretch; }
    .file-input-status { border-radius: var(--radius-sm); min-height: 42px; }
    .attachment-preview-modal { padding: 16px; }
    .attachment-preview-panel { padding: 14px; border-radius: var(--radius-lg); }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar::before,
    .sidebar::after {
        animation: none;
        transform: none;
        opacity: 0.12;
    }
}
