/* ═══════════════════════════════════════════════════════════════════════════════
   Civil-Invoice by BaldevTech — Minimal Modern Dark Orange Theme
   Mobile-first responsive stylesheet
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --primary: #c2570a;
  --primary-dark: #9a4508;
  --primary-light: #fff3e8;
  --primary-mid: #f3c08c;

  --surface: #ffffff;
  --bg: #f1f5f9;
  --bg-hover: #f8fafc;

  --border: #e2e8f0;
  --border-focus: #f0b679;

  --text-primary: #3b261e;
  --text-secondary: #8b7464;
  --text-muted: #b8a594;

  --danger: #e11d48;
  --danger-light: #ffe1e7;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);

  --sidebar-w: 260px;
  --topbar-h: 56px;
  --transition: 0.2s ease;
}

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

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

body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

@media (max-width: 767px) {
  html,
  body {
    background-color: var(--primary);
  }
}

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

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}
.flex {
  display: flex;
}
.flex-col {
  display: flex;
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-4 {
  gap: 1rem;
}
.text-sm {
  font-size: 0.8125rem;
}
.text-xs {
  font-size: 0.75rem;
}
.text-muted {
  color: var(--text-muted);
}
.font-semibold {
  font-weight: 600;
}
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Screen Shells ─────────────────────────────────────────────────────────── */
.screen {
  min-height: 100vh;
  width: 100%;
}

/* ══════════════════════════════════════════════════════════════════════════════
   AUTH SCREENS
   ══════════════════════════════════════════════════════════════════════════════ */
#auth-screen {
  display: flex;
  align-items: stretch;
  justify-content: center;
  background-color: #fff3e8;
  background-image:
    linear-gradient(rgba(194, 87, 10, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(194, 87, 10, 0.09) 1px, transparent 1px),
    linear-gradient(135deg, #fff3e8 0%, #fde1be 100%);
  background-size:
    40px 40px,
    40px 40px,
    cover;
  background-repeat: repeat, repeat, no-repeat;
  padding: 0 2rem;
}

.auth-container {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: clamp(3rem, 8vw, 9rem);
  align-items: start;
  width: 100%;
  max-width: 1180px;
  min-height: 100vh;
}

.auth-hero {
  align-self: center;
  max-width: 620px;
  padding: 2rem 0;
}

.auth-hero-eyebrow {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
  text-transform: uppercase;
}

.auth-hero h1 {
  color: var(--text-primary);
  font-size: clamp(2.25rem, 4vw, 4rem);
  line-height: 1.08;
  max-width: 600px;
}

.auth-hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-top: 1.5rem;
  max-width: 570px;
}

.auth-hero-app {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 1.5rem;
}

.auth-mobile-actions,
.mobile-back-btn {
  display: none;
}

.google-play-logo {
  background: linear-gradient(145deg, #00a1ff 0 35%, #00c878 35% 58%, #ffcf00 58% 77%, #ff4b55 77%);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  display: inline-block;
  height: 1.35rem;
  width: 1.15rem;
  flex: 0 0 auto;
}

.auth-content {
  display: flex;
  flex-direction: column;
  align-self: center;
  justify-self: center;
  padding: 2rem 0;
  width: 100%;
  max-width: 400px;
}

@media (max-width: 767px) {
  #auth-screen {
    align-items: flex-start;
    padding: 1.5rem;
  }

  .auth-container {
    display: block;
    min-height: auto;
  }

  .auth-hero {
    display: block;
    padding: 2.5rem 0 1rem;
  }

  .auth-hero h1 {
    font-size: 2rem;
  }

  .auth-hero-app {
    display: none;
  }

  .auth-hero-subtitle {
    display: block;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 1rem;
  }

  .auth-mobile-actions {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
  }

  .auth-mobile-actions .btn {
    width: auto;
    min-width: 5.5rem;
  }

  .android-download-btn {
    display: inline-flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    gap: 0.5rem;
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.65rem 0.85rem;
    text-align: right;
    text-decoration: none;
  }

  .android-download-btn:hover {
    background: var(--primary-light);
    text-decoration: none;
  }

  .android-download-btn .google-play-logo {
    height: 1.1rem;
    width: 0.95rem;
  }

  .auth-container.mobile-login-visible .auth-hero {
    display: none;
  }

  .auth-container.mobile-login-visible .auth-content {
    display: flex;
  }

  .mobile-back-btn {
    display: block;
    align-self: flex-start;
    background: none;
    border: 0;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding: 0;
  }

  .auth-content {
    display: none;
  }

  .auth-content {
    align-self: flex-start;
    padding: 2.5rem 0 1.5rem;
    max-width: 400px;
    margin: 0 auto;
  }
}

