/* ============================================================
   StayLedger — Design System
   Inter font, blue primary palette, light professional theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --blue-primary:   #1E40AF;
  --blue-accent:    #3B82F6;
  --blue-light:     #EFF6FF;
  --blue-mid:       #DBEAFE;
  --green:          #16A34A;
  --green-light:    #DCFCE7;
  --amber:          #D97706;
  --amber-light:    #FEF3C7;
  --red:            #DC2626;
  --red-light:      #FEE2E2;
  --bg:             #F8FAFC;
  --card:           #FFFFFF;
  --border:         #E2E8F0;
  --border-focus:   #3B82F6;
  --text-primary:   #1E293B;
  --text-secondary: #64748B;
  --text-muted:     #94A3B8;
  --primary:        #1E40AF;
  --accent:         #3B82F6;
  --sidebar-w:      240px;
  --header-h:       60px;
  --radius:         8px;
  --radius-lg:      12px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow-md:      0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:      0 8px 24px rgba(0,0,0,.12);
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.5;
  height: 100%;
}

/* ── Login Page ─────────────────────────────────────────────── */
.login-page,
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1E40AF 0%, #1E3A8A 100%);
}

.login-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--blue-primary);
  letter-spacing: -0.5px;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

.login-error {
  background: var(--red-light, #fef2f2);
  color: var(--red, #dc2626);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── App Shell ──────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--blue-primary);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-logo h2 {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-logo span {
  color: rgba(255,255,255,.6);
  font-size: 11px;
  font-weight: 500;
  display: block;
  margin-top: 2px;
}

.sidebar-property {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 8px;
}

.sidebar-property-label {
  color: rgba(255,255,255,.5);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 4px;
}

.sidebar-property-name {
  color: rgba(255,255,255,.9);
  font-size: 13px;
  font-weight: 500;
}

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

.nav-section-label {
  color: rgba(255,255,255,.4);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 12px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-left-color: #93C5FD;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .8;
}

.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-user {
  color: rgba(255,255,255,.7);
  font-size: 12px;
}

.sidebar-user strong {
  color: #fff;
  display: block;
  font-size: 13px;
}

.sidebar-user .role-badge {
  display: inline-block;
  margin-top: 4px;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.btn-logout {
  display: block;
  margin-top: 10px;
  color: rgba(255,255,255,.5);
  font-size: 12px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
}

.btn-logout:hover { color: rgba(255,255,255,.9); }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-header {
  height: var(--header-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
}

.page-header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.page-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── Module Views (visibility toggled via .hidden utility) ──── */
.module-view { display: block; }
.module-view.hidden { display: none !important; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── Form Elements ──────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

input.big-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--blue-primary);
  text-align: center;
  padding: 14px 16px;
  border-width: 2px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
}

.btn:hover { opacity: .88; }
.btn:active { transform: scale(.98); }

.btn-primary { background: var(--blue-primary); color: #fff; }
.btn-accent  { background: var(--blue-accent);  color: #fff; }
.btn-success { background: var(--green);         color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--blue-primary);
  border: 1.5px solid var(--blue-primary);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Pricing Calculator ─────────────────────────────────────── */
.pricing-hero {
  background: linear-gradient(135deg, var(--blue-primary) 0%, #1D4ED8 100%);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: #fff;
  margin-bottom: 24px;
}

.pricing-hero h2 {
  font-size: 16px;
  font-weight: 600;
  opacity: .8;
  margin-bottom: 20px;
}

.net-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 380px;
}

.net-input-wrapper span {
  font-size: 28px;
  font-weight: 700;
  color: rgba(255,255,255,.7);
}

.net-input-wrapper input {
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.3);
  color: #fff;
  font-size: 36px;
  font-weight: 700;
  text-align: right;
  border-radius: var(--radius);
  padding: 10px 14px;
  width: 220px;
}

.net-input-wrapper input::placeholder { color: rgba(255,255,255,.4); }
.net-input-wrapper input:focus {
  border-color: rgba(255,255,255,.6);
  box-shadow: 0 0 0 3px rgba(255,255,255,.15);
  background: rgba(255,255,255,.2);
}

.net-hint {
  font-size: 12px;
  color: rgba(255,255,255,.6);
  margin-top: 8px;
}

/* ── Portal Price Table ─────────────────────────────────────── */
.portal-table {
  width: 100%;
  border-collapse: collapse;
}

.portal-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
}

.portal-table th:not(:first-child) { text-align: right; }

.portal-table td {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.portal-table tr:last-child td { border-bottom: none; }

.portal-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.portal-dot.airbnb  { background: #FF5A5F; }
.portal-dot.bcom    { background: #003580; }
.portal-dot.direct  { background: var(--green); }
.portal-dot.other   { background: var(--text-muted); }

.portal-label { font-size: 14px; font-weight: 600; }
.portal-sublabel { font-size: 11px; color: var(--text-secondary); }

.markup-input-cell { text-align: right; }

.markup-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--blue-light);
  border: 1.5px solid var(--blue-mid);
  border-radius: 6px;
  padding: 4px 8px;
}

.markup-inline input {
  width: 48px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue-primary);
  text-align: right;
  padding: 0;
  outline: none;
  font-family: inherit;
}

.markup-inline span {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-primary);
}

.price-cell {
  text-align: right;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.price-cell .currency {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-right: 2px;
}

.price-action {
  text-align: right;
}

.copy-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.copy-btn:hover {
  border-color: var(--blue-accent);
  color: var(--blue-accent);
}

.copy-btn.copied {
  border-color: var(--green);
  color: var(--green);
}

/* ── Slider ─────────────────────────────────────────────────── */
.slider-wrapper {
  padding: 8px 0 4px;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--blue-mid);
  border-radius: 3px;
  outline: none;
  border: none;
  padding: 0;
  box-shadow: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--blue-primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(30,64,175,.35);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Scenario Cards ─────────────────────────────────────────── */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.scenario-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}

.scenario-card:hover {
  border-color: var(--blue-accent);
  background: var(--blue-light);
}

.scenario-card.active-scenario {
  border-color: var(--blue-primary);
  background: var(--blue-light);
}

.scenario-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.scenario-net {
  font-size: 20px;
  font-weight: 700;
  color: var(--blue-primary);
  margin: 6px 0 2px;
}

.scenario-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.scenario-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
}

.scenario-delete:hover { color: var(--red); background: var(--red-light); }

/* ── Save Scenario Modal ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  display: none;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 420px;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ── Stat badges ────────────────────────────────────────────── */
.stat-row {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.stat-pill {
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: rgba(255,255,255,.85);
}

.stat-pill strong {
  color: #fff;
  font-size: 14px;
}

/* ── Utilities ──────────────────────────────────────────────── */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-12 { gap: 12px; }
.gap-20 { gap: 20px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--green); }
.fw-600 { font-weight: 600; }
.hidden { display: none !important; }

/* ── Toast ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text-primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slide-in .2s ease;
}

.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

@keyframes slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left  { display: flex; align-items: center; gap: 0.75rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.topbar-property {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
}

/* ── Property selector in sidebar ──────────────────────────── */
.property-selector-wrap {
  padding: 0.75rem 1rem 0.25rem;
}
.form-control-sm {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

/* ── Nav badge ──────────────────────────────────────────────── */
.nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 2px 7px;
  text-transform: uppercase;
}

/* ── Modal (HTML uses .modal, .modal-header, etc.) ──────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 440px;
  max-width: 94vw;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body   { padding: 1.25rem; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ── Scenario card extra ────────────────────────────────────── */
.scenario-info  { flex: 1; min-width: 0; }
.scenario-meta  { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.scenario-actions { display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0; }

/* ── Deduction grid ─────────────────────────────────────────── */
.deduction-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.deduction-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
}
.deduction-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ── Coming Soon placeholder ─────────────────────────────────── */
.coming-soon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem;
}
.coming-soon-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}
.coming-soon-wrap h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
  color: var(--text-primary);
}
.coming-soon-wrap p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 400px;
}

