/* Shaheen Network Billing — Design System
   Approved palette only. No colors outside these tokens. */

:root {
  --primary: #155EEF;
  --primary-dark: #0B2A5B;
  --secondary-cyan: #06B6D4;
  --accent-orange: #FF8A00;
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --info: #0EA5E9;
  --bg: #F5F8FC;
  --card: #FFFFFF;
  --text: #172033;
  --text-secondary: #64748B;
  --border: #E2E8F0;
  --hover-bg: #FAFBFF;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(23, 32, 51, 0.06), 0 1px 3px rgba(23, 32, 51, 0.08);
  --sidebar-width: 260px;
  --topbar-height: 64px;
}

/* Dark mode — same token NAMES, different values, so every component
   below (which all already read var(--bg)/var(--card)/var(--text)/etc,
   never hardcoded light-mode hex) re-themes automatically. Status/accent
   colors are lightened slightly versus their light-mode values, since
   the light-mode shades are tuned for contrast against a WHITE card,
   not a dark one — used as-is here, several would fail contrast. */
[data-theme="dark"] {
  --primary: #4C8DFF;
  --primary-dark: #0B2A5B;
  --secondary-cyan: #22D3EE;
  --accent-orange: #FFA24D;
  --success: #34D399;
  --warning: #FBBF24;
  --danger: #F87171;
  --info: #38BDF8;
  --bg: #0F1621;
  --card: #182233;
  --text: #F4F7FC;
  --text-secondary: #C3CCDC;
  --border: #2A3548;
  --hover-bg: #1E293D;

  --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  transition: background 0.25s ease, color 0.25s ease;
}
/* Smooth theme-toggle transition — scoped to surfaces that actually
   change color on toggle, not a blanket "body *" (which would fight
   with components that already define their own transition, like
   .stat-card's hover lift, and adds needless cost on large tables). */
body, .card, .stat-card, .sidebar, .app-topbar, table, th, td,
input, select, textarea, .btn-secondary, .badge, .flash,
.report-card, .neu-card {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

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

/* ---------- App Shell ---------- */

#nav-toggle { display: none; }
.sidebar-overlay { display: none; }

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--primary-dark);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-brand small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 500;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  text-decoration: none;
  color: #fff;
}

.sidebar-link.active {
  background: var(--primary);
  color: #fff;
}
.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
}

.sidebar-areas summary {
  cursor: pointer;
  list-style: none;
}
.sidebar-areas summary::-webkit-details-marker { display: none; }

.sidebar-areas[open] summary .chevron { transform: rotate(90deg); }
.chevron { display: inline-block; transition: transform 0.15s; margin-left: auto; }

.sidebar-subnav { padding-left: 12px; }