/* ── Auth Form ─────────────────────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--surface);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(194, 87, 10, 0.12);
}

.form-group input::placeholder {
  color: var(--text-muted);
}
.form-group textarea {
  resize: vertical;
  min-height: 72px;
}

/* ── Custom Select (replaces native <select> to fix mobile overflow clipping) */
.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.custom-select.open .custom-select-trigger,
.custom-select-trigger:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(194, 87, 10, 0.12);
  outline: none;
}

.custom-select-value {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.custom-select-value.placeholder {
  color: var(--text-muted);
}

.custom-select-arrow {
  font-size: 1.25rem !important;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-left: 0.25rem;
  transition: transform 0.2s ease;
}
.custom-select.open .custom-select-arrow {
  transform: rotate(180deg);
}

/* Dropdown list — positioned via JS with position:fixed to escape overflow containers */
.custom-select-dropdown {
  display: none;
  background: var(--surface);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  overflow-y: auto;
  z-index: 9999;
}
.custom-select.open .custom-select-dropdown {
  display: block;
}

.custom-select-dropdown li {
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.custom-select-dropdown li:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.custom-select-dropdown li.selected {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.inv-gst-chk-label,
.inv-discount-chk-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  user-select: none;
  white-space: nowrap;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.75rem 0.25rem 0.5rem;
  flex-shrink: 0;
  transition:
    border-color var(--transition),
    background var(--transition);
}

.inv-gst-chk-label:has(input:checked),
.inv-discount-chk-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.inv-gst-chk-label input[type="checkbox"],
.inv-discount-chk-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.qt-type-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.qt-type-pill-btn {
  appearance: none;
  border: 1px solid #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.qt-type-pill-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.password-input-wrap {
  position: relative;
}

.password-input-wrap input {
  padding-right: 2.5rem;
}

.auth-inline-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.auth-link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.auth-link-btn:hover {
  text-decoration: underline;
}

.auth-mode-actions {
  display: flex;
  justify-content: center;
  min-height: 1.25rem;
}

.auth-helper-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
  color: var(--text-muted);
}

.auth-legal-text {
  margin: -0.5rem 0 0;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.auth-legal-text a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-legal-text a:hover {
  text-decoration: underline;
}

.legal-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #fff3e8 0%, #fde1be 100%);
  padding: 1.25rem;
}

.legal-card {
  width: min(900px, 100%);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.legal-card h1 {
  font-size: 1.35rem;
  margin-bottom: 0.2rem;
}

.legal-updated {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.legal-card h2 {
  font-size: 0.98rem;
  margin: 1rem 0 0.35rem;
}

.legal-card p,
.legal-card li {
  font-size: 0.86rem;
  color: var(--text-primary);
}

.legal-card ul {
  list-style: disc;
  padding-left: 1.1rem;
  margin: 0.35rem 0;
}

.legal-back-link {
  display: inline-flex;
  margin-top: 1rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.toggle-password {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  padding: 0;
  line-height: 1;
}

.toggle-password:hover {
  color: var(--primary);
}
.toggle-password .material-icons {
  font-size: 1.2rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition:
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}
.btn-primary:disabled {
  background: var(--primary-mid);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg);
}

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

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid transparent;
}
.btn-ghost:hover {
  background: var(--primary-light);
}

.btn-icon {
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
  transition:
    background var(--transition),
    color var(--transition);
}
.btn-icon:hover {
  background: var(--bg);
  color: var(--primary);
}
.btn-icon .material-icons {
  font-size: 1.2rem;
}
.btn-icon.is-loading {
  color: var(--primary);
  opacity: 1;
}

.btn-full {
  width: 100%;
}
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* ── Error / Info messages ─────────────────────────────────────────────────── */
.error-msg {
  background: var(--danger-light);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  border-left: 3px solid var(--danger);
}

/* ══════════════════════════════════════════════════════════════════════════════
   MAIN APP LAYOUT
   ══════════════════════════════════════════════════════════════════════════════ */
#app-screen {
  display: grid;
  grid-template-areas:
    "topbar"
    "banner"
    "main";
  grid-template-rows: var(--topbar-h) auto 1fr;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

/* ── Top Bar (mobile) ──────────────────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding: 0 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Centered page title (shown on non-Invoices pages on mobile) */
.topbar-page-title {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  pointer-events: none;
}

/* Topbar brand/page-title switching on mobile */
@media (max-width: 767px) {
  #app-screen[data-page="invoices"] .topbar-page-title {
    display: none;
  }
  #app-screen[data-page="invoices"] .topbar-brand {
    margin-right: 2.5rem;
  }
  #app-screen:not([data-page="invoice-detail"]) #topbar-menu-btn {
    display: flex;
  }
  #app-screen[data-page="account"] #topbar-menu-btn,
  #app-screen[data-page="my-business"] #topbar-menu-btn,
  #app-screen[data-page="plans"] #topbar-menu-btn {
    display: none;
  }
  #app-screen[data-page="account"] #topbar-page-back-btn,
  #app-screen[data-page="my-business"] #topbar-page-back-btn,
  #app-screen[data-page="plans"] #topbar-page-back-btn {
    display: flex;
  }
  #app-screen[data-page="account"] .bottom-nav,
  #app-screen[data-page="my-business"] .bottom-nav,
  #app-screen[data-page="plans"] .bottom-nav {
    display: none;
  }
  #app-screen:not([data-page="invoices"]) .topbar-brand {
    opacity: 0;
    pointer-events: none;
  }
  #app-screen:not([data-page="invoices"]) .topbar-page-title {
    display: block;
  }

  /* Invoice detail: hide brand + page-title, show detail row + kebab */
  #app-screen[data-page="invoice-detail"] .topbar-brand {
    opacity: 0;
    pointer-events: none;
  }
  #app-screen[data-page="invoice-detail"] .topbar-page-title {
    display: none;
  }
  #app-screen[data-page="invoice-detail"] .topbar-detail {
    display: flex !important;
  }
  #app-screen[data-page="invoice-detail"] #topbar-kebab-btn {
    display: flex;
  }
  /* Hide in-page back + action buttons — replaced by topbar kebab */
  #app-screen[data-page="invoice-detail"] .back-btn {
    display: none !important;
  }
  #app-screen[data-page="invoice-detail"] .inv-detail-actions {
    display: none !important;
  }
  /* Hide page-header entirely (title/subtitle redundant on mobile — topbar shows it) */
  #app-screen[data-page="invoice-detail"] .page-header {
    display: none !important;
  }
  /* Sections panel: "Add Section" button hidden on mobile — FAB handles it there */
  #app-screen[data-page="invoice-detail"] #add-section-btn-header {
    display: none !important;
  }
  /* Remove top padding so tabs sit flush under topbar */
  #app-screen[data-page="invoice-detail"] .page-container {
    padding-top: 0 !important;
  }

  /* Terms list: same treatment — topbar shows "Terms", FAB adds a new term */
  #app-screen[data-page="terms-list"] .page-header {
    display: none !important;
  }
  #app-screen[data-page="terms-list"] .page-container {
    padding-top: 0 !important;
  }

  /* Quotation sections header action is replaced by the FAB on mobile. */
  #qt-add-section-btn-header {
    display: none !important;
  }
}