/* ── Login brand / title / subtitle ─────────────────────────── */
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}
.login-logo {
  width: 44px;
  height: 44px;
  background: var(--primary, #1E40AF);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.login-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.login-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Sidebar brand (override/alias) ─────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}
.sidebar-logo {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

/* ── Sidebar footer user strip ──────────────────────────────── */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.1);
  margin-top: auto;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.68rem;
  color: rgba(255,255,255,.55);
}
.logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.logout-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ── Login error (duplicate guard — already defined above) ───── */

/* ── Toast fix (single element not container) ───────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}
.toast-info    { background: var(--primary); }
.toast-success { background: var(--green); }
.toast-error   { background: #dc2626; }

/* ── Portal name input ──────────────────────────────────────── */
.portal-name-input {
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  width: 140px;
}
.portal-name-input:focus {
  outline: none;
  background: var(--bg);
  border: 1px solid var(--accent);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .pricing-hero { padding: 20px; }
  .net-input-wrapper input { font-size: 28px; width: 180px; }
  .price-cell { font-size: 18px; }
  .modal { width: 96vw; }
}

/* ══════════════════════════════════════════════════════════════
   MODULE STYLES — added for Module 2-7 HTML
══════════════════════════════════════════════════════════════ */

/* ── KPI cards ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}
.kpi-card--accent { border-left: 3px solid var(--primary); }
.kpi-card--green  { border-left: 3px solid var(--green); }
.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}
.kpi-value--red   { color: #dc2626; }
.kpi-value--green { color: var(--green); }
.kpi-value--amber { color: var(--amber); }

/* ── Charts ─────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
.chart-card-header { margin-bottom: 1rem; }
.chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.chart-wrap { height: 240px; position: relative; }

/* ── Section card ───────────────────────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
.section-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1rem;
}

/* ── Table wrap ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

/* ── View layout ────────────────────────────────────────────── */
.view-section { padding: 1.5rem 2rem; }
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.view-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem;
}
.view-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--bg-subtle); color: var(--text-primary); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Form grids ─────────────────────────────────────────────── */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-group--full { grid-column: 1 / -1; }

