/*
 * App-wide theme. FA3S brand colors (23 Aug 2026 rebrand) — navy/orange/
 * teal, lifted from the user's fa3s_logo.svg fill colors, replacing the
 * original placeholder green. Token names are unchanged from before the
 * rebrand (--accent/--accent-deep/--accent-soft/--ink/--line/etc.) so no
 * Blade view needed touching — every view already styles through these
 * variables, never a hardcoded hex, which is what made this a
 * tokens-only change. Two token groups are new: --action/--action-deep/
 * --action-soft (orange — primary buttons, the "do something" color) and
 * --success/--success-deep/--success-soft (teal — a genuinely separate
 * semantic "good" color, not just a re-use of --accent, per the standard
 * "semantic color is separate from brand accent" rule: --accent is navy,
 * the *structural* brand color, not the app's success color).
 *
 * public/css/auth.css (the login page) shares this same token set — it's
 * loaded after this file on guest.blade.php and only adds login-page-
 * specific layout, not its own palette, so the two pages can't drift out
 * of sync again.
 */
:root {
  --paper: #eef2f7;
  --card: #ffffff;
  --ink: #0f2438;
  --ink-soft: #5b6b7f;
  --line: #dde4ee;

  --accent: #0b3a5e;        /* navy — brand structural color: sidebar, links, headers */
  --accent-deep: #082b47;   /* deep navy — sidebar gradient end, hover/darken */
  --accent-soft: #e1e8f1;   /* soft navy tint — table headers, debit pills, hovers */

  --action: #e8792c;        /* orange — primary buttons, the "do something" color */
  --action-deep: #c9631e;   /* orange hover/active */
  --action-soft: #fdeadb;   /* soft orange tint */

  --success: #17a2a0;       /* teal — a real semantic "good" color, distinct from --accent */
  --success-deep: #128582;
  --success-soft: #dff3f2;

  --danger: #b23a2e;
  --danger-soft: #fbe9e6;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Poppins', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

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

.tabular { font-variant-numeric: tabular-nums; font-family: var(--mono); }

.app-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(165deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #eaf1f8;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.sidebar .brand { display: flex; align-items: center; gap: 0.6rem; }
.sidebar .brand img { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
.sidebar .brand .brand-text { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.02em; line-height: 1.15; }
.sidebar .brand small { display: block; font-weight: 400; opacity: 0.65; font-size: 0.72rem; margin-top: 1px; letter-spacing: 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.15rem; }
.sidebar nav a { display: flex; align-items: center; gap: 0.6rem; color: #d9e6f2; padding: 0.4rem 0.6rem; border-radius: 6px; font-size: 0.9rem; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.sidebar nav a.active { background: rgba(232, 121, 44, 0.18); border-left-color: var(--action); color: #fff; text-decoration: none; }

.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Collapsible group headings — click to slide the sub-items open/closed.
   The 0fr/1fr grid-template-rows trick animates to "auto" height without
   JS measuring anything; JS (public/js/nav.js) only ever toggles the
   `.open` class + persists the choice, never touches inline styles. */
.nav-group { display: flex; flex-direction: column; margin-top: 0.6rem; }
.nav-group-toggle {
  all: unset;
  box-sizing: border-box;
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; padding: 0.4rem 0.6rem; border-radius: 6px;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: #d9e6f2; opacity: 0.7; cursor: pointer;
}
.nav-group-toggle:hover { background: rgba(255, 255, 255, 0.06); opacity: 1; }
.nav-group-toggle .chevron { width: 13px; height: 13px; margin-left: auto; flex-shrink: 0; transition: transform 0.18s ease; }
.nav-group:not(.open) .nav-group-toggle .chevron { transform: rotate(-90deg); }

.nav-group-items { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.22s ease; }
.nav-group.open .nav-group-items { grid-template-rows: 1fr; }
.nav-group-items-inner { overflow: hidden; display: flex; flex-direction: column; gap: 0.1rem; }
.nav-group-items-inner a { padding-left: 1.85rem; font-size: 0.87rem; }
.nav-group-items-inner a .nav-icon { width: 14px; height: 14px; }

main.content { padding: 1.75rem 2.25rem; max-width: 1180px; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; margin: 0; color: var(--accent); }
.page-head .sub { color: var(--ink-soft); font-size: 0.88rem; }

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--action); color: #fff; border: none;
  padding: 0.55rem 1rem; border-radius: 8px; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--action-deep); text-decoration: none; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.danger { background: var(--danger); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; }
.card + .card { margin-top: 1rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.15rem; }
.stat .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.stat .value { font-size: 1.4rem; font-weight: 700; margin-top: 0.2rem; }
.stat .value.credit { color: var(--danger); }
.stat .value.debit { color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-soft); background: var(--accent-soft); padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line);
}
tbody td { padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: #fbfcfe; }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap table { border: none; border-radius: 0; }
.table-wrap thead th:first-child, .table-wrap tbody td:first-child { padding-left: 1rem; }

.pill { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.pill.debit { background: var(--accent-soft); color: var(--accent); }
.pill.credit { background: var(--danger-soft); color: var(--danger); }
.pill.muted { background: #ececec; color: #666; }

form .field { margin-bottom: 1rem; }
form label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--ink-soft); }
form input[type=text], form input[type=date], form input[type=number], form select, form textarea {
  width: 100%; padding: 0.5rem 0.65rem; border: 1px solid var(--line); border-radius: 8px; font-size: 0.9rem;
  font-family: var(--font); background: #fff; color: var(--ink);
}
form input[type=text]:focus, form input[type=date]:focus, form input[type=number]:focus, form select:focus, form textarea:focus {
  outline: none; border-color: var(--action); box-shadow: 0 0 0 3px rgba(232, 121, 44, 0.15);
}
form textarea { min-height: 4.5rem; }
form .checkbox { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
form .checkbox input { width: auto; accent-color: var(--success); }
form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }

.entries-table input, .entries-table select { padding: 0.4rem 0.5rem; font-size: 0.85rem; }
.entries-table td { padding: 0.4rem; }
.entries-total { font-weight: 700; }
.entries-total.balanced { color: var(--success-deep); }
.entries-total.unbalanced { color: var(--danger); }

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert.success { background: var(--success-soft); color: var(--success-deep); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert ul { margin: 0.3rem 0 0 1.1rem; }

.badge-group { font-size: 0.75rem; color: var(--ink-soft); }

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; }
  .sidebar nav { flex-direction: row; }
}