.topbar-detail {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  position: absolute;
  left: 1rem;
  max-width: calc(100% - 2rem);
}

.topbar-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  padding: 4px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.topbar-back-btn:hover {
  background: var(--primary-light);
}
.topbar-back-btn .material-icons {
  font-size: 1.25rem;
}

.topbar-detail-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Topbar kebab menu (mobile invoice detail) */
#topbar-kebab-btn {
  display: none;
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  padding: 6px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}
#topbar-kebab-btn:hover {
  background: var(--bg);
}
#topbar-kebab-btn .material-icons {
  font-size: 1.375rem;
}

#topbar-menu-btn {
  display: none;
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  padding: 6px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}

.topbar-page-back-btn {
  display: none;
  position: absolute;
  left: 0.75rem;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  padding: 6px;
  border-radius: var(--radius-sm);
}
.topbar-page-back-btn:hover {
  background: var(--bg);
}
.topbar-page-back-btn .material-icons {
  font-size: 1.3rem;
}
#topbar-menu-btn:hover {
  background: var(--bg);
}
#topbar-menu-btn .material-icons {
  font-size: 1.3rem;
}

.topbar-kebab-menu {
  position: absolute;
  top: var(--topbar-h);
  right: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  min-width: 160px;
  overflow: hidden;
}
.topbar-kebab-menu button {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  text-align: left;
}
.topbar-kebab-menu button:last-child {
  border-bottom: none;
}
.topbar-kebab-menu button:hover {
  background: var(--bg);
}
.topbar-kebab-menu button .material-icons {
  font-size: 1rem;
  color: var(--text-secondary);
}
.topbar-kebab-menu button.kebab-danger {
  color: var(--danger);
}
.topbar-kebab-menu button.kebab-danger .material-icons {
  color: var(--danger);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-logo {
  height: 28px;
  object-fit: contain;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.3px;
}

/* ── Plan Expiry Notification Strip ──────────────────────────────────────── */
.expiry-banner {
  grid-area: banner;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #fef3c7;
  color: #7a5b00;
  border-bottom: 1px solid rgba(122, 91, 0, 0.18);
  font-size: 0.8125rem;
  font-weight: 500;
}

.expiry-banner.hidden {
  display: none;
}

.expiry-banner-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}

