/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
    --page-bg: #f3f7fc;
    --surface: #ffffff;
    --surface-alt: #edf4ff;
    --text: #12233f;
    --muted: #607089;
    --line: rgba(16, 38, 69, 0.12);
    --brand: #0b63c8;
    --brand-dark: #084892;
    --brand-soft: rgba(11, 99, 200, 0.14);
    --success: #0f8c57;
    --success-soft: rgba(15, 140, 87, 0.12);
    --danger: #c43b3b;
    --danger-soft: rgba(196, 59, 59, 0.10);
    --warning: #b96200;
    --warning-soft: rgba(185, 98, 0, 0.12);
    --gray: #607089;
    --gray-soft: rgba(96, 112, 137, 0.12);
    --shadow: 0 28px 80px rgba(11, 33, 63, 0.14);
    --radius: 16px;
    --nav-h: 68px;
    --header-h: 56px;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    min-height: 100%;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--page-bg);
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ── App layout shell ────────────────────────────────────────────────────── */
.app-layout {
    background: #f0f5fb;
}

.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid var(--line);
    z-index: 100;
    box-shadow: 0 2px 12px rgba(11,33,63,0.07);
}

.app-header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 16px;
    gap: 12px;
}

.header-back {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    font-size: 1.3rem;
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--brand);
    flex-shrink: 0;
}

.header-logo-wrap { flex-shrink: 0; }
.header-logo { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; }

.header-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions { margin-left: auto; display: flex; gap: 8px; }

.header-btn {
    background: var(--brand);
    color: #fff;
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ── Main shell ──────────────────────────────────────────────────────────── */
.shell { min-height: 100vh; }

.shell-app {
    padding-top: calc(var(--header-h) + 12px);
    padding-bottom: calc(var(--nav-h) + 16px);
}

.page-wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 8px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Bottom navigation ───────────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: #fff;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(11,33,63,0.07);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: 10px;
    color: var(--muted);
    transition: color 0.2s, background 0.2s;
    flex: 1;
    min-width: 0;
}

.bnav-item.active {
    color: var(--brand);
    background: var(--brand-soft);
}

.bnav-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.bnav-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.bnav-add {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff !important;
    font-size: 1.6rem;
    display: grid;
    place-items: center;
    margin-top: -14px;
    box-shadow: 0 6px 20px rgba(11,99,200,0.4);
    flex: none;
}

.bnav-add .bnav-icon { font-size: 1.4rem; }

/* ── Toast flash messages ─────────────────────────────────────────────────── */
.toast {
    margin: 4px 12px 0;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}
.toast-success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(15,140,87,0.2); }
.toast-error   { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(196,59,59,0.2); }

