/* ===== ZADVOCATES LLP ERP — Light Mode, Navy & Gold ===== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Brand Colors (from logo) */
  --navy-900: #0d1e3d;
  --navy-800: #132750;
  --navy-700: #1a3068;
  --navy-600: #234080;
  --navy-500: #2e5099;

  --gold-400: #c9a84c;
  --gold-500: #b8922e;
  --gold-600: #9a7820;
  --gold-light: rgba(184, 146, 46, 0.10);
  --gold-border: rgba(184, 146, 46, 0.25);

  /* Light Surfaces */
  --bg-page:    #f4f6fa;
  --bg-sidebar: #0d1e3d;       /* keep sidebar dark navy — brand anchor */
  --surface-1:  #ffffff;
  --surface-2:  #f8f9fc;
  --surface-3:  #eef0f6;
  --surface-card: #ffffff;

  /* Text */
  --text-primary:   #0d1e3d;
  --text-secondary: #3d5280;
  --text-muted:     #7b8fb5;
  --text-on-dark:   #e8edf8;
  --text-on-dark-muted: #7a93c0;

  /* Status */
  --success: #1a9e5c;
  --warning: #d4820a;
  --danger:  #c0392b;
  --info:    #2471a3;

  /* Layout */
  --sidebar-w:  270px;
  --topbar-h:   66px;
  --radius:     10px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 4px rgba(13,30,61,.07);
  --shadow-md:  0 4px 16px rgba(13,30,61,.10);
  --shadow-lg:  0 8px 32px rgba(13,30,61,.13);
  --transition: 0.18s ease;
}

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

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

a { color: var(--navy-700); text-decoration: none; }
a:hover { color: var(--gold-500); }

/* ===== LAYOUT ===== */
.erp-layout { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR (stays dark navy — logo lives here) ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  box-shadow: 2px 0 12px rgba(0,0,0,.15);
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .logo-img {
  width: 46px; height: 46px;
  object-fit: contain;
  background: white;
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}
.sidebar-brand .firm-name {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
  line-height: 1.2;
}
.sidebar-brand .firm-sub {
  font-size: 10px;
  color: var(--text-on-dark-muted);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  margin-top: 2px;
}

.sidebar-user {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 11px;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold-light);
  border: 2px solid var(--gold-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--gold-400); font-weight: 700;
  flex-shrink: 0;
  background: rgba(184,146,46,0.2);
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text-on-dark); }
.user-role { font-size: 11px; color: var(--gold-400); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-section {
  padding: 10px 20px 4px;
  font-size: 9.5px; text-transform: uppercase;
  letter-spacing: 1.6px; color: var(--text-on-dark-muted);
  font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; color: rgba(232,237,248,0.7);
  font-size: 13px; font-weight: 500;
  transition: var(--transition);
  cursor: pointer; border-left: 3px solid transparent;
}
.nav-item:hover  { background: rgba(255,255,255,0.06); color: #fff; border-left-color: rgba(184,146,46,0.4); }
.nav-item.active { background: rgba(184,146,46,0.12); color: var(--gold-400); border-left-color: var(--gold-400); }
.nav-item .icon  { font-size: 15px; width: 20px; text-align: center; opacity: 0.85; }

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.logout-btn {
  display: flex; align-items: center; gap: 8px;
  color: rgba(232,237,248,0.5); font-size: 13px;
  padding: 8px 0; width: 100%; transition: var(--transition);
}
.logout-btn:hover { color: #e74c3c; }

/* ===== MAIN AREA ===== */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--topbar-h);
  background: var(--surface-1);
  border-bottom: 1px solid var(--surface-3);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center;
  padding: 0 28px; gap: 14px; flex-shrink: 0;
}
.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 19px; font-weight: 600;
  color: var(--navy-900); flex: 1;
}
.topbar-date { font-size: 12px; color: var(--text-muted); }

.topbar-badge {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-secondary);
  font-size: 16px; cursor: pointer; transition: var(--transition);
  border: 1px solid var(--surface-3);
}
.topbar-badge:hover { background: var(--gold-light); color: var(--gold-500); border-color: var(--gold-border); }
.badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold-500); border: 2px solid var(--surface-1);
}

.content { flex: 1; overflow-y: auto; padding: 26px 28px; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 22px; }
.page-header h1 { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--navy-900); }
.page-header p  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ===== KPI CARDS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }

.kpi-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold-600), var(--gold-400));
}
.kpi-card:hover { border-color: var(--gold-border); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.kpi-sub   { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.kpi-icon  { position: absolute; bottom: 12px; right: 14px; font-size: 26px; opacity: 0.07; }

/* ===== SECTION CARDS ===== */
.section-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-lg);
  margin-bottom: 20px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.section-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--surface-3);
  background: var(--surface-2);
}
.section-card-title { font-family: 'Playfair Display', serif; font-size: 15px; font-weight: 600; color: var(--navy-900); }
.section-card-body  { padding: 0; }

/* ===== DATA TABLE ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--surface-2); padding: 10px 18px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); text-align: left; font-weight: 700;
  border-bottom: 1px solid var(--surface-3);
}
.data-table td { padding: 12px 18px; border-bottom: 1px solid var(--surface-3); font-size: 13px; color: var(--text-secondary); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gold-light); color: var(--navy-900); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-active   { background: #d4f5e5; color: #1a7a4a; }
.badge-pending  { background: #fef3dc; color: #a06b0a; }
.badge-review   { background: #dceeff; color: #1a5fa0; }
.badge-closed   { background: #eaecf2; color: #5a6b8a; }
.badge-overdue  { background: #fde8e6; color: #b5281c; }
.badge-approved { background: #d4f5e5; color: #1a7a4a; }
.badge-high     { background: #fde8e6; color: #b5281c; }
.badge-medium   { background: #fef3dc; color: #a06b0a; }
.badge-low      { background: #dceeff; color: #1a5fa0; }

/* ===== BUTTONS ===== */
.btn-gold {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px;
  background: linear-gradient(135deg, var(--gold-600), var(--gold-400));
  color: #fff; font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; transition: var(--transition);
  box-shadow: 0 2px 6px rgba(184,146,46,.3);
}
.btn-gold:hover { opacity: 0.9; color: #fff; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px;
  background: transparent;
  border: 1px solid var(--gold-border);
  color: var(--gold-600); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--transition);
}
.btn-outline:hover { background: var(--gold-light); border-color: var(--gold-500); }

.btn-navy {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px;
  background: var(--navy-800);
  color: #fff; font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; transition: var(--transition);
}
.btn-navy:hover { background: var(--navy-700); color: #fff; }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh; display: flex;
  background: var(--bg-page);
}
.login-left {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: var(--navy-900);
  position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(184,146,46,0.12) 0%, transparent 70%);
  top: -100px; right: -100px;
}
.login-left::after {
  content: '';
  position: absolute; width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(184,146,46,0.08) 0%, transparent 70%);
  bottom: -50px; left: -50px;
}
.login-brand { text-align: center; position: relative; z-index: 1; }
.login-brand img { width: 120px; margin-bottom: 24px; background: white; border-radius: 16px; padding: 12px; }
.login-brand h1 { font-family: 'Playfair Display', serif; font-size: 32px; color: #fff; font-weight: 700; }
.login-brand .llp { color: var(--gold-400); font-size: 14px; letter-spacing: 4px; text-transform: uppercase; margin-top: 4px; }
.login-brand p { color: rgba(255,255,255,0.45); font-size: 13px; margin-top: 12px; max-width: 260px; }

.login-right {
  width: 460px; display: flex; align-items: center; justify-content: center;
  padding: 48px 40px;
}
.login-card {
  width: 100%; max-width: 360px;
}
.login-card h2 { font-family: 'Playfair Display', serif; font-size: 24px; color: var(--navy-900); margin-bottom: 6px; }
.login-card .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 32px; }
.login-divider { width: 40px; height: 3px; background: var(--gold-500); border-radius: 2px; margin-bottom: 28px; }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.8px; }
.form-control {
  width: 100%; padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--surface-3);
  border-radius: 8px; color: var(--text-primary); font-size: 14px;
  transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--gold-500); background: #fff; box-shadow: 0 0 0 3px rgba(184,146,46,0.12); }
.form-control::placeholder { color: var(--text-muted); }
.btn-login {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  color: #fff; font-size: 14px; font-weight: 700;
  border: none; border-radius: 8px; cursor: pointer;
  letter-spacing: 0.5px; transition: var(--transition); margin-top: 8px;
  box-shadow: 0 4px 14px rgba(13,30,61,.25);
}
.btn-login:hover { background: linear-gradient(135deg, var(--navy-700), var(--gold-600)); }
.alert-error {
  background: #fde8e6; border: 1px solid #f5c6c2; color: var(--danger);
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}