.expiry-banner-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expiry-banner-btn {
  flex-shrink: 0;
  border: 1.5px solid rgba(122, 91, 0, 0.35);
  background: rgba(122, 91, 0, 0.08);
  color: inherit;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.2rem 0.75rem;
  cursor: pointer;
}

.expiry-banner-btn:hover {
  background: rgba(122, 91, 0, 0.16);
}

.expiry-banner.expired {
  background: var(--danger-light);
  color: var(--danger);
  border-bottom-color: rgba(190, 18, 60, 0.2);
}

.expiry-banner.expired .expiry-banner-btn {
  border-color: rgba(190, 18, 60, 0.35);
  background: rgba(190, 18, 60, 0.08);
}

.expiry-banner.expired .expiry-banner-btn:hover {
  background: rgba(190, 18, 60, 0.16);
}

/* ── Main Content ──────────────────────────────────────────────────────────── */
.main-content {
  grid-area: main;
  overflow-y: auto;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(194, 87, 10, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(194, 87, 10, 0.07) 1px, transparent 1px);
  background-size: 40px 40px;
  background-repeat: repeat;
}

/* Bottom padding on mobile for bottom nav bar */
@media (max-width: 767px) {
  .main-content {
    padding-bottom: 60px;
  }

  .sidebar {
    width: min(84vw, 290px);
  }

  .sidebar-user-card {
    padding: 0.75rem 0.9rem;
  }

  .nav-list {
    display: none;
  }

  .sidebar-extra-links,
  .sidebar-extra-divider {
    display: block;
  }

  .sidebar-extra-links {
    padding: 0.5rem 0.65rem 0.3rem;
  }

  .sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 0.85rem 1.1rem;
  }
}