/* ── PWA Install Banner ──────────────────────────────────────────────────── */
.pwa-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(90deg, #0b3d91, #1a56db);
    color: #fff;
    padding: 10px 14px;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.pwa-banner-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.pwa-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
    line-height: 1.35;
}
.pwa-banner-text strong { font-size: 0.85rem; }
.pwa-banner-btn {
    background: #fff;
    color: #1a56db;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}
.pwa-banner-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

/* ── Hero banner ─────────────────────────────────────────────────────────── */
.hero-card {
    background: linear-gradient(135deg, #0b63c8, #084892);
    border-radius: var(--radius);
    padding: 20px 20px 22px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(11,99,200,0.38);
}

.hero-blob {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.hero-blob-a {
    width: 160px; height: 160px;
    top: -50px; right: -40px;
    background: rgba(255,255,255,0.10);
}
.hero-blob-b {
    width: 100px; height: 100px;
    bottom: -30px; right: 60px;
    background: rgba(135,215,255,0.12);
}

.hero-text { position: relative; z-index: 1; }
.hero-greeting { font-size: 0.8rem; opacity: 0.82; margin-bottom: 4px; }
.hero-shop { font-size: 1.25rem; font-weight: 800; margin-bottom: 4px; }
.hero-date { font-size: 0.72rem; opacity: 0.72; }
.hero-phone { font-size: 3rem; position: relative; z-index: 1; line-height: 1; }

/* ── Quick actions ───────────────────────────────────────────────────────── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.qa-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 6px;
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(11,33,63,0.07);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s;
    border-top: 3px solid transparent;
}
.qa-btn:active { transform: scale(0.94); }
.qa-icon  { font-size: 2.4rem; line-height: 1; }
.qa-label { font-size: 0.7rem; font-weight: 700; text-align: center; color: var(--muted); line-height: 1.3; }

.qa-repair   { border-top-color: #7c3aed; }
.qa-sale     { border-top-color: var(--success); }
.qa-customer { border-top-color: var(--brand); }
.qa-track    { border-top-color: var(--warning); }
.qa-recharge { border-top-color: #ed1c24; }

/* ── Recharge alerts on dashboard ─────────────────────────────────────────── */
.alerts-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.alerts-header {
    display: flex; justify-content: space-between; align-items: center;
}
.alerts-title { font-weight: 800; font-size: 0.92rem; }
.alerts-link  { font-size: 0.78rem; color: var(--brand); font-weight: 600; }
.alerts-list  { display: flex; flex-direction: column; gap: 6px; }

.alert-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: #f8fbff;
    border-left: 3px solid var(--gray);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s, background 0.15s;
}
.alert-row:active { transform: scale(0.98); }
.alert-expired  { border-left-color: var(--danger); background: rgba(196,59,59,0.05); }
.alert-upcoming { border-left-color: var(--warning); background: rgba(185,98,0,0.05); }
.alert-active   { border-left-color: var(--success); }

.alert-net {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: grid; place-items: center;
    color: #fff; font-size: 1rem;
    flex-shrink: 0;
}
.alert-info { flex: 1; min-width: 0; }
.alert-name { font-weight: 700; font-size: 0.88rem; line-height: 1.2; }
.alert-name small { font-weight: 500; color: var(--muted); font-size: 0.78rem; }
.alert-sub  { font-size: 0.74rem; color: var(--muted); margin-top: 2px; }

.alert-days {
    font-size: 0.75rem; font-weight: 800;
    padding: 4px 10px; border-radius: 999px;
    flex-shrink: 0;
    background: var(--gray-soft); color: var(--gray);
}
.alert-days-expired  { background: var(--danger-soft); color: var(--danger); }
.alert-days-upcoming { background: var(--warning-soft); color: var(--warning); }
.alert-days-active   { background: var(--success-soft); color: var(--success); }

/* ── Network selection (recharge form) ────────────────────────────────────── */
.network-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.network-radio {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    padding: 14px 8px;
    border-radius: 14px;
    background: var(--surface);
    border: 2px solid var(--line);
    cursor: pointer;
    transition: all 0.15s;
    --nw: var(--brand);
}
.network-radio input { display: none; }
.network-radio .nw-icon  { font-size: 1.6rem; line-height: 1; }
.network-radio .nw-label { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.network-radio-active {
    border-color: var(--nw);
    background: color-mix(in srgb, var(--nw) 10%, white);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--nw) 25%, transparent);
}
.network-radio-active .nw-label { color: var(--nw); }

/* ── Customer picker (search-as-you-type) ─────────────────────────────────── */
.cust-picker { position: relative; }

.cp-search-wrap { position: relative; }
.cp-icon {
    position: absolute;
    top: 50%; left: 12px;
    transform: translateY(-50%);
    font-size: 0.95rem;
    pointer-events: none;
    color: var(--muted);
}
.cp-search { padding-left: 36px !important; }

.cp-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(11,33,63,0.15);
    border: 1px solid var(--line);
    max-height: 280px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.cp-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
    transition: background 0.1s;
}
.cp-result:last-child { border-bottom: none; }
.cp-result:hover { background: var(--surface-alt); }

.cp-r-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    display: grid; place-items: center;
    font-size: 0.95rem;
    font-weight: 800;
    flex-shrink: 0;
}
.cp-r-info { flex: 1; min-width: 0; }
.cp-r-name { font-weight: 700; font-size: 0.9rem; }
.cp-r-mob { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.cp-empty {
    padding: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.cp-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--brand-soft);
    border: 1.5px solid var(--brand);
    border-radius: 12px;
}
.cp-sel-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: grid; place-items: center;
    font-size: 1rem;
    font-weight: 800;
    flex-shrink: 0;
}
.cp-sel-info { flex: 1; min-width: 0; }
.cp-sel-name { font-weight: 700; font-size: 0.95rem; }
.cp-sel-mob { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

.cp-clear {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.6);
    color: var(--danger);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.15s;
}
.cp-clear:hover { background: var(--danger-soft); }

/* ── Phone prefix widget (+965) ──────────────────────────────────────────── */
.phone-input-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
    transition: border-color 0.15s;
}
.phone-input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,0.12); }
.phone-prefix {
    padding: 0 10px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    border-right: 1.5px solid var(--line);
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    user-select: none;
}
.phone-digits-input {
    flex: 1;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: transparent;
    padding: 10px 12px;
    font-size: 1rem;
    outline: none;
    min-width: 0;
    letter-spacing: 0.08em;
}

/* ── Mobile lookup (repair form) ─────────────────────────────────────────── */
.mob-lookup-wrap { position: relative; }

.mob-suggest {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(11,33,63,0.15);
    border: 1px solid var(--line);
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.mob-sug-row {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
    transition: background 0.1s;
}
.mob-sug-row:last-child { border-bottom: none; }
.mob-sug-row:hover { background: var(--brand-soft); }
.mob-sug-mob  { font-size: 0.9rem; font-weight: 700; color: var(--brand); }
.mob-sug-name { font-size: 0.82rem; color: var(--muted); }

.cust-status {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--muted);
    padding: 8px 12px;
    background: var(--surface-alt);
    border-radius: 8px;
    border-left: 3px solid var(--line);
}
.cust-status-ok {
    background: var(--success-soft);
    color: var(--success);
    border-left-color: var(--success);
}
.cust-status-new {
    background: var(--warning-soft);
    color: var(--warning);
    border-left-color: var(--warning);
}

