@import url('https://fonts.googleapis.com/css2?family=Karla:wght@400;500;700&display=swap');

/* =========================================================
   Admin theme — dark, matching the Sales entry page.
   Every page uses these shared tokens; change a color here
   and it changes site-wide.
   ========================================================= */
:root {
  /* brand */
  --barnwood: #3d2b1f;
  --pumpkin: #c1541c;
  --pumpkin-dark: #9c3f14;
  --amber: #d9822b;
  --danger: #a3341e;          /* button backgrounds */

  /* surfaces */
  --bg: #121212;              /* page */
  --surface: #1c1c1c;         /* cards, forms, tables */
  --surface-2: #2a2a2a;       /* inputs, table headers, totals */
  --surface-3: #3a3a3a;       /* dividers, raised boxes */
  --line: #333;               /* borders */
  --line-field: #444;         /* input borders */

  /* text */
  --text: #f0f0f0;
  --text-strong: #ffffff;
  --text-soft: #cfcfcf;
  --muted: #a8a8a8;
  --link: #ffb066;

  /* status text (readable on dark) */
  --danger-text: #ff8a75;
  --success-text: #7bd88f;

  /* accent stripes on stat cards */
  --stripe-sales: #8a9a3b;
  --stripe-expense: #d9573f;

  color-scheme: dark;         /* dark date pickers, dropdowns, scrollbars */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Karla", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---- Header / nav ---- */
.admin-header {
  background: var(--barnwood);
  color: #f4efe2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.5rem;
  border-bottom: 3px solid var(--pumpkin);
}

.admin-header a { color: #f4efe2; text-decoration: none; }

.admin-nav { display: flex; gap: 1.5rem; align-items: center; }
.admin-nav a { font-weight: 500; padding-bottom: 3px; border-bottom: 2px solid transparent; }
.admin-nav a.active, .admin-nav a:hover { border-color: #d9a441; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

/* ---- Page layout & type ---- */
.admin-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  background: var(--bg);
}

h1 { font-size: 1.6rem; margin-top: 0; }
h1, h2, h3 { color: var(--text-strong); }
p { color: var(--text-soft); }
.muted { color: var(--muted); }

.admin-wrap a:not(.btn), .login-wrap a:not(.btn) { color: var(--link); }

.page-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem 1rem;
}
.header-total {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
}

/* ---- Stat cards (Dashboard, Reports) ---- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--stripe-sales);
  padding: 1.1rem 1.3rem;
}

.stat-card .label { font-size: 0.85rem; color: var(--muted); }
.stat-card .value { font-size: 1.5rem; font-weight: 700; margin-top: 0.2rem; color: var(--text-strong); }
.stat-card.expense { border-left-color: var(--stripe-expense); }
.stat-card.net { border-left-color: var(--pumpkin); }

/* ---- Forms ---- */
input, select, textarea {
  background: var(--surface-2);
  color: var(--text-strong);
  border: 1px solid var(--line-field);
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: #8a8a8a; }

form.entry-form {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.5rem;
  max-width: 480px;
  margin-bottom: 2.5rem;
  display: grid;
  gap: 0.9rem;
}

form.entry-form label { font-weight: 700; font-size: 0.95rem; display: block; margin-bottom: 0.3rem; color: var(--text-strong); }
form.entry-form input, form.entry-form select, form.entry-form textarea {
  width: 100%; padding: 0.7rem 0.7rem; font-size: 16px;
}
form.entry-form > div { min-width: 0; }
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
}

/* Label-left / input-right rows: Date, Cash In Drawer, Credit cards, Checks */
.field-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.field-row label {
  flex: 0 0 100px;
  margin-bottom: 0;
}
.field-row input { flex: 1; text-align: center; }

/* Small inline input inside a table cell (Users page email box) */
.inline-input { padding: 0.35rem 0.5rem; font-size: 0.92rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-block; background: var(--pumpkin); color: #fff; border: none;
  padding: 0.85rem 1.3rem; font-weight: 700; cursor: pointer; text-decoration: none; font-size: 1rem;
  text-align: center;
}
.btn:hover { background: var(--pumpkin-dark); }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn-danger { background: var(--danger); }
.btn-secondary { background: #4a4a4a; }
.btn-secondary:hover { background: #5a5a5a; }
.btn-block { display: block; width: 100%; }

/* ---- Sales wizard ---- */
.wizard-actions { display: flex; gap: 0.7rem; margin-top: 0.4rem; }
.wizard-actions .btn { flex: 1; }

.review-card {
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--pumpkin);
  padding: 1.3rem; max-width: 480px; margin-bottom: 2.5rem;
}
.review-card h2 { margin-top: 0; margin-bottom: 0.5rem; font-size: 1.2rem; }
.review-section { margin-bottom: 1.1rem; }
.review-section h3 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); margin: 0 0 0.5rem;
}
.review-row {
  display: flex; justify-content: space-between; padding: 0.35rem 0;
  border-bottom: 1px dashed var(--surface-3); font-size: 0.98rem;
}
.review-row:last-child { border-bottom: none; }
.review-row .rv-label { color: var(--text-strong); }
.review-row .rv-value { font-weight: 700; color: var(--text-strong); }
.review-total {
  display: flex; justify-content: space-between; align-items: baseline;
  background: var(--surface-2); color: var(--text-strong); padding: 0.9rem 1rem; margin-top: 0.8rem;
  font-size: 1.1rem;
}
.review-total .rv-value { font-size: 1.5rem; color: var(--amber); }