.page-container {
  padding: 1.25rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.dashboard-page-header {
  margin-bottom: 1.25rem;
}

.dashboard-filters {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.dashboard-filter-group h3 {
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.dashboard-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.dashboard-chip {
  min-width: 3rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid #d4dce9;
  border-radius: 999px;
  background: var(--surface);
  color: #60728e;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.dashboard-chip:hover,
.dashboard-chip.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.dashboard-amount {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #f2d1b3;
  border-radius: var(--radius);
  background: #fff4e8;
}

.dashboard-amount span,
.dashboard-amount small {
  color: #7b5a43;
  font-size: 0.8125rem;
  font-weight: 700;
}

.dashboard-amount strong {
  color: #a94308;
  font-size: 1.5rem;
  font-weight: 800;
}

.dashboard-amount small {
  color: #8b7568;
  font-size: 0.75rem;
  font-weight: 400;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.dashboard-metric {
  display: flex;
  min-height: 7.6rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  border-radius: var(--radius);
  color: #4f6480;
}

.dashboard-metric .material-icons {
  color: #3c526f;
  font-size: 1.375rem;
}

.dashboard-metric strong {
  color: #203a5c;
  font-size: 1.55rem;
  font-weight: 800;
}

.dashboard-metric > span:last-child {
  font-size: 0.8125rem;
  font-weight: 700;
}

.dashboard-metric-invoices { background: #e4f2f5; }
.dashboard-metric-quotations { background: #fcecd9; }
.dashboard-metric-clients { background: #e9f4e2; }
.dashboard-metric-terms { background: #f4e7f4; }

@media (max-width: 767px) {
  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.24s ease-out;
  box-shadow: var(--shadow-lg);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 200;
  backdrop-filter: blur(2px);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.sidebar-logo {
  height: 32px;
  object-fit: contain;
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary);
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sidebar-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.sidebar-close-btn:hover {
  background: var(--bg);
  color: var(--text-primary);
}
.sidebar-close-btn .material-icons {
  font-size: 1.25rem;
}

/* Hide close btn on desktop */
@media (min-width: 768px) {
  .sidebar-close-btn {
    display: none;
  }
}

.sidebar-user-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--primary-light);
}

.user-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-left: 0.25rem;
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.user-detail-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
}

.user-detail-icon {
  font-size: 0.875rem !important;
  color: var(--primary);
  flex-shrink: 0;
}

.user-detail-val {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Nav List ──────────────────────────────────────────────────────────────── */
.nav-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 14 rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition:
    background var(--transition),
    color var(--transition);
  user-select: none;
}

.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.25rem !important;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 0 rem;
  border-top: 1px solid var(--border);
}

.sidebar-footer .btn-logout {
  border-top: none;
  padding-top: 0.625rem;
  margin-top: 0.4rem;
}

.sidebar-extra-links,
.sidebar-extra-divider {
  display: block;
}

.sidebar-extra-link {
  width: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
}

.sidebar-extra-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-extra-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-extra-link:hover .material-icons,
.sidebar-extra-link.active .material-icons {
  color: var(--primary);
}

.sidebar-extra-link .material-icons {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.sidebar-extra-divider {
  height: 1px;
  margin: 0.45rem 0.9rem;
  background: var(--border);
}

.sidebar-branding-block {
  margin-top: 0rem;
  padding-top: 0rem;
  text-align: center;
}

.sidebar-branding-logo {
  height: 24px;
  margin: 0 auto 0.5rem;
  opacity: 0.78;
  object-fit: contain;
}

.sidebar-branding-text {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--danger);
  transition: background var(--transition);
}
.btn-logout:hover {
  background: var(--danger-light);
}
.btn-logout .material-icons {
  font-size: 1.25rem;
}

/* ══════════════════════════════════════════════════════════════════════════════
   BOTTOM NAV (mobile only)
   ══════════════════════════════════════════════════════════════════════════════ */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
  z-index: 200;
  height: 60px;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.625rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.2px;
  transition: color var(--transition);
  border: none;
  background: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item .material-icons {
  font-size: 1.375rem !important;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item:hover {
  color: var(--primary);
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   FAB — Floating Action Button (mobile only)
   ══════════════════════════════════════════════════════════════════════════════ */
.fab {
  position: fixed;
  bottom: calc(60px + 16px);
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 300;
  transition:
    background var(--transition),
    transform 0.15s ease,
    opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.fab:hover {
  background: var(--primary-dark, var(--primary));
  transform: scale(1.06);
}
.fab:active {
  transform: scale(0.95);
}
.fab .material-icons {
  font-size: 1.5rem !important;
}

@media (min-width: 768px) {
  .fab {
    display: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE PAGE LAYOUT OVERRIDES
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  /* Hide section title and subtitle — topbar shows section name instead */
  .page-title,
  .page-subtitle {
    display: none;
  }

  /* Mobile drawer should only show extra links; main nav tabs stay in bottom nav */
  .nav-list {
    display: none;
  }

  /* Hide page-header add buttons — FAB replaces them on mobile */
  .page-header .btn {
    display: none;
  }
  /* But keep invoice detail action buttons always visible */
  .inv-detail-actions .btn {
    display: inline-flex;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   DESKTOP LAYOUT  (≥ 768px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  #app-screen {
    grid-template-areas:
      "sidebar banner"
      "sidebar main";
    grid-template-rows: auto 1fr;
    grid-template-columns: var(--sidebar-w) 1fr;
  }

  .topbar {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    transform: none !important;
    box-shadow: none;
    grid-area: sidebar;
  }

  .sidebar-overlay {
    display: none !important;
  }
  .sidebar-close-btn {
    display: none !important;
  }

  .main-content {
    grid-area: main;
  }

  .page-container {
    padding: 2rem 1.5rem;
  }

  .nav-list {
    max-height: calc(100vh - 18.5rem);
    overflow-y: auto;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   PAGE COMPONENTS
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Page Header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Cards Grid ────────────────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--transition),
    transform var(--transition);
  position: relative;
}

.card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.card-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-body {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.card-action-menu-wrap {
  position: relative;
}

.card-action-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 132px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 30;
  overflow: hidden;
}

.card-action-menu button {
  display: block;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  text-align: left;
  padding: 0.45rem 0.625rem;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text-primary);
  cursor: pointer;
}

.card-action-menu button:last-child {
  border-bottom: none;
}

.card-action-menu button:hover {
  background: var(--bg);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
}

/* ── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .material-icons {
  font-size: 3rem;
  opacity: 0.4;
  display: block;
  margin: 0 auto 0.75rem;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* ── Loading State ─────────────────────────────────────────────────────────── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 0.75rem;
  color: var(--text-secondary);
}

.loading-state .spinner {
  border-color: var(--primary-mid);
  border-top-color: var(--primary);
  width: 28px;
  height: 28px;
  border-width: 3px;
}

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  border: 1px solid var(--border);
}

thead th {
  background: var(--bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.625rem 0.875rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

thead th:last-child {
  border-right: none;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}
tbody tr:hover {
  background: var(--bg-hover);
}

tbody td {
  padding: 0.75rem 0.875rem;
  color: var(--text-primary);
  vertical-align: middle;
  border-right: 1px solid var(--border);
}

tbody td:last-child {
  border-right: none;
}

.td-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

/* ══════════════════════════════════════════════════════════════════════════════
   USERS PAGE — responsive card / table toggle
   ══════════════════════════════════════════════════════════════════════════════ */

/* Mobile: show cards, hide table */
.usr-table-wrapper {
  display: none;
}
.usr-cards-grid {
  display: grid;
}

/* Desktop (≥ 768px): show table, hide cards */
@media (min-width: 768px) {
  .usr-cards-grid {
    display: none;
  }
  .usr-table-wrapper {
    display: block;
  }
}

/* Card detail rows */
.usr-card-meta {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}
.usr-card-meta:last-child {
  border-bottom: none;
}

.usr-meta-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  min-width: 90px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   INVOICE PAGE
   ══════════════════════════════════════════════════════════════════════════════ */
.invoices-search-wrap {
  position: relative;
  margin: -0.1rem 0 0.9rem;
}

.invoices-search-wrap .material-icons {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.05rem;
  color: var(--text-muted);
  pointer-events: none;
}

.invoices-search-input {
  width: 100%;
  padding: 0.62rem 0.8rem 0.62rem 2.2rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--surface);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  outline: none;
}

.invoices-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(194, 87, 10, 0.12);
}

.invoices-search-input::placeholder {
  color: var(--text-muted);
}

.invoice-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
}

.invoice-tab {
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition:
    color var(--transition),
    border-color var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  white-space: nowrap;
}

.invoice-tab:hover {
  color: var(--primary);
}
.invoice-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.terms-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
}

.terms-tab {
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition:
    color var(--transition),
    border-color var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  white-space: nowrap;
}

.terms-tab:hover {
  color: var(--primary);
}
.terms-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.my-business-tabs {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
}

.my-business-tab {
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.7rem 0.15rem;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
}

.my-business-tab:hover,
.my-business-tab.active {
  color: var(--primary);
}

.my-business-tab.active {
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.my-business-panel[hidden] {
  display: none;
}

/* Mobile: sticky tabs strip — top:0 because .main-content is the scroll container
   and already starts flush below the topbar. Using top:0 keeps tabs pinned to
   the very top of .main-content's visible area (= just below the app bar).
   The min-height:0 rule on .main-content (below) guarantees it is always the
   scroll container so this assumption always holds. */
@media (max-width: 767px) {
  /* Give #app-screen an explicit height so the CSS grid has a definite block
     size on mobile. With only min-height:100vh the spec treats the grid's block
     size as indefinite, so 1fr sizes to fit content and body scrolls instead of
     .main-content. An explicit height makes 1fr = (viewport − topbar), which
     constrains .main-content and forces it to scroll internally. */
  #app-screen {
    height: 100vh; /* safe fallback */
    height: 100dvh; /* adapts when mobile browser chrome shows/hides */
    min-height: 0; /* neutralise the global min-height:100vh */
  }

  /* Guarantee .main-content is always the scroll container on mobile */
  .main-content {
    min-height: 0;
  }

  #app-screen[data-page="invoice-detail"] .invoice-tabs {
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--surface);
    margin: 0 -1rem 1.25rem;
    padding: 0 1rem;
    border-bottom: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
  }
  #app-screen[data-page="invoice-detail"] .invoice-tab {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0;
  }

  #app-screen[data-page="terms-list"] .terms-tabs {
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--surface);
    margin: 0 -1rem 1.25rem;
    padding: 0 1rem;
    border-bottom: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
  }

  #app-screen[data-page="terms-list"] .terms-tab {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0;
  }

  #app-screen[data-page="my-business"] .my-business-tabs {
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--surface);
    margin: 0 -1rem 1.25rem;
    padding: 0 1rem;
    box-shadow: var(--shadow-sm);
  }

  #app-screen[data-page="my-business"] .my-business-tab {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0;
  }
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

