/* ==========================================================================
   AutoCrafterAI — Customer dashboard stylesheet
   Self-contained: tokens + top-nav layout + components + auth.
   ========================================================================== */

:root {
    --brand: #1c6c8f;
    --brand-deep: #14546f;
    --brand-bright: #18a8c8;
    --brand-tint: rgba(24, 168, 200, 0.10);
    --brand-gradient: linear-gradient(135deg, var(--brand-deep), var(--brand-bright));

    --bg: #f4f7f9;
    --surface: #ffffff;
    --text: #112a33;
    --text-soft: #5d717a;
    --border: rgba(17, 42, 51, 0.10);
    --success: #16a34a;
    --danger: #e2556a;

    --font-h: 'Manrope', -apple-system, sans-serif;
    --font-b: 'Inter', -apple-system, sans-serif;
    --radius: 12px;
    --container: 960px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-b); color: var(--text); background-color: var(--bg); font-size: 15px; }
a { text-decoration: none; color: inherit; }
.text-accent { color: var(--brand-bright); }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 24px; }

/* ── Shell (sidebar + body) ────────────────────────────────────────────── */
.dash { min-height: 100vh; }
.side {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: 260px; display: flex; flex-direction: column;
    background-color: var(--surface); border-right: 1px solid var(--border);
    padding: 22px 16px;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; font-family: var(--font-h); font-weight: 800; font-size: 18px; }
.side-brand img { width: 30px; height: 30px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    font-family: var(--font-h); font-weight: 600; font-size: 14.5px; color: var(--text-soft);
    position: relative; transition: color .15s ease, background-color .15s ease;
}
.side-link svg { width: 20px; height: 20px; flex-shrink: 0; opacity: .85; }
.side-link:hover { color: var(--text); background-color: var(--bg); }
.side-link.is-active { color: var(--brand); background-color: var(--brand-tint); }
.side-link.is-active::before {
    content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 22px; border-radius: 0 4px 4px 0; background-image: var(--brand-gradient);
}
.side-link.is-active svg { opacity: 1; }

.side-foot { margin-top: auto; padding-top: 18px; }
.side-upgrade {
    display: block; padding: 14px 16px; margin-bottom: 14px; border-radius: 12px;
    background-image: var(--brand-gradient); color: #fff;
}
.side-upgrade strong { display: block; font-family: var(--font-h); font-size: 15px; }
.side-upgrade span { display: block; margin-top: 3px; font-size: 12.5px; opacity: .85; }

.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 6px 0; border-top: 1px solid var(--border); padding-top: 14px; }
.side-avatar {
    display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0;
    border-radius: 50%; background-image: var(--brand-gradient); color: #fff;
    font-family: var(--font-h); font-weight: 700; font-size: 15px;
}
.side-user-meta { display: flex; flex-direction: column; min-width: 0; }
.side-user-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-plan { font-size: 12px; color: var(--text-soft); }
.side-logout {
    margin-left: auto; display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0;
    border: 1px solid var(--border); border-radius: 9px; background: transparent; color: var(--text-soft); cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}
.side-logout svg { width: 18px; height: 18px; }
.side-logout:hover { color: var(--danger); border-color: var(--danger); }

.side-backdrop { display: none; position: fixed; inset: 0; z-index: 30; background: rgba(17, 42, 51, .45); }

