.logbook-layout {
  flex: 1; min-width: 0; overflow-y: auto; padding: 24px;
}

/* Everything the logbook shows lives in one outlined panel, so the tab reads as
   a single document rather than parts floating on the background. */
.logbook-panel {
  max-width: 1100px; margin: 0 auto;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--border), 0 4px 16px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: calc(100dvh - 96px);
}

.logbook-head {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex: none;
}
.logbook-head label { color: var(--muted); font-size: 14px; }
.logbook-head select { width: auto; min-width: 170px; }
.logbook-head .spacer { flex: 1; }
.download-link {
  font-size: 14px; font-weight: 500; padding: 8px 16px; text-decoration: none;
  color: var(--text-strong); border-radius: var(--radius-sm); background: var(--surface-2);
}
.download-link:hover { background: var(--surface-3); }

.totals {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 16px 20px; flex: none;
}
.total-card {
  background: var(--bg-deep);
  border-radius: var(--radius); padding: 12px 16px; min-width: 132px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.total-card .label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted);
}
.total-card .value { font-size: 22px; font-weight: 600; margin-top: 3px; color: var(--text-strong); }
.total-card .detail { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* One colour per style, reused by the tag in the table so the eye can follow
   a style down the list. */
.style-violet { --style: #a5b0ff; }
.style-cyan   { --style: #4fd6e0; }
.style-amber  { --style: #f0b132; }
.style-pink   { --style: #f57bb0; }
.style-lime   { --style: #86d94a; }
.style-orange { --style: #f0863a; }

.total-card[class*="style-"] { box-shadow: inset 0 0 0 1px var(--style); }
.total-card[class*="style-"] .label { color: var(--style); }
.total-card.earned { box-shadow: inset 0 0 0 2px var(--accent); }
.total-card.earned .label { color: #a5b0ff; }
.total-card.earned .value { color: #c3c8ff; }

.style-tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  color: var(--style);
  background: color-mix(in srgb, var(--style) 16%, transparent);
}

/* The list scrolls on its own so the balance bar stays put underneath it. */
.logbook-table-wrap { flex: 1; overflow: auto; min-height: 120px; }
table.logbook { width: 100%; border-collapse: collapse; font-size: 14px; }
table.logbook th {
  text-align: left; padding: 10px 20px; color: var(--muted); font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
table.logbook td {
  padding: 11px 20px; border-bottom: 1px solid var(--bg);
  color: var(--text); line-height: 1.4;
}
table.logbook td.file { color: var(--text-strong); font-weight: 500; }
table.logbook td.when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.logbook td.amount {
  text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; color: var(--text-strong); font-weight: 600;
}
table.logbook tbody tr:hover td { background: var(--surface-2); }

/* ---- Balance bar ---- */
.balance-bar {
  display: flex; align-items: center; gap: 20px;
  padding: 16px 20px; flex: none;
}
.balance-left { flex: none; }
.balance-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted);
}
.balance-figure { font-size: 26px; font-weight: 700; margin-top: 2px; }
.balance-note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.balance-progress { flex: 1; min-width: 0; }
.balance-progress .progress { height: 6px; }

/* Owed sits on top of the table and is loud about it. */
.balance-bar.owed {
  background: rgba(242, 63, 67, 0.1);
  border-bottom: 1px solid var(--danger);
}
.balance-bar.owed .balance-figure { color: #ff9093; }

.balance-bar.ahead, .balance-bar.settled {
  background: rgba(35, 165, 90, 0.08);
  border-top: 1px solid var(--border);
}
.balance-bar.ahead .balance-figure, .balance-bar.settled .balance-figure { color: #5fd894; }
.balance-bar.ahead .progress .bar { background: var(--success); }

/* A row you can still watch says so; one whose file is gone stays readable. */
table.logbook tr.playable { cursor: pointer; }
table.logbook tr.playable:hover { background: var(--surface-2); }
table.logbook tr.gone .file { color: var(--muted); text-decoration: line-through; }

/*
 * On a phone the whole page scrolls, as one thing.
 *
 * The desktop layout caps the panel at the window and gives the list a scroll
 * area of its own, so the balance bar stays put underneath it. On a phone the
 * cards wrap onto three rows and there is nothing left: the list was squeezed
 * to its 120px floor and showed one row out of eighteen, inside a scroll region
 * small enough to be hard to catch with a thumb. One scroll container, and the
 * list is as long as it is.
 */
@media (max-width: 720px) {
  .logbook-layout { padding: 12px; }
  .logbook-panel { padding: 0; max-height: none; }

  .logbook-table-wrap { flex: none; overflow-x: auto; overflow-y: visible; min-height: 0; }
  table.logbook { min-width: 620px; }

  /* Compact cards, so the list starts near the top rather than below the fold. */
  .totals { gap: 6px; padding: 12px; }
  .total-card { min-width: 0; flex: 1 1 46%; padding: 8px 10px; }
  .total-card .value { font-size: 18px; }
  .total-card .detail { font-size: 11px; }

  .logbook-head { padding: 12px; }
  .balance-bar { padding: 12px; flex-wrap: wrap; }
  .extras-block { padding: 12px; }
}

/* A category nothing has been filed under yet: present, but not shouting. */
.total-card.empty-card { opacity: 0.55; }

/* The same money read as work, so it sits apart from the category cards. */
.total-card.style-count {
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}

/* A video added by hand sits in the same list, and reads the same. Only the
   absence of a file to play makes it different, which is not worth a colour. */
table.logbook tr.added { cursor: default; }

/* Only there for the admin, and only worth noticing on the row it belongs to. */
.line-drop {
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 6px;
}
.line-drop:hover { color: var(--danger); }
table.logbook .row-tools { width: 28px; text-align: right; }
table.logbook tr .line-drop { opacity: 0; }
table.logbook tr:hover .line-drop { opacity: 1; }

/* The same money read as work, on the bar it is a translation of. */
.balance-videos {
  margin-left: 10px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-strong);
  font-variant-numeric: tabular-nums; font-size: 11px; cursor: default;
}

/* Beside the period picker, where the rest of the list's controls are. */
.add-extra {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-strong);
  font-size: 14px; font-weight: 500;
}
.add-extra:hover { background: var(--accent); color: #fff; }
.add-extra svg {
  width: 15px; height: 15px; fill: none; flex: none;
  stroke: currentColor; stroke-width: 2.2; stroke-linecap: round;
}
.add-extra[hidden] { display: none; }

/*
 * Wat er met de hand bij is gezet.
 *
 * Die regels zien er met opzet uit als elke andere — een video die buiten de app
 * om betaald is, is gewoon een video. Maar bij het nakijken van de boeken is
 * juist dat de vraag, en daar was geen antwoord op te krijgen.
 */
.only-added {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); cursor: pointer;
}
.only-added input { accent-color: var(--accent); }
.only-added .pill {
  background: var(--surface-3); color: var(--text-strong);
  border-radius: 999px; padding: 0 7px; font-size: 11px;
}
.by-hand {
  margin-left: 8px; padding: 1px 6px; border-radius: 999px;
  background: var(--warning-soft, rgba(240, 177, 50, 0.15));
  color: var(--warning); font-size: 10px; white-space: nowrap;
}
