:root {
    --bg: #f4efe7;
    --bg-soft: #fbf7f1;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #fffdf9;
    --line: rgba(58, 41, 29, 0.12);
    --line-strong: rgba(58, 41, 29, 0.22);
    --text: #23170f;
    --muted: #766454;
    --primary: #c86c2c;
    --primary-deep: #8f4516;
    --accent: #14746f;
    --danger: #b8403a;
    --shadow: 0 30px 80px rgba(88, 55, 29, 0.14);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 999px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(200, 108, 44, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(20, 116, 111, 0.16), transparent 24%),
        linear-gradient(180deg, #fffaf3 0%, var(--bg) 55%, #efe6da 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

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

.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
    margin-bottom: 28px;
    padding: 18px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: rgba(255, 251, 245, 0.78);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary) 0%, #efb169 100%);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.06em;
    box-shadow: 0 12px 30px rgba(200, 108, 44, 0.28);
}

.brand-mark strong,
.topbar__user strong {
    display: block;
    font-size: 0.98rem;
}

.brand-mark small,
.topbar__user small,
.eyebrow,
.muted {
    color: var(--muted);
}

.topbar__nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar__nav a,
.ghost-link,
.pill-link {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    transition: 180ms ease;
}

.topbar__nav a:hover,
.ghost-link:hover,
.pill-link:hover {
    background: rgba(200, 108, 44, 0.1);
}

.topbar__nav a.is-active {
    background: #23170f;
    color: #fff7ef;
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hero,
.panel,
.stats-card,
.ticket-list,
.timeline,
.auth-card,
.feature-card,
.table-card,
.cta-band {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    padding: 34px;
    border-radius: 36px;
    overflow: hidden;
    position: relative;
}

.hero::after {
    content: '';
    position: absolute;
    inset: auto -40px -60px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 116, 111, 0.14), transparent 70%);
}

.hero h1,
.page-head h1 {
    margin: 0;
    font-size: clamp(2.1rem, 4vw, 4rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
}

.hero p,
.page-head p {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.hero__actions,
.stack-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.button,
.button-secondary,
.button-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 18px;
    border-radius: 16px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button {
    background: linear-gradient(135deg, var(--primary) 0%, #e79a56 100%);
    color: #fff;
    box-shadow: 0 16px 32px rgba(200, 108, 44, 0.28);
}

.button-secondary {
    background: #fff7ef;
    border-color: rgba(200, 108, 44, 0.18);
}

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

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

.hero__aside,
.panel,
.auth-card,
.feature-card,
.table-card,
.cta-band {
    border-radius: var(--radius-xl);
    padding: 24px;
}

.mini-metrics,
.stats-grid,
.feature-grid,
.table-grid,
.admin-grid,
.form-grid,
.content-grid,
.kpi-grid {
    display: grid;
    gap: 18px;
}

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

.metric-chip,
.stats-card {
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.84);
}

.metric-chip strong,
.stats-card strong {
    display: block;
    margin-top: 12px;
    font-size: 1.5rem;
}

.page {
    display: grid;
    gap: 24px;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

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

.content-grid {
    grid-template-columns: 1.45fr 0.9fr;
}

.panel h2,
.ticket-list h2,
.timeline h2,
.auth-card h2,
.table-card h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.ticket-list,
.timeline {
    border-radius: var(--radius-xl);
    padding: 26px;
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ticket-title strong,
.ticket-id {
    display: block;
}

.ticket-id {
    color: var(--muted);
    font-size: 0.88rem;
}

.badge,
.priority {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
}

.status-open { background: rgba(20, 116, 111, 0.12); color: #0b5d59; }
.status-progress { background: rgba(200, 108, 44, 0.14); color: #9a551f; }
.status-alert { background: rgba(184, 64, 58, 0.12); color: #912f2b; }
.status-waiting { background: rgba(79, 70, 229, 0.12); color: #493dc4; }
.status-closed { background: rgba(34, 197, 94, 0.12); color: #177843; }
.status-neutral { background: rgba(35, 23, 15, 0.08); color: var(--text); }

.priority-high { background: rgba(184, 64, 58, 0.12); color: var(--danger); }
.priority-medium { background: rgba(200, 108, 44, 0.12); color: var(--primary-deep); }
.priority-low { background: rgba(20, 116, 111, 0.12); color: var(--accent); }
.priority-neutral { background: rgba(35, 23, 15, 0.08); color: var(--text); }

.timeline__item {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.timeline__item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.timeline__time {
    font-weight: 700;
}

.auth-wrap {
    min-height: calc(100vh - 110px);
    display: grid;
    place-items: center;
}

.auth-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    width: 100%;
}

.auth-showcase {
    padding: 34px;
    border-radius: 34px;
    background: linear-gradient(135deg, rgba(31, 41, 55, 0.92), rgba(20, 116, 111, 0.86));
    color: #fff6ee;
    box-shadow: var(--shadow);
}

.auth-showcase p,
.auth-showcase .muted {
    color: rgba(255, 246, 238, 0.75);
}

.auth-card form,
.form-stack {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 14px 15px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: rgba(255, 253, 249, 0.9);
    color: var(--text);
}

.field textarea {
    min-height: 130px;
    resize: vertical;
}

.feature-grid,
.table-grid,
.admin-grid,
.kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card h3,
.table-card h3 {
    margin-top: 0;
}

.feature-card p,
.table-card p,
.stats-card p,
.panel p {
    margin-bottom: 0;
}

.split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.list-clean {
    display: grid;
    gap: 12px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.list-clean li {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.list-clean li:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

[data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 500ms ease, transform 500ms ease;
}

[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 980px) {
    .topbar,
    .hero,
    .content-grid,
    .auth-layout,
    .stats-grid,
    .feature-grid,
    .table-grid,
    .admin-grid,
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .page-head,
    .topbar__user {
        align-items: start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .app-shell {
        width: min(100% - 20px, 100%);
    }

    .topbar,
    .hero,
    .panel,
    .ticket-list,
    .timeline,
    .auth-card,
    .feature-card,
    .table-card,
    .auth-showcase {
        padding: 20px;
    }

    .mini-metrics {
        grid-template-columns: 1fr;
    }
}