.terms-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.terms-picker-body {
  padding-top: 0.75rem;
}

.terms-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.terms-picker-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.55rem 0.65rem;
}

.terms-picker-row.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(194, 87, 10, 0.12) inset;
}

.terms-picker-row.dragging {
  opacity: 0.6;
}

.terms-picker-drag {
  color: var(--text-muted);
  cursor: move;
  user-select: none;
}

.terms-picker-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  cursor: pointer;
  color: var(--text-primary);
}

.terms-picker-checkbox {
  margin-top: 0.2rem;
  accent-color: var(--primary);
}

@media (max-width: 767px) {
  .terms-picker-header {
    flex-direction: column;
    align-items: stretch;
  }

  .terms-picker-header .btn {
    width: 100%;
  }
}

/* Totals bar above items table */
.items-totals-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 0.875rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.items-total-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.625rem 1.5rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.items-total-cell + .items-total-cell {
  border-left: 1px solid var(--border);
}
.items-total-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.125rem;
}
.items-total-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.items-total-final .items-total-value {
  color: var(--primary);
}

/* Section-wise item table headers (PDF-inspired) */
.section-group-row td.section-group-cell {
  padding: 0.4rem 0.85rem;
  background: var(--bg);
  border-top: 2px solid var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.section-group-index {
  display: inline-block;
  min-width: 2.1rem;
  margin-right: 0.55rem;
  padding: 0.08rem 0.38rem;
  border: 1px solid var(--text-secondary);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-align: center;
  color: var(--text-secondary);
  background: var(--surface);
  vertical-align: middle;
}

.section-group-title {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-primary);
  vertical-align: middle;
}

