/* ─── Soho House England aesthetic ───
 * Cream backgrounds, deep forest-green accent, refined serif headings,
 * warm slate body text, generous whitespace. Mobile-first.
 */

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

:root {
  --bg: #f5efe4;            /* warm ivory */
  --bg-alt: #efe7d6;         /* slightly darker cream for stripes */
  --surface: #fbf7ee;        /* parchment for cards */
  --border: #d9cfb9;         /* soft warm grey */
  --border-faint: #e8dec9;
  --text: #2a2520;           /* warm near-black */
  --text-muted: #6b5f51;     /* muted bronze */
  --text-faint: #9f8e75;     /* warm faint */
  --accent: #2d4a30;         /* British racing green */
  --accent-hover: #20381f;
  --accent-bg: #e6e0c7;      /* dusty olive */
  --accent-fg: #93a08e;      /* soft sage */
  --gold: #a07c2a;           /* aged brass */
  --positive: #4a7c2a;       /* moss */
  --negative: #8b2a2a;       /* oxblood */
  --warning: #a85a1f;        /* burnished orange */
  --warning-bg: #f1e6d4;
  --row-alt: #f1ead9;
  --radius: 4px;
  --radius-lg: 6px;
  --shadow-sm: 0 1px 0 rgba(42, 37, 32, 0.04);
  --shadow: 0 8px 24px rgba(42, 37, 32, 0.08);
  --serif: "Cormorant Garamond", "Garamond", "Georgia", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.15s; }
a:hover { border-bottom-color: var(--accent); }

/* ─── Layout: shell + nav ─── */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.5px;
}
.topbar-title a { color: var(--text); border: none; }
.topbar-title a:hover { border: none; }

.menu-toggle {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text);
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  display: none;
}

.sidebar.open { display: block; position: fixed; inset: 56px 0 0 0; z-index: 9; padding-top: 16px; }

.sidebar-brand {
  display: none;
  padding: 0 24px 24px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

@media (min-width: 900px) { .sidebar-brand { display: block; } }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }

.sidebar a {
  padding: 12px 16px;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  letter-spacing: 0.3px;
  border: none;
}

.sidebar a:hover { background: var(--accent-bg); border: none; }
.sidebar a.active { background: var(--accent); color: var(--bg); }
.sidebar a .icon { width: 18px; text-align: center; opacity: 0.7; font-size: 14px; }
.sidebar a.active .icon { opacity: 1; }
.sidebar a.sidebar-child { padding-left: 36px; font-size: 13px; font-weight: 400; }
.sidebar a.sidebar-child .icon { font-size: 12px; opacity: 0.5; }
.sidebar a.sidebar-header { font-weight: 500; }
.sidebar .sidebar-caret { margin-left: auto; font-size: 11px; opacity: 0.5; }

.sidebar-logout {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-left: 12px;
  margin-right: 12px;
}
.sidebar-logout a { padding-left: 16px; }

main {
  padding: 24px 20px 60px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 240px 1fr;
    grid-template-rows: 1fr;
  }
  .topbar { display: none; }
  .sidebar { display: block; position: sticky; top: 0; align-self: start; height: 100vh; }
  main { padding: 48px 56px 80px; }
}

/* ─── Typography ─── */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.3px;
  margin: 0 0 16px 0;
  color: var(--text);
}
h1 { font-size: 36px; line-height: 1.1; margin-bottom: 4px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }

.section-eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold);
  margin-bottom: 6px;
  font-weight: 600;
}

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.serif { font-family: var(--serif); }

/* ─── Tiles ─── */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0 28px;
}

@media (min-width: 600px) {
  .tile-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
}

.tile.accent { border-left: 3px solid var(--accent); }
.tile.positive { border-left: 3px solid var(--positive); }
.tile.warning  { border-left: 3px solid var(--warning); }
.tile.danger   { border-left: 3px solid var(--negative); }
.tile.gold     { border-left: 3px solid var(--gold); }

.tile .label {
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
}

.tile .value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  margin-top: 6px;
  word-break: break-word;
  line-height: 1.1;
}

.tile .sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.card-header h2, .card-header h3 { margin: 0; }

/* ─── Buttons ─── */
.btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  transition: background 0.15s;
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: var(--text-faint); cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-secondary:hover { background: var(--accent-bg); }
.btn-danger { background: var(--negative); }
.btn-danger:hover { background: #6e2020; }
.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn-block { display: block; width: 100%; }

/* ─── Forms ─── */
.input, .select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--sans);
  background: #fffefa;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, .select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 74, 48, 0.12);
}

.label-row {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.field { margin-bottom: 16px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }

/* ─── Tables ─── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -22px; padding: 0 22px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-weight: 600;
  padding: 12px 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border-faint);
  vertical-align: top;
}

tr:hover td { background: var(--row-alt); }

.amount-pos { color: var(--positive); font-variant-numeric: tabular-nums; }
.amount-neg { color: var(--negative); font-variant-numeric: tabular-nums; }
.amount     { font-variant-numeric: tabular-nums; font-family: var(--sans); }

/* ─── Chips & status ─── */
.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.chip-warning  { background: var(--warning-bg); color: var(--warning); }
.chip-positive { background: #e3eed5; color: var(--positive); }
.chip-danger   { background: #f3dada; color: var(--negative); }

.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--serif);
  font-size: 17px;
}

.error {
  padding: 12px 16px;
  background: #f3dada;
  border-left: 3px solid var(--negative);
  border-radius: var(--radius);
  color: var(--negative);
  font-size: 14px;
  margin-bottom: 16px;
}

.success {
  padding: 12px 16px;
  background: #e3eed5;
  border-left: 3px solid var(--positive);
  border-radius: var(--radius);
  color: var(--positive);
  font-size: 14px;
  margin-bottom: 16px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Login ─── */
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(ellipse at top, rgba(45, 74, 48, 0.06), transparent 60%),
    var(--bg);
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 44px 32px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-faint);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 24px;
  margin-bottom: 16px;
  letter-spacing: 1px;
}
.login-logo h1 { margin: 0; font-size: 28px; }
.login-logo .tag {
  margin-top: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  font-weight: 600;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-faint);
  margin: 24px 0;
}

.kbd {
  background: var(--bg-alt);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.demo-banner {
  background: var(--gold);
  color: var(--bg);
  padding: 8px 16px;
  font-size: 13px;
  text-align: center;
  letter-spacing: 0.4px;
}
.demo-banner strong { font-weight: 600; margin-right: 6px; }
.demo-banner a { color: var(--bg); text-decoration: underline; margin-left: 12px; border: none; }
.demo-banner a:hover { border: none; }