.sidebar-sublink {
  display: flex;
  justify-content: space-between;
  padding: 9px 20px 9px 34px;
  color: rgba(255,255,255,0.72);
  font-size: 13.5px;
}
.sidebar-sublink:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.sidebar-sublink.active { background: rgba(21,94,239,0.35); color: #fff; font-weight: 600; }
.sidebar-sublink .code-pill {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
}
.sidebar-footer .role-badge {
  display: inline-block;
  background: var(--secondary-cyan);
  color: #04303a;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  height: var(--topbar-height);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-title { font-size: 18px; font-weight: 700; }

.hamburger {
  display: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text);
  background: none;
  border: none;
}

.app-content {
  padding: 24px;
  flex: 1;
}

/* ---------- Components ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 14px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  display: block;
  transition: box-shadow 0.15s, transform 0.15s;
}
.stat-card:hover { box-shadow: 0 4px 14px rgba(23,32,51,0.1); transform: translateY(-1px); }
.stat-card-clickable { text-decoration: none; color: inherit; cursor: pointer; }
.stat-card-clickable:hover { text-decoration: none; color: inherit; border-color: var(--primary); box-shadow: 0 6px 18px rgba(21,94,239,0.14); transform: translateY(-2px); }
.stat-card .label { font-size: 13px; color: var(--text-secondary); font-weight: 600; padding-right: 40px; }
.stat-card .value { font-size: 26px; font-weight: 800; margin-top: 6px; color: var(--primary-dark); }
.stat-card.accent-orange .value { color: var(--accent-orange); }
.stat-card.accent-success .value { color: var(--success); }
.stat-card.accent-danger .value { color: var(--danger); }

.stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(21,94,239,0.09);
  color: var(--primary);
  flex-shrink: 0;
}
.stat-card.accent-success .stat-icon { background: rgba(22,163,74,0.12); color: var(--success); }
.stat-card.accent-orange .stat-icon { background: rgba(255,138,0,0.12); color: var(--accent-orange); }
.stat-card.accent-danger .stat-icon { background: rgba(220,38,38,0.1); color: var(--danger); }

/* Dark mode only: numbers, their icons, and the box titles all go
   pure bright white for maximum readability against the dark card —
   light mode is completely untouched (stays navy/green/orange/red as
   designed). The colored chip BEHIND each icon stays colored (still
   a nice accent), only the icon glyph itself and the text turn white. */
[data-theme="dark"] .stat-card .label { color: #FFFFFF; }
[data-theme="dark"] .stat-card .value,
[data-theme="dark"] .stat-card.accent-orange .value,
[data-theme="dark"] .stat-card.accent-success .value,
[data-theme="dark"] .stat-card.accent-danger .value { color: #FFFFFF; }
[data-theme="dark"] .stat-icon,
[data-theme="dark"] .stat-card.accent-success .stat-icon,
[data-theme="dark"] .stat-card.accent-orange .stat-icon,
[data-theme="dark"] .stat-card.accent-danger .stat-icon { color: #FFFFFF; }

/* ---------- Icons (inline SVG helper, App\Support\Icons) ---------- */
.icon { flex-shrink: 0; vertical-align: -3px; }
.sidebar-link .icon, .sidebar-areas summary .icon { color: rgba(255,255,255,0.65); }
.sidebar-link.active .icon { color: #fff; }
.sidebar-link:hover .icon { color: #fff; }
.card-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title-row .icon-badge {
  width: 34px; height: 34px; border-radius: 9px;
  background: rgba(21,94,239,0.09); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-title-row .card-title { margin: 0; }

/* ---------- Reports landing cards ---------- */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.report-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
.report-card:hover {
  box-shadow: 0 6px 20px rgba(23,32,51,0.12);
  transform: translateY(-2px);
  border-color: var(--primary);
  text-decoration: none;
  color: inherit;
}
.report-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: rgba(21,94,239,0.09); color: var(--primary);
}
.report-card.accent-success .report-card-icon { background: rgba(22,163,74,0.12); color: var(--success); }
.report-card.accent-orange .report-card-icon { background: rgba(255,138,0,0.12); color: var(--accent-orange); }
.report-card.accent-info .report-card-icon { background: rgba(14,165,233,0.12); color: var(--info); }
.report-card-body { flex: 1; padding-right: 16px; }
.report-card-title { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--text); }
.report-card-desc { margin: 0; font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }
.report-card-arrow {
  position: absolute; top: 22px; right: 20px;
  color: var(--text-secondary);
  transition: transform 0.15s, color 0.15s;
}
.report-card:hover .report-card-arrow { transform: translateX(3px); color: var(--primary); }

.report-header { margin-bottom: 4px; }
.report-back {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
}
.report-back .icon { transform: rotate(180deg); }
.report-back:hover { color: var(--primary); text-decoration: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.hint { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

input[type=text], input[type=tel], input[type=number], input[type=date], input[type=password],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21,94,239,0.15);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 12px; color: var(--text-secondary); font-weight: 600; font-size: 12.5px; text-transform: uppercase; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: var(--hover-bg); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-active, .badge-paid, .badge-completed { background: rgba(22,163,74,0.12); color: var(--success); }
.badge-suspended, .badge-pending, .badge-due_soon { background: rgba(245,158,11,0.14); color: var(--warning); }
.badge-permanently_disconnected, .badge-overdue, .badge-danger { background: rgba(220,38,38,0.1); color: var(--danger); }
.badge-temporarily_disconnected, .badge-inactive, .badge-cancelled { background: rgba(100,116,139,0.14); color: var(--text-secondary); }
.badge-info, .badge-upcoming, .badge-partially_paid { background: rgba(14,165,233,0.12); color: var(--info); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { text-decoration: none; color: var(--primary); }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash-success { background: rgba(22,163,74,0.1); color: var(--success); border: 1px solid rgba(22,163,74,0.25); }
.flash-error { background: rgba(220,38,38,0.08); color: var(--danger); border: 1px solid rgba(220,38,38,0.22); }
.flash-info { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.28); }
[data-theme="dark"] .flash-info { background: rgba(251,191,36,0.14); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-state .icon { font-size: 32px; margin-bottom: 8px; }

.search-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search-bar input[type=text] { max-width: 320px; }
.search-bar select { max-width: 200px; }

.login-wrap {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--primary-dark);
  background-image: linear-gradient(165deg, var(--primary-dark) 0%, #0a2748 40%, #071b30 75%, #04121f 100%);
  padding: 40px 20px;
}
.login-bg-net {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  display: flex;
  border-radius: 28px;
  box-shadow: 0 30px 60px rgba(4,18,31,0.45);
}
.login-hero { border-radius: 28px 0 0 28px; }
.login-form-col { border-radius: 0 28px 28px 0; }
@media (max-width: 760px) {
  .login-shell { flex-direction: column; max-width: 440px; }
  .login-hero { border-radius: 28px 28px 0 0; }
  .login-form-col { border-radius: 0 0 28px 28px; }
}

.login-hero {
  flex: 1;
  min-width: 0;
  position: relative;
  background: linear-gradient(160deg, var(--primary-dark) 0%, #071b30 62%, #04121f 100%);
  padding: 44px 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
}
.login-hero-brand { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.login-hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.4px;
  color: #FFB067;
  background: rgba(255,138,0,0.14);
  border: 1px solid rgba(255,138,0,0.32);
  padding: 6px 14px; border-radius: 100px;
  margin: 0 0 18px;
}
.login-hero-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-orange); box-shadow: 0 0 0 3px rgba(255,138,0,0.25); }
.login-hero-h1 { font-size: 25px; font-weight: 700; margin: 0 0 10px; line-height: 1.2; }
.login-hero-h1 em { font-style: normal; color: var(--accent-orange); }
.login-hero-lede { font-size: 14px; color: rgba(255,255,255,0.75); line-height: 1.6; margin: 0 0 22px; max-width: 300px; }
.login-trust-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.login-trust-item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,0.85); }
.login-trust-item .ic-circle {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.login-form-col {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  padding: 28px 32px 36px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
@media (max-width: 760px) {
  .login-hero { padding: 34px 28px 30px; }
  .login-form-col { padding: 24px 22px 32px; }
}

/* ---------- Embossed (neumorphic) card — same background tone as the
   panel it sits on, "raised" purely via a light/dark shadow pair. ---------- */
.neu-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border-radius: 20px;
  padding: 34px 30px;
  box-shadow: 9px 9px 20px rgba(11,42,91,0.14), -9px -9px 20px rgba(255,255,255,0.9);
}
.neu-card h1 { font-size: 19px; margin: 0 0 4px; color: var(--text); }
.neu-card p.sub { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 22px; }
.neu-card .form-group { margin-bottom: 18px; }
.neu-card input[type=text], .neu-card input[type=password] {
  background: var(--bg);
  border: none;
  border-radius: 12px;
  padding: 13px 14px;
  box-shadow: inset 5px 5px 10px rgba(11,42,91,0.09), inset -5px -5px 10px rgba(255,255,255,0.8);
}
.neu-card input[type=text]:focus, .neu-card input[type=password]:focus {
  box-shadow: inset 4px 4px 8px rgba(11,42,91,0.12), inset -4px -4px 8px rgba(255,255,255,0.75), 0 0 0 3px rgba(21,94,239,0.15);
}
.neu-password-wrap { position: relative; }
.neu-password-wrap input { padding-right: 42px; width: 100%; }
.neu-password-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 9px; border: none;
  background: var(--bg); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 3px 3px 6px rgba(11,42,91,0.1), -3px -3px 6px rgba(255,255,255,0.8);
}
.neu-card .btn {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  border-radius: 12px;
  box-shadow: 5px 5px 12px rgba(21,94,239,0.3), -3px -3px 8px rgba(255,255,255,0.5);
}
.neu-card .btn:active { box-shadow: inset 3px 3px 7px rgba(11,42,91,0.35); }
.btn-block { width: 100%; justify-content: center; }

.login-footer { position: relative; z-index: 1; color: rgba(255,255,255,0.45); font-size: 12.5px; margin-top: 24px; text-align: center; }

.field-error { color: var(--danger); font-size: 12.5px; margin-top: 4px; }

.text-muted { color: var(--text-secondary); }
.mb-0 { margin-bottom: 0; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    z-index: 20;
    width: 280px;
    height: 100vh;
    height: 100dvh; /* iOS/Android address-bar-safe viewport height — falls back to 100vh where unsupported */
    overflow-y: auto;
    overscroll-behavior: contain; /* stops the elastic scroll-bounce from revealing the page behind it */
    -webkit-overflow-scrolling: touch;
    transition: left 0.2s ease;
    box-shadow: 0 0 0 100vmax rgba(11,42,91,0);
  }
  #nav-toggle:checked ~ .app-shell .sidebar {
    left: 0;
    box-shadow: 0 0 0 100vmax rgba(11,42,91,0.45);
  }
  /* Invisible click-catcher over the rest of the screen while the
     sidebar is open on mobile — tapping anywhere outside the sidebar
     closes it. It's a <label for="nav-toggle">, so a tap toggles the
     same checkbox the hamburger does; no JS needed. */
  .sidebar-overlay { display: none; }
  #nav-toggle:checked ~ .app-shell .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    cursor: pointer;
  }
  .hamburger { display: inline-flex; }
  .app-content { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .search-bar input[type=text], .search-bar select { max-width: none; width: 100%; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--border); padding: 10px 0; }
  td { border: none; padding: 4px 0; }
  td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; }
}