.section-summary-row td {
  border-top: 1px dashed var(--border);
}

.section-summary-row td.section-summary-cell {
  text-align: right;
  background: var(--bg);
  padding: 0.55rem 0.85rem;
}

.section-summary-content {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.section-summary-qty {
  color: var(--text-muted);
}

.section-summary-subtotal {
  font-weight: 700;
  color: var(--primary);
}
/* Hide in-table total rows — shown in the bar above */
.total-row {
  display: none;
}

@media (max-width: 767px) {
  .items-totals-bar {
    justify-content: flex-start;
  }
  .items-total-cell {
    padding: 0.625rem 1rem;
  }
  .section-summary-row td.section-summary-cell {
    text-align: left;
  }
  .section-summary-content {
    justify-content: flex-start;
  }
}

/* ── Invoice List ──────────────────────────────────────────────────────────── */
.invoice-list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--transition),
    transform var(--transition);
}

.invoice-list-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.invoice-list-info h4 {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.invoice-list-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.invoice-list-meta {
  text-align: right;
  flex-shrink: 0;
}

.invoice-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.invoice-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

/* Business header card — two-column body (logo | details) */
.bh-card-body-cols {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.bh-logo-col {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
}

.bh-details-col {
  flex: 1;
  min-width: 0;
}

.gst-badge {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 3px;
  vertical-align: middle;
}

.inv-gst-tag {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  background: #2563eb;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: 0.03em;
  line-height: 1.6;
}

.qt-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1;
  border: 1px solid transparent;
}

.qt-type-badge.type-a {
  background: #e0f2fe;
  color: #0c4a6e;
  border-color: #bae6fd;
}

.qt-type-badge.type-b {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #ddd6fe;
}

/* Invoice detail back button */
.inv-detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  margin-bottom: 1rem;
  font-weight: 500;
}
.back-btn:hover {
  text-decoration: none;
}
.back-btn .material-icons {
  font-size: 1.1rem;
}

/* Items table amount column */
.amount-col {
  font-weight: 600;
  color: var(--primary);
}

/* Invoice total row */
.total-row td {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--primary-light);
}

.total-gst-row td {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--bg);
}

.final-total-row td {
  font-size: 1rem;
  background: var(--primary-light);
  border-top: 2px solid var(--primary);
}

/* ══════════════════════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.modal-close-btn:hover {
  background: var(--bg);
  color: var(--text-primary);
}
.modal-close-btn .material-icons {
  font-size: 1.25rem;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════════════════════
   CONFIRM DIALOG
   ══════════════════════════════════════════════════════════════════════════════ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
}

.confirm-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 360px;
  padding: 2rem 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: modal-in 0.18s ease;
}

.confirm-icon-wrap {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--danger-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.confirm-icon {
  font-size: 1.75rem !important;
  color: var(--danger);
}

.confirm-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.confirm-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.confirm-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.confirm-actions .btn {
  flex: 1;
}

/* ════════════════════════════════ ACCOUNT PAGE ════════════════════════════ */

.account-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 1rem 2rem;
}

