/* FITTO Control Panel: one stylesheet, system fonts, tables first, phone layout under 600 px. */
:root { --ink: #1c2230; --muted: #5b6474; --line: #dfe3ea; --bg: #f5f6f8; --card: #fff; --accent: #1f3b73; --accent-ink: #fff; --ok: #1b5e33; --warn: #7a3d00; --bad: #7a1f16; --radius: 6px; }
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.4; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.93em; }
.muted { color: var(--muted); } .small { font-size: 0.86em; } .nowrap { white-space: nowrap; } .right { text-align: right; }
.ext { font-size: 0.8em; color: var(--muted); }
h1 { font-size: 1.45rem; margin: 0 0 0.6rem; } h2 { font-size: 1.1rem; margin: 1.4rem 0 0.5rem; } h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
h1 .count { font-weight: 400; color: var(--muted); font-size: 0.8em; margin-left: 0.5rem; }
.counts { color: var(--muted); margin: 0 0 0.6rem; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; padding: 0.5rem 1rem; background: var(--accent); color: var(--accent-ink); }
.brand { color: #fff; font-weight: 700; letter-spacing: 0.02em; font-size: 1.1rem; } .brand span { font-weight: 300; margin-left: 0.3rem; opacity: 0.85; }
.search { display: flex; gap: 0.3rem; flex: 1 1 260px; max-width: 520px; } .search input { flex: 1; min-width: 0; }
.nav { display: flex; flex-wrap: wrap; gap: 0.1rem 0.2rem; } .nav a { color: #e8ecf5; padding: 0.3rem 0.55rem; border-radius: var(--radius); } .nav a.active, .nav a:hover { background: rgba(255,255,255,0.16); color: #fff; text-decoration: none; }
.who { margin-left: auto; font-size: 0.9em; color: #e8ecf5; } .who a { color: #fff; margin-left: 0.5rem; } .role { background: rgba(255,255,255,0.2); padding: 0.05rem 0.4rem; border-radius: 10px; font-size: 0.85em; text-transform: capitalize; }
.page { padding: 1rem; max-width: 1500px; margin: 0 auto; }
.foot { padding: 1rem; color: var(--muted); font-size: 0.85em; text-align: center; }
.banner { padding: 0.6rem 1rem; margin: 0; } .banner.warn { background: #fce8cc; color: var(--warn); } .banner.info { background: #e3f2fd; color: #0b4a7a; } .banner.ok { background: #dbf5e3; color: var(--ok); }

/* controls */
input, select, textarea, button { font: inherit; }
input[type=search], input[type=text], input[type=date], input[type=number], input[type=email], select, textarea { padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); }
.btn { display: inline-block; padding: 0.38rem 0.75rem; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: #fff; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { text-decoration: none; filter: brightness(1.1); } .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--accent); } .btn.small { padding: 0.2rem 0.5rem; font-size: 0.85em; } .btn.export { margin-left: auto; background: #2d6a4f; border-color: #2d6a4f; } .btn.danger { background: #a3261b; border-color: #a3261b; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: flex-end; padding: 0.7rem; margin: 0 0 0.8rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.filters label { display: flex; flex-direction: column; font-size: 0.8em; color: var(--muted); gap: 0.15rem; } .filters label > * { font-size: 1rem; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; padding: 0.5rem 0.7rem; margin: 0.4rem 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.actions .sel { color: var(--muted); font-size: 0.9em; margin-right: 0.4rem; }
.pager { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; align-items: center; justify-content: flex-end; margin: 0.6rem 0; color: var(--muted); font-size: 0.9em; }
.pager .pages { display: inline-flex; gap: 0.25rem; align-items: center; } .pager .current { color: var(--ink); padding: 0 0.3rem; } .pager .gap { padding: 0 0.2rem; }
.pager .sizes { display: inline-flex; gap: 0.35rem; align-items: center; } .sizelink { color: var(--accent); padding: 0 0.2rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: center; padding: 0.3rem 1rem; background: #eef1f6; color: var(--muted); font-size: 0.82em; border-bottom: 1px solid var(--line); }
.whotoggle { display: inline-flex; gap: 0.2rem; margin: 0 0 0.6rem; } .whotoggle a { padding: 0.3rem 0.7rem; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: var(--radius); } .whotoggle a.active { background: var(--accent); color: #fff; border-color: var(--accent); } .whotoggle a:hover { text-decoration: none; }
tr.who-human td:first-child { box-shadow: inset 3px 0 0 #c96a00; } tr.needs-person td:first-child { box-shadow: inset 3px 0 0 #c96a00; }
.intro { color: var(--muted); margin: 0 0 0.8rem; } .intro b { color: var(--ink); }
.tilegroup { margin-bottom: 0.4rem; } .tilegroup h2 { margin: 0.6rem 0 0.4rem; font-size: 1rem; }
.badge { display: inline-block; padding: 0.08rem 0.5rem; border-radius: 10px; font-size: 0.82em; white-space: nowrap; font-weight: 500; }
.dot { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 50%; margin-right: 0.35rem; vertical-align: -1px; }
.empty { color: var(--muted); padding: 1rem; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.thumb { width: 48px; height: 48px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 4px; vertical-align: middle; }
.thumb.big { width: 160px; height: 160px; } .thumb.mid { width: 96px; height: 96px; }
.asin-cell { display: inline-flex; align-items: center; gap: 0.4rem; } .asin-cell .thumb { width: 36px; height: 36px; flex: 0 0 36px; }
#toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; max-width: 420px; }
.toast { padding: 0.6rem 0.9rem; border-radius: var(--radius); background: #1c2230; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,0.25); animation: fade 6s forwards; } .toast.warn { background: #a3261b; }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* tables */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.92em; }
th, td { padding: 0.4rem 0.55rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
td { white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
td.wrap, td.num { max-width: none; }
th { background: #eef1f6; color: #2b3c66; font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; } tbody tr:hover { background: #f8f9fc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.status-done td, tr.status-ignore td { color: var(--muted); }
td .clip { display: inline-block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
td.wrap { white-space: normal; min-width: 240px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; } .card h2, .card h3 { margin-top: 0; }

/* home */
.strip { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.8rem; }
.strip .item { flex: 1 1 180px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.7rem; font-size: 0.9em; } .strip .item b { display: block; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.tile { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.8rem; color: var(--ink); } .tile:hover { text-decoration: none; border-color: var(--accent); }
.tile-value { font-size: 1.6rem; font-weight: 600; line-height: 1.1; } .tile-label { color: var(--muted); font-size: 0.85em; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.chart svg { width: 100%; height: auto; display: block; } .chart .legend { display: flex; gap: 1rem; font-size: 0.8em; color: var(--muted); margin-top: 0.3rem; } .legend i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; vertical-align: -1px; }
.bars { display: grid; grid-template-columns: max-content 1fr max-content; gap: 0.3rem 0.6rem; align-items: center; font-size: 0.88em; } .bars .bar { height: 12px; background: #e8edf7; border-radius: 3px; overflow: hidden; } .bars .bar i { display: block; height: 100%; background: var(--accent); }
.images { display: flex; flex-wrap: wrap; gap: 1rem; } .images figure { margin: 0; text-align: center; font-size: 0.85em; color: var(--muted); } .images img { max-width: 200px; max-height: 200px; border: 1px solid var(--line); background: #fff; }
.sign-in { max-width: 420px; margin: 4rem auto; text-align: center; }
details.more summary { cursor: pointer; color: var(--accent); }
.progress { display: inline-block; width: 120px; height: 8px; background: #e8edf7; border-radius: 4px; overflow: hidden; vertical-align: middle; } .progress i { display: block; height: 100%; background: #2d6a4f; animation: slide 1.5s infinite linear; width: 40%; }
@keyframes slide { from { margin-left: -40%; } to { margin-left: 100%; } }
pre.log { white-space: pre-wrap; font-size: 0.82em; background: #fff; border: 1px solid var(--line); padding: 0.6rem; border-radius: var(--radius); max-height: 320px; overflow: auto; }

/* phone: tables become cards, search and the status strip stay on top */
@media (max-width: 600px) {
  html { font-size: 14px; }
  .page { padding: 0.6rem; }
  .top { padding: 0.4rem 0.6rem; } .who { font-size: 0.8em; width: 100%; margin-left: 0; }
  .nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; } .nav a { flex: 0 0 auto; }
  .filters label { flex: 1 1 45%; } .btn.export { margin-left: 0; }
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border-bottom: 6px solid var(--bg); padding: 0.3rem 0; }
  table.cards td { border: 0; padding: 0.15rem 0.6rem; display: grid; grid-template-columns: 38% 1fr; gap: 0.5rem; text-align: left !important; white-space: normal; max-width: none; overflow: visible; }
  table.cards td::before { content: attr(data-h); color: var(--muted); font-size: 0.82em; }
  table.cards td:empty { display: none; }
  td .clip { max-width: 100%; white-space: normal; }
  .tile-value { font-size: 1.3rem; }
}
