/* AB Computers Customer Portal — hand-rolled, dependency-free CSS */

:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --ink: #16232e;
    --muted: #5b6b7c;
    --line: #dfe6ee;
    --brand: #0f2d4a;
    --brand-2: #14538c;
    --accent: #0e7c66;
    --danger: #b3261e;
    --warn: #b45309;
    --ok: #0e7c66;
    --focus: #1a73e8;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(15, 45, 74, 0.08), 0 4px 14px rgba(15, 45, 74, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background:
        radial-gradient(1200px 400px at 85% -10%, rgba(20, 83, 140, 0.10), transparent 60%),
        var(--bg);
    min-height: 100vh;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--brand);
    color: #fff;
    padding: 8px 14px;
    border-radius: 0 0 8px 0;
    z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------------- topbar ---------------- */

.topbar {
    background: var(--brand);
    color: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: linear-gradient(135deg, #14538c, #0e7c66);
    color: #fff;
    font-size: 15px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small {
    font-weight: 400;
    font-size: 11px;
    color: #cfe0f0;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.nav {
    display: flex;
    gap: 4px;
    margin-left: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
    color: #d7e4f0;
    padding: 9px 13px;
    border-radius: 8px;
    font-weight: 500;
    white-space: nowrap;
    font-size: 14.5px;
    border: 1px solid transparent;
}
.nav a:hover { background: rgba(255, 255, 255, 0.12); text-decoration: none; }
.nav a.active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border-color: rgba(255, 2, 2, 0);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0; }
.user-chip {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13.5px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.logout-form { display: inline-flex; }

/* ---------------- layout ---------------- */

.shell { display: flex; flex-direction: column; min-height: 100vh; }
.main {
    flex: 1;
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.2px; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 14.5px; }

/* ---------------- cards & stats ---------------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.card + .card { margin-top: 18px; }
.card h2 { margin: 0 0 14px; font-size: 18px; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--brand-2);
}
.stat.ok::before { background: var(--ok); }
.stat.warn::before { background: var(--warn); }
.stat.danger::before { background: var(--danger); }
.stat-label { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; color: var(--ink); }
.stat-hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------------- tables ---------------- */

.table-wrap { overflow-x: auto; }
table.list {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}
table.list th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--muted);
    padding: 10px 12px;
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}
table.list td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.list tbody tr:hover { background: #f8fafd; }
table.list td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list th.num { text-align: right; }
.nowrap { white-space: nowrap; }

.empty {
    text-align: center;
    color: var(--muted);
    padding: 36px 16px !important;
}

/* ---------------- badges ---------------- */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge.unpaid { background: #fdf3e2; color: var(--warn); }
.badge.paid { background: #e5f5f0; color: var(--ok); }
.badge.overdue { background: #fde8e6; color: var(--danger); }
.badge.open { background: #e8f0fe; color: #1a56b0; }
.badge.answered { background: #e5f5f0; color: var(--ok); }
.badge.closed { background: #eceff3; color: var(--muted); }
.badge.low { background: #eceff3; color: var(--muted); }
.badge.normal { background: #e8f0fe; color: #1a56b0; }
.badge.high { background: #fde8e6; color: var(--protected) }
.badge.high { background: #fde8e6; color: var(--danger); }
.badge.method-card { background: #e8f0fe; color: #1a56b0; }
.badge.method-bank { background: #eceff3; color: var(--muted); }

/* ---------------- filter pills ---------------- */

.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none !important;
}
.pill:hover { border-color: var(--brand-2); color: var(--brand-2); }
.pill.active { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }

/* ---------------- buttons & forms ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    background: var(--brand-2);
    color: #fff;
    transition: background 0.15s ease, transform 0.05s ease;
    text-decoration: none !important;
}
.btn:hover { background: #0d4m2f; }
.btn:hover { background: #0d4674; }
.btn:active { transform: translateY(1px); }
.btn.secondary {
    background: #fff;
    color: var(--brand-2);
    border-color: var(--brand-2);
}
.btn.secondary:hover { background: #f0f6fc; }
.btn.ghost { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.35); }
.btn.ghost:hover { background: rgba(255,255,255,0.24); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #8f1d17; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------------- forms ---------------- */

.form-grid { display: grid; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 12.5px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #b9c6d4;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15); }
textarea { min-height: 120px; resize: vertical; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.form-actions .btn { min-width: 140px; }

/* ---------------- login ---------------- */

body.login-body {
    background: radial-gradient(900px 500px at 20% -10%, #14538c 0%, #0f2d4a 55%, #0a1f35 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 420px;
    padding: 36px 34px 30px;
}
.login-card h1 { margin: 0 0 6px; font-size: 24px; }
.login-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-form .field + .field { margin-top: 16px; }
.login-form .field label { font-weight: 600; font-size: 14px; }
.login-form input { padding: 12px 14px; }
.login-form .btn { width: 100%; margin-top: 22px; padding: 12px; }
.login-footer {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12.5px;
    text-align: center;
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}
.login-brand .brand-mark { width: 44px; height: 44px; font-size: 17px; }
.login-brand span.name { font-weight: 700; font-size: 17px; color: var(--brand); }
.login-brand small { display: block; color: var(--muted); font-size: 12px; }
.demo-hint {
    background: #f0f6fc;
    border: 1px solid #cfe0f0;
    color: #14538c;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12.5px;
    margin-top: 16px;
    text-align: center;
}
.demo-hint code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #fff; padding: 1px 5px; border-radius: 4px; border: 1px solid #cfe0f0; }

/* ---------------- flashes ---------------- */

.flashes { display: grid; gap: 10px; margin-bottom: 18px; }
.flash {
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14.5px;
    border: 1px solid transparent;
}
.flash-success { background: #e5f5f0; color: #0b5d4d; border-color: #b9e3d6; }
.flash-error { background: #fde8e6; color: #8f1d17; border-color: #f2c4c0; }
.flash-notice { background: #e8f0fe; color: #1a56b0; border-color: #c5d8f7; }

/* ---------------- tickets ---------------- */

.thread { display: grid; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.msg.customer { border-left: 4px solid var(--brand-2); }
.msg.support { border-left: 4px solid var(--accent); background: #f6fbfa; }
.msg-head {
    display: flex;
    justify-content: folder;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    background: #f8fafd;
    border-bottom: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--muted);
    flex-wrap: wrap;
}
.msg-head .who { font-weight: 700; color: var(--ink); text-transform: capitalize; }
.msg-body { padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }

.reply-box { margin-top: 18px; }

/* ---------------- misc ---------------- */

.footer {
    border-top: 1px solid var(--line);
    padding: 18px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    background: #fff;
}
.footer span { display: block; margin-bottom: 4px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14.5px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.muted { color: var(--muted); }
.right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

.error-page { max-width: 560px; margin: 60px auto; text-align: center; padding: 0 20px; }
.error-page h1 { font-size: 56px; margin: 0; color: var(--brand); }
.error-page p { color: var(--muted); font-size: 16px; }

@media (max-width: 980px) {
    .topbar-inner { flex-wrap: wrap; padding: 10px 14px; gap: 8px; min-height: 0; }
    .nav {
        order: 3;
        width: 100%;
        flex: 0 0 100%;
        margin-left: 0;
        padding-bottom: 4px;
    }
    .nav a { padding: 8px 10px; font-size: 13.5px; }
    .topbar-actions { margin-left: auto; }
    .user-chip { max-width: 120px; font-size: 12.5px; padding: 5px 10px; }
    .main { padding: 20px 14px 40px; }
    .stat-value { font-size: 24px; }
    .page-head h1 { font-size: 22px; }
    .grid-2 { grid-template-columns: 1fr; }
    .form-actions .btn { width: 100%; }
}

@media (max-width: 520px) {
    .topbar-inner { padding-inline: 12px; }
    .brand { gap: 8px; }
    .brand-mark { width: 34px; height: 34px; border-radius: 8px; }
    .brand-text { font-size: 14px; }
    .brand-text small { font-size: 9.5px; }
    .user-chip { display: none; }
    .topbar-actions { gap: 6px; }
    .nav { gap: 2px; }
    .nav a { padding: 7px 9px; font-size: 13px; }
    .main { padding-inline: 12px; }
}

@media print {
    .topbar, .footer, .flashes, .btn, .reply-box { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #999; }
}