/* Desktop grid layout */
@media (min-width: 1024px) {
  .account-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
  }

  .account-section-col-1 {
    grid-column: 1;
    grid-row: 1;
  }

  .account-section-col-2 {
    grid-column: 2;
    grid-row: 1;
  }

  .account-section-col-3 {
    grid-column: 1;
    grid-row: 2;
  }

  .account-section-col-4 {
    grid-column: 2;
    grid-row: 2;
  }

  .account-section-col-delete {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

.account-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow: hidden;
}

.account-section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1rem 0;
}

.account-section-icon {
  font-size: 1.25rem;
  color: var(--primary);
}

.account-section-icon-danger {
  color: #dc2626;
}

/* My Details Section */
.account-details-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.account-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.account-detail-row:last-child {
  border-bottom: none;
}

.account-detail-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.account-detail-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

/* Section Content */
.account-section-content {
  display: flex;
  flex-direction: column;
}

.account-section-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}

/* Recovery Settings */
.recovery-settings-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.recovery-option {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
}

.recovery-option-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.recovery-option-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
}

.recovery-option-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

.recovery-status-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
}

.recovery-option-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .account-detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .account-detail-value {
    text-align: left;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   BOTTOM SHEET
   ══════════════════════════════════════════════════════════════════════════════ */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(2px);
}

.bottom-sheet {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.sheet-drag-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0.625rem auto 0;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sheet-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sheet-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}
.sheet-close-btn:hover {
  background: var(--bg);
}
.sheet-close-btn .material-icons {
  font-size: 1.25rem;
}

.sheet-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

/* ── Download Progress Modal (non-dismissible) ───────────────────────────── */
.download-progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.download-progress-modal {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 1rem 1rem 1.1rem;
}

.download-progress-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.download-progress-message {
  margin: 0.5rem 0 0.85rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.download-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  position: relative;
}

.download-progress-bar {
  position: absolute;
  left: -42%;
  top: 0;
  width: 42%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #9a4508 0%, #c2570a 100%);
  animation: download-progress-move 1.1s ease-in-out infinite;
}

@keyframes download-progress-move {
  0% {
    left: -42%;
  }
  100% {
    left: 100%;
  }
}

/* ── Shared form actions inside modal/sheet ──────────────────────────────── */
.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  flex-wrap: wrap;
}

.form-actions .btn {
  min-width: 90px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATION
   ══════════════════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 0.625rem 1.25rem;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.toast-message {
  display: inline-block;
}

.toast-action-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.18rem 0.62rem;
  cursor: pointer;
}

.toast-action-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.toast.success {
  background: var(--success);
}
.toast.error {
  background: var(--danger);
}
.toast.warning {
  background: var(--warning);
  color: var(--text-primary);
}
.toast.subscription-reminder {
  background: #7a5b00;
  color: #fff9dc;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(255, 219, 102, 0.35);
}
.toast.subscription-reminder .toast-action-btn {
  border-color: rgba(255, 239, 179, 0.45);
  background: rgba(255, 244, 204, 0.14);
  color: #fff9dc;
}
.toast.subscription-reminder .toast-action-btn:hover {
  background: rgba(255, 244, 204, 0.25);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   USERS PAGE
   ══════════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-light);
  color: #065f46;
}
.badge-danger {
  background: var(--danger-light);
  color: #9f1239;
}
.badge-warning {
  background: var(--warning-light);
  color: #92400e;
}
.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── Subscription status ────────────────────────────────────────────────── */
.sub-active {
  color: var(--success);
}
.sub-expired {
  color: var(--danger);
}

/* ── Plans page ─────────────────────────────────────────────────────────── */
.plans-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.plan-card-current {
  border-color: var(--success);
}

.plan-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.plan-card-head h3 {
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.plan-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.plan-price-cancelled {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: line-through;
}

.plan-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}

.plan-discount {
  color: #065f46;
  background: var(--success-light);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.3;
}

.plan-term {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.plan-details {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0.75rem 0;
}

.plan-allowances {
  margin-top: 0.5rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.55rem;
}

.plan-allowances li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.2rem 0;
}

.plan-allowances li strong {
  color: var(--text-primary);
}

.plan-card-action {
  margin-top: auto;
  padding-top: 0.85rem;
}

.plan-purchase-btn {
  min-height: 42px;
}

.plan-purchase-btn .material-icons {
  font-size: 1.05rem;
}

.plan-free-note {
  display: block;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE TWEAKS
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-row-2 {
    grid-template-columns: 1fr 1fr;
  }
  .form-row-3 {
    grid-template-columns: 1fr 1fr;
  }
  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    align-self: flex-end;
  }
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
