/* FTPBuilder web app – the same colours as the Windows app (windows/Ui.cs, Theme). */
:root {
  --bg: #0B1120;
  --panel: #0F172A;
  --card: #172033;
  --line: #26324A;
  --text: #E5E7EB;
  --muted: #94A3B8;
  --accent: #C8F135;
  --warn: #E3B341;
  --good: #3FB950;
  --off: #F0883E;
  --error: #F85149;
  --hover: #22304A;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

#app { display: flex; min-height: 100%; }
#nav { width: 210px; flex: none; background: var(--panel); padding: 22px 12px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 22px; margin: 4px 0 22px 16px; }
.brand b { color: var(--accent); font-weight: 800; }
#nav-items { display: flex; flex-direction: column; gap: 4px; }
#nav-items button { text-align: left; background: none; border: 0; border-radius: 8px; padding: 10px 16px; cursor: pointer; color: var(--text); font-size: 15px; }
#nav-items button:hover { background: var(--hover); }
#nav-items button.on { background: var(--hover); font-weight: 700; }
#nav-items button .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-left: 8px; vertical-align: middle; }
#nav-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 16px; }
#main { flex: 1; min-width: 0; padding: 26px 30px 40px; max-width: 1240px; }
.loading { color: var(--muted); padding: 40px; }

@media (max-width: 820px) {
  #app { flex-direction: column; }
  #nav { width: auto; height: auto; position: sticky; top: 0; z-index: 5; flex-direction: row; align-items: center; padding: 8px; overflow-x: auto; }
  .brand { display: none; }
  #nav-items { flex-direction: row; }
  #nav-items button { padding: 8px 12px; white-space: nowrap; }
  #nav-foot { display: none; }
  #main { padding: 16px 14px 40px; }
}

h1 { font-size: 28px; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 19px; margin: 0; font-weight: 700; }
h3 { font-size: 16px; margin: 0; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.good { color: var(--good); }
.warn { color: var(--warn); }
.off { color: var(--off); }
.error { color: var(--error); }
.accent { color: var(--accent); }
.bold { font-weight: 700; }

.col { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.split { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.wrap { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 980px) { .grid2 { grid-template-columns: 1fr; } }

.card { background: var(--card); border-radius: var(--radius); padding: 18px; border: 2px solid transparent; }
.card.flat { padding: 14px; }
.card.choice { cursor: pointer; width: 320px; max-width: 100%; }
.card.choice.on { border-color: var(--accent); }
.card.warn-border { border-color: var(--warn); }
.card.narrow { max-width: 760px; }
.sep { height: 1px; background: var(--line); margin: 6px 0; }

.btn { background: var(--hover); border: 0; border-radius: 8px; padding: 9px 16px; cursor: pointer; color: var(--text); white-space: nowrap; }
.btn:hover:not(:disabled) { background: #2C3B58; }
.btn.primary { background: var(--accent); color: #111; font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: #D8FF55; }
.btn.danger { color: var(--error); }
.btn.big { padding: 13px 26px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: default; }
.rpe-buttons { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; width: 100%; max-width: 480px; }
.rpe-buttons .btn { min-height: 44px; padding-inline: 0; }
@media (max-width: 560px) { .rpe-buttons { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.chip { background: var(--hover); border: 2px solid transparent; border-radius: 20px; padding: 6px 14px; cursor: pointer; color: var(--text); }
.chip.on { border-color: var(--accent); font-weight: 700; }

input[type=text], input[type=number], input[type=search], input[type=date], select, textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; width: 100%; }
label.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); width: 17px; height: 17px; }

table.facts { border-collapse: collapse; }
table.facts td { padding: 3px 24px 3px 0; vertical-align: top; }
table.facts td:last-child { font-weight: 700; padding-right: 0; }

.interval-report summary { cursor: pointer; font-weight: 700; }
.interval-report table { width: 100%; max-width: 520px; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.interval-report th, .interval-report td { padding: 5px 3px; text-align: right; border-bottom: 1px solid var(--line); }
.interval-report th { vertical-align: bottom; }

.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); }

svg { display: block; }
.chart { width: 100%; }

/* workouts */
.wlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.wcard { background: var(--card); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; border: 2px solid transparent; cursor: pointer; }
.wcard:hover { border-color: var(--line); }
.wcard.on { border-color: var(--accent); }
.cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }

/* plan calendar */
.cal { display: grid; grid-template-columns: 118px repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .head { font-size: 12px; color: var(--muted); padding-left: 8px; text-transform: uppercase; }
.cal .side { padding-top: 8px; }
.cal .cell { min-height: 80px; border-radius: 8px; padding: 7px 8px; background: var(--card); border: 2px solid transparent; cursor: pointer; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal .cell.rest { background: var(--panel); }
.cal .cell.today { border-color: var(--muted); }
.cal .cell.sel { border-color: var(--accent); }
.cal .bar { height: 4px; border-radius: 2px; }
.cal .name { font-size: 12.5px; font-weight: 700; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal .foot { font-size: 11.5px; }
@media (max-width: 820px) {
  .cal { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .cal .side { grid-column: 1 / -1; display: flex; gap: 10px; align-items: baseline; padding-top: 6px; }
  .cal .corner { display: none; }
  .cal .cell { min-height: 64px; padding: 5px; }
  .cal .name { font-size: 11px; }
}

.weekstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekstrip .cell { background: var(--panel); border-radius: 8px; padding: 8px; min-height: 96px; border: 2px solid transparent; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.weekstrip .cell.today { border-color: var(--accent); }

/* ride */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metrics.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { background: var(--card); border-radius: var(--radius); padding: 14px 10px; text-align: center; }
.metric .v { font-size: 52px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric .u { color: var(--muted); font-size: 13px; }
@media (max-width: 820px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .metric .v { font-size: 38px; } }

.devices { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.status-dot.on { background: var(--good); }
.status-dot.busy { background: var(--warn); }

/* coach */
.chat { display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 760px; border-radius: 14px; padding: 12px 16px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.user { background: #24375A; align-self: flex-end; }
.bubble.assistant { background: var(--card); align-self: flex-start; }
.proposal { border: 2px solid var(--accent); border-radius: 12px; padding: 14px; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; white-space: normal; }
.compose { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 4px; display: flex; gap: 10px; align-items: flex-end; }
.compose textarea { min-height: 46px; max-height: 200px; }

/* toast and dialogs */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #26324A; color: var(--text); padding: 10px 18px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.4); z-index: 20; max-width: 90vw; }
#modal { position: fixed; inset: 0; background: rgba(5, 9, 18, .72); z-index: 15; display: flex; align-items: center; justify-content: center; padding: 20px; }
#modal .dialog { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: 980px; width: 100%; max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
#modal .dialog.small { max-width: 460px; }

.signin { max-width: 520px; margin: 8vh auto; text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.signin .brand { font-size: 40px; margin: 0; }

.list-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.recent-ride { display: grid; grid-template: "date name stats source" / 92px minmax(0, 1fr) auto 80px; }
.recent-ride-date { grid-area: date; }
.recent-ride-name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-ride-stats { grid-area: stats; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.recent-ride-source { grid-area: source; text-align: right; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .recent-ride { grid-template: "name name" "date source" "stats stats" / 1fr minmax(0, 1fr); gap: 4px 12px; }
}
.zones { display: flex; height: 14px; border-radius: 4px; overflow: hidden; }
.pill { display: inline-block; background: var(--panel); border-radius: 6px; padding: 3px 8px; margin: 0 6px 6px 0; font-size: 13px; }
