/* Tales Group — olive #3E4022, terracotta #A04A24, cream #FCEDD6 (taken from the
   logo artwork). Display type is a high-contrast serif to echo the wordmark;
   everything a person types into is plain sans, because forms are not branding. */
:root {
  --olive: #3e4022;
  --olive-700: #2c2e18;
  --terra: #a04a24;
  --terra-600: #8a3f1e;
  --cream: #fcedd6;
  --cream-200: #f6e4c9;
  --ink: #1d1e16;
  --muted: #7d7a68;
  --line: #e6dcc6;
  --paper: #fffdf8;
  --ok: #4b7a45;
  --warn: #b7791f;
  --bad: #a3342a;
  --serif: "Didot", "Bodoni MT", "Playfair Display", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --radius: 2px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--cream);
}

a { color: var(--terra); }

/* ---------------------------------------------------------------- shell --- */
.shell { display: flex; min-height: 100vh; }

.nav {
  width: 212px;
  flex: 0 0 212px;
  background: var(--olive);
  color: var(--cream);
  padding: 22px 0;
  display: flex;
  flex-direction: column;
}

.nav .brand {
  padding: 0 20px 22px;
  border-bottom: 1px solid rgba(252, 237, 214, 0.16);
  margin-bottom: 14px;
}
.nav .brand img { width: 120px; filter: invert(1) brightness(1.6); }

.nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 20px;
  color: rgba(252, 237, 214, 0.78);
  text-decoration: none;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  border-left: 2px solid transparent;
}
.nav a:hover { color: var(--cream); background: rgba(252, 237, 214, 0.06); }
.nav a.on {
  color: var(--cream);
  border-left-color: var(--terra);
  background: rgba(160, 74, 36, 0.22);
}
.nav .count {
  background: var(--terra);
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
}
.nav .spacer { flex: 1; }
.nav .foot { padding: 0 20px; font-size: 11.5px; color: rgba(252, 237, 214, 0.5); }
.nav .foot a { color: rgba(252, 237, 214, 0.5); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 24px;
  margin: 0;
  letter-spacing: 0.01em;
}
.topbar .grow { flex: 1; }

.body { padding: 24px 28px 60px; }

/* ---------------------------------------------------------------- bits ---- */
.btn {
  border: 1px solid var(--olive);
  background: var(--olive);
  color: var(--cream);
  padding: 8px 15px;
  font-size: 13px;
  font-family: var(--sans);
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  cursor: pointer;
}
.btn:hover { background: var(--olive-700); }
.btn.ghost { background: transparent; color: var(--olive); }
.btn.ghost:hover { background: rgba(62, 64, 34, 0.08); }
.btn.terra { background: var(--terra); border-color: var(--terra); color: #fff; }
.btn.terra:hover { background: var(--terra-600); }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

input, select, textarea {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 9px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(160, 74, 36, 0.35); }
textarea { min-height: 72px; resize: vertical; }
label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 17px;
  margin: 0 0 14px;
}
.card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }

.kpi { background: var(--paper); border: 1px solid var(--line); padding: 16px 18px; }
.kpi .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.kpi .value { font-family: var(--serif); font-size: 27px; margin-top: 6px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.alert .value { color: var(--bad); }

table { width: 100%; border-collapse: collapse; background: var(--paper); }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.row:hover td { background: var(--cream-200); cursor: pointer; }
td.num, th.num { text-align: right; white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

.tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.tag.draft { background: #efe9dc; color: #6b6553; }
.tag.scheduled { background: #e4ecf3; color: #3c5a72; }
.tag.sent, .tag.viewed { background: #e7f0e4; color: var(--ok); }
.tag.part_paid { background: #fbf0d8; color: var(--warn); }
.tag.paid { background: var(--ok); color: #fff; }
.tag.overdue { background: var(--bad); color: #fff; }
.tag.void, .tag.declined { background: #ece9e4; color: #8a8378; text-decoration: line-through; }
.tag.accepted { background: var(--ok); color: #fff; }
.tag.active { background: #e7f0e4; color: var(--ok); }
.tag.paused { background: #fbf0d8; color: var(--warn); }
.tag.ended { background: #ece9e4; color: #8a8378; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.muted { color: var(--muted); }
/* Terracotta, not red: this is the brand's own alarm colour. */
.warn { color: var(--terra); background: #fdf1e7; border-left: 3px solid var(--terra);
        padding: 9px 12px; margin: 0 0 14px; font-size: 13px; line-height: 1.45; }
.empty { padding: 42px; text-align: center; color: var(--muted); background: var(--paper); border: 1px dashed var(--line); }

/* bars for the 12-month chart; a chart library for twelve numbers is not worth it */
.bars { display: flex; align-items: flex-end; gap: 7px; height: 120px; }
.bars .bar { flex: 1; background: var(--terra); opacity: 0.85; min-height: 2px; position: relative; }
.bars .bar:hover { opacity: 1; }
.bars-x { display: flex; gap: 7px; margin-top: 6px; }
.bars-x span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }

/* line editor */
.lines th { background: var(--cream-200); }
.lines td { padding: 6px 7px; }
.lines input, .lines select { padding: 5px 7px; font-size: 13px; }
.lines .w-qty { width: 72px; }
.lines .w-price { width: 110px; }
.lines .w-pct { width: 64px; }
.totals { margin-left: auto; width: 290px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { border-top: 1px solid var(--olive); margin-top: 6px; padding-top: 9px; font-family: var(--serif); font-size: 19px; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(29, 30, 22, 0.42); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw);
  background: var(--paper); border-left: 1px solid var(--line); z-index: 41;
  display: flex; flex-direction: column;
}
.drawer header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer header h2 { font-family: var(--serif); font-weight: 400; font-size: 19px; margin: 0; flex: 1; }
.drawer .inner { padding: 20px 22px; overflow: auto; flex: 1; }
.drawer footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--olive); color: var(--cream); padding: 11px 20px;
  border-radius: var(--radius); z-index: 60; font-size: 13.5px; max-width: 70vw;
}
.toast.bad { background: var(--bad); color: #fff; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--cream); }
.login-box { background: var(--paper); border: 1px solid var(--line); padding: 38px 34px; width: 340px; text-align: center; }
.login-box img { width: 150px; margin-bottom: 26px; }
.login-box .field { text-align: left; }
.login-box .btn { width: 100%; margin-top: 6px; }
.login-err { color: var(--bad); font-size: 13px; margin-top: 12px; min-height: 18px; }