/* ---------- Print (admin pages) ---------- */

@media print {
  .no-print, .sidebar, .app-topbar, .hamburger { display: none !important; }
  .app-content { padding: 0 !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ---------- Public Invoice ---------- */

.public-invoice-body {
  background: var(--bg);
  min-height: 100vh;
  padding: 24px 16px 60px;
}

/* ---------- Public invoice — custom branded document design ---------- */

.invoice-page {
  max-width: 820px;
  margin: 0 auto;
}

.invoice-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.inv2-paper {
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 16px;
  padding: 34px 38px;
  box-shadow: var(--shadow);
}

.inv2-header {
  display: flex;
  align-items: flex-start;
  gap: 26px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--border);
}
.inv2-brand { flex: 1.3; min-width: 0; }
.inv2-brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.inv2-logo-mark {
  width: 42px; height: 42px; border-radius: 10px;
  background: rgba(21,94,239,0.09); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.inv2-logo-img { width: 42px; height: 42px; object-fit: contain; flex-shrink: 0; }
.inv2-brand-name { font-size: 19px; font-weight: 800; color: var(--primary); letter-spacing: 0.3px; }
.inv2-contact-list { display: flex; flex-direction: column; gap: 5px; }
.inv2-contact-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); }
.inv2-contact-item .icon { color: var(--primary); flex-shrink: 0; }

