:root {
    --bg: #f4efe6;
    --bg-strong: #ead9bf;
    --surface: rgba(255, 250, 242, 0.86);
    --surface-strong: #fff8ef;
    --line: rgba(95, 55, 17, 0.14);
    --ink: #24160c;
    --muted: #6f5a4a;
    --accent: #c34b1d;
    --accent-deep: #7f2708;
    --success: #0d7a57;
    --warning: #cf7c18;
    --danger: #a42920;
    --shadow: 0 30px 80px rgba(78, 47, 18, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    background:
        radial-gradient(circle at top left, rgba(238, 208, 160, 0.55), transparent 28%),
        radial-gradient(circle at top right, rgba(186, 94, 34, 0.15), transparent 25%),
        linear-gradient(180deg, #f8f3ea 0%, #f0e6d7 100%);
    color: var(--ink);
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-sans);
    color: var(--ink);
    background: transparent;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

#app {
    min-height: 100vh;
}

.boot-screen,
.auth-shell,
.shell {
    min-height: 100vh;
}

.boot-screen,
.auth-shell {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 460px);
    gap: 24px;
    padding: 32px;
}

.auth-hero,
.panel,
.sidebar,
.topbar,
.flash,
.loading-bar {
    backdrop-filter: blur(16px);
}

.panel,
.sidebar,
.topbar {
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel {
    padding: 24px;
}

.auth-hero {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    border: 1px solid rgba(195, 75, 29, 0.16);
    border-radius: 36px;
    padding: 48px;
    background:
        linear-gradient(135deg, rgba(255, 248, 238, 0.9), rgba(237, 214, 183, 0.62)),
        radial-gradient(circle at top right, rgba(195, 75, 29, 0.15), transparent 35%);
}

.auth-hero h1,
.brand-block h1,
.hero-panel h1 {
    font-size: clamp(2.2rem, 5vw, 4.4rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
    margin: 0;
}

.auth-panel {
    width: 100%;
}

.flash,
.loading-bar {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 50;
    max-width: min(420px, calc(100vw - 32px));
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 250, 244, 0.94);
    box-shadow: var(--shadow);
}

.flash-success {
    color: var(--success);
}

.flash-error {
    top: 86px;
    color: var(--danger);
}

.loading-bar {
    top: auto;
    bottom: 16px;
    color: var(--accent-deep);
}

.shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    background:
        linear-gradient(180deg, rgba(123, 46, 15, 0.96), rgba(60, 26, 8, 0.95)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
    color: #fff7ef;
}

.brand-block,
.sidebar-footer {
    display: grid;
    gap: 8px;
}

.brand-block span,
.sidebar-footer p,
.eyebrow,
.muted,
small {
    color: inherit;
    opacity: 0.72;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    font-weight: 700;
}

.nav-list {
    display: grid;
    gap: 10px;
    margin: 32px 0;
}

.nav-item,
.ghost-button,
.secondary-button,
.primary-button,
.danger-button,
.ticket-row,
.ticket-card,
.attachment-item {
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.nav-item {
    border: 1px solid rgba(255, 247, 239, 0.12);
    border-radius: 18px;
    padding: 14px 16px;
    text-align: left;
    background: rgba(255, 255, 255, 0.06);
    color: #fffaf2;
}

.nav-item.active,
.nav-item:hover {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.16);
}

.main-area {
    display: grid;
    gap: 18px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
}

.topbar h2,
.section-heading h2,
.section-heading h3,
.workspace-toolbar h2 {
    margin: 0;
    font-size: clamp(1.3rem, 2vw, 2rem);
    letter-spacing: -0.04em;
}

.topbar-actions,
.hero-meta,
.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-panel {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    background:
        radial-gradient(circle at top right, rgba(195, 75, 29, 0.16), transparent 28%),
        linear-gradient(135deg, rgba(255, 249, 241, 0.94), rgba(237, 217, 191, 0.72));
}

.lede {
    max-width: 50ch;
    color: var(--muted);
}

.hero-chip,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.84rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.6);
}

