:root {
    --ink: #111827;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --page: #f6f8fb;
    --brand: #2563eb;
    --brand-dark: #1e40af;
    --accent: #0f766e;
    --danger: #dc2626;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 30px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
}
a { text-decoration: none; }

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 480px;
    background:
        radial-gradient(circle at 14% 18%, rgba(37, 99, 235, .10), transparent 28%),
        radial-gradient(circle at 70% 78%, rgba(15, 118, 110, .10), transparent 26%),
        #f8fafc;
}
.auth-hero {
    padding: 7vw 6vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-hero h1 { font-size: clamp(2.6rem, 5vw, 4.6rem); font-weight: 800; letter-spacing: 0; line-height: .98; max-width: 780px; }
.auth-hero p { color: var(--muted); max-width: 660px; font-size: 1.05rem; line-height: 1.55; }
.auth-panel {
    background: #fff;
    padding: 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 60px rgba(15, 23, 42, .06);
}
.brand-pill {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--brand);
    font-weight: 800;
}

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 252px;
    background: #111827;
    color: #fff;
    padding: 22px 16px;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { color: #fff; display: flex; align-items: center; gap: 12px; font-size: 1rem; padding: 0 6px; }
.brand span {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #2563eb;
    font-weight: 800;
}
.brand img {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: cover;
    background: #fff;
}
.brand strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar nav, .mobile-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a, .mobile-nav a {
    color: #d1d5db;
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .94rem;
    font-weight: 500;
}
.sidebar nav a:hover, .mobile-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active, .mobile-nav a.active {
    background: #ffffff;
    color: #111827;
}
.sidebar nav a.active i, .mobile-nav a.active i { color: var(--brand); }
.app-main { flex: 1; min-width: 0; }
.topbar {
    min-height: 70px;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    padding: 13px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    position: sticky;
    top: 0;
    z-index: 5;
}
.topbar h1 { margin: 0; font-size: 1.22rem; font-weight: 750; line-height: 1.2; }
.topbar span { color: var(--muted); font-size: .84rem; }
.content-wrap { padding: 24px; max-width: 1680px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card, .panel, .table-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.stat-card { padding: 16px; min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-card small { color: var(--muted); display: block; margin-bottom: 8px; font-weight: 650; }
.stat-card strong { font-size: 1.65rem; line-height: 1; letter-spacing: 0; }
.panel { padding: 18px; }
.table-panel { overflow: hidden; }
.table { margin-bottom: 0; font-size: .92rem; }
.table > :not(caption) > * > * { padding: .78rem .9rem; border-bottom-color: var(--line); }
.table thead th {
    background: var(--surface-soft);
    color: #475569;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.form-label { color: #475569; font-size: .82rem; font-weight: 650; margin-bottom: .38rem; }
.form-control, .form-select {
    border-radius: 8px;
    border-color: #cbd5e1;
    min-height: 42px;
}
.form-control:focus, .form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12);
}
.btn { border-radius: 8px; font-weight: 650; min-height: 38px; }
.btn-sm { min-height: 32px; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-light {
    background: #f8fafc;
    border-color: var(--line);
}
.badge {
    border-radius: 6px;
    font-weight: 700;
    padding: .42em .58em;
}
.filter-panel { padding: 16px; }
.filter-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.filter-heading h2 { margin: 0; font-size: .98rem; font-weight: 750; }
.filter-heading span { color: var(--muted); font-size: .84rem; }
.filter-actions .btn { min-width: 42px; }
.ticket-table .table td:first-child {
    color: #1d4ed8;
    white-space: nowrap;
}
.ticket-table .table td:nth-child(2) {
    min-width: 220px;
    font-weight: 600;
}
.suggestion-box {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 8px;
    padding: 14px;
    display: none;
}
.comment-item {
    border-left: 3px solid var(--brand);
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.internal-note { border-left-color: #f59e0b; background: #fffbeb; }
.timeline-item { border-bottom: 1px solid var(--line); padding: 10px 0; color: var(--muted); }
.timeline-feed {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.timeline-entry {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
}
.timeline-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #eff6ff;
    color: var(--brand);
}
.timeline-entry.note .timeline-icon { background: #fffbeb; color: #b45309; }
.timeline-entry.attachment .timeline-icon { background: #ecfdf5; color: #047857; }
.timeline-entry.history .timeline-icon { background: #f8fafc; color: #64748b; }
.timeline-body {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px 14px;
}
.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: #1d4ed8;
    font-size: .88rem;
    font-weight: 650;
}
.notification-menu { width: min(360px, calc(100vw - 24px)); }
.notification-menu .dropdown-item { white-space: normal; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.alert { border-radius: 8px; border-width: 1px; box-shadow: var(--shadow); }
.company-preview {
    display: flex;
    align-items: center;
    gap: 14px;
}
.company-preview img, .company-preview span {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    object-fit: cover;
    background: var(--brand);
    color: #fff;
    font-size: 1.6rem;
    font-weight: 800;
}
.company-preview p { color: var(--muted); margin: 3px 0 0; }
.landing-page {
    min-height: 100vh;
    background: #f6f8fb;
    color: #111827;
}
.landing-nav {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.landing-brand {
    color: #111827;
    font-weight: 800;
    font-size: 1.1rem;
}
.landing-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.landing-actions a:not(.btn) {
    color: #334155;
    font-weight: 650;
}
.landing-hero {
    max-width: 1180px;
    margin: 0 auto;
    min-height: 560px;
    padding: 64px 24px 48px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
    align-items: center;
    gap: 52px;
}
.landing-copy h1 {
    max-width: 760px;
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    line-height: 1;
    font-weight: 850;
    margin: 0 0 22px;
    color: #0f172a;
}
.landing-copy .lead {
    max-width: 680px;
    color: #475569;
    font-size: 1.2rem;
    line-height: 1.65;
}
.eyebrow {
    color: #0f766e;
    font-weight: 800;
    text-transform: uppercase;
    font-size: .78rem;
    letter-spacing: 0;
    margin-bottom: 14px;
}
.landing-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}
.landing-panel {
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
    padding: 22px;
    display: grid;
    gap: 14px;
}
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}
.metric-row span,
.ticket-preview span {
    color: #64748b;
    font-weight: 650;
}
.metric-row strong {
    font-size: 1.8rem;
    color: #0f766e;
}
.ticket-preview {
    display: grid;
    gap: 6px;
    padding: 18px;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
}
.landing-features {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px 70px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}
.landing-features article {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 24px;
}
.landing-features h2 {
    font-size: 1.1rem;
    font-weight: 800;
}
.landing-features p {
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

@media (max-width: 1180px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-panel { min-height: 100vh; padding: 28px; }
    .content-wrap { padding: 18px; }
    .topbar { padding: 12px 16px; align-items: flex-start; }
    .topbar > div:last-child { flex-wrap: wrap; justify-content: flex-end; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .landing-nav { padding: 14px 18px; }
    .landing-actions { gap: 10px; }
    .landing-hero {
        grid-template-columns: 1fr;
        min-height: 0;
        padding: 42px 18px 34px;
        gap: 28px;
    }
    .landing-copy .lead { font-size: 1rem; }
    .landing-panel { padding: 16px; }
    .landing-features {
        grid-template-columns: 1fr;
        padding: 0 18px 44px;
    }
}
@media (max-width: 520px) {
    .stat-grid { grid-template-columns: 1fr; }
    .landing-nav {
        align-items: flex-start;
        flex-direction: column;
    }
}
