/* =========================================================
   ISP BILLING CENTER — design system
   Palette: ink navy sidebar, signal-teal accent, amber warn.
   Self-contained, no external font/icon CDN required.
   ========================================================= */

:root{
    --ink:        #0F1826;
    --ink-2:      #16233A;
    --teal:       #14B8A6;
    --teal-dark:  #0D9488;
    --amber:      #F59E0B;
    --red:        #DC2626;
    --green:      #16A34A;
    --bg:         #F4F6F9;
    --card:       #FFFFFF;
    --border:     #E3E8EF;
    --text:       #101827;
    --muted:      #64748B;
    --radius:     10px;
    --shadow:     0 1px 2px rgba(16,24,39,.04), 0 6px 20px rgba(16,24,39,.06);
    font-variant-numeric: tabular-nums;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
    margin:0;
    background:var(--bg);
    color:var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size:14.5px;
    line-height:1.5;
}
a{ color:var(--teal-dark); text-decoration:none; }
a:hover{ text-decoration:underline; }
h1,h2,h3,h4{ margin:0 0 4px; font-weight:700; letter-spacing:-.01em; }
p{ margin:0 0 10px; }
.muted{ color:var(--muted); }
code{ background:#EEF1F5; padding:1px 6px; border-radius:4px; font-size:.9em; }

/* ---------- Brand mark (signal bars) ---------- */
.brand-mark{
    display:inline-flex; align-items:flex-end; gap:3px; height:18px; margin-right:2px;
}
.brand-mark span{ width:4px; background:var(--teal); border-radius:2px; display:block; }
.brand-mark span:nth-child(1){ height:6px; }
.brand-mark span:nth-child(2){ height:11px; }
.brand-mark span:nth-child(3){ height:16px; }

/* ---------- Buttons ---------- */
.btn{
    display:inline-flex; align-items:center; justify-content:center; gap:6px;
    border:1px solid transparent; border-radius:8px; padding:9px 16px;
    font-size:14px; font-weight:600; cursor:pointer; background:#fff; color:var(--text);
    transition:filter .12s ease, background .12s ease; text-decoration:none;
}
.btn:hover{ text-decoration:none; filter:brightness(0.97); }
.btn-primary{ background:var(--teal-dark); color:#fff; }
.btn-primary:hover{ background:#0B7C71; }
.btn-outline{ background:transparent; border-color:var(--border); color:var(--text); }
.btn-danger{ background:#FEE2E2; color:var(--red); }
.btn-danger:hover{ background:#FCA5A5; }
.btn-warn{ background:#FEF3C7; color:#92400E; }
.btn-sm{ padding:5px 10px; font-size:12.5px; border-radius:6px; }
.btn-block{ width:100%; }
.btn[disabled]{ opacity:.5; cursor:not-allowed; }

/* ---------- Forms ---------- */
label{ display:block; font-size:12.5px; font-weight:600; color:var(--muted); margin:14px 0 5px; text-transform:uppercase; letter-spacing:.03em; }
label:first-of-type{ margin-top:0; }
input[type=text],input[type=password],input[type=email],input[type=number],input[type=date],input[type=tel],select,textarea{
    width:100%; padding:9px 11px; border:1px solid var(--border); border-radius:8px;
    font-size:14.5px; font-family:inherit; background:#fff; color:var(--text);
}
input:focus,select:focus,textarea:focus{ outline:2px solid var(--teal); outline-offset:0; border-color:var(--teal); }
textarea{ resize:vertical; min-height:70px; }
.form-row{ display:grid; grid-template-columns:1fr 1fr; gap:0 14px; }
.form-hint{ font-size:12px; color:var(--muted); margin-top:4px; }
.form-actions{ margin-top:18px; display:flex; gap:10px; flex-wrap:wrap; }

/* ---------- Alerts / flash ---------- */
.alert{ padding:11px 14px; border-radius:8px; margin-bottom:14px; font-size:13.5px; }
.alert-danger{ background:#FEF2F2; color:#991B1B; border:1px solid #FECACA; }
.alert-success{ background:#F0FDF9; color:#0B6E62; border:1px solid #99F1E4; }
.alert-warning{ background:#FFFBEB; color:#92400E; border:1px solid #FDE68A; }

/* ---------- Badges ---------- */
.badge{ display:inline-block; padding:3px 10px; border-radius:999px; font-size:11.5px; font-weight:700; letter-spacing:.02em; }
.badge-success{ background:#DCFCE7; color:#15803D; }
.badge-warning{ background:#FEF3C7; color:#92400E; }
.badge-danger{ background:#FEE2E2; color:#B91C1C; }
.badge-muted{ background:#EEF1F5; color:#475569; }

/* ---------- Auth pages (login / install) ---------- */
.auth-body{ display:flex; align-items:center; justify-content:center; min-height:100vh; background:linear-gradient(160deg,var(--ink) 0%, var(--ink-2) 45%, #1B2A45 100%); }
.auth-card{ width:380px; max-width:92vw; background:var(--card); border-radius:16px; padding:34px 32px; box-shadow:var(--shadow); }
.auth-brand{ display:flex; flex-direction:column; align-items:center; gap:10px; font-weight:800; font-size:16px; margin-bottom:22px; color:var(--ink); text-align:center; }
.auth-logo-img{ height:64px; max-width:220px; object-fit:contain; }
.auth-brand-mark{
    display:inline-flex; align-items:flex-end; gap:5px; height:34px; width:34px;
    justify-content:center; background:var(--ink); border-radius:10px; padding:8px;
}
.auth-brand-mark span{ width:6px; background:var(--teal); border-radius:2px; display:block; }
.auth-brand-mark span:nth-child(1){ height:9px; }
.auth-brand-mark span:nth-child(2){ height:15px; }
.auth-brand-mark span:nth-child(3){ height:20px; }

/* ---------- App shell ---------- */
.app-shell{ display:flex; min-height:100vh; }
.hamburger{
    display:none; align-items:center; justify-content:center; width:34px; height:34px; flex-shrink:0;
    border:1px solid var(--border); border-radius:8px; background:#fff; font-size:16px; cursor:pointer; color:var(--text);
}
.sidebar-backdrop{
    display:none; position:fixed; inset:0; background:rgba(15,24,38,.5); z-index:39;
}
.sidebar-backdrop.show{ display:block; }
.sidebar{
    width:236px; flex-shrink:0; background:var(--ink); color:#CBD5E1;
    display:flex; flex-direction:column; position:sticky; top:0; height:100vh;
}
.sidebar-brand{ display:flex; align-items:center; gap:8px; font-weight:800; color:#fff; padding:20px 20px 16px; font-size:14.5px; }
.sidebar-org{ padding:0 20px 16px; font-size:12px; color:#8291A8; border-bottom:1px solid rgba(255,255,255,.08); margin-bottom:10px; }
.sidebar-org strong{ display:block; color:#E2E8F0; font-size:13px; font-weight:600; }
.sidebar nav{ flex:1; padding:4px 12px; }
.sidebar nav a{
    display:flex; align-items:center; gap:10px; color:#AEB9CC; text-decoration:none;
    padding:9px 12px; border-radius:8px; font-size:13.5px; font-weight:500; margin-bottom:2px;
}
.sidebar nav a:hover{ background:rgba(255,255,255,.06); color:#fff; }
.sidebar nav a.active{ background:var(--teal-dark); color:#fff; }
.sidebar-foot{ padding:14px 20px; border-top:1px solid rgba(255,255,255,.08); font-size:12.5px; }
.sidebar-foot a{ color:#AEB9CC; }

.main{ flex:1; min-width:0; }
.topbar{
    display:flex; align-items:center; justify-content:space-between; gap:16px;
    padding:16px 28px; background:#fff; border-bottom:1px solid var(--border); position:sticky; top:0; z-index:5;
}
.topbar h1{ font-size:19px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.topbar-meta{ flex-shrink:0; white-space:nowrap; }
.content{ padding:24px 28px 60px; }

/* ---------- Cards / stats ---------- */
.stat-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:14px; margin-bottom:22px; }
.stat-card{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px; }
.stat-card .label{ font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; font-weight:600; }
.stat-card .value{ font-size:23px; font-weight:800; margin-top:6px; }
.stat-card .sub{ font-size:12px; color:var(--muted); margin-top:4px; }
.stat-card.accent .value{ color:var(--teal-dark); }
.stat-card.warn .value{ color:#B45309; }
.stat-card.danger .value{ color:var(--red); }

.card{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:20px 22px; margin-bottom:20px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; gap:10px; flex-wrap:wrap; }
.card-head h2{ font-size:16px; }

/* ---------- Table ---------- */
.table-wrap{ overflow-x:auto; }
table.tbl{ width:100%; border-collapse:collapse; font-size:13.5px; }
table.tbl th{ text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.03em; color:var(--muted); padding:9px 12px; border-bottom:1px solid var(--border); white-space:nowrap; }
table.tbl th.text-right{ text-align:right; }
table.tbl td{ padding:11px 12px; border-bottom:1px solid #EEF1F5; vertical-align:middle; }
table.tbl tbody tr:hover{ background:#FAFBFC; }
table.tbl tfoot td{ font-weight:700; border-top:2px solid var(--border); border-bottom:none; }
.text-right{ text-align:right; }
.text-center{ text-align:center; }
.empty-state{ text-align:center; padding:40px 20px; color:var(--muted); }

.filters{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:16px; align-items:flex-end; }
.filters .field{ display:flex; flex-direction:column; }
.filters label{ margin:0 0 4px; }
.filters input,.filters select{ min-width:150px; }

/* ---------- Modal ---------- */
.modal-overlay{ position:fixed; inset:0; background:rgba(15,24,38,.55); display:none; align-items:flex-start; justify-content:center; padding:40px 16px; z-index:50; overflow-y:auto; }
.modal-overlay.open{ display:flex; }
.modal-box{ background:#fff; border-radius:14px; width:520px; max-width:100%; padding:24px 26px; box-shadow:var(--shadow); }
.modal-box h3{ font-size:16px; margin-bottom:4px; }
.modal-close{ float:right; cursor:pointer; border:none; background:none; font-size:18px; color:var(--muted); }

/* ---------- Pill nav (tabs) ---------- */
.pill-nav{ display:flex; gap:6px; margin-bottom:16px; flex-wrap:wrap; }
.pill-nav a{ padding:6px 14px; border-radius:999px; background:#EEF1F5; color:var(--text); font-size:13px; font-weight:600; text-decoration:none; }
.pill-nav a.active{ background:var(--ink); color:#fff; }

/* ---------- Invoice print ---------- */
.invoice-body{ background:#EEF1F5; }
.invoice-toolbar{ max-width:720px; margin:18px auto 0; display:flex; justify-content:space-between; align-items:center; padding:0 4px; }
.invoice-sheet{ max-width:720px; margin:16px auto 60px; background:#fff; border-radius:12px; padding:40px 44px; box-shadow:var(--shadow); }
.invoice-head{ display:flex; justify-content:space-between; gap:20px; border-bottom:2px solid var(--ink); padding-bottom:18px; margin-bottom:20px; }
.invoice-company{ font-size:18px; font-weight:800; }
.invoice-meta{ text-align:right; }
.invoice-title{ font-size:22px; font-weight:800; letter-spacing:.04em; color:var(--teal-dark); }
.invoice-bill-to{ margin-bottom:22px; }
table.invoice-items{ width:100%; border-collapse:collapse; margin-top:6px; }
table.invoice-items th{ text-align:left; font-size:11.5px; text-transform:uppercase; color:var(--muted); border-bottom:1px solid var(--border); padding:8px 4px; }
table.invoice-items th.text-right{ text-align:right; }
table.invoice-items td{ padding:10px 4px; border-bottom:1px solid #F1F3F6; }
table.invoice-items tfoot td{ border-bottom:none; padding:6px 4px; }
table.invoice-items tr.row-strong td{ font-weight:800; font-size:15.5px; border-top:1px solid var(--ink); padding-top:10px; }
.invoice-payinfo{ margin-top:22px; background:#F4F6F9; border-radius:8px; padding:12px 16px; }
.invoice-footer{ margin-top:28px; text-align:center; font-size:12.5px; }
.invoice-authenticity{ margin-top:20px; padding-top:16px; border-top:1px dashed var(--border); text-align:center; }

/* ---------- Generic print/export sheet (customer lists, monitoring, etc.) ---------- */
.print-body{ background:#EEF1F5; }
.print-toolbar{ max-width:1000px; margin:18px auto 0; display:flex; justify-content:space-between; align-items:center; padding:0 4px; }
.print-sheet{ max-width:1000px; margin:16px auto 60px; background:#fff; border-radius:12px; padding:32px 36px; box-shadow:var(--shadow); }
.print-sheet h1{ font-size:20px; margin-bottom:2px; }
.print-meta{ color:var(--muted); font-size:12.5px; margin-bottom:18px; }
table.print-table{ width:100%; border-collapse:collapse; font-size:12.5px; }
table.print-table th{ text-align:left; background:#F4F6F9; padding:8px 10px; border-bottom:2px solid var(--ink); font-size:11px; text-transform:uppercase; letter-spacing:.03em; }
table.print-table th.text-right{ text-align:right; }
table.print-table td{ padding:7px 10px; border-bottom:1px solid #EEF1F5; }
table.print-table tr{ page-break-inside:avoid; }
.export-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.pagination{ display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-top:16px; }

@media print{
    .no-print{ display:none !important; }
    body{ background:#fff; }
    .invoice-sheet{ box-shadow:none; margin:0; border-radius:0; max-width:none; }
    .print-sheet{ box-shadow:none; margin:0; border-radius:0; max-width:none; padding:6px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 880px){
    .hamburger{ display:inline-flex; }
    .sidebar{ position:fixed; left:-236px; top:0; z-index:40; transition:left .18s ease; box-shadow:var(--shadow); }
    .sidebar.open{ left:0; }
    .content{ padding:18px 16px 50px; }
    .topbar{ padding:14px 16px; }
    .form-row{ grid-template-columns:1fr; }
    .stat-grid{ grid-template-columns:repeat(2,1fr); }
    .invoice-sheet{ padding:26px 20px; }
    .invoice-toolbar{ padding:0 4px; }
}

@media (max-width: 640px){
    .topbar-meta{ display:none; }
    .filters{ flex-direction:column; align-items:stretch; }
    .filters > *{ width:100%; }
    .filters input,.filters select{ min-width:0; width:100%; }
    .filters button, .filters .btn{ width:100%; }
    .card{ padding:16px; }
    .modal-overlay{ padding:20px 10px; }
    .modal-box{ padding:20px 18px; }
    .stat-card .value{ font-size:20px; }
    table.tbl th, table.tbl td{ padding:9px 8px; }
    .invoice-head{ flex-direction:column; gap:12px; }
    .invoice-meta{ text-align:left; }
}

@media (max-width: 460px){
    .stat-grid{ grid-template-columns:1fr; }
    .auth-card{ padding:26px 22px; }
    .card-head{ flex-direction:column; align-items:flex-start; }
}