/* ── Quick-day chips for recharge validity ────────────────────────────────── */
.quick-days-row {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0;
    scrollbar-width: none;
    margin-top: -4px;
}
.quick-days-row::-webkit-scrollbar { display: none; }
.quick-days-label {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 700;
    flex-shrink: 0;
    margin-right: 4px;
}
.qd-chip {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
}
.qd-chip:hover { border-color: var(--brand); color: var(--brand); }
.qd-chip-active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* ── Auto-calculated expiry display ───────────────────────────────────────── */
.expiry-display {
    background: linear-gradient(135deg, var(--brand-soft), rgba(11,99,200,0.04));
    border: 1.5px dashed var(--brand);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
}
.expiry-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand);
    margin-bottom: 4px;
}
.expiry-date-big {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
}

/* ── WhatsApp send card on recharge edit ──────────────────────────────────── */
.wa-send-card {
    background: linear-gradient(135deg, rgba(37,211,102,0.06), rgba(37,211,102,0.02));
    border: 1.5px solid rgba(37,211,102,0.3);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.wa-send-meta {
    display: flex; flex-wrap: wrap; gap: 12px;
    font-size: 0.8rem; color: var(--muted);
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(37,211,102,0.3);
}
.wa-send-meta b { color: var(--text); font-weight: 700; }

/* ── List search bar ─────────────────────────────────────────────────────── */
.list-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 0 12px;
    margin-bottom: 4px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.list-search-wrap:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
.list-search-icon { font-size: 1rem; flex-shrink: 0; opacity: 0.5; }
.list-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 11px 0;
    font-size: 0.95rem;
    outline: none;
    color: var(--text);
    min-width: 0;
}
.list-search-input::placeholder { color: var(--muted); }
.list-search-clear {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    line-height: 1;
}
.list-search-clear:hover { background: var(--danger-soft); color: var(--danger); }
.list-search-count {
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
    padding: 2px 0 6px;
}

/* ── Recharge cards (list page) ───────────────────────────────────────────── */
.recharge-card {
    display: block;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    border-left: 4px solid var(--gray);
    text-decoration: none; color: var(--text);
    transition: transform 0.15s;
}
.recharge-card:active { transform: scale(0.98); }
.recharge-active   { border-left-color: var(--success); }
.recharge-upcoming { border-left-color: var(--warning); }
.recharge-expired  { border-left-color: var(--danger); }

.recharge-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.recharge-info { flex: 1; min-width: 0; }
.recharge-name { font-weight: 700; font-size: 0.95rem; }
.recharge-mobile { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

.network-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem; font-weight: 700;
    flex-shrink: 0;
}

.recharge-bottom {
    display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
}
.recharge-meta {
    display: flex; gap: 10px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap;
}

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px 8px 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    border-top: 3px solid transparent;
}

.stat-icon-wrap {
    font-size: 1rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    margin: 0 auto 6px;
}
.stat-icon-green { background: var(--success-soft); }
.stat-icon-amber { background: var(--warning-soft); }
.stat-icon-red   { background: var(--danger-soft); }
.stat-icon-blue  { background: var(--brand-soft); }

.stat-num {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-active   { border-top-color: var(--success); }
.stat-upcoming { border-top-color: var(--warning); }
.stat-overdue  { border-top-color: var(--danger); }
.stat-neutral  { border-top-color: var(--brand); }

.stat-active   .stat-num { color: var(--success); }
.stat-upcoming .stat-num { color: var(--warning); }
.stat-overdue  .stat-num { color: var(--danger); }
.stat-neutral  .stat-num { color: var(--brand); }

/* ── Filter tabs ─────────────────────────────────────────────────────────── */
.filter-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar { display: none; }

.tab {
    flex-shrink: 0;
    padding: 7px 14px;
    border-radius: 20px;
    background: var(--surface);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid var(--line);
    white-space: nowrap;
}

.tab-active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* ── Entry cards ─────────────────────────────────────────────────────────── */
.entry-list { display: flex; flex-direction: column; gap: 8px; }

.entry-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    border-left: 4px solid var(--gray);
}

.entry-active   { border-left-color: var(--success); }
.entry-upcoming { border-left-color: var(--warning); }
.entry-overdue  { border-left-color: var(--danger); }
.entry-completed { border-left-color: var(--gray); opacity: 0.75; }

.entry-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.entry-name   { font-weight: 700; font-size: 0.95rem; }
.entry-service { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.entry-dates  { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.entry-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.entry-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--muted);
}

.entry-actions { display: flex; gap: 6px; align-items: center; }

.entry-note {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--muted);
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-active    { background: var(--success-soft); color: var(--success); }
.badge-upcoming  { background: var(--warning-soft); color: var(--warning); }
.badge-overdue   { background: var(--danger-soft); color: var(--danger); }
.badge-completed { background: var(--gray-soft); color: var(--gray); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    box-shadow: 0 6px 18px rgba(11,99,200,0.3);
}