/* ── Invoices ───────────────────────────────────────────────── */
.invoices-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.invoice-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}
.invoice-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.invoice-number {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}
.invoice-period {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.invoice-status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.invoice-card-totals {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.invoice-card-totals div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.invoice-card-totals span { font-size: 0.68rem; color: var(--text-secondary); }
.invoice-card-totals strong { font-size: 0.875rem; font-weight: 600; }
.inv-total strong { color: var(--primary); font-size: 1rem; }
.invoice-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.invoice-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}
.invoice-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.invoice-detail-header h3 { margin: 0; font-size: 1.05rem; }

/* ── Checklist (generate invoice modal) ─────────────────────── */
.checklist-scroll {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  background: var(--bg);
}
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0.25rem;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 6px;
}
.check-item:hover { background: var(--bg-subtle); }
.check-item input { margin-top: 2px; flex-shrink: 0; }

/* ── Vault ──────────────────────────────────────────────────── */
.vault-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}
.vault-file-label {
  display: block;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
}
.vault-file-label:hover {
  border-color: var(--primary);
  background: #EFF6FF;
  color: var(--primary);
}
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.vault-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.vault-card-icon { font-size: 1.75rem; flex-shrink: 0; line-height: 1; }
.vault-card-body { flex: 1; min-width: 0; }
.vault-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.4rem;
}
.vault-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}
.vault-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
.vault-card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.vault-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

/* ── Pricing layout ─────────────────────────────────────────── */
.pricing-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.pricing-breakdown {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ── Button sizes ───────────────────────────────────────────── */
.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  border-radius: 6px;
}
.btn-full { width: 100%; }

/* ── Sidebar avatar ─────────────────────────────────────────── */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}
.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.65rem;
  color: rgba(255,255,255,.55);
}
.sidebar-logout {
  flex-shrink: 0;
  border-color: rgba(255,255,255,.25);
  color: rgba(255,255,255,.7);
}
.sidebar-logout:hover {
  border-color: rgba(255,255,255,.6);
  color: #fff;
  background: rgba(255,255,255,.08);
}

/* ── Coming soon fallback ───────────────────────────────────── */
.coming-soon-wrap {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}
.coming-soon-icon { font-size: 3.5rem; margin-bottom: 1rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
  .invoices-layout { grid-template-columns: 1fr; }
  .pricing-layout { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .view-section { padding: 1rem; }
}
@media (max-width: 640px) {
  .vault-upload-row { flex-direction: column; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Toast (updated for dynamic creation) ───────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast-success  { background: var(--green, #16A34A); }
.toast-error    { background: #dc2626; }
.toast-info     { background: var(--primary, #1E40AF); }
