/* ────────────────────────────────────────────────────────────
   Dhanam Wealth — shared styles
   Light theme: white background + dark text + Dhanam gold accents.
   Variable names are kept (--navy, --card, etc.) for back-compat with
   inline styles across page files; values reinterpreted as light tokens.
──────────────────────────────────────────────────────────── */

:root {
  /* Backgrounds (variable names kept for compat — actual colors are light) */
  --navy:    #f5f7fa;          /* page background — soft off-white */
  --navy2:   #ffffff;          /* secondary panel / dropdown surface */
  --navy3:   #eceff5;          /* tertiary band — secondary buttons, table stripes */

  /* Brand gold — three shades for use on a light background */
  --gold:    #C9A227;          /* primary brand — used for button/badge fills */
  --gold2:   #8a6810;          /* darker — readable on white for body links */
  --gold3:   #6b520a;          /* darkest — headings / important small text */

  /* Text */
  --text:    #1a2540;          /* primary — body copy, table cells */
  --muted:   #6b7591;          /* secondary — labels, hints, subtle copy */

  /* Surfaces & borders */
  --border:  #e3e6ee;          /* card / divider border */
  --card:    #ffffff;          /* card surface */
  --card2:   #f7f8fa;          /* card alt header band */

  /* Status accents (kept similar but tuned for legibility on white) */
  --danger:  #d04545;
  --success: #2ea869;
  --info:    #2563eb;
  --purple:  #7c5cff;
}

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

body {
  background: var(--navy);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  min-height: 100vh;
}

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

/* ─── Layout shell ──────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, #ffffff 0%, #f7f8fa 100%);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-brand { display: flex; align-items: center; gap: 12px; }
.app-logo {
  width: 38px; height: 38px;
  background: var(--gold);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #1a2540;
}
.app-logo-img {
  height: 48px;
  width: auto;
  display: block;
}
.app-brand-text {
  padding-left: 14px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}
.app-title { font-size: 13px; font-weight: 700; color: var(--gold3); letter-spacing: 0.3px; }
.app-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.app-user {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px;
}
.app-user .role-badge {
  background: var(--gold);
  color: #1a2540;
  padding: 3px 9px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
}

/* ─── Persistent navigation — VERTICAL SIDEBAR (desktop) ─── */
/* On wide viewports, .app-nav is a fixed-position left sidebar starting
   below the sticky .app-header. On mobile (<= 768px) it collapses back to
   a horizontal scrollable bar so narrow screens stay usable. */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-nav {
  position: fixed;
  top: 70px;          /* sits below the sticky header (header ~70px tall) */
  left: 0;
  bottom: 0;
  width: 220px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  z-index: 5;
}
.app-nav::-webkit-scrollbar { width: 4px; }
.app-nav::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 2px; }

.app-nav-item {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border-left: 3px solid transparent;
  transition: color 120ms, border-color 120ms, background 120ms;
  white-space: nowrap;
}
.app-nav-item:hover {
  color: var(--gold2);
  background: rgba(201,162,39,0.07);
  text-decoration: none;
}
.app-nav-item.active {
  color: var(--gold3);
  border-left-color: var(--gold);
  background: rgba(201,162,39,0.10);
}

/* Push the main content to the right of the sidebar. The header keeps its
   full width and sits above both. Targets the .main wrapper used by every
   logged-in page. */
body.has-side-nav .main,
body.has-side-nav > main {
  margin-left: 220px;
}

@media (max-width: 768px) {
  /* Mobile fallback: sidebar reverts to horizontal scrollable bar */
  body.has-side-nav .main,
  body.has-side-nav > main {
    margin-left: 0;
  }
  .app-nav {
    position: static;
    top: auto;
    bottom: auto;
    left: auto;
    width: auto;
    flex-direction: row;
    align-items: stretch;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 12px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .app-nav::-webkit-scrollbar { height: 4px; width: auto; }
  .app-nav-item {
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 10px 12px;
    font-size: 11px;
  }
  .app-nav-item.active {
    border-left: none;
    border-bottom-color: var(--gold);
  }
}

/* ─── Centred auth card (login page) ────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(201,162,39,0.10), transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(37,99,235,0.06), transparent 60%),
    var(--navy);
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 32px;
  width: 380px;
  max-width: 100%;
  box-shadow: 0 8px 28px rgba(26,37,64,0.08);
}
.auth-logo {
  width: 56px; height: 56px;
  background: var(--gold);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #1a2540;
  font-weight: 800;
  font-size: 24px;
  margin: 0 auto 18px;
}
.auth-logo-img {
  display: block;
  width: 200px;
  height: auto;
  max-width: 80%;
  margin: 0 auto 14px;
}
.auth-title {
  text-align: center;
  color: var(--gold3);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.auth-sub {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
  margin-bottom: 26px;
}

/* ─── Forms ──────────────────────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 5px;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,0.18);
}
.form-row input:disabled,
.form-row select:disabled,
.form-row textarea:disabled {
  background: var(--card2);
  color: var(--muted);
  cursor: not-allowed;
}

.btn {
  background: var(--gold);
  color: #1a2540;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 120ms, box-shadow 120ms;
}
.btn:hover { background: var(--gold2); }
.btn.secondary {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.secondary:hover { border-color: var(--gold); color: var(--gold2); background: var(--card2); }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg {
  background: rgba(208,69,69,0.08);
  border: 1px solid rgba(208,69,69,0.30);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 14px;
}
.success-msg {
  background: rgba(46,168,105,0.08);
  border: 1px solid rgba(46,168,105,0.30);
  color: var(--success);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 14px;
}

/* ─── Generic card ──────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(26,37,64,0.04);
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold3);
  margin-bottom: 12px;
}

.muted { color: var(--muted); }
.hint  { font-size: 10px; color: var(--muted); margin-top: 4px; }