.metric-grid,
.admin-grid {
    display: grid;
    gap: 16px;
}

.metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.metric-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: rgba(255, 252, 247, 0.88);
}

.metric-card strong {
    font-size: 2rem;
    letter-spacing: -0.06em;
}

.split-panel,
.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
    gap: 18px;
}

.section-heading,
.workspace-toolbar,
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.ticket-stack,
.ticket-list,
.admin-list,
.message-list,
.comment-list {
    display: grid;
    gap: 12px;
}

.ticket-card,
.ticket-row,
.spotlight-card,
.message-item,
.comment-item,
.admin-item,
.attachment-item {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 16px;
    background: rgba(255, 252, 248, 0.85);
    text-align: left;
}

.ticket-row.active,
.ticket-card:hover,
.ticket-row:hover,
.attachment-item:hover {
    transform: translateY(-2px);
    border-color: rgba(195, 75, 29, 0.32);
    box-shadow: 0 16px 36px rgba(95, 55, 17, 0.08);
}

.ticket-card-top,
.ticket-card-bottom,
.status-column {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.ticket-card p,
.comment-item p,
.message-item p,
.detail-description {
    color: var(--muted);
}

.ticket-detail {
    display: grid;
    gap: 16px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.detail-grid div {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px 14px;
    background: rgba(255, 251, 245, 0.8);
}

.detail-grid dt {
    color: var(--muted);
    font-size: 0.82rem;
}

.detail-grid dd {
    margin: 6px 0 0;
    font-weight: 600;
}

.action-band,
.inline-form,
.assign-form,
.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.stack-form,
.form-grid,
.upload-box {
    display: grid;
    gap: 14px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.94rem;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(95, 55, 17, 0.16);
    border-radius: 16px;
    padding: 13px 14px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
}

select[multiple] {
    min-height: 130px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(195, 75, 29, 0.22);
    border-color: rgba(195, 75, 29, 0.42);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
    border-radius: 16px;
    padding: 12px 16px;
    border: 1px solid transparent;
}

.primary-button {
    color: #fffaf4;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

.secondary-button {
    color: var(--accent-deep);
    background: rgba(195, 75, 29, 0.08);
    border-color: rgba(195, 75, 29, 0.16);
}

.ghost-button {
    color: inherit;
    background: transparent;
    border-color: var(--line);
}

.danger-button {
    color: #fff6f5;
    background: linear-gradient(135deg, #c84338, #92211a);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover {
    transform: translateY(-1px);
}

.badge-open,
.badge-low {
    background: rgba(11, 120, 86, 0.08);
    color: var(--success);
}

.badge-progress,
.badge-medium {
    background: rgba(31, 92, 173, 0.09);
    color: #1f5cad;
}

.badge-waiting {
    background: rgba(207, 124, 24, 0.12);
    color: var(--warning);
}

.badge-internal,
.badge-high {
    background: rgba(122, 64, 171, 0.1);
    color: #7a40ab;
}

.badge-resolved {
    background: rgba(13, 122, 87, 0.12);
    color: var(--success);
}

.badge-closed {
    background: rgba(56, 43, 34, 0.12);
    color: #5b4d44;
}

.badge-urgent {
    background: rgba(164, 41, 32, 0.12);
    color: var(--danger);
}

.danger-zone {
    display: flex;
    justify-content: flex-end;
}

.admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-item {
    display: grid;
    gap: 12px;
}

.admin-section-block {
    display: grid;
    gap: 14px;
}

.admin-section-block + .admin-section-block {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.compact-item {
    align-items: center;
}

.message-list.compact {
    max-height: 280px;
    overflow: auto;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 280px;
    border: 1px dashed rgba(95, 55, 17, 0.2);
    border-radius: 22px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 1100px) {
    .shell,
    .auth-shell,
    .split-panel,
    .workspace-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 18px;
    }
}

@media (max-width: 720px) {
    .shell,
    .auth-shell {
        padding: 12px;
    }

    .topbar,
    .panel,
    .sidebar {
        border-radius: 22px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .hero-panel,
    .section-heading,
    .workspace-toolbar,
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }
}