.btn-outline {
    background: #fff;
    color: var(--brand);
    border: 1.5px solid var(--brand);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-full { width: 100%; }

.btn-sm {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--surface-alt);
    color: var(--brand);
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-sm-success {
    background: var(--success-soft);
    color: var(--success);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}

.empty-icon { font-size: 2.8rem; margin-bottom: 12px; }
.empty-state p { margin-bottom: 20px; font-size: 0.95rem; }

/* ── Search bar ──────────────────────────────────────────────────────────── */
.search-bar {
    display: flex;
    gap: 8px;
    background: var(--surface);
    border-radius: 14px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
}

.btn-search {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 4px;
}

/* ── Customer list ───────────────────────────────────────────────────────── */
.customer-list { display: flex; flex-direction: column; gap: 8px; }

.customer-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    transition: transform 0.15s;
}

.customer-card:active { transform: scale(0.98); }

.cust-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    font-weight: 800;
    flex-shrink: 0;
}

.cust-info { flex: 1; min-width: 0; }
.cust-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 3px; }
.cust-meta { display: flex; gap: 10px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; }
.cust-arrow { color: var(--muted); font-size: 1.3rem; flex-shrink: 0; }

/* ── Settings page ───────────────────────────────────────────────────────── */
.settings-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    transition: transform 0.15s;
    text-decoration: none;
    color: var(--text);
}
.settings-card:active { transform: scale(0.98); }
.settings-card-logout { display: block; }
.settings-icon { font-size: 1.8rem; flex-shrink: 0; }
.settings-info { flex: 1; }
.settings-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 2px; }
.settings-sub { font-size: 0.78rem; color: var(--muted); }
.settings-footer { text-align: center; font-size: 0.78rem; color: var(--muted); padding: 8px 0; }

.pwa-settings-btn {
    padding: 8px 18px;
    font-size: 0.82rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Install App box ─────────────────────────────────────────────────────── */
.install-box {
    background: var(--surface);
    border: 1.5px solid var(--brand);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.install-box-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.install-box-logo {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.install-box-title { font-weight: 800; font-size: 1rem; }
.install-box-sub   { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.install-auto-btn { font-size: 1rem; padding: 13px; font-weight: 700; }

.install-progress {
    background: var(--surface-2);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.install-progress-bar {
    height: 6px;
    background: var(--brand);
    border-radius: 3px;
    width: 0;
    transition: width 0.5s ease;
}
.install-progress-label {
    font-size: 0.78rem;
    color: var(--muted);
    text-align: center;
}

.install-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.install-manual { display: flex; flex-direction: column; gap: 10px; }
.install-manual-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.install-diag {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    font-size: 0.82rem;
}
.install-diag summary {
    cursor: pointer;
    color: var(--muted);
    user-select: none;
    list-style: none;
}
.install-diag summary::-webkit-details-marker { display: none; }
.diag-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.diag-row  { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.diag-dot  {
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}

.ios-install-box {
    background: var(--surface);
    border: 1.5px solid var(--brand);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: -6px;
}
.ios-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    line-height: 1.5;
}
.ios-step span:first-child {
    background: var(--brand);
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}
.ios-share-icon {
    display: inline-block;
    background: #007aff;
    color: #fff;
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 0.8rem;
}

/* ── Customer detail ─────────────────────────────────────────────────────── */
.detail-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
}

.detail-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 auto 10px;
}

.detail-name { font-size: 1.15rem; font-weight: 800; margin-bottom: 6px; }
.detail-meta { display: flex; justify-content: center; gap: 14px; font-size: 0.82rem; color: var(--muted); flex-wrap: wrap; }
.detail-notes { margin-top: 10px; font-size: 0.85rem; color: var(--muted); text-align: left; }
.detail-btns { display: flex; gap: 10px; margin-top: 16px; justify-content: center; }

/* ── Mini stats (customer detail) ────────────────────────────────────────── */
.mini-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.mstat {
    background: var(--surface);
    border-radius: 12px;
    padding: 10px 6px;
    text-align: center;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mstat span { display: block; font-size: 1.3rem; font-weight: 800; margin-bottom: 2px; }
.mstat-active span    { color: var(--success); }
.mstat-upcoming span  { color: var(--warning); }
.mstat-overdue span   { color: var(--danger); }
.mstat-completed span { color: var(--gray); }

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding-top: 4px;
}

/* ── CRM Form ────────────────────────────────────────────────────────────── */
.crm-form { display: flex; flex-direction: column; gap: 14px; }

.for-customer {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-alt);
    border-radius: 12px;
    padding: 12px;
}

.cust-avatar-sm {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    display: grid; place-items: center;
    font-size: 0.9rem; font-weight: 800;
    flex-shrink: 0;
}

.for-name { font-weight: 700; font-size: 0.9rem; }
.for-mobile { font-size: 0.78rem; color: var(--muted); }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1.5px solid #dfe7f1;
    background: #f8fbff;
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(11,99,200,0.12);
    background: #fff;
}

.form-textarea { min-height: 90px; resize: vertical; }

.form-hint { font-size: 0.75rem; color: var(--muted); }

.delete-form { margin-top: 4px; }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(196,59,59,0.2); }

/* ── Reminder list ───────────────────────────────────────────────────────── */
.reminder-legend { display: flex; gap: 8px; flex-wrap: wrap; }
.reminder-list { display: flex; flex-direction: column; gap: 8px; }