/* ── Body / topbar / content ───────────────────────────────────────────── */
.dash-body { margin-left: 260px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 14px;
    height: 64px; padding: 0 clamp(24px, 4vw, 44px);
    background-color: rgba(255, 255, 255, .85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.topbar-burger { display: none; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 9px; background: transparent; color: var(--text); cursor: pointer; }
.topbar-burger svg { width: 20px; height: 20px; }
.topbar-title { font-family: var(--font-h); font-weight: 700; font-size: 16px; }
.topbar-uid { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--brand); background-color: var(--brand-tint); padding: 5px 11px; border-radius: 999px; }

.dash-content { flex: 1; width: 100%; max-width: 1040px; margin-inline: auto; padding: clamp(28px, 4vw, 40px) clamp(24px, 4vw, 44px) 64px; }
.dash-head { margin-bottom: 28px; }
.dash-title { font-family: var(--font-h); font-size: 28px; font-weight: 800; margin: 0; }
.dash-sub { margin: 6px 0 0; color: var(--text-soft); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 28px; }
.card { background-color: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card-label { font-size: 13px; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.4px; }
.card-value { display: block; margin-top: 8px; font-family: var(--font-h); font-size: 24px; font-weight: 800; }
.card-value--uid { font-family: 'JetBrains Mono', monospace; font-size: 19px; color: var(--brand); }
.card-meta { display: block; margin-top: 8px; font-size: 12.5px; color: var(--text-soft); }

/* ── Upsell banner ─────────────────────────────────────────────────────── */
.upsell {
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    padding: 22px 26px; margin-bottom: 30px; border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(20, 84, 111, .06), rgba(24, 168, 200, .10));
    border: 1px solid rgba(24, 168, 200, .28);
}
.upsell h2 { font-family: var(--font-h); font-size: 17px; font-weight: 800; margin: 0 0 4px; }
.upsell p { margin: 0; color: var(--text-soft); font-size: 14px; }

/* ── Quick actions ─────────────────────────────────────────────────────── */
.dash-section { font-family: var(--font-h); font-size: 15px; font-weight: 700; margin: 4px 0 16px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.quick {
    display: flex; align-items: center; gap: 15px; padding: 18px 20px;
    background-color: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.quick:hover { border-color: var(--brand-bright); transform: translateY(-2px); box-shadow: 0 14px 30px -18px rgba(17, 42, 51, .3); }
.quick-icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 11px; background-color: var(--brand-tint); color: var(--brand); }
.quick-icon svg { width: 22px; height: 22px; }
.quick-text { display: flex; flex-direction: column; min-width: 0; }
.quick-text strong { font-family: var(--font-h); font-size: 15px; }
.quick-text span { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }

.pill { display: inline-block; padding: 4px 12px; font-size: 13px; font-weight: 700; border-radius: 999px; }
.pill--active { color: var(--success); background-color: rgba(22, 163, 74, 0.12); }
.pill--suspended { color: var(--danger); background-color: rgba(226, 85, 106, 0.12); }

.panel { background-color: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.panel h2 { font-family: var(--font-h); font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.panel p { color: var(--text-soft); margin: 0 0 18px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-family: var(--font-h); font-weight: 600; font-size: 14px; padding: 11px 20px; border: 1px solid transparent; border-radius: 999px; cursor: pointer; transition: filter 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.btn--primary { background-image: var(--brand-gradient); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--block { width: 100%; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field label { font-family: var(--font-h); font-weight: 600; font-size: 14px; }
.input { width: 100%; padding: 11px 13px; font: inherit; font-size: 14px; color: var(--text); background-color: #fff; border: 1px solid var(--border); border-radius: 9px; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.field-error { font-size: 13px; color: var(--danger); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.alert { padding: 13px 18px; border-radius: 10px; font-size: 14px; margin-bottom: 22px; }
.alert--success { color: var(--success); background-color: rgba(22, 163, 74, 0.10); border: 1px solid rgba(22, 163, 74, 0.35); }

/* ── Auth (login / register) ───────────────────────────────────────────── */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(60% 60% at 50% 0%, var(--brand-tint), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 430px; background-color: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 34px; box-shadow: 0 30px 60px -30px rgba(17, 42, 51, 0.25); }
.auth-logo { height: 38px; margin-bottom: 22px; }
.auth-title { font-family: var(--font-h); font-size: 24px; font-weight: 800; margin: 0 0 6px; }
.auth-sub { margin: 0 0 24px; color: var(--text-soft); font-size: 14px; }
.auth-foot { margin-top: 22px; text-align: center; font-size: 14px; color: var(--text-soft); }
.auth-foot a { color: var(--brand); font-weight: 600; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-soft); margin-bottom: 18px; }

/* ── Social login ──────────────────────────────────────────────────────── */
.btn-google {
    display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
    padding: 12px 20px; font-family: var(--font-h); font-weight: 600; font-size: 14.5px;
    color: var(--text); background-color: #fff; border: 1px solid var(--border); border-radius: 999px;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn-google svg { width: 18px; height: 18px; }
.btn-google:hover { border-color: var(--brand); box-shadow: 0 2px 10px -4px rgba(17, 42, 51, .2); }
.auth-divider { display: flex; align-items: center; gap: 14px; margin: 20px 0; color: var(--text-soft); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background-color: var(--border); }

/* ── Notice banner ─────────────────────────────────────────────────────── */
.notice {
    padding: 12px 18px;
    margin-bottom: 22px;
    font-size: 14px;
    color: var(--text-soft);
    background-color: var(--brand-tint);
    border: 1px solid rgba(24, 168, 200, 0.3);
    border-radius: 10px;
}
.notice strong { color: var(--brand); }

/* ── License card ──────────────────────────────────────────────────────── */
.license-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
}
.license-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.license-plan { font-family: var(--font-h); font-size: 18px; font-weight: 800; margin-right: 12px; }
.license-renew { font-size: 13px; color: var(--text-soft); }

.license-key {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    margin-bottom: 22px;
}
.license-key code {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--brand);
    letter-spacing: 0.5px;
    overflow-wrap: anywhere;
}

.license-sites-bar { height: 8px; border-radius: 999px; background-color: var(--bg); overflow: hidden; margin-bottom: 8px; }
.license-sites-bar span { display: block; height: 100%; background-image: var(--brand-gradient); }
.license-sites-label { font-size: 13px; color: var(--text-soft); }

.license-sites-list { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 6px; }
.license-site-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.license-site-row:last-child { border-bottom: 0; }
.license-site-url { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }

/* ── Release / download rows ───────────────────────────────────────────── */
.release-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.release-row:last-child { border-bottom: 0; }
.release-head { display: flex; align-items: center; gap: 10px; }
.release-ver { font-family: var(--font-h); font-weight: 700; font-size: 16px; }
.release-notes { margin: 8px 0 6px; font-size: 14px; color: var(--text-soft); }
.release-date { font-size: 13px; color: var(--text-soft); }

.pill--pending { color: var(--brand); background-color: var(--brand-tint); }

/* ── Billing table ─────────────────────────────────────────────────────── */
.bill-table { width: 100%; border-collapse: collapse; }
.bill-table th {
    text-align: left;
    padding: 14px 24px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-soft);
    border-bottom: 1px solid var(--border);
}
.bill-table td { padding: 16px 24px; border-bottom: 1px solid var(--border); font-size: 14px; }
.bill-table tr:last-child td { border-bottom: 0; }
.bill-inv { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--brand); }
.bill-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Invoice ───────────────────────────────────────────────────────────── */
.invoice-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.invoice {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
}
.invoice-top { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.invoice-logo { height: 32px; margin-bottom: 12px; }
.invoice-from { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-soft); }
.invoice-meta { text-align: right; }
.invoice-meta h1 { font-family: var(--font-h); font-size: 26px; font-weight: 800; margin: 0 0 8px; }
.invoice-meta p { margin: 2px 0; font-size: 13px; color: var(--text-soft); }
.invoice-meta .pill { margin-top: 8px; }
.invoice-billto { margin-bottom: 28px; }
.invoice-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-soft); }
.invoice-billto p { margin: 6px 0 0; font-size: 14px; line-height: 1.7; }
.invoice-uid { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--brand); }
.invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.invoice-table th { text-align: left; padding: 12px 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-soft); border-bottom: 2px solid var(--border); }
.invoice-table td { padding: 16px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.invoice-table .ar { text-align: right; }
.invoice-table tfoot td { border-bottom: 0; padding-top: 18px; }
.invoice-total { font-family: var(--font-h); font-weight: 800; font-size: 18px; }
.invoice-ref { font-size: 13px; color: var(--text-soft); }
.invoice-foot { margin-top: 24px; font-size: 13px; color: var(--text-soft); }

@media print {
    .side, .topbar, .invoice-actions { display: none !important; }
    body { background: #fff; }
    .dash-body { margin-left: 0; }
    .dash-content { padding: 0; max-width: none; }
    .invoice { border: 0; padding: 0; }
}

/* ── Responsive: sidebar becomes an off-canvas drawer ──────────────────── */
@media (max-width: 960px) {
    .side { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 30px 60px -20px rgba(17, 42, 51, .3); }
    .dash.is-side-open .side { transform: translateX(0); }
    .dash.is-side-open .side-backdrop { display: block; }
    .dash-body { margin-left: 0; }
    .topbar-burger { display: grid; place-items: center; }
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
    .release-row { flex-direction: column; align-items: stretch; }
    .license-top { flex-direction: column; align-items: flex-start; }
    .bill-table th:nth-child(2), .bill-table td:nth-child(2) { display: none; }
    .topbar-uid { display: none; }
}