/* ===== GRID HELPERS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 768px)  { .login-left { display: none; } .login-right { width: 100%; } }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb { background: #c8d0e0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-500); }

/* ===== CLIENT & CASE MODULES ===== */
.module-head{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;margin-bottom:22px}
.module-head h1{font-size:26px;margin-bottom:3px}.module-head p,.muted{color:var(--text-muted)}
.btn{display:inline-flex;align-items:center;justify-content:center;border:1px solid #d9dfeb;background:#fff;color:var(--navy-800);padding:9px 15px;border-radius:8px;font-weight:600;cursor:pointer}.btn-primary{background:var(--navy-800);border-color:var(--navy-800);color:#fff}.btn-sm{padding:6px 10px;font-size:12px}
.search-bar{display:flex;gap:10px;margin-bottom:18px}.search-bar input,.search-bar select{padding:10px 12px;border:1px solid #dce2ec;border-radius:8px;background:#fff;outline:none}.search-bar input{flex:1}
.table-card,.form-card,.info-card{background:#fff;border:1px solid #e5e9f1;border-radius:12px;box-shadow:var(--shadow-sm);overflow:hidden}.table-card table{width:100%;border-collapse:collapse}.table-card th,.table-card td{padding:13px 15px;text-align:left;border-bottom:1px solid #edf0f5}.table-card th{font-size:11px;text-transform:uppercase;letter-spacing:.7px;color:var(--text-muted);background:#fafbfc}.table-card td small{display:block;color:var(--text-muted);margin-top:2px}.empty{text-align:center;padding:35px!important;color:var(--text-muted)}
.stat-row{display:flex;gap:14px;margin-bottom:18px}.stat-card{background:#fff;border:1px solid #e5e9f1;border-radius:10px;padding:14px 20px;min-width:150px}.stat-card b{font-size:24px;display:block}.stat-card span{font-size:12px;color:var(--text-muted)}
.status{display:inline-block;padding:4px 8px;border-radius:999px;font-size:11px;font-weight:700;background:#eef0f5}.status-active{background:#e7f6ee;color:#18794e}.status-closed,.status-archived{background:#eef0f5;color:#596579}.status-on_hold,.status-intake{background:#fff3dc;color:#98600a}.status-urgent{background:#fde9e7;color:#a72d21}.status-prospect{background:#e9f2fb;color:#24658c}
.form-card{padding:24px;display:grid;grid-template-columns:1fr 1fr;gap:16px}.field label{display:block;font-size:12px;font-weight:600;margin-bottom:5px;color:var(--text-secondary)}.field input,.field select,.field textarea{width:100%;padding:10px 11px;border:1px solid #dce2ec;border-radius:7px;background:#fff;font:inherit}.field textarea{min-height:100px}.field:has(textarea){grid-column:1/-1}.form-actions{grid-column:1/-1;display:flex;justify-content:flex-end;gap:10px;padding-top:8px}.error{color:var(--danger);font-size:12px}.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.info-card{padding:22px}.info-card h3{margin-bottom:17px}.info-card dl{display:grid;grid-template-columns:150px 1fr;gap:9px 14px}.info-card dt{font-size:12px;color:var(--text-muted)}.info-card dd{margin:0}.card-head{display:flex;align-items:center;justify-content:space-between}.list-row{padding:12px 0;border-top:1px solid #edf0f5;display:flex;justify-content:space-between;gap:10px}.timeline{margin-top:20px}.timeline-item{border-left:2px solid var(--gold-400);padding:0 0 16px 14px;margin-bottom:14px}.timeline-item span{display:block;color:var(--text-muted);font-size:11px}.timeline-item p{margin-top:5px}.compact-form{padding-bottom:15px;border-bottom:1px solid #edf0f5}.compact-form .field{margin-bottom:10px}.compact-form .field:has(textarea){grid-column:auto}
@media(max-width:900px){.detail-grid,.form-card{grid-template-columns:1fr}.field:has(textarea){grid-column:auto}.module-head{align-items:flex-start;flex-direction:column}.search-bar{flex-wrap:wrap}}

/* ===== MODULE 09 · PAYMENTS & EXPENSES ===== */
.finance-page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; margin-bottom:22px; }
.finance-page-head h1 { margin:2px 0 4px; }
.payment-create-layout { display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:20px; align-items:start; }
.payment-form-card, .payment-summary-card { border:1px solid var(--surface-3); box-shadow:var(--shadow-sm); }
.finance-section-title { display:flex; align-items:center; gap:13px; padding-bottom:18px; margin-bottom:18px; border-bottom:1px solid var(--surface-3); }
.finance-section-title h2 { margin:0 0 3px; font-size:18px; }
.finance-icon { width:44px; height:44px; border-radius:12px; display:flex; align-items:center; justify-content:center; background:var(--gold-light); color:var(--gold-600); font-size:21px; font-weight:700; }
.finance-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.form-field.full { grid-column:1/-1; }
.required { color:#b5281c; }
.help-text { display:block; margin-top:6px; color:var(--text-muted); font-size:11px; }
.invoice-preview { margin-top:13px; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); border:1px solid var(--gold-border); border-radius:10px; background:var(--gold-light); overflow:hidden; }
.invoice-preview > div { padding:11px 13px; border-right:1px solid var(--gold-border); }
.invoice-preview > div:last-child { border-right:0; }
.invoice-preview span { display:block; color:var(--text-muted); font-size:10px; text-transform:uppercase; letter-spacing:.6px; margin-bottom:4px; }
.invoice-preview strong { display:block; color:var(--navy-900); font-size:12px; }
.invoice-preview .balance-cell strong { color:var(--gold-600); font-size:14px; }
.payment-summary-card { position:sticky; top:20px; padding:24px; }
.summary-kicker { color:var(--gold-600); font-size:10px; font-weight:700; letter-spacing:1.5px; }
.summary-amount { font-size:34px; line-height:1.15; font-weight:800; color:var(--navy-900); margin:8px 0 22px; font-variant-numeric:tabular-nums; }
.summary-amount small { font-size:13px; font-weight:600; color:var(--text-muted); }
.summary-line { display:flex; justify-content:space-between; gap:12px; padding:11px 0; border-bottom:1px solid var(--surface-3); font-size:12px; color:var(--text-muted); }
.summary-line strong { color:var(--navy-900); font-variant-numeric:tabular-nums; }
.summary-balance { border-bottom:0; padding-top:15px; color:var(--navy-900); font-weight:700; }
.summary-balance strong { color:var(--gold-600); font-size:15px; }
.payment-note { margin:15px 0; padding:11px 12px; border-radius:9px; background:var(--surface-2); color:var(--text-muted); font-size:11px; line-height:1.5; }
.vertical-actions { display:flex; flex-direction:column; margin-top:14px; }
.btn-large { width:100%; justify-content:center; padding:11px 16px; }
.payment-method-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:8px; }
.form-control { width:100%; box-sizing:border-box; }

@media (max-width: 900px) {
  .payment-create-layout { grid-template-columns:1fr; }
  .payment-summary-card { position:static; }
  .invoice-preview { grid-template-columns:repeat(2,1fr); }
  .invoice-preview > div { border-bottom:1px solid var(--gold-border); }
  .finance-grid { grid-template-columns:1fr; }
}
/* Phase 6.3 security forms */
.security-form input:not([type=checkbox]), .security-form select, .security-form textarea { font-family: inherit; }

/* Case change history */
.history-entry{border-top:1px solid #edf0f5;padding:14px 0}.history-entry:first-of-type{border-top:0}
.history-head{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:8px}.history-head .muted{font-size:12px}
.history-change{display:grid;grid-template-columns:170px 1fr;gap:10px;padding:6px 0}.history-label{font-size:12px;font-weight:600;color:var(--text-secondary)}
.history-diff{white-space:pre-wrap;word-break:break-word}
.ch-del{background:#fde8e8;color:#b42318;text-decoration:line-through;padding:0 2px;border-radius:3px}
.ch-ins{background:#e6f6ea;color:#067647;text-decoration:none;padding:0 2px;border-radius:3px}
.link-btn{background:none;border:0;padding:0;color:#b42318;cursor:pointer;font:inherit;font-size:11px}
@media(max-width:900px){.history-change{grid-template-columns:1fr}}
