:root {
    color-scheme: light;
    --bg: #f7f4ef;
    --bg-2: #fffaf4;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-solid: #ffffff;
    --surface-muted: #fff7ef;
    --text: #2f3439;
    --heading: #20242a;
    --muted: #70757b;
    --border: #ebe3d9;
    --border-strong: #dccdbd;
    --primary: #d97a2b;
    --primary-dark: #bc6217;
    --primary-soft: #fff0e1;
    --secondary: #5d6670;
    --secondary-soft: #eef1f4;
    --success: #1f8b58;
    --danger: #b4453f;
    --warning: #bf751e;
    --purple: #6d54a8;
    --shadow: 0 20px 60px rgba(68, 52, 38, 0.11);
    --shadow-soft: 0 12px 30px rgba(68, 52, 38, 0.08);
    --ring: rgba(217, 122, 43, 0.16);
    --radius-xl: 34px;
    --radius-lg: 26px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #16181b;
    --bg-2: #20242a;
    --surface: rgba(39, 42, 47, 0.88);
    --surface-solid: #252930;
    --surface-muted: #2b251f;
    --text: #edf0f3;
    --heading: #ffffff;
    --muted: #b1b6bd;
    --border: #3a3f47;
    --border-strong: #555b64;
    --primary: #f08b36;
    --primary-dark: #ff9a45;
    --primary-soft: rgba(240, 139, 54, 0.16);
    --secondary: #d5d9de;
    --secondary-soft: #30353d;
    --success: #64d597;
    --danger: #ff8a80;
    --warning: #f6b15f;
    --purple: #b9a4f5;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.30);
    --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.20);
    --ring: rgba(240, 139, 54, 0.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    line-height: 1.5;
    background:
        radial-gradient(circle at top left, rgba(217, 122, 43, 0.20), transparent 25%),
        radial-gradient(circle at top right, rgba(93, 102, 112, 0.14), transparent 26%),
        linear-gradient(180deg, var(--bg-2), var(--bg));
    min-height: 100vh;
}

html[data-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(240, 139, 54, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(255,255,255, 0.06), transparent 24%),
        linear-gradient(180deg, var(--bg-2), var(--bg));
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { color: var(--heading); letter-spacing: -0.02em; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(20px);
    background: rgba(255, 250, 244, 0.84);
    border-bottom: 1px solid rgba(235, 227, 217, 0.88);
}
html[data-theme="dark"] .topbar {
    background: rgba(32, 36, 42, 0.84);
    border-bottom-color: rgba(58, 63, 71, 0.86);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 86px;
    gap: 20px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: var(--text);
    min-width: 0;
}
.brand:hover { text-decoration: none; }
.brand-logo {
    width: 112px;
    max-height: 56px;
    object-fit: contain;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.10));
}
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 1.05rem; letter-spacing: .02em; white-space: nowrap; }
.brand-copy small { font-size: .77rem; color: var(--muted); letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.menu { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.menu a {
    color: var(--secondary);
    font-weight: 760;
    padding: 10px 14px;
    border-radius: 999px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.menu a:hover { text-decoration: none; background: var(--surface); color: var(--heading); transform: translateY(-1px); }
.menu-cta {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff !important;
    box-shadow: 0 10px 22px rgba(217, 122, 43, 0.25);
}
.menu-cta:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.menu-toggle,
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--heading);
    border: 1px solid var(--border);
    border-radius: 15px;
    font-size: 22px;
    width: 46px;
    height: 46px;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease;
}
.menu-toggle:hover,
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.menu-toggle { display: none; }

.main { padding: 34px 0 56px; }
.footer { margin-top: 24px; border-top: 1px solid var(--border); background: rgba(255, 250, 244, 0.72); backdrop-filter: blur(14px); }
html[data-theme="dark"] .footer { background: rgba(32, 36, 42, 0.72); }
.footer-grid { min-height: 96px; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 0; }
.footer-brand { font-weight: 850; margin-bottom: 4px; }
.footer-copy { color: var(--muted); font-weight: 650; }

.hero {
    display: grid;
    grid-template-columns: 1.13fr .97fr;
    gap: 30px;
    align-items: center;
    min-height: calc(100vh - 230px);
}
.hero h1 { font-size: clamp(36px, 5vw, 64px); line-height: 1.02; margin: 12px 0 18px; max-width: 780px; }
.hero p { color: var(--muted); font-size: 18px; max-width: 720px; }
.eyebrow {
    display: inline-flex;
    color: var(--primary-dark);
    background: var(--primary-soft);
    border: 1px solid rgba(217, 122, 43, 0.26);
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .09em;
    padding: 8px 14px;
    border-radius: 999px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-badges,
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.soft-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    font-weight: 750;
    color: var(--secondary);
}
.hero-panel { display: grid; gap: 18px; }
.hero-card,
.card,
.auth-card,
.stat-card,
.comment,
.mini-card,
.feature-card,
.insight-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}
.hero-card,
.card,
.auth-card { padding: 28px; }
.brand-showcase { display: flex; align-items: center; gap: 20px; position: relative; overflow: hidden; }
.brand-showcase::after {
    content: "";
    position: absolute;
    right: -50px;
    bottom: -70px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(217, 122, 43, 0.11);
}
.hero-logo { width: 196px; max-width: 42%; object-fit: contain; filter: drop-shadow(0 14px 18px rgba(0,0,0,.11)); position: relative; z-index: 1; }
.hero-feature-grid,
.feature-grid,
.service-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.feature-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mini-card,
.feature-card,
.insight-card { padding: 20px; box-shadow: var(--shadow-soft); }
.mini-card strong,
.feature-card h3 { display: block; margin-bottom: 8px; }
.mini-card span,
.feature-card p { color: var(--muted); }
.icon-bubble,
.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 22px;
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(217, 122, 43, .16);
}
.section-soft { margin-top: 22px; }

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 16px;
    border: 1px solid transparent;
    font-weight: 850;
    cursor: pointer;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 14px 26px rgba(217, 122, 43, 0.26); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.btn-secondary { background: var(--surface); color: var(--heading); border-color: var(--border); box-shadow: var(--shadow-soft); }
