/* =========================================================
   GLOBAL DESIGN TOKENS — LIGHT MODE
   ========================================================= */

:root {
  /* Brand Blues (4 shades) */
  --blue-1: #0057b8;               /* Primary */
  --blue-2: #00a3e0;               /* Accent */
  --blue-3: rgba(0,87,184,0.06);   /* Hover background */
  --blue-4: #4ea3ff;               /* Dark-mode primary */

  /* Neutral Greys (5 levels) */
  --grey-0: #ffffff;
  --grey-1: #f1f3f5;
  --grey-2: #e5e7eb;
  --grey-3: #6b7280;
  --grey-4: #333333;
  --grey-5: #1a1c1f;

  /* Core variables */
  --primary: var(--blue-1);
  --accent: var(--blue-2);
  --bg: #f8f9fa;
  --text: #222222;
  --muted: var(--grey-3);
  --card-bg: var(--grey-0);
  --border: var(--grey-2);

  /* Shadows */
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.04);

  /* Status colors */
  --good: #0a7f3f;
  --bad: #b00020;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  /* Additional spacing tokens */
  --space-tight: var(--space-1);
  --space-loose: var(--space-3);

  /* Modal backdrop */
  --modal-backdrop: rgba(17,24,39,0.55);

  /* Radii */
  --radius: 10px;
  --radius-sm: 6px;

  --max-width: 900px;
}

/* =========================================================
   RESET + BASE
   ========================================================= */

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding-top: 80px;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-2);
  font-weight: 700;
}

p {
  margin: 0 0 var(--space-2);
}

/* =========================================================
   HEADER / NAVBAR
   ========================================================= */

header {
  width: 100%;
  position: fixed;
  top: 0;
  background: var(--grey-0);
  left: 0;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.navbar {
  padding: var(--space-3) var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Logo Area */
.logo-group {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.logo {
  font-size: 1.7rem;
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}

.logo a {
  color: inherit;
  text-decoration: none;
}

.tagline {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
}

/* Navigation */
.nav-right {
  display: flex;
  align-items: center;
  gap: 96px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav-links a {
  position: relative;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-links a:hover {
  color: var(--primary);
  background: var(--blue-3);
}

.nav-links a.active {
  color: var(--primary);
  font-weight: 600;
}

.nav-links a.active::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* =========================================================
   ACCOUNT CONTROLS
   ========================================================= */

.account-controls {
  position: relative;
}

.account-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.account-icon:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,87,184,0.15);
}

.account-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Profile Dropdown */
.account-menu {
  position: absolute;
  top: 48px;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  min-width: 160px;
  padding: 6px 0;
  display: none;
  z-index: 999;
  list-style: none;
}

.account-menu.show {
  display: flex;
  flex-direction: column;
}

.account-menu .section-title {
  padding: 8px 14px 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.menu-btn {
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.menu-btn:hover {
  background: rgba(0,0,0,0.04);
}

.logout .menu-btn {
  color: var(--bad);
  font-weight: 600;
}

.logout .menu-btn:hover {
  background: rgba(176,0,32,0.1);
}

/* =========================================================
   MAIN CONTENT WRAPPER
   ========================================================= */

.main {
  max-width: var(--max-width);
  margin: var(--space-5) auto;
  background: var(--card-bg);
  padding: var(--space-5);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* =========================================================
   FOOTER
   ========================================================= */

footer {
  background: var(--grey-1);
  margin-top: var(--space-6);
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.footer-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: var(--space-5);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

.footer-column h4 {
  font-size: 1.1rem;
  margin-bottom: var(--space-3);
  color: var(--primary);

}

.footer-column a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-column a:hover {
  color: var(--accent);
}

.footer-bottom {
  background: var(--grey-0);
  text-align: center;
  padding: var(--space-4);
  border-top: 1px solid var(--border);
  color: #555;
}

/* =========================================================
   UTILITIES
   ========================================================= */

.subtle { color: var(--muted); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.grid { display: grid; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  background: var(--grey-0);
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 2.25rem;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn:hover { background: var(--grey-1); }
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.btn--primary:hover { filter: brightness(0.95); }

.btn--link {
  background: transparent;
  border: none;
  color: var(--primary);
}

.btn--danger {
  background: var(--bad);
  border-color: var(--bad);
  color: white;
}

/* =========================================================
   CARDS
   ========================================================= */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* =========================================================
   TABLES
   ========================================================= */

.table-wrap { overflow-x: auto; }

.txn-table {
  width: 100%;
  border-collapse: collapse;
}

.txn-table th,
.txn-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--grey-1);
  white-space: nowrap;
}

.txn-table thead th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
}

.txn-table tbody tr:hover {
  background: #fafafa;
}

.num { text-align: right; }

/* =========================================================
   INPUTS
   ========================================================= */

input, select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--grey-0);
  color: var(--gray-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,163,224,0.15);
  outline: none;
}

/* =========================================================
   MODAL
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  backdrop-filter: blur(3px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 1rem;
  width: 100%;
  max-width: 540px;
  padding: 1.8rem 2rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.modal-content h2 {
  margin-bottom: var(--space-3);
  font-size: 1.3rem;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.txn-form { display: flex; flex-direction: column; gap: 1rem; }

.form-row { display: flex; gap: 1rem; }

.form-row label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: 0.9rem;
  color: var(--muted);
}

.form-row input {
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,1px,1px);
  white-space: nowrap;
}

/* =========================================================
   DARK MODE (single, consolidated block)
   ========================================================= */

:root[data-theme="dark"] {
  --primary: var(--blue-4);
  --accent: #66c7ff;

  --bg: #1c1f23;
  --text: #e6e6e6;
  --muted: #9ba3af;

  --card-bg: #2a2e33;
  --border: #3a3f46;

  --shadow-sm: 0 2px 6px rgba(0,0,0,0.4);

  --good: #1dbf68;
  --bad: #ff6b6b;
}

:root[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text);
}

:root[data-theme="dark"] header {
  background: #23272b;
}

:root[data-theme="dark"] .nav-links a {
  color: var(--text);
}

:root[data-theme="dark"] .nav-links a:hover {
  background: rgba(78,163,255,0.12);
  color: var(--primary);
}

:root[data-theme="dark"] .main,
:root[data-theme="dark"] .card {
  background: var(--card-bg);
  color: var(--text);
}

:root[data-theme="dark"] .txn-table tbody tr:hover {
  background: rgba(255,255,255,0.04);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: #202327;
}

:root[data-theme="dark"] .btn {
  background: #2f3338;
  color: #ffffff;
}

:root[data-theme="dark"] .btn:hover {
  background: #3a3f46;
}

:root[data-theme="dark"] .btn--primary {
  background: var(--primary);
  color: white;
}

:root[data-theme="dark"] .btn--danger {
  background: var(--bad);
  border-color: var(--bad);
  color: white;
}

:root[data-theme="dark"] .footer-bottom,
:root[data-theme="dark"] footer {
  background: #23272b;
  border-color: var(--border);
  color: var(--muted);
}