.reminder-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    border-left: 4px solid var(--gray);
}

.reminder-pending { border-left-color: var(--brand); }
.reminder-sent    { border-left-color: var(--success); opacity: 0.8; }
.reminder-failed  { border-left-color: var(--danger); }
.reminder-skipped { border-left-color: var(--gray); opacity: 0.6; }

.rem-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.rem-customer { font-weight: 700; font-size: 0.9rem; }
.rem-service  { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.rem-meta { display: flex; gap: 8px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; margin-bottom: 8px; }
.rem-message {
    font-size: 0.78rem;
    color: var(--muted);
    background: #f4f8fd;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}
.rem-actions { display: flex; gap: 8px; }

/* ── WhatsApp page ───────────────────────────────────────────────────────── */
.wa-status-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    font-weight: 600;
    font-size: 1rem;
}

.wa-connected    { color: var(--success); }
.wa-disconnected { color: var(--danger); }
.wa-loading      { color: var(--muted); }

.wa-qr-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
}

.qr-instructions { font-size: 0.85rem; color: var(--muted); margin-bottom: 16px; }
.qr-img { max-width: 240px; width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.qr-refresh { font-size: 0.75rem; color: var(--muted); margin-top: 10px; }

.wa-actions { display: flex; justify-content: center; }

.manual-send-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.manual-result {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
}
.result-success { background: var(--success-soft); color: var(--success); }
.result-error   { background: var(--danger-soft); color: var(--danger); }

/* ── Repair job cards ────────────────────────────────────────────────────── */
.repair-card {
    display: block;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    border-left: 4px solid var(--gray);
    text-decoration: none; color: var(--text);
    transition: transform 0.15s;
}
.repair-card:active { transform: scale(0.98); }
.repair-received    { border-left-color: var(--brand); }
.repair-diagnosing  { border-left-color: var(--warning); }
.repair-waiting_parts { border-left-color: #d97706; }
.repair-in_repair   { border-left-color: #7c3aed; }
.repair-ready       { border-left-color: var(--success); }
.repair-delivered   { border-left-color: var(--gray); opacity: 0.8; }
.repair-cancelled   { border-left-color: var(--danger); opacity: 0.7; }

.repair-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.repair-job-no { font-weight: 800; font-size: 0.9rem; color: var(--brand); }
.repair-device { font-weight: 700; font-size: 0.95rem; margin-bottom: 3px; }
.repair-customer { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.repair-meta { display: flex; gap: 10px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; margin-bottom: 4px; }
.repair-problem { font-size: 0.82rem; color: var(--muted); margin-top: 4px; border-top: 1px solid var(--line); padding-top: 6px; }

/* Repair badge colours */
.badge-repair-brand   { background: var(--brand-soft); color: var(--brand); }
.badge-repair-warning { background: var(--warning-soft); color: var(--warning); }
.badge-repair-amber   { background: rgba(217,119,6,0.12); color: #b45309; }
.badge-repair-purple  { background: rgba(124,58,237,0.12); color: #6d28d9; }
.badge-repair-success { background: var(--success-soft); color: var(--success); }
.badge-repair-gray    { background: var(--gray-soft); color: var(--gray); }
.badge-repair-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-lg { padding: 5px 14px; font-size: 0.78rem; }

/* ── Repair job detail ────────────────────────────────────────────────────── */
.job-header-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.job-number { font-size: 1.2rem; font-weight: 800; color: var(--brand); }
.job-device { font-size: 0.95rem; color: var(--muted); }
.job-imei   { font-size: 0.78rem; color: var(--muted); }

/* Status stepper */
.status-stepper {
    display: flex; align-items: center; overflow-x: auto;
    background: var(--surface); border-radius: var(--radius);
    padding: 14px 12px; gap: 0;
    box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    scrollbar-width: none;
}
.status-stepper::-webkit-scrollbar { display: none; }
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.step-dot {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--line); color: var(--muted);
    display: grid; place-items: center;
    font-size: 0.72rem; font-weight: 700;
}
.step-done .step-dot  { background: var(--success-soft); color: var(--success); }
.step-current .step-dot { background: var(--brand); color: #fff; }
.step-label { font-size: 0.62rem; color: var(--muted); font-weight: 600; text-align: center; max-width: 56px; }
.step-done .step-label, .step-current .step-label { color: var(--text); }
.step-line { flex: 1; height: 2px; background: var(--line); min-width: 10px; }
.step-line-done { background: var(--success); }

.status-update-box {
    background: var(--surface); border-radius: var(--radius);
    padding: 14px; box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    display: flex; flex-direction: column; gap: 10px;
}
.wa-notify-label { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); cursor: pointer; white-space: nowrap; }

/* Info grid (detail page) */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.info-card { background: var(--surface); border-radius: 12px; padding: 12px; box-shadow: 0 2px 8px rgba(11,33,63,0.06); }
.info-card-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.info-card-val   { font-size: 1rem; font-weight: 700; }
.info-card-sub   { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

.detail-section { background: var(--surface); border-radius: 12px; padding: 14px; box-shadow: 0 2px 8px rgba(11,33,63,0.06); }
.detail-text { font-size: 0.88rem; color: var(--text); line-height: 1.6; }

/* Status log */
.status-log { display: flex; flex-direction: column; gap: 0; }
.log-row { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.log-row:last-child { padding-bottom: 0; }
.log-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
.log-dot-brand   { background: var(--brand); }
.log-dot-warning { background: var(--warning); }
.log-dot-amber   { background: #d97706; }
.log-dot-purple  { background: #7c3aed; }
.log-dot-success { background: var(--success); }
.log-dot-gray    { background: var(--gray); }
.log-dot-danger  { background: var(--danger); }
.log-body { flex: 1; }
.log-status { font-weight: 700; font-size: 0.85rem; }
.log-note   { font-size: 0.8rem; color: var(--muted); margin-top: 1px; }
.log-time   { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

/* Section label */
.form-section-label {
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--muted); padding-top: 4px;
}

/* ── Sales cards ─────────────────────────────────────────────────────────── */
.sale-card {
    display: block; background: var(--surface); border-radius: var(--radius);
    padding: 14px; box-shadow: 0 2px 8px rgba(11,33,63,0.06);
    text-decoration: none; color: var(--text); transition: transform 0.15s;
}
.sale-card:active { transform: scale(0.98); }
.sale-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.sale-inv      { font-weight: 800; font-size: 0.9rem; color: var(--brand); }
.sale-customer { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.sale-amount   { font-size: 1.1rem; font-weight: 800; color: var(--success); }
.sale-amount span { font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.sale-meta     { display: flex; gap: 8px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; align-items: center; }
.pay-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.pay-badge-lg  { padding: 5px 14px; font-size: 0.82rem; }
.pay-cash     { background: var(--success-soft); color: var(--success); }
.pay-card     { background: var(--brand-soft); color: var(--brand); }
.pay-transfer { background: rgba(124,58,237,0.12); color: #6d28d9; }

/* ── New sale form ────────────────────────────────────────────────────────── */
.customer-type-row { display: flex; gap: 8px; }
.type-radio { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line); cursor: pointer; font-weight: 600; font-size: 0.9rem; transition: all 0.15s; }
.type-radio input { display: none; }
.type-radio-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }

.items-table-wrap { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 8px rgba(11,33,63,0.06); }
.items-header { display: grid; grid-template-columns: 2fr 0.6fr 1fr 0.8fr 0.8fr 0.4fr; gap: 4px; padding: 8px 10px; background: var(--surface-alt); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.item-row { display: grid; grid-template-columns: 2fr 0.6fr 1fr 0.8fr 0.8fr 0.4fr; gap: 4px; padding: 6px 10px; border-top: 1px solid var(--line); align-items: center; }
.item-row .form-input { padding: 8px 10px; font-size: 0.85rem; }
.item-total { font-weight: 700; font-size: 0.85rem; text-align: right; }
.btn-sm-danger { background: var(--danger-soft); color: var(--danger); }

.totals-box { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: 0 2px 8px rgba(11,33,63,0.06); display: flex; flex-direction: column; gap: 10px; }
.totals-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.totals-input { max-width: 140px; padding: 8px 10px !important; text-align: right; }
.totals-grand { font-size: 1.1rem; font-weight: 800; color: var(--success); padding-top: 8px; border-top: 1px solid var(--line); }

/* ── Invoice detail ──────────────────────────────────────────────────────── */
.invoice-card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 8px rgba(11,33,63,0.06); }
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.invoice-no { font-size: 1.1rem; font-weight: 800; color: var(--brand); }
.invoice-date { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.invoice-customer { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.invoice-cust-name { font-weight: 700; }
.invoice-cust-mob  { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.invoice-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.invoice-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--line); }
.invoice-table td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.text-right { text-align: right !important; }
.inv-subtotal-row td { color: var(--muted); font-size: 0.82rem; }
.inv-discount-row td { color: var(--danger); font-size: 0.82rem; }
.inv-total-row td { font-size: 1rem; padding-top: 10px; border-top: 2px solid var(--text); border-bottom: none; }
.invoice-notes  { margin-top: 12px; font-size: 0.82rem; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--line); }
.invoice-footer { text-align: center; font-size: 0.8rem; color: var(--muted); margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line); }
.invoice-actions { display: flex; flex-direction: column; gap: 8px; }

/* ── Thermal Receipt ─────────────────────────────────────────────────────── */
.receipt {
    background: #fff;
    color: #111;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;
    max-width: 320px;
    margin: 0 auto 16px;
    padding: 18px 16px 24px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    border: 1px solid #e8e8e8;
}

/* top notch / ticket cut */
.receipt::before {
    content: '';
    display: block;
    height: 6px;
    background: repeating-linear-gradient(90deg, #1a56db 0 12px, transparent 12px 20px);
    border-radius: 3px;
    margin-bottom: 16px;
}

.receipt-head {
    text-align: center;
    margin-bottom: 10px;
}
.receipt-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 6px;
}
.receipt-shop-name {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: #0b213f;
}
.receipt-shop-sub {
    font-size: 0.72rem;
    color: #777;
    margin-top: 2px;
}
.receipt-shop-contact {
    font-size: 0.72rem;
    color: #666;
    margin-top: 3px;
    line-height: 1.4;
}

.receipt-divider {
    text-align: center;
    color: #bbb;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    margin: 8px 0;
    overflow: hidden;
    white-space: nowrap;
}

.receipt-meta { margin: 4px 0; }
.receipt-meta-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.78rem;
}
.receipt-meta-row span:first-child { color: #777; }
.receipt-pay-badge {
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
}
.receipt-pay-cash     { background: #d1fae5; color: #065f46; }
.receipt-pay-card     { background: #dbeafe; color: #1e40af; }
.receipt-pay-transfer { background: #fef3c7; color: #92400e; }

.receipt-customer { margin: 6px 0; }
.receipt-cust-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: #999; }
.receipt-cust-name  { font-weight: 700; font-size: 0.9rem; margin-top: 2px; }
.receipt-cust-mob   { font-size: 0.75rem; color: #666; margin-top: 1px; }

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    margin: 4px 0;
}
.receipt-table th {
    text-align: left;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
    padding: 3px 0;
    border-bottom: 1px dashed #ddd;
}
.receipt-table td { padding: 4px 0; border-bottom: 1px dashed #eee; }
.receipt-center { text-align: center; }
.receipt-right  { text-align: right; }
.receipt-disc-row td { color: #e53e3e; font-size: 0.72rem; }

.receipt-totals { margin: 4px 0; }
.receipt-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    padding: 2px 0;
    color: #555;
}
.receipt-total-disc { color: #e53e3e; }

.receipt-grand {
    display: flex;
    justify-content: space-between;
    font-size: 1.05rem;
    font-weight: 900;
    color: #0b213f;
    padding: 4px 0;
    letter-spacing: 0.03em;
}

.receipt-notes {
    margin: 8px 0;
    font-size: 0.75rem;
    color: #666;
    padding: 6px;
    background: #f9f9f9;
    border-radius: 4px;
}

.receipt-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 14px 0 8px;
    gap: 6px;
}
.receipt-qr-wrap img,
.receipt-qr-wrap canvas {
    border: 4px solid #fff;
    border-radius: 8px;
    box-shadow: 0 0 0 1px #e8e8e8;
}
.receipt-qr-label {
    font-size: 0.68rem;
    color: #999;
    letter-spacing: 0.06em;
}

.receipt-footer {
    text-align: center;
    font-size: 0.72rem;
    color: #999;
    margin-top: 10px;
    line-height: 1.6;
}

/* bottom cut marks */
.receipt::after {
    content: '';
    display: block;
    height: 6px;
    background: repeating-linear-gradient(90deg, #1a56db 0 12px, transparent 12px 20px);
    border-radius: 3px;
    margin-top: 16px;
}

/* ── Thermal Print ───────────────────────────────────────────────────────── */
@media print {
    @page { size: 80mm auto; margin: 0; }
    body * { visibility: hidden; }
    .receipt, .receipt * { visibility: visible; }
    .receipt {
        position: absolute;
        left: 0; top: 0;
        max-width: 100%;
        width: 80mm;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 4mm 6mm;
    }
    .receipt::before, .receipt::after { display: none; }
    .no-print, .bottom-nav, .app-header, .pwa-banner { display: none !important; }
}

/* ── Login page (existing design preserved) ──────────────────────────────── */
.shell:not(.shell-app) {
    background:
        radial-gradient(circle at top left, rgba(11, 99, 200, 0.18), transparent 28%),
        linear-gradient(135deg, #eff6ff 0%, #f8fbff 42%, #eef4fa 100%);
    min-height: 100vh;
}

.login-shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.12fr 0.88fr;
    overflow: hidden;
    background: #ffffff;
}

.login-brand {
    position: relative;
    display: none;
    flex-direction: column;
    justify-content: center;
    padding: 40px 44px;
    color: #ffffff;
    overflow: hidden;
    background: linear-gradient(135deg, #061838, #0a2d67, #0b63c8, #1a7ce2);
}

.login-blob { position: absolute; border-radius: 999px; filter: blur(55px); }
.blob-a { width: 320px; height: 320px; top: -70px; left: -90px; background: rgba(255,255,255,0.12); }
.blob-b { width: 360px; height: 360px; right: -70px; bottom: -90px; background: rgba(9,215,255,0.14); }
.blob-c { width: 220px; height: 220px; top: 44%; left: 48%; background: rgba(255,255,255,0.1); }

.brand-top, .brand-main, .brand-credit { position: relative; z-index: 1; }

.brand-top {
    position: absolute; top: 24px; left: 24px;
    display: flex; align-items: center; gap: 14px;
}

.brand-mini-logo, .panel-head-logo {
    background: #ffffff; border-radius: 14px; padding: 6px 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.14);
}
.brand-mini-logo img, .panel-head-logo img { display: block; width: 52px; height: 52px; object-fit: contain; }

.brand-name { font-size: 1.15rem; font-weight: 800; }
.brand-subtitle { margin-top: 2px; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.76); }

.brand-main { max-width: 450px; }
.brand-kicker { margin-bottom: 16px; font-size: 0.74rem; letter-spacing: 0.28em; text-transform: uppercase; color: rgba(255,255,255,0.7); }
.brand-main h1 { margin: 0 0 14px; font-size: clamp(2.7rem, 4vw, 4.2rem); line-height: 1.08; }
.brand-main h1 span { color: #87d7ff; }
.brand-main p { margin: 0; max-width: 390px; line-height: 1.8; color: rgba(255,255,255,0.84); }
.brand-divider { width: 64px; height: 3px; margin: 24px 0 28px; border-radius: 999px; background: linear-gradient(90deg, #ffffff, #7dc8ff); }
.brand-circle { display: flex; justify-content: center; margin: 0 0 24px; }
.brand-circle-inner { width: 150px; height: 150px; border-radius: 999px; display: grid; place-items: center; background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.18); box-shadow: 0 0 44px rgba(18,115,214,0.3); }
.brand-circle-inner img { width: 118px; height: 118px; object-fit: contain; background: #ffffff; border-radius: 999px; padding: 10px; }
.brand-quote { text-align: center; font-style: italic; }
.brand-credit { position: absolute; left: 44px; bottom: 18px; font-size: 0.72rem; color: rgba(255,255,255,0.62); }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #f3f7fc; }
.login-panel-card { width: 100%; max-width: 430px; background: #ffffff; border-radius: 22px; box-shadow: 0 20px 60px rgba(11,33,63,0.12); padding: 32px; border-top: 4px solid var(--brand); }

.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid #e8eef6; }
.panel-title { margin: 0 0 2px; font-size: 1.4rem; font-weight: 800; color: #0a2d67; }
.panel-wordmark img { display: block; width: min(250px, 100%); height: auto; }
.panel-subtitle { font-size: 0.84rem; color: var(--muted); }

.status { margin-top: 28px; padding: 14px 16px; border-radius: 16px; font-size: 0.96rem; }
.status.error { background: rgba(196,59,59,0.08); border: 1px solid rgba(196,59,59,0.2); color: var(--danger); }

.auth-form { margin-top: 30px; display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 0.95rem; font-weight: 600; }
.input-wrap { position: relative; }
.input-icon { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: #8ca0bb; font-weight: 700; pointer-events: none; }
.field input { width: 100%; padding: 13px 14px 13px 35px; border-radius: 12px; border: 1.5px solid #dfe7f1; background: #f8fbff; transition: border-color 0.2s, box-shadow 0.2s; }
.field input:focus { outline: none; border-color: rgba(11,99,200,0.5); background: #fff; box-shadow: 0 0 0 4px rgba(11,99,200,0.1); }

.button { border: 0; border-radius: 18px; padding: 16px 22px; font-weight: 700; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.button:hover { transform: translateY(-2px); }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); box-shadow: 0 18px 36px rgba(11,99,200,0.26); }
.login-submit { margin-top: 6px; }
.button-secondary { color: var(--text); background: #fff; border: 1px solid var(--line); }

.helper-card { margin-top: 24px; padding: 18px 20px; border-radius: 20px; background: var(--surface-alt); border: 1px solid rgba(11,99,200,0.08); }
.login-helper { border-radius: 14px; background: #f4f8fd; }
.helper-card strong { display: block; margin-bottom: 6px; }
.helper-card p { margin: 0; color: var(--muted); line-height: 1.7; }
.inline-form { margin: 0; }

.error-card { width: min(600px,100%); padding: 40px; border-radius: 28px; background: rgba(255,255,255,0.92); box-shadow: var(--shadow); text-align: center; }
.error-card h1 { margin-top: 0; font-size: 2.4rem; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(4, 1fr); }
    .mini-stats { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .detail-btns { flex-direction: column; }
    .stat-num { font-size: 1.3rem; }
    .hero-shop { font-size: 1.05rem; }
    .hero-phone { font-size: 2.4rem; }
}

@media (min-width: 900px) {
    .login-brand { display: flex; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 899px) {
    .login-brand { display: none; }
    .login-shell { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    body { background: radial-gradient(circle at top left, rgba(11,99,200,0.12), transparent 30%), linear-gradient(180deg, #f7faff 0%, #edf3fb 100%); }
    .login-panel { padding: 10px 10px 18px; align-items: stretch; background: transparent; }
    .login-panel-card { max-width: 100%; min-height: calc(100vh - 20px); border-radius: 22px; border-top: 4px solid var(--brand); }
    .panel-head { flex-direction: column; align-items: center; text-align: center; gap: 14px; }
    .panel-wordmark img { width: min(250px, 100%); margin: 0 auto; }
    .field input { padding: 15px 16px 15px 36px; border-radius: 15px; background: #dfe9f8; border-color: #d2def1; font-size: 1rem; }
    .field input:focus { background: #eef4fd; }
    .button { padding: 15px 18px; border-radius: 16px; font-size: 1rem; }
    .auth-form { margin-top: 22px; gap: 16px; }
}
