/* Canary Copy app. Layout: a desk with sheets on it. */
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--canary); padding: 6px 10px; z-index: 10; }

.top { display: flex; align-items: center; gap: 18px; padding: 14px clamp(16px, 3vw, 36px); border-bottom: var(--line); background: var(--white); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 850; font-stretch: 120%; font-size: 1.18rem; letter-spacing: -0.01em; }
.brand:hover { background: none; }
.asof { margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; }
.private { margin: 0; font-size: var(--t-xs); color: var(--ink-2); font-stretch: 88%; max-width: none; }

.tabs { display: flex; gap: 0; overflow-x: auto; background: var(--white); border-bottom: var(--line); padding: 0 clamp(8px, 2.4vw, 28px); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { font: inherit; font-weight: 650; font-stretch: 92%; color: var(--ink-2); background: none; border: 0; border-bottom: 5px solid transparent; padding: 12px 14px 8px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-current="page"] { color: var(--ink); border-bottom-color: var(--canary); font-weight: 800; }
.tabs .count { display: inline-block; min-width: 1.5em; text-align: center; margin-left: 5px; padding: 0 5px; background: var(--goldenrod); border: 1.5px solid var(--ink); border-radius: 2px; font-size: var(--t-xs); font-weight: 800; }

main { padding: clamp(18px, 3vw, 36px); max-width: 1240px; margin: 0 auto; min-height: 60vh; }
main:focus { outline: none; }
.foot { padding: 18px clamp(16px, 3vw, 36px) 40px; max-width: 1240px; margin: 0 auto; font-size: var(--t-xs); color: var(--ink-2); }
.foot p { max-width: 100ch; margin-bottom: 0.5em; }

.viewhead { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.viewhead h1 { font-size: var(--t-xl); }
.viewhead p { margin: 6px 0 0; color: var(--ink-2); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Totals strip: four tear-off stubs */
.stubs { display: grid; grid-template-columns: repeat(4, 1fr); border: var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow-sheet); margin-bottom: 26px; }
.stub { padding: 14px 18px 12px; border-right: 1.5px dashed var(--ink-3); }
.stub:last-child { border-right: 0; }
.stub .amt { font-family: var(--typed); font-size: clamp(1.3rem, 2.6vw, 2rem); font-weight: 700; display: block; line-height: 1.15; }
.stub.goldenrod { background: var(--goldenrod-pale); }
.stub.pink { background: var(--pink-pale); }
.stub.canary { background: var(--canary-pale); }
.stub small { display: block; font-size: var(--t-xs); color: var(--ink-2); }

.cols { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 26px; align-items: start; }
h2.sec { font-size: var(--t-md); margin: 0 0 12px; }

/* An item that needs attention: a sheet in its status colour */
.need { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 16px; padding: 14px 16px; margin-bottom: 12px; align-items: start; }
.need .who { font-family: var(--typed); font-weight: 700; font-size: 1.05rem; }
.need .meta { font-size: var(--t-sm); color: var(--ink-2); }
.need .why { grid-column: 1 / -1; margin: 6px 0 0; max-width: none; }
.need .acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.need .amt { font-family: var(--typed); font-weight: 700; font-size: 1.15rem; text-align: right; }

.upcoming { padding: 4px 16px 10px; }
.upcoming .row { display: grid; grid-template-columns: 7.2em 1fr auto; gap: 10px; padding: 9px 0; border-bottom: var(--hair); align-items: baseline; }
.upcoming .row:last-child { border-bottom: 0; }
.upcoming .d { font-family: var(--typed); font-weight: 700; }
.upcoming .a { font-family: var(--typed); }

.empty { padding: 28px; text-align: left; }
.empty h2 { font-size: var(--t-lg); margin-bottom: 8px; }

/* Ledger table: ruled like a ledger page */
.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.tablewrap { overflow-x: auto; }
table.ledger { width: 100%; border-collapse: collapse; background: var(--white); font-size: var(--t-sm); }
table.ledger th { text-align: left; font-stretch: 78%; font-weight: 650; font-size: var(--t-xs); color: var(--ink-2); padding: 10px 12px 6px; border-bottom: var(--line); white-space: nowrap; vertical-align: bottom; }
table.ledger td { padding: 9px 12px; border-bottom: var(--hair); vertical-align: top; }
table.ledger tr:last-child td { border-bottom: 0; }
table.ledger td.t { font-family: var(--typed); white-space: nowrap; }
table.ledger td.n { font-family: var(--typed); text-align: right; white-space: nowrap; }
table.ledger th.n { text-align: right; }
table.ledger tr.pink td { background: var(--pink-pale); }
table.ledger tr.goldenrod td { background: var(--goldenrod-pale); }
table.ledger tr.canary td { background: var(--canary-pale); }
table.ledger .sub { display: block; font-family: var(--sans); font-size: var(--t-xs); color: var(--ink-2); white-space: normal; }
.rowacts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.link { font: inherit; font-size: var(--t-xs); font-weight: 700; font-stretch: 86%; color: var(--ink); background: none; border: 0; padding: 2px 0; text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }
.link:hover { background: var(--canary); }

/* Fields */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field input, .field select, .field textarea { font: inherit; font-family: var(--typed); color: var(--ink); background: var(--white); border: var(--line); border-radius: var(--radius); padding: 0.5em 0.6em; width: 100%; min-width: 0; }
.field textarea { min-height: 5.2em; resize: vertical; font-family: var(--sans); }
.field .hint { font-size: var(--t-xs); color: var(--ink-2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.check input { width: 1.15em; height: 1.15em; margin-top: 0.2em; accent-color: var(--ink); flex: none; }

dialog { border: var(--line); border-radius: var(--radius); padding: 0; max-width: min(640px, 94vw); width: 100%; background: var(--canary-pale); color: var(--ink); box-shadow: 8px 8px 0 var(--ink); }
dialog::backdrop { background: rgba(35, 32, 95, 0.45); }
dialog form { padding: 22px 24px 20px; display: grid; gap: 14px; }
dialog h2 { font-size: var(--t-lg); }
dialog .dlgacts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: var(--radius); font-weight: 650; opacity: 0; pointer-events: none; transition: opacity 160ms, transform 160ms; max-width: 92vw; z-index: 20; }
#toast.on { opacity: 1; transform: translateX(-50%); }

/* Pay calendar: one rule sheet per platform */
.rule { padding: 20px 22px; margin-bottom: 18px; }
.rule h2 { font-size: var(--t-lg); margin-bottom: 6px; }
.rule .plain { font-size: var(--t-md); line-height: 1.3; max-width: 48ch; margin-bottom: 14px; }
.src { margin: 0 0 12px; padding: 10px 14px; border-left: 5px solid var(--canary); background: var(--white); border-radius: 0 var(--radius) var(--radius) 0; }
.sheet.white .src, .rule .src { background: var(--canary-pale); border-left-color: var(--ink); }
.src p { font-family: var(--typed); font-size: var(--t-sm); margin: 0 0 6px; max-width: 80ch; }
.src cite { font-style: normal; font-size: var(--t-xs); color: var(--ink-2); overflow-wrap: anywhere; }
.rule ul { padding-left: 1.1em; margin: 6px 0 12px; }
.rule li { margin-bottom: 4px; max-width: 80ch; }
.unknown { background: var(--goldenrod-pale); border: 1.5px dashed var(--ink); border-radius: var(--radius); padding: 10px 14px; }
.unknown ul { margin: 4px 0 0; }

/* Dispute packet */
.packetwrap { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr); gap: 26px; align-items: start; }
.packet { padding: 34px 38px; font-size: 0.95rem; }
.packet h1 { font-size: 1.7rem; }
.packet h2 { font-size: 1.05rem; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: var(--line); }
.packet table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.packet th, .packet td { text-align: left; padding: 5px 6px; border-bottom: var(--hair); vertical-align: top; }
.packet th { font-stretch: 78%; font-weight: 650; color: var(--ink-2); font-size: 0.74rem; }
.packet td { font-family: var(--typed); }
.packet td.n, .packet th.n { text-align: right; }
.packet .phead { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 8px; }
.packet .copyline { font-stretch: 78%; font-weight: 700; font-size: 0.74rem; border-top: var(--line); margin-top: 26px; padding-top: 8px; display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); }
.packet p { max-width: none; }
.packet ol { padding-left: 1.2em; }

@media (max-width: 900px) {
  .cols, .packetwrap { grid-template-columns: 1fr; }
  .stubs { grid-template-columns: 1fr 1fr; }
  .stub:nth-child(2) { border-right: 0; }
  .stub:nth-child(-n+2) { border-bottom: 1.5px dashed var(--ink-3); }
  .asof { margin-left: 0; }
  .private { flex-basis: 100%; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .packet { padding: 22px 18px; }
}
@media (max-width: 640px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  /* Ledger rows become slips */
  table.ledger thead { display: none; }
  table.ledger, table.ledger tbody, table.ledger tr, table.ledger td { display: block; width: 100%; }
  table.ledger tr { border-bottom: var(--line); padding: 8px 0; }
  table.ledger td { border: 0; padding: 3px 12px; text-align: left !important; white-space: normal !important; }
  table.ledger td[data-l]::before { content: attr(data-l) ' '; font-family: var(--sans); font-stretch: 78%; font-weight: 650; font-size: var(--t-xs); color: var(--ink-2); display: inline-block; min-width: 7.5em; }
  .rowacts { justify-content: flex-start; }
  .need { grid-template-columns: 1fr auto; }
  .need > div:first-child { grid-column: 1 / -1; }
  .need .amt { align-self: center; }
}

@media print {
  body { background: #fff; }
  .top, .tabs, .foot, .noprint, #toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .packetwrap { display: block; }
  .packet { border: 0; box-shadow: none; padding: 0; }
  a:hover { background: none; }
}

/* Packet tables: keep dates and amounts on one line; let only the last column wrap. */
.packet td { white-space: nowrap; }
.packet td:last-child { white-space: normal; }
.packetwrap > * { min-width: 0; }
.packet .tscroll { overflow-x: auto; }
@media (max-width: 900px) { .packet table { display: block; overflow-x: auto; } }

.nudge { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 18px; }
.nudge p { margin: 0; max-width: 70ch; }