.btn-ghost { background: transparent; color: var(--heading); border-color: var(--border); }
.btn-small { padding: 8px 12px; border-radius: 12px; font-size: 13px; }

.auth-card { max-width: 540px; margin: 30px auto; }
.auth-card.wide { max-width: 900px; }
.auth-surface { background: linear-gradient(180deg, var(--surface), var(--surface-muted)); }
.auth-brand { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.auth-brand img { width: 122px; object-fit: contain; filter: drop-shadow(0 10px 16px rgba(0,0,0,.09)); }
.auth-brand h1 { margin: 0 0 6px; }

.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 8px; font-weight: 760; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 13px 14px;
    font: inherit;
    color: var(--text);
    background: rgba(255,255,255,.86);
    box-shadow: inset 0 1px 2px rgba(0,0,0,.025);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background: rgba(22, 24, 27, .52); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 4px solid var(--ring); border-color: var(--primary); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }
.help, .small { font-size: 13px; }
.muted { color: var(--muted); }
.alert { padding: 14px 16px; border-radius: 17px; margin-bottom: 18px; font-weight: 760; box-shadow: var(--shadow-soft); }
.alert-success { background: rgba(31, 139, 88, .12); color: var(--success); border: 1px solid rgba(31, 139, 88, .25); }
.alert-error { background: rgba(180, 69, 63, .12); color: var(--danger); border: 1px solid rgba(180, 69, 63, .25); }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 22px; }
.page-head h1 { margin: 0 0 5px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.card { margin-bottom: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.dashboard-welcome {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 18px;
    align-items: stretch;
    margin-bottom: 22px;
}
.welcome-panel {
    background: linear-gradient(135deg, rgba(217,122,43,.13), rgba(255,255,255,.62));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 28px;
    position: relative;
    overflow: hidden;
}
html[data-theme="dark"] .welcome-panel { background: linear-gradient(135deg, rgba(240,139,54,.18), rgba(39,42,47,.78)); }
.welcome-panel::after {
    content: "";
    position: absolute;
    right: -70px;
    top: -70px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: rgba(217, 122, 43, 0.15);
}
.welcome-panel h1 { margin: 0 0 8px; font-size: clamp(30px, 4vw, 46px); }
.insight-card { display: grid; gap: 12px; }
.insight-card strong { font-size: 28px; color: var(--heading); }
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { padding: 20px; display: grid; gap: 14px; box-shadow: var(--shadow-soft); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 90px; height: 90px; right: -38px; bottom: -38px; border-radius: 50%; background: var(--primary-soft); }
.stat-card strong { font-size: 36px; line-height: 1; color: var(--heading); }
.stat-card-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; position: relative; z-index: 1; }
.stat-card-number { position: relative; z-index: 1; }
.stat-card small { color: var(--muted); font-weight: 700; }
.table-wrap { overflow-x: auto; border-radius: 22px; border: 1px solid var(--border); background: rgba(255,255,255,.62); }
html[data-theme="dark"] .table-wrap { background: rgba(22,24,27,.25); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
tr:hover td { background: rgba(255, 249, 243, .75); }
html[data-theme="dark"] tr:hover td { background: rgba(255,255,255,.04); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.table-title { font-weight: 850; color: var(--heading); }
.table-sub { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 11px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.badge-blue { background: rgba(93, 102, 112, .14); color: var(--secondary); }
.badge-yellow { background: rgba(217, 122, 43, .14); color: var(--primary-dark); }
.badge-green { background: rgba(31, 139, 88, .13); color: var(--success); }
.badge-red { background: rgba(180, 69, 63, .13); color: var(--danger); }
.badge-purple { background: rgba(109, 84, 168, .13); color: var(--purple); }
.badge-gray { background: rgba(112, 117, 123, .13); color: var(--secondary); }
.badge-light { background: var(--primary-soft); color: var(--primary-dark); }
.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters input { flex: 1 1 280px; }
.filters select { flex: 0 0 200px; }
.center { text-align: center; }
.ticket-layout { display: grid; grid-template-columns: 1fr 350px; gap: 22px; align-items: start; }
.ticket-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.preline { white-space: pre-line; }
.side-card dl { display: grid; grid-template-columns: 100px 1fr; gap: 10px 12px; }
.side-card dt { color: var(--muted); font-weight: 850; }
.side-card dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.compact { gap: 12px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.comment { padding: 17px; margin: 14px 0; background: rgba(255,255,255,.62); }
html[data-theme="dark"] .comment { background: rgba(22,24,27,.28); }
.comment-head { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); }
.comment-head strong { color: var(--heading); }
.comment-form { margin-top: 20px; }
.attachment { font-weight: 850; }
.inline-form { display: inline; }

.ticket-progress {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 18px 0 4px;
}
.progress-step {
    position: relative;
    padding: 12px 10px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255,255,255,.48);
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}
html[data-theme="dark"] .progress-step { background: rgba(22,24,27,.25); }
.progress-step.active,
.progress-step.done {
    border-color: rgba(217,122,43,.35);
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.progress-step.done::before { content: "✓ "; }

.empty-state {
    padding: 34px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--muted);
    background: rgba(255,255,255,.36);
}

@media (max-width: 1040px) {
    .menu-toggle { display: inline-flex; }
    .menu {
        display: none;
        position: absolute;
        left: 16px;
        right: 16px;
        top: 86px;
        background: var(--surface-solid);
        padding: 14px;
        border-radius: 22px;
        border: 1px solid var(--border);
        box-shadow: var(--shadow);
        flex-direction: column;
        align-items: stretch;
        z-index: 80;
    }
    .menu a { width: 100%; }
    .menu-open .menu { display: flex; }
}

@media (max-width: 980px) {
    .hero,
    .ticket-layout,
    .dashboard-welcome,
    .grid-3,
    .feature-grid.three { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
    .hero,
    .grid-2,
    .hero-feature-grid,
    .feature-grid,
    .service-grid { grid-template-columns: 1fr; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .page-actions { justify-content: flex-start; }
    .footer-grid { flex-direction: column; align-items: flex-start; }
    .ticket-progress { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .container { width: min(100% - 24px, 1180px); }
    .stats-grid { grid-template-columns: 1fr; }
    .hero { min-height: auto; }
    .hero h1 { font-size: 34px; }
    .card,
    .auth-card,
    .hero-card { padding: 20px; }
    .brand-logo { width: 86px; }
    .brand-copy strong { font-size: .96rem; }
    .brand-copy small { font-size: .68rem; }
    .auth-brand { align-items: flex-start; }
    .theme-toggle { width: 43px; height: 43px; }
}

@media print {
    :root { color-scheme: light; }
    html[data-theme="dark"] { color-scheme: light; }
    body { background: #fff !important; color: #111 !important; }
    .no-print,
    .btn,
    .comment-form,
    .theme-toggle,
    .menu-toggle { display: none !important; }
    .container { width: 100%; }
    .main { padding: 0; }
    .card,
    .comment,
    .stat-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        background: #fff !important;
    }
    .ticket-layout { grid-template-columns: 1fr; }
    a { color: #111; text-decoration: none; }
}
