:root {
  color-scheme: dark;
  --bg: #121417;
  --card: #1c2025;
  --line: #2c3239;
  --text: #f2f4f6;
  --muted: #9aa4ae;
  --accent: #e0483e;
  --good: #3fa66b;
  --warn: #d9a43a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.brand span { font-weight: 400; color: var(--muted); font-size: .9rem; }

main { max-width: 640px; margin: 0 auto; padding: 8px 16px 40px; }
footer { text-align: center; padding: 24px 16px; font-size: .85rem; }
footer a, small a, .card a { color: inherit; }

h1 { font-size: 1.6rem; margin: 24px 0 12px; }
h2 { font-size: 1.1rem; margin: 28px 0 8px; color: var(--muted); font-weight: 600; }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label { display: flex; flex-direction: column; gap: 4px; font-size: .95rem; }

input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 0;
}
input:focus { outline: 2px solid var(--accent); border-color: transparent; }

button {
  font: inherit;
  color: var(--text);
  background: #2f353d;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); font-weight: 600; }
button.link { background: none; padding: 0; color: var(--text); text-decoration: underline; }
button.small { padding: 6px 10px; font-size: .9rem; }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.wrap input { flex: 1 1 200px; }
.row.wrap input.short { flex: 0 1 140px; }

.muted { color: var(--muted); }
.big { font-size: 1.3rem; font-weight: 600; margin: 0; }
.error { color: #ff8a80; }
.good-text { color: var(--good); }
.warn-text { color: var(--warn); }

.banner {
  border: 1px solid var(--warn);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 16px;
}
.banner.good { border-color: var(--good); }
.banner.warn { border-color: var(--warn); }
button.danger { background: none; border: 1px solid var(--warn); color: var(--warn); }
.banner p { margin: 0 0 8px; }
.banner.good p { margin: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: 0; }
.list .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list .off { color: var(--muted); text-decoration: line-through; }

.steps { margin: 0; padding-left: 20px; }
.steps li { margin: 4px 0; }
.card p { margin: 0; }

/* Links that look like buttons (Logs on the account page). */
a.button {
  display: inline-block;
  color: var(--text);
  background: #2f353d;
  border-radius: 8px;
  padding: 10px 16px;
  text-decoration: none;
}
a.button.primary { background: var(--accent); font-weight: 600; }
a.button.small { padding: 6px 10px; font-size: .9rem; }
a.link { color: var(--text); }

/* Logs page ------------------------------------------------------------ */

body.wide main { max-width: 960px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 24px 0 12px; }
.page-head h1 { margin: 0; flex: 1; min-width: 200px; }
.page-head .actions { display: flex; gap: 10px; }
.small { font-size: .88rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
}
.toolbar .spacer { flex: 1; }
label.inline { flex-direction: row; align-items: center; gap: 6px; }
label.inline input, label.inline select { padding: 6px 8px; }
select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.tabs { display: flex; gap: 4px; background: var(--card); padding: 4px; border-radius: 10px; }
.tab { background: none; padding: 8px 14px; }
.tab.on { background: #2f353d; font-weight: 600; }

h3.day { font-size: 1rem; color: var(--muted); margin: 22px 0 8px; font-weight: 600; }

.log {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.log p { margin: 4px 0; }
.log.cleaning { background: #1a2a22; border-left: 4px solid var(--good); }
.top-line { flex-wrap: wrap; }
.top-line .grow { flex: 1; min-width: 140px; }
.pill { background: #2f353d; border-radius: 999px; padding: 2px 10px; font-size: .85rem; }
.log details { margin-top: 6px; }
.log summary { cursor: pointer; color: var(--muted); }
.log ul { margin: 6px 0; padding-left: 20px; }
.log .group p { margin-top: 8px; }
.note { font-size: .92rem; }
.note.wait { color: var(--warn); }
.note.bad { color: #ff8a80; }
.history .edit { border-left: 2px solid var(--line); padding-left: 10px; margin: 8px 0; }
.history .edit ul { font-size: .9rem; }

dialog {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog form { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
dialog h2 { margin: 0; color: var(--text); font-size: 1.25rem; }
dialog p { margin: 0; }
fieldset.card { border: 0; margin: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 4px; float: left; width: 100%; }
.card.sign { border: 1px solid var(--warn); }
.row.end { justify-content: flex-end; }

/* Printing: only the grind log table, laid out like the app's PDF. ------ */

.print-only { display: none; }

@media print {
  @page { size: letter landscape; margin: 0.4in; }
  :root { color-scheme: light; }
  html, body { background: #fff; color: #000; font-size: 8.5pt; }
  .print-head strong { white-space: nowrap; padding: 0 4pt 0 12pt; }
  .no-print, dialog, footer { display: none !important; }
  .print-only { display: block; }
  .print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1.5pt solid #000;
    padding-bottom: 4pt;
    margin-bottom: 6pt;
  }
  .print-head h1 { font-size: 13.5pt; margin: 0; }
  .print-head p { margin: 0; }
  .print-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .print-table thead { display: table-header-group; }
  .print-table th {
    background: #e0e0e0;
    text-align: left;
    border-top: .8pt solid #424242;
    border-bottom: .8pt solid #424242;
  }
  .print-table th, .print-table td {
    padding: 2pt 3pt;
    vertical-align: top;
    white-space: pre-line;
    overflow-wrap: anywhere;
  }
  .print-table td { border-top: .3pt solid #9e9e9e; }
  .print-table tr.first td { border-top: .8pt solid #424242; }
  .print-table tr.clean td { background: #f5f5f5; font-weight: bold; }
  .print-table tr { break-inside: avoid; }
  .print-table th:nth-child(1) { width: 12%; }
  .print-table th:nth-child(2) { width: 14%; }
  .print-table th:nth-child(3) { width: 17%; }
  .print-table th:nth-child(4) { width: 13%; }
  .print-table th:nth-child(5) { width: 8%; }
  .print-table th:nth-child(6) { width: 10%; }
  .print-table th:nth-child(7) { width: 12%; }
  .print-table th:nth-child(8) { width: 8%; }
  .print-table th:nth-child(9) { width: 6%; }
  .print-foot { font-size: 7pt; color: #616161; margin-top: 6pt; }
}