.inv2-divider { width: 2px; align-self: stretch; background: var(--border); flex-shrink: 0; }

.inv2-title-block { flex: 1; text-align: right; }
.inv2-title { font-size: 34px; font-weight: 900; color: var(--primary); letter-spacing: 1px; line-height: 1; }
.inv2-tagline { font-size: 12.5px; color: var(--text-secondary); margin: 6px 0 14px; }
.inv2-invoice-no-box {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--primary); border-radius: 8px;
  padding: 8px 16px; background: rgba(21,94,239,0.05);
}
.inv2-invoice-no-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary); }
.inv2-invoice-no-value { font-size: 14px; font-weight: 800; color: var(--text); }

.inv2-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.inv2-box { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.inv2-box-title {
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 9px 16px;
}
.inv2-box-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.inv2-row { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: var(--text); }
.inv2-row .icon { color: var(--primary); flex-shrink: 0; margin-top: 1px; }

.inv2-charges { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.inv2-charges-header {
  background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  padding: 10px 18px; text-align: center;
}
.inv2-charges-body { padding: 4px 18px; }
.inv2-charge-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.inv2-charge-row:last-child { border-bottom: none; }
.inv2-charge-label { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); }
.inv2-charge-label .icon { color: var(--primary); }
.inv2-charge-amount { font-size: 14px; font-weight: 600; color: var(--text); }

.inv2-totals { border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px; margin-bottom: 20px; }
.inv2-total-row { display: flex; justify-content: space-between; padding: 10px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.inv2-total-row:last-child { border-bottom: none; }
.inv2-total-main { font-weight: 800; font-size: 16px; color: var(--primary); }
.inv2-total-remaining { font-weight: 800; font-size: 16px; color: var(--accent-orange); }
.inv2-total-remaining.inv2-settled { color: var(--success); }

.inv2-payment-methods { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 20px; max-width: 320px; }
.inv2-payment-methods .inv2-box-title { }
.inv2-methods-list { padding: 6px 16px; }
.inv2-method-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.inv2-method-item:last-child { border-bottom: none; }
.inv2-method-item .icon { color: var(--primary); }

.inv2-note-row {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap;
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border);
}
.inv2-note { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--text-secondary); max-width: 400px; }
.inv2-note .icon { color: var(--primary); flex-shrink: 0; margin-top: 1px; }
.inv2-signature { text-align: center; font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.inv2-signature-line { width: 160px; border-bottom: 1px solid var(--text-secondary); margin-bottom: 6px; }

.inv2-footer-bar {
  background: var(--primary); color: #fff;
  display: flex; justify-content: center; gap: 28px; flex-wrap: wrap;
  font-size: 12px; padding: 12px 18px; border-radius: 10px;
  margin-top: 20px;
}
.inv2-footer-bar span { display: flex; align-items: center; gap: 6px; }
.inv2-footer-bar .icon { color: #fff; }

@media (max-width: 640px) {
  .inv2-paper { padding: 22px; }
  .inv2-header { flex-direction: column; }
  .inv2-divider { display: none; }
  .inv2-title-block { text-align: left; }
  .inv2-two-col { grid-template-columns: 1fr; }
}

@media print {
  .inv2-paper { box-shadow: none; }
}

.invoice-banner {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-weight: 700;
  text-align: center;
  font-size: 15px;
}

.invoice-banner-paid { background: rgba(22,163,74,0.12); color: var(--success); border: 1px solid rgba(22,163,74,0.3); }
.invoice-banner-cancelled { background: rgba(100,116,139,0.14); color: var(--text-secondary); border: 1px solid var(--border); }
.invoice-banner-overdue { background: rgba(220,38,38,0.08); color: var(--danger); border: 1px solid rgba(220,38,38,0.25); }

.invoice-section-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin: 28px 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.invoice-section-title .icon { color: var(--primary); }

.invoice-summary-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 16px;
}

.invoice-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.invoice-summary-row.total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 12px;
  font-weight: 700;
  font-size: 15px;
}

.invoice-summary-row.remaining {
  font-weight: 800;
  font-size: 17px;
  color: var(--accent-orange);
}

.invoice-summary-row.remaining.settled { color: var(--success); }

.invoice-footer-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

@media print {
  .public-invoice-body { padding: 0; background: #fff; }
  .invoice-actions { display: none !important; }
  .inv2-paper { box-shadow: none; border-color: var(--primary); padding: 0; }
}