.highlight-box {
  background: var(--surface-3);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin: 0.2rem 0;
}
.highlight-box label { text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.03em; }
.highlight-box input { background: var(--surface-2); }

/* Step indicator (no longer shown, kept in case it's reused) */
.wizard-steps {
  display: flex;
  gap: 0.4rem;
  max-width: 480px;
  margin-bottom: 1.3rem;
  overflow-x: auto;
}
.wstep {
  flex: 1;
  min-width: 90px;
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.5rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.wstep span {
  display: block;
  width: 22px; height: 22px; line-height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-strong);
  margin: 0 auto 0.3rem;
  font-size: 0.8rem;
}
.wstep.current { border-color: var(--pumpkin); color: #ffffff; }
.wstep.current span { background: var(--pumpkin); color: #fff; }

/* Duplicate-day warning */
.dup-warning {
  max-width: 480px;
  background: #2a2110;
  border: 1px solid #6b4a1a;
  border-left: 4px solid var(--amber);
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
  color: #f0d9a8;
}
.dup-warning a { color: var(--link); font-weight: 700; }

/* Cash-drawer expense line items (Sales step 3) */
.expense-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0; border-bottom: 1px dashed var(--surface-3); font-size: 0.92rem;
  color: var(--text);
}
.expense-item:last-of-type { border-bottom: none; }
.expense-item-right { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; }

/* ---- Tables ---- */
table.data-table { width: 100%; border-collapse: collapse; background: var(--surface); color: var(--text); }
table.data-table th, table.data-table td {
  text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); font-size: 0.92rem;
}
table.data-table th { background: var(--surface-2); color: var(--text-strong); }
table.data-table tr:nth-child(even) { background: #222; }

details summary { color: var(--text-strong); }

/* Wide tables scroll sideways inside their own box instead of stretching the page */
.table-scroll { overflow-x: auto; }

/* ---- Filter bar (Reports) ---- */
.filter-bar {
  display: flex; gap: 0.8rem; align-items: end; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.filter-bar label { font-size: 0.85rem; font-weight: 700; display: block; margin-bottom: 0.3rem; color: var(--text-strong); }
.filter-bar input { padding: 0.5rem 0.6rem; }

/* ---- Bill counters ---- */
.bill-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}
.bill-input {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.bill-input label {
  flex: 0 0 100px;
  font-weight: 700; font-size: 0.9rem; color: var(--text-strong); margin-bottom: 0;
}
.bill-input input { flex: 1; text-align: center; }

.cash-summary {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.8rem 1rem;
  display: grid;
  gap: 0.3rem;
  font-size: 0.95rem;
}

/* ---- Status text ---- */
.negative { color: var(--danger-text); font-weight: 700; }
.error-msg { color: var(--danger-text); font-size: 0.9rem; margin-bottom: 1rem; }
.success-msg { color: var(--success-text); font-size: 0.9rem; margin-bottom: 1rem; }

/* ---- Login / password-reset cards ---- */
.login-wrap {
  max-width: 360px; margin: 4rem auto; background: var(--surface); padding: 2rem;
  border: 1px solid var(--line); border-top: 4px solid var(--pumpkin);
}
.login-wrap h1 { font-size: 1.3rem; }
.login-wrap label { display: block; font-weight: 700; margin-bottom: 0.3rem; color: var(--text-strong); }
.login-wrap input:not([type="hidden"]) {
  width: 100%; padding: 0.7rem; margin-bottom: 1.1rem; font-size: 16px;
}

/* ---- Compare Seasons ---- */
.season-form { margin-bottom: 1rem; }
.season-form label { display: block; font-weight: 700; margin-bottom: 0.25rem; color: var(--text-strong); }
.season-form select { width: 100%; padding: 0.6rem; font-size: 1rem; }

.pace-banner {
  border-radius: 10px; padding: 1rem; margin-bottom: 1rem; text-align: center;
  border: 1px solid var(--line); background: var(--surface);
}
.pace-banner .pace-main { font-size: 1.9rem; font-weight: 800; line-height: 1.2; }
.pace-banner .pace-sub { font-size: 0.95rem; font-weight: 600; margin-top: 0.15rem; }
.pace-banner.ahead { border-color: #2f6b3f; background: #14261a; color: var(--success-text); }
.pace-banner.behind { border-color: #7a3325; background: #2a1511; color: var(--danger-text); }
.pace-banner.none { color: var(--muted); font-weight: 600; }

.season-stats { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.season-stat {
  flex: 1; min-width: 140px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.75rem;
}
.season-stat .label { font-size: 0.8rem; color: var(--muted); }
.season-stat .value { font-size: 1.4rem; font-weight: 700; color: var(--text-strong); }

.chart-box { position: relative; width: 100%; height: 300px; }

.debug-box {
  background: var(--surface); border: 1px solid var(--amber); border-radius: 8px;
  padding: 0.75rem; margin: 1rem 0; font-family: monospace; font-size: 0.85rem; color: var(--text);
}

/* =========================================================
   Responsive — keep these last so they override the above
   ========================================================= */
@media (max-width: 480px) {
  .admin-wrap { padding: 1.2rem 1rem 3rem; }
  form.entry-form, .review-card { padding: 1.1rem; max-width: 100%; }
}

/* Mobile app shell: hamburger menu */
@media (max-width: 640px) {
  .admin-header { padding: 0.8rem 1rem; position: relative; }
  .expenses-table th:nth-child(3), .expenses-table td:nth-child(3),
  .expenses-table th:nth-child(5), .expenses-table td:nth-child(5),
  .expenses-table th:nth-child(6), .expenses-table td:nth-child(6) {
    display: none;
  }
  .nav-toggle { display: block; }

  .admin-nav {
    display: none;
    position: absolute;
    top: 100%; right: 1rem;
    background: var(--barnwood);
    border: 1px solid #3a3a3a;
    flex-direction: column;
    min-width: 160px;
    z-index: 50;
  }
  .admin-nav.open { display: flex; }
  .admin-nav a {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .admin-nav a:last-child { border-bottom: none; }

  .stat-row { grid-template-columns: 1fr 1fr; }
  table.data-table th, table.data-table td { font-size: 0.85rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
}
/* Locked date on the Sales form, and the "past days unlocked" notice */
.locked-date {
  flex: 1; text-align: center; font-weight: 700; color: var(--text-strong);
  background: var(--surface-2); border: 1px solid var(--line-field); padding: 0.6rem 0.8rem;
}
.unlock-banner {
  max-width: 480px; background: #14241a; border: 1px solid #2f5a3a;
  border-left: 4px solid var(--success-text); padding: 0.8rem 1rem;
  margin-bottom: 1rem; font-size: 0.92rem; color: #cfeed6;
}
.unlock-banner a { color: var(--link); font-weight: 700; }
