:root {
  color-scheme: light;
  /* Farm green background with cream type: the logo's colors, swapped. */
  --bg: #2e4b32;
  --paper: #375a3c;
  --raise: #41664a;
  --sel: #4b7451;
  --line: #557a5a;
  --ink: #f8f3e7;
  --muted: #c5cfbc;
  --accent: #f8f3e7;
  --accent-2: #e6dcc4;
  --on-accent: #2e4b32;
  --field: #fbf8f0;
  --field-ink: #1f2a20;
  --field-line: #d9d0bb;
  --red: #b23a33;
  --red-soft: #f6e1dc;
  --amber-soft: #f6ebc9;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.45; }
[hidden] { display: none !important; }
.wrap { width: min(100% - 32px, 760px); margin: 0 auto; padding-bottom: 48px; }
.wrap.wide { width: min(100% - 32px, 1040px); }

header.top { display: flex; align-items: center; gap: 14px; padding: 18px 0 10px; }
header.top img { width: 92px; height: auto; display: block; }
header.top .title { font-size: 1.05rem; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; }
header.top .sub { font-size: 0.85rem; color: var(--muted); }
header.top .spacer { flex: 1; }

h1 { font-size: 1.7rem; margin: 18px 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; margin: 26px 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

button, .button {
  font: inherit; font-weight: 600;
  background: var(--accent); color: var(--on-accent);
  border: 0; border-radius: 12px; padding: 12px 20px;
  cursor: pointer; text-decoration: none; display: inline-block;
  -webkit-tap-highlight-color: transparent;
}
button:hover { background: var(--accent-2); }
button.secondary { background: var(--paper); color: var(--accent); border: 2px solid var(--line); }
button.secondary:hover { border-color: var(--accent-2); }
button.danger { background: var(--red); color: #fff8ec; }
button.danger:hover { background: #c7463e; }
button.link { background: none; color: var(--accent); padding: 4px 6px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
button.small { padding: 7px 12px; font-size: 0.9rem; border-radius: 9px; }
button[disabled] { opacity: 0.55; cursor: wait; }
:focus-visible { outline: 3px solid #e7d9a8; outline-offset: 2px; }

input, select, textarea {
  font: inherit; color: var(--field-ink); width: 100%;
  background: var(--field); border: 2px solid var(--field-line); border-radius: 10px; padding: 10px 12px;
}
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
label { display: block; font-size: 0.9rem; font-weight: 600; margin: 0 0 4px; }
.field { margin-bottom: 14px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 14px; }
.error { background: var(--red-soft); color: var(--red); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.notice { background: var(--sel); color: var(--accent); border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-weight: 600; }

/* Kids' clock */
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.name {
  background: var(--paper); color: var(--ink); border: 2px solid var(--line);
  border-radius: 18px; padding: 22px 14px; font-size: 1.25rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.name:hover { background: var(--paper); border-color: var(--accent-2); }
.name .status { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.name.on { border-color: var(--accent); background: var(--sel); }
.name.on .status { color: var(--accent); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #a6dc8c; margin-right: 5px; vertical-align: 1px; }

.projects { display: grid; gap: 10px; }
.project {
  background: var(--paper); color: var(--ink); border: 2px solid var(--line);
  border-radius: 14px; padding: 14px 16px; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.project:hover { background: var(--paper); border-color: var(--accent-2); }
.project[aria-pressed="true"] { border-color: var(--accent); background: var(--sel); }
.project .co { font-size: 0.85rem; font-weight: 500; color: var(--muted); }

.big { width: 100%; font-size: 1.3rem; padding: 18px; border-radius: 16px; margin-top: 14px; }
.clock { text-align: center; padding: 26px 18px; }
.clock .timer { font-size: 3.2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); letter-spacing: -0.02em; }
.clock .what { font-size: 1.2rem; font-weight: 600; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat .k { font-size: 0.85rem; color: var(--muted); }
.stat .v { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .v2 { font-size: 0.95rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; background: var(--raise); }
tr.sub td { color: var(--muted); font-size: 0.9rem; }
tr.sub td:first-child { padding-left: 28px; }
tr.inactive td { color: var(--muted); }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.tag.open { background: var(--sel); color: var(--accent); }
.tag.long { background: var(--amber-soft); color: #7a5a10; }

/* Parents' page */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 4px; }
.tabs button { background: transparent; color: var(--accent); border: 2px solid var(--line); }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin: 10px 0 14px; }
.toolbar .field { margin: 0; }
.toolbar select, .toolbar input { width: auto; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }

dialog { border: 0; border-radius: 18px; padding: 22px; width: min(100% - 32px, 480px); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgba(10, 20, 12, 0.6); }
dialog h2 { margin-top: 0; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.actions .left { margin-right: auto; }

@media (max-width: 520px) {
  header.top img { width: 72px; }
  .clock .timer { font-size: 2.6rem; }
  h1 { font-size: 1.45rem; }
}
.time24 { font-variant-numeric: tabular-nums; }
#import-dlg textarea { min-height: 160px; resize: vertical; }
.job-menu {
  font-size: 1.15rem; font-weight: 600; padding: 16px 44px 16px 16px; border-radius: 14px;
  -webkit-appearance: none; appearance: none;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%232e4b32' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center;
}
h2 label { font-size: inherit; font-weight: inherit; margin: 0; display: inline; }

/* Invoice: a white sheet on screen, and the only thing that prints. */
.sheet { background: #fff; color: #1f2a20; border-radius: 8px; padding: 36px; margin-top: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); }
.sheet-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; }
.sheet-logo { width: 120px; height: auto; display: block; margin-bottom: 8px; }
.sheet-meta { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sheet-meta label { white-space: nowrap; font-size: 0.9rem; font-weight: 600; color: #5d6a5e; margin: 0; display: flex; align-items: center; gap: 6px; }
.sheet-meta .sheet-in { width: 150px; text-align: right; font-weight: 600; color: #1f2a20; }
.sheet-title { font-size: 2rem; font-weight: 700; color: #2e4b32; letter-spacing: 0.04em; text-transform: uppercase; }
.sheet-period { font-size: 0.9rem; color: #5d6a5e; }
.sheet-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #5d6a5e; margin-bottom: 2px; }
.sheet-bill { margin-bottom: 22px; }
.sheet .sheet-in {
  background: transparent; color: inherit; border: 1px dashed #cfc7b3; border-radius: 6px;
  padding: 4px 6px; font: inherit; resize: none; width: min(100%, 340px); line-height: 1.4;
}
.sheet .sheet-in:focus { border-style: solid; border-color: #2e4b32; outline: none; }
.sheet-notes { width: 100% !important; margin-top: 18px; color: #5d6a5e !important; }
.sheet-table { font-size: 0.92rem; }
.sheet-table th { color: #5d6a5e; border-bottom: 2px solid #2e4b32; }
.sheet-table td { border-bottom: 1px solid #e6e0d0; }
.sheet-table .muted { color: #5d6a5e; }
.sheet-table tr.total td { background: #f3efe4; border-bottom: 0; font-size: 1.05rem; }

@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  body * { visibility: hidden; }
  #invoice-sheet, #invoice-sheet * { visibility: visible; }
  #invoice-sheet { position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; box-shadow: none; border-radius: 0; }
  .sheet .sheet-in { border-color: transparent; padding-left: 0; padding-right: 0; }
  .sheet input[type="date"]::-webkit-calendar-picker-indicator { display: none; }
}

/* Pay period close-out bar on the Hours tab */
.period-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 4px 0 6px; }
.period-bar > div { flex: 1 1 220px; }
.period-bar .period-name { font-weight: 700; }
.period-bar .small { color: var(--muted); }
.period-bar.closed { border-color: #a6dc8c; }
.period-bar button[disabled] { cursor: not-allowed; }

/* Saved invoices */
.sheet { position: relative; }
.sheet-from { font-size: 1.05rem; font-weight: 700; color: #2e4b32; }
.sheet-k { font-size: 0.85rem; font-weight: 600; color: #5d6a5e; margin-right: 6px; }
.sheet-meta > div { font-variant-numeric: tabular-nums; }
.sheet-to { font-size: 1.05rem; font-weight: 600; }
.sheet-paid {
  position: absolute; top: 120px; left: 50%; transform: translateX(-50%) rotate(-8deg);
  border: 4px solid #3f8f4a; color: #3f8f4a; border-radius: 10px; padding: 6px 18px;
  font-size: 1.6rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; white-space: nowrap;
}

/* Limits and forgotten clock-outs to review */
.flags { background: var(--amber-soft); color: #5a4108; border-radius: 14px; padding: 4px 16px 10px; margin: 8px 0 4px; }
.flags h2 { margin: 10px 0 6px; font-size: 1.05rem; color: #5a4108; }
.flags ul { margin: 0; padding-left: 20px; }
.flags li { margin: 3px 0; }
.limits { margin-top: 10px; font-size: 0.95rem; color: var(--muted); }
.limits b { color: var(--ink); font-variant-numeric: tabular-nums; }
.limits .over { color: #f2c46d; }

/* Lists of cards (shifts, kids, companies, jobs, invoices): name and details on the left,
   amount on the right, then the button. Reads well on a phone and a computer alike. */
.list { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item.empty { color: var(--muted); }
.item.inactive { opacity: 0.6; }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-title { font-weight: 600; }
.item-title .muted { font-weight: 400; }
.item-sub { font-size: 0.88rem; color: var(--muted); margin-top: 2px; }
.item-sub .tag { margin-left: 6px; }
.item-note { font-size: 0.85rem; color: var(--muted); font-style: italic; margin-top: 3px; }
.item-side { text-align: right; flex: 0 0 auto; }
.item-side .item-sub .tag { margin-left: 0; }
.item-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-act { flex: 0 0 auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.narrow-only { display: none; }

/* Phones */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap, .wrap.wide { width: calc(100% - 24px); }
  .wide-only { display: none !important; }
  .narrow-only { display: inline; }

  header.top { gap: 10px; padding: 12px 0 6px; }
  header.top img { width: 56px; }
  header.top .title { font-size: 0.95rem; white-space: nowrap; }
  header.top .sub { font-size: 0.78rem; }
  header.top .link { white-space: nowrap; font-size: 0.9rem; }

  /* Tabs: one row, equal widths */
  .tabs { flex-wrap: nowrap; gap: 4px; background: rgba(0, 0, 0, 0.18); border-radius: 12px; padding: 4px; }
  .tabs button { flex: 1 1 0; border: 0; padding: 9px 4px; font-size: 0.95rem; border-radius: 9px; }

  /* Toolbars: the date menu full width, buttons side by side */
  .toolbar { gap: 8px; }
  .toolbar .field { flex: 1 1 100%; }
  .toolbar select, .toolbar input { width: 100%; }
  .toolbar .spacer { display: none; }
  .toolbar > button { flex: 1 1 0; padding: 11px 8px; font-size: 0.95rem; }
  #inv-saved-bar > .link { flex: 1 1 100%; text-align: left; padding-left: 0; }

  .period-bar { padding: 12px; }
  .period-bar button { flex: 1 1 auto; }

  h2 { font-size: 1.1rem; margin: 22px 0 8px; }
  th, td { padding: 9px 10px; }

  /* Cards: the button drops under the details when space is tight */
  .item { flex-wrap: wrap; padding: 12px; gap: 6px 10px; }
  .item-main { flex: 1 1 0; }
  .item.has-actions .item-act { flex: 1 1 100%; justify-content: flex-start; }

  /* Dialogs fill the screen width and scroll if long */
  dialog { width: calc(100% - 16px); max-height: calc(100% - 24px); padding: 18px 16px; border-radius: 16px; }
  .row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .actions button { flex: 1 1 0; }
  .actions .left { margin-right: 0; flex: 1 1 100%; order: 2; }

  /* Invoice sheet */
  .sheet { padding: 20px 16px; }
  .sheet-head { flex-direction: column; gap: 14px; margin-bottom: 18px; }
  .sheet-meta { text-align: left; align-items: flex-start; }
  .sheet-title { font-size: 1.6rem; }
  .sheet-paid { top: 70px; left: auto; right: 12px; transform: rotate(-8deg); font-size: 1.1rem; }
}
.flags li.show-all { list-style: none; margin-left: -20px; }
.flags .link { color: #5a4108; padding-left: 0; }
@media (max-width: 640px) {
  /* Short tables fit by letting names wrap */
  .table-wrap td:first-child, .table-wrap th:first-child { white-space: normal; }
  .table-wrap th { font-size: 0.72rem; }
}
@media (max-width: 640px) {
  /* Section headings with small Add buttons stay on one line */
  .toolbar > button.small { flex: 0 0 auto; }
  .toolbar > h2 { flex: 1 1 auto; }
}

/* Today tab: one card per child with time left, and Mon–Sat bars */
.avail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 6px 0 10px; }
.avail.card { margin: 0; padding: 16px; }
.avail-head { margin-bottom: 10px; }
.avail-name { font-size: 1.2rem; font-weight: 700; }
.avail-name .muted { font-weight: 400; }
.avail-now { font-size: 0.88rem; color: #bfe3b0; margin-top: 2px; }
.avail-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.avail-stat { background: rgba(0, 0, 0, 0.16); border-radius: 10px; padding: 8px 10px; }
.avail-stat .k { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.avail-stat .v { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: 2px; }
.avail-stat .s { font-size: 0.78rem; color: var(--muted); }
.avail-stat.over .v, .avail-stat.over .s { color: #f2c46d; }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 12px; }
.bar { text-align: center; }
.bar-track { height: 54px; background: rgba(0, 0, 0, 0.18); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.bar-fill { width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 0; }
.bar.over .bar-fill { background: #f2c46d; }
.bar.ahead .bar-track { background: transparent; border: 1px dashed var(--line); }
.bar.today .bar-track { outline: 2px solid #a6dc8c; outline-offset: 1px; }
.bar-day { font-size: 0.75rem; font-weight: 600; margin-top: 4px; }
.bar.today .bar-day { color: #a6dc8c; }
.bar-val { font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1em; }
@media (max-width: 640px) {
  .avail-grid { grid-template-columns: 1fr; }
  .tabs button { font-size: 0.9rem; }
}

/* Three short boxes in a row (Started · Duration · Ended) */
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
/* iPhone date boxes have a wide built-in size and centered text; keep them in their column */
input[type="date"] { min-width: 0; max-width: 100%; display: block; -webkit-appearance: none; appearance: none; min-height: 48px; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
/* Cancel and Save are the same width on a computer too */
.actions button:not(.left) { min-width: 120px; }
/* Same border on every action button, so Cancel and Save come out exactly equal */
.actions button { border: 2px solid transparent; }
.actions button[type="submit"] { border-color: var(--accent); }
.actions button.secondary { border-color: var(--line); }
.actions button.danger { border-color: var(--red); }
/* A box that's filled in automatically (like a wage set by age) looks read-only everywhere */
input:disabled, select:disabled { background: rgba(255, 255, 255, 0.1); color: var(--ink); border-color: transparent; -webkit-text-fill-color: var(--ink); opacity: 1; }
/* The dialog heading takes focus when a dialog opens; don't draw a ring around it */
dialog h2:focus { outline: none; }
/* Invoice: long job names wrap so Hours and Amount always stay on the sheet */
.sheet-table { table-layout: auto; }
.sheet-table th:first-child, .sheet-table td:first-child { white-space: normal; overflow-wrap: anywhere; width: 100%; }
@media (max-width: 640px) {
  .sheet-table th, .sheet-table td { padding: 9px 6px; }
  .sheet-table th:first-child, .sheet-table td:first-child { padding-left: 8px; }
  .sheet-table th:last-child, .sheet-table td:last-child { padding-right: 8px; }
}
/* Company headings inside the Jobs list */
.group-head { padding: 10px 14px 6px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: rgba(0, 0, 0, 0.14); border-bottom: 1px solid var(--line); }
.group-head.inactive { opacity: 0.6; }
.group-head .tag { margin-left: 6px; text-transform: none; letter-spacing: 0; }
/* Company headings stand apart from their jobs: darker band, cream bar, a gap before
   each new company, and the jobs indented beneath. */
#project-rows .group-head {
  background: rgba(0, 0, 0, 0.3); color: var(--ink);
  font-size: 0.85rem; font-weight: 800; letter-spacing: 0.07em;
  padding: 12px 14px 10px; border-left: 4px solid var(--accent); border-bottom: 1px solid var(--line);
}
#project-rows .item { padding-left: 28px; }
/* One card per company, with space between them */
.groups { display: grid; gap: 12px; }
