/* Tyn Studio — finance. Calm minimalism: off-white ground, hairline rules,
   Gelasio for identity moments, Arimo for working text and numbers. */

@font-face {
  font-family: "Arimo";
  src: url("../fonts/arimo.d116de091179.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Arimo";
  src: url("../fonts/arimo-italic.045156402351.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Gelasio";
  src: url("../fonts/gelasio.3aefdd71198b.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f8f6f3;
  --surface: #fffefb;
  --ink: #1c1b18;
  --muted: #8a857c;
  --faint: #b3ada2;
  --line: #e6e1d7;
  --line-strong: #cfc8ba;
  --blue: #1f3b70;
  --slate: #587fbc;
  --orange: #d3542a;
  --sand: #efe9dd;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Arimo", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2 {
  font-family: "Gelasio", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.01em;
}
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 19px; margin: 0 0 12px; }

/* ---- chrome ---- */

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 26px 40px 22px;
  border-bottom: 1px solid var(--line);
}
.wordmark { display: flex; align-items: baseline; gap: 10px; }
.wordmark img { height: 26px; width: auto; transform: translateY(3px); }
.wordmark span {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.wordmark:hover { text-decoration: none; }

.topbar nav { display: flex; gap: 26px; align-items: center; }
.topbar nav a { color: var(--ink); font-size: 14px; }
.topbar nav a.active {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

.btn {
  background: var(--blue);
  color: #fff !important;
  padding: 7px 14px;
  border-radius: 3px;
  font-size: 13.5px;
  border: 1px solid var(--blue);
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: #17305d; text-decoration: none !important; }
.btn-ghost {
  background: transparent;
  color: var(--blue) !important;
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--sand); border-color: var(--blue); }
.btn-quiet {
  background: none; border: none; color: var(--muted);
  font-size: 13px; cursor: pointer; padding: 0; font-family: inherit;
}
.btn-quiet:hover { color: var(--orange); }

main { padding: 30px 40px 80px; }

.logout-form { display: inline-flex; align-items: center; gap: 10px; margin-left: 8px; }
.user-chip { color: var(--muted); font-size: 12.5px; }

.demo-banner {
  background: var(--sand);
  color: var(--blue);
  font-size: 13px;
  text-align: center;
  padding: 7px 16px;
  border-bottom: 1px solid var(--line-strong);
}

.auth-card { max-width: 380px; margin: 60px auto 0; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }

.messages { padding: 14px 40px 0; }
.message { font-size: 14px; color: var(--blue); padding: 4px 0; }
.message.error { color: var(--orange); }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
  gap: 20px;
}
.page-head .sub { color: var(--muted); font-size: 13.5px; }

/* ---- overview table ---- */

.window-nav { display: flex; align-items: center; gap: 8px; }
.window-nav a {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  font-size: 13px;
}
.window-nav a:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }

.table-scroll { overflow-x: auto; border-top: 1px solid var(--line-strong); }

table.grid {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.grid th {
  font-weight: 400;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  text-align: left;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
}
.grid td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}
.grid th.num, .grid td.num { text-align: right; }
.grid td.line-no { color: var(--faint); font-size: 11.5px; }
.grid td.code { color: var(--muted); font-size: 12px; }
.grid td.name a { color: var(--ink); }
.grid td.name a:hover { color: var(--blue); }

.grid th.month-now, .grid td.month-now { background: var(--sand); }
.grid th.month-now { color: var(--blue); }

.grid td.cell { color: var(--muted); }
.grid td.cell.paid { color: var(--ink); }
.grid td.cell.paid::after {
  content: "●";
  font-size: 6px;
  color: var(--slate);
  vertical-align: 2px;
  margin-left: 5px;
}
.grid td.cell.partial::after {
  content: "◐";
  font-size: 8px;
  color: var(--slate);
  margin-left: 5px;
}
.grid tr.excluded td { opacity: 0.42; }

.grid tr.section td {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding-top: 22px;
  border-bottom: 1px solid var(--line-strong);
  position: static !important; /* section label spans the sticky column too */
}

/* Keep the Total € column visible while the months scroll underneath it. */
.grid th:last-child, .grid td:last-child {
  position: sticky;
  right: 0;
  background: var(--bg);
  border-left: 1px solid var(--line-strong);
  z-index: 2;
}

/* Frozen detail pane: the identity columns stay put, only months scroll.
   Widths must be fixed so each column's `left` offset lines up. */
.frozen .c1, .frozen .c2, .frozen .c3, .frozen .c4,
.frozen .c5, .frozen .c6, .frozen .c7, .frozen .c8 {
  position: sticky;
  background: var(--bg);
  z-index: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frozen .c1 { left: 0;     width: 30px;  min-width: 30px;  max-width: 30px; }
.frozen .c2 { left: 30px;  width: 104px; min-width: 104px; max-width: 104px; }
.frozen .c3 { left: 134px; width: 122px; min-width: 122px; max-width: 122px; }
.frozen .c4 { left: 256px; width: 152px; min-width: 152px; max-width: 152px; }
.frozen .c5 { left: 408px; width: 184px; min-width: 184px; max-width: 184px; }
.frozen .c6 { left: 592px; width: 104px; min-width: 104px; max-width: 104px; }
.frozen .c7 { left: 696px; width: 38px;  min-width: 38px;  max-width: 38px; }
.frozen .c8 { left: 734px; width: 122px; min-width: 122px; max-width: 122px;
  border-right: 1px solid var(--line-strong); }
.frozen .section-label { position: sticky; left: 0; z-index: 2; background: var(--bg); }

/* Partner payout sub-rows: money going out, orange. */
tr.partner-row td { border-bottom: 1px solid var(--line); }
tr.partner-row .sub-name { font-size: 12.5px; color: var(--muted); }
tr.partner-row .sub-name a { color: var(--orange); }
.grid td.cell.out { color: #dd9070; }
.grid td.cell.out.paid-out { color: var(--orange); }
.grid td.cell.out.paid-out::after {
  content: "●";
  font-size: 6px;
  color: var(--orange);
  vertical-align: 2px;
  margin-left: 5px;
}
.grid td.out { color: var(--orange); }
.grid tfoot tr.partner-total td { color: var(--orange); }
.grid tfoot tr.net td { border-top: 1px solid var(--line); }

.grid tfoot td {
  border-bottom: none;
  padding-top: 12px;
  font-weight: 700;
}
.grid tfoot tr.totals td { border-top: 1px solid var(--line-strong); }
.grid tfoot tr.weighted td {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
  padding-top: 2px;
}
.grid tfoot .foot-label { font-weight: 400; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.09em; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
.status.st-figuring_out::before { background: var(--faint); }
.status.st-not_now::before { background: var(--orange); }
.status.st-awaiting::before { background: var(--sand); border: 1px solid var(--slate); }
.status.st-proposal_wip::before { background: var(--slate); opacity: 0.5; }
.status.st-proposal_submitted::before { background: var(--slate); }
.status.st-ongoing::before { background: var(--blue); }
.status.st-closed::before { background: var(--ink); }
.status .pct { color: var(--muted); font-size: 11px; }

/* Inline status editing in the overview table */
.status-form { display: inline-flex; align-items: center; gap: 6px; }
.status-form .pct { color: var(--muted); font-size: 11px; }
.status-select {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 2px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.status-select:hover, .status-select:focus {
  border-color: var(--line-strong);
  background: var(--surface);
  outline: none;
}

/* ---- cards ---- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px 22px 18px;
  display: block;
  color: var(--ink);
}
a.card:hover { border-color: var(--slate); text-decoration: none; }
.card h3 {
  font-family: "Gelasio", Georgia, serif;
  font-weight: 400;
  font-size: 19px;
  margin: 0 0 2px;
}
.card .meta { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.card .figure {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.card .figures {
  display: flex;
  gap: 22px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 4px;
}

/* History / audit trail */
.history { margin-top: 36px; }
.hist {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
  max-width: 760px;
  font-variant-numeric: tabular-nums;
}
.hist td { padding: 7px 16px 7px 0; border-top: 1px solid var(--line); vertical-align: baseline; }
.hist .when { color: var(--muted); white-space: nowrap; }
.hist .who { color: var(--slate); font-size: 12px; }
.hist .what {
  color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
}
.card .figure small { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; display: block; }

/* ---- detail & forms ---- */

.detail-grid { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 44px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.facts { border-top: 1px solid var(--line-strong); }
.facts div {
  display: flex; justify-content: space-between; gap: 18px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.facts dt, .facts .k {
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  padding-top: 3px;
}
.facts .v { text-align: right; font-variant-numeric: tabular-nums; }

form.stack { max-width: 560px; }
form.stack p { margin: 0 0 16px; display: flex; flex-direction: column; gap: 5px; }
form.stack label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
form.stack input, form.stack select, form.stack textarea,
.sched input, .sched select {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 8px 10px;
}
form.stack input:focus, form.stack select:focus, form.stack textarea:focus,
.sched input:focus { outline: none; border-color: var(--blue); }
form.stack .helptext { font-size: 12px; color: var(--faint); }
form.stack .errorlist { color: var(--orange); font-size: 13px; margin: 0; padding: 0; list-style: none; }
.form-actions { display: flex; gap: 14px; align-items: center; margin-top: 24px; }

.payment-dates { display: flex; flex-direction: column; gap: 5px; margin: 4px 0 16px; }
.payment-dates label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
.payment-dates .date-row { display: flex; gap: 8px; flex-wrap: wrap; }
.payment-dates input { width: 130px; }

table.sched { border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.sched th {
  font-weight: 400; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); text-align: left; padding: 8px 12px 6px 0;
}
.sched td { padding: 5px 12px 5px 0; border-top: 1px solid var(--line); }
.sched input[type="number"], .sched input[type="text"] { width: 120px; text-align: right; }
.sched input[name$="-due"] { width: 130px; text-align: left; }
.sched .locked { color: var(--muted); font-size: 12px; }

.note { color: var(--muted); font-size: 13px; }
.note.warn { color: var(--orange); }

/* Partners */
.partners-section { margin-top: 36px; }
.partner-block { margin-bottom: 18px; }
.partner-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 2px; }
.partner-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.partner-add select, .partner-add input {
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 3px; padding: 7px 9px;
}
.partner-add input[name="percent"], .partner-add input[name="fixed_amount"] { width: 110px; }
.out { color: var(--orange); }
.out-figure { color: var(--orange); }
.sched td.out { text-align: right; padding-right: 12px; font-variant-numeric: tabular-nums; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  padding: 44px;
  text-align: center;
  color: var(--muted);
}
