/* One look, site-wide: a plain spreadsheet - white background, black grid
   borders, green header/name cells, amber input cells. No dark mode. */
:root {
  --bg: #ffffff;
  --panel: #f1f3f4;
  --green: #93c47d;
  --green-dark: #6aa84f;
  --amber: #ffe599;
  --fg: #1a1a1a;
  --muted: #555555;
  --border: #333333;
  --danger: #cc0000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 Arial, "Segoe UI", system-ui, sans-serif;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

main { max-width: 760px; margin: 0 auto; padding: 16px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 16px;
  background: var(--green);
  border-bottom: 1px solid var(--border);
}
.topbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.brand { font-weight: 700; color: var(--fg); white-space: nowrap; }
.mainnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.mainnav a {
  color: var(--fg);
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: .85rem;
  white-space: nowrap;
}
.mainnav a:hover { text-decoration: none; background: rgba(0, 0, 0, .08); }
.mainnav a.active {
  background: var(--amber);
  border-color: var(--border);
  font-weight: 700;
}
.topbar form { display: inline; margin: 0; }
.topbar-right a { color: var(--fg); font-weight: 600; }

h1 { font-size: 1.3rem; margin: .2em 0 .6em; }
h2 { font-size: 1.05rem; margin: 1.2em 0 .4em; }

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

label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }

input, textarea, button {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 9px;
}
input:focus, textarea:focus { outline: 2px solid var(--green-dark); outline-offset: -1px; }

button {
  background: var(--green);
  border-color: var(--border);
  color: var(--fg);
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: var(--green-dark); }

.btn {
  display: inline-block;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 9px 14px;
  text-align: center;
  cursor: pointer;
}
.btn:hover { background: var(--panel); }
.btn.primary { background: var(--green); font-weight: 700; }
.btn.primary:hover { background: var(--green-dark); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--bg); }
.btn.rm { padding: 9px; }

.linkbtn {
  background: none;
  border: none;
  color: var(--green-dark);
  padding: 0;
  font-weight: 700;
  cursor: pointer;
}

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.row:hover { text-decoration: none; background: var(--panel); }
.row .date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .82rem; white-space: nowrap; }
.row .title { flex: 1; color: var(--fg); font-weight: 700; }
.row .who { color: var(--muted); font-size: .82rem; }
.row .who.me { color: var(--green-dark); font-weight: 700; }

.meta, .notes, .people { color: var(--muted); }
.notes { white-space: pre-wrap; }
.error { color: var(--danger); }

.tablewrap { overflow-x: auto; }

/* Sets/reps/weight logging table - the reference spreadsheet look, and now
   the one visual language the rest of the site matches too. */
table.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  background: var(--bg);
  color: var(--fg);
}
table.sheet th, table.sheet td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
table.sheet thead th { background: var(--green); font-weight: 700; }
table.sheet .sheet-name { background: var(--green); min-width: 130px; }
table.sheet .sheet-input { background: var(--amber); min-width: 90px; }
.sheet-exname { font-weight: 700; }
.sheet-exname-input { font-weight: 700; margin-bottom: 4px; }
.newexrow-rmcell { text-align: center; vertical-align: middle; width: 1%; }
.newexwrap { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.sheet-target { margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.sheet-x { white-space: nowrap; }

.setstack { display: flex; flex-direction: column; gap: 4px; }
.setline { display: flex; align-items: center; gap: 4px; }
.setlabel { font-weight: 700; white-space: nowrap; }
table.sheet .setbox {
  width: 56px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--fg);
  padding: 2px 4px;
  font-size: .82rem;
}
table.sheet .setbox:disabled { opacity: .6; background: var(--panel); }

table.sheet .notesbox {
  width: 100%;
  min-width: 90px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--fg);
  padding: 4px 6px;
  font: inherit;
  font-size: .82rem;
  resize: vertical;
}
table.sheet .setsbox { width: 56px; min-width: 56px; flex: 0 0 auto; resize: none; }
table.sheet .notesbox:disabled { opacity: .6; background: var(--panel); }

.exrow {
  display: grid;
  grid-template-columns: 1fr 68px 68px 84px 1fr auto;
  gap: 6px;
  margin-bottom: 6px;
}
.exrow input { padding: 8px; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.deleteform { margin-top: 10px; }
.actions form { display: inline; margin: 0; }

.pagehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.weekgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  align-items: start;
}
.daybox {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px;
}
.daybox.today { border-color: var(--green-dark); box-shadow: 0 0 0 1px var(--green-dark) inset; }
.daybox:has(table.sheet) { grid-column: 1 / -1; }
.daybox summary {
  cursor: pointer;
  list-style: none;
}
.daybox summary::-webkit-details-marker { display: none; }
.daybox-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.daybox-head::after {
  content: "\25BE";
  color: var(--muted);
  font-size: .7rem;
  margin-left: 6px;
}
.daybox[open] .daybox-head::after { content: "\25B4"; }
.dayname { font-weight: 700; font-size: .9rem; }
.daydate { color: var(--muted); font-size: .78rem; display: inline-flex; align-items: center; gap: 5px; }
.daydot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-dark);
  display: inline-block;
}
.daybody { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.daynone { color: var(--muted); font-size: .78rem; margin: 0; }

.dayworkout {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dayworkout-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.dayworkout .wtitle { font-size: .85rem; font-weight: 700; }
.dayworkout .wwho { font-size: .72rem; color: var(--muted); }
.dayworkout .wwho.me { color: var(--green-dark); }
.wnotes { font-size: .78rem; color: var(--muted); margin: 0; white-space: pre-wrap; }
.wexlist { list-style: none; margin: 0; padding: 0; font-size: .78rem; display: flex; flex-direction: column; gap: 2px; }
.daylink { font-size: .78rem; align-self: flex-start; }

.placeholder {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.placeholder h1 { font-size: 2rem; margin: 0; }

.levelcard {
  background: var(--green);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 40px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.level-label { color: var(--fg); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.level-number { font-size: 4rem; font-weight: 700; color: var(--fg); line-height: 1; }
.level-sub { color: var(--fg); margin-top: 8px; }
.hint { color: var(--muted); text-align: center; margin-top: 16px; }

@media (max-width: 560px) {
  .exrow { grid-template-columns: 1fr 1fr 1fr auto; }
  .exrow input[name="ex_name"] { grid-column: 1 / -1; }
  .exrow input[name="ex_notes"] { grid-column: 1 / -1; }
}
