* { box-sizing: border-box; }
:root {
  --ink: #14171c; --muted: #566070; --line: #e2e5ea; --soft: #f4f5f7;
  --accent: #e8590c; --accent-dark: #c94a06; --accent-soft: #fff0e6; --warn: #8a5300; --warn-soft: #fff6e0; --bad: #b42318;
}
html { background: var(--soft); }
body { margin: 0; color: var(--ink); font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); }
h1 { font-size: 15px; margin: 0; }
h2 { font-size: 13px; margin: 0; }
main { max-width: 760px; margin: 0 auto; padding: 12px 12px 32px; display: flex; flex-direction: column; gap: 10px; }
section, .card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
small { color: var(--muted); font-size: 12px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.drop { border: 2px dashed #c2c8d2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

button { font: inherit; cursor: pointer; border-radius: 8px; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ghost { height: 32px; padding: 0 12px; border: 1px solid #c2c8d2; background: #fff; color: var(--ink); white-space: nowrap; }
.ghost:hover { background: var(--soft); }
.ghost:disabled { opacity: .6; cursor: default; }
.ghost.icon { width: 34px; height: 34px; padding: 0; font-size: 16px; flex-shrink: 0; }
.ghost.big { flex: 1; height: 38px; font-weight: 700; }
.ghost.wide { width: 100%; }
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 2px; font-size: 12px; }
.primary { height: 38px; border: 0; background: var(--accent); color: #fff; font-weight: 800; letter-spacing: .03em; width: 100%; }
.primary:hover { background: var(--accent-dark); }
.primary:disabled { background: #c2c8d2; cursor: default; }

.error { margin: 0; padding: 8px 12px; border-radius: 8px; background: #fdecea; color: var(--bad); font-weight: 600; white-space: pre-line; }
.head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }

.table-wrap { overflow-x: auto; position: relative; } /* keeps the hidden .sr label inside */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 5px 6px; border-bottom: 1px solid #eef0f3; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.file { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
td.rm button { width: 26px; height: 26px; border: 0; background: none; color: var(--muted); font-size: 16px; }
td.rm button:hover { background: var(--soft); color: var(--bad); }

.warnings { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.warnings:empty { display: none; }
.warnings li { background: var(--warn-soft); color: var(--warn); padding: 5px 10px; border-radius: 6px; font-size: 12px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 0; border: 0; padding: 0; min-width: 0; }
.field > label, legend { font-weight: 600; font-size: 12px; color: var(--muted); padding: 0; }
.inline { display: flex; gap: 6px; }
input[type=text], input[type=datetime-local], select {
  height: 34px; border: 1px solid #c2c8d2; border-radius: 8px; padding: 0 8px; font: inherit; color: inherit; background: #fff; min-width: 0; width: 100%;
}
.custom { margin-top: 2px; }
.unit { align-self: center; color: var(--muted); white-space: nowrap; }
#pace.bad { border-color: var(--bad); outline-color: var(--bad); }
#paceNote.changed { color: var(--accent-dark); font-weight: 600; }
.seg { display: flex; border: 1px solid #c2c8d2; border-radius: 8px; overflow: hidden; height: 34px; }
.seg .radio { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-weight: 700; }
.seg .radio + .radio { border-left: 1px solid #c2c8d2; }
.seg .radio:has(input:checked) { background: var(--accent-soft); color: var(--accent-dark); }
.radio input, .check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.radio.off, .check.off { opacity: .5; cursor: default; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; margin: 10px 0 0; }
.check-note { display: block; margin: 2px 0 0 24px; color: var(--accent-dark); }

.summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.summary div { background: var(--soft); border-radius: 8px; padding: 4px 9px; display: flex; gap: 6px; align-items: baseline; }
.summary dt { color: var(--muted); font-size: 11.5px; }
.summary dd { margin: 0; font-weight: 700; font-size: 12.5px; }

.progress { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
main > .progress { margin: 0; }
.bar { height: 6px; border-radius: 99px; background: #eef0f3; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .2s ease; }
.progress.done .bar span { background: #17894f; }

.ready { margin-top: 8px; padding: 10px; border: 1px solid #b7e2c8; background: #effaf3; border-radius: 10px; }
.ready-line { margin: 0 0 8px; color: #11643a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ready-line span { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; }
.actions .primary { flex: 2; }
.stale { margin: 8px 0 0; color: var(--warn); font-size: 12px; }

.help { margin-top: 10px; color: var(--muted); font-size: 12px; }
.help summary { cursor: pointer; width: fit-content; }
.steps { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.steps a { color: var(--accent-dark); }
/* The web page (app.agwalk.com) adds class "web" to <html>; the extension "ext". */
.web .ext-only, html:not(.web) .web-only { display: none; }
.head-link { margin-left: auto; color: var(--accent-dark); font-weight: 600; text-decoration: none; white-space: nowrap; }

@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .drop { flex-direction: column; align-items: stretch; text-align: center; }
  #files th:nth-child(-n+2), #files td:nth-child(-n+2) { display: none; } /* # and file name */
}

/* The web page is the phone layout everywhere: on a computer it's a
   phone-width column in the middle (the owner's choice), with the same
   one-column rules as small screens above. */
html.web { background: #e9ebef; }
.web body { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--soft); box-shadow: 0 0 0 1px var(--line); }
.web header { position: sticky; top: 0; z-index: 1; }
.web h1 { font-size: 14px; }
.web .grid { grid-template-columns: 1fr; }
.web .drop { flex-direction: column; align-items: stretch; text-align: center; }
.web #files th:nth-child(-n+2), .web #files td:nth-child(-n+2) { display: none; }
