/* MOCI Gym — dark "equipment console" theme inspired by Technogym's premium look.
   To change the accent colour, edit --accent (and --accent-ink for text on it). */
:root {
  --accent: #ffd100;        /* energy yellow */
  --accent-ink: #111111;    /* text on accent */
  --accent-soft: rgba(255, 209, 0, .12);
  --bg: #0d0e10;            /* page */
  --surface: #17191c;       /* cards */
  --surface-2: #202328;     /* inputs, nested blocks */
  --line: #2c3036;
  --text: #f3f4f5;
  --muted: #9aa0a8;
  --ok: #3ddc84;
  --warn: #ffb020;
  --danger: #ff5a52;
  --radius: 14px;
  --head: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); background: var(--bg); color: var(--text); font-size: 15.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--head); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 .6rem; line-height: 1.1; font-weight: 700; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; }
h2 a, h3 a { color: var(--text); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; padding: 3rem 1rem; }
.hidden { display: none !important; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: .8rem; }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 4px; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: #000; color: #fff;
  display: flex; align-items: center; gap: .7rem; padding: .7rem 16px; border-bottom: 3px solid var(--accent);
}
.topbar .title { font-family: var(--head); font-weight: 700; font-size: 1.35rem; letter-spacing: .14em; text-transform: uppercase; flex: 1; }
.topbar .who { font-size: .82rem; color: var(--muted); }
.topbar button { background: transparent; color: #fff; border: 1px solid #3a3f46; }
.nav { display: flex; gap: .2rem; background: #000; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.nav a {
  text-decoration: none; color: var(--muted); padding: .75rem .8rem; white-space: nowrap; position: relative;
  font-family: var(--head); text-transform: uppercase; letter-spacing: .08em; font-size: .98rem; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--accent); border-bottom-color: var(--accent); }
.badge {
  display: inline-block; min-width: 1.2rem; padding: 0 .35rem; border-radius: 999px; background: var(--danger); color: #fff;
  font-family: var(--body); font-size: .7rem; line-height: 1.2rem; text-align: center; margin-left: .3rem; letter-spacing: 0; vertical-align: 1px;
}
main { max-width: 920px; margin: 0 auto; padding: 20px 16px 90px; }

@media (max-width: 640px) {
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; border-top: 1px solid var(--line); border-bottom: 0;
    justify-content: space-around; padding: 0 4px env(safe-area-inset-bottom);
  }
  .nav a { font-size: .8rem; padding: .7rem .4rem; border-bottom: 0; border-top: 3px solid transparent; }
  .nav a.on { border-top-color: var(--accent); }
  .topbar .who { display: none; }
  h1 { font-size: 1.5rem; }
}

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.tight { padding: 11px 13px; }
.card h2, .card h3 { margin-bottom: .4rem; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tile { cursor: pointer; padding: 0; overflow: hidden; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile img, .tile .noimg { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--surface-2); }
.tile .noimg { display: flex; align-items: center; justify-content: center; font-size: 2.6rem; }
.tile .body { padding: 11px 13px; }
.tile .body b { font-family: var(--head); text-transform: uppercase; letter-spacing: .04em; font-size: 1.05rem; }
.grid.stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid.stats .card { margin-bottom: 0; padding: 12px; }
@media (max-width: 640px) { .stat { font-size: 1.6rem !important; } .grid.stats .small { font-size: .72rem; } }
.stat { font-family: var(--head); font-size: 2.3rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.pill { display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: rgba(61, 220, 132, .13); color: var(--ok); }
.pill.warn { background: rgba(255, 176, 32, .14); color: var(--warn); }
.pill.grey { background: var(--surface-2); color: var(--muted); }

/* ---------- forms ---------- */
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .25rem; text-transform: uppercase; letter-spacing: .05em; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text);
}
input::placeholder, textarea::placeholder { color: #6b717a; }
input:disabled { opacity: .6; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type="checkbox"] { accent-color: var(--accent); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
.fields { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.fields .full { grid-column: 1 / -1; }
button, .btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 10px;
  padding: .6rem 1rem; cursor: pointer; text-decoration: none; display: inline-block; font-size: .95rem; font-weight: 500;
}
button:hover, .btn:hover { border-color: #4a5058; }
button.primary, .btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  font-family: var(--head); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-size: 1.05rem;
}
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); }
button.small.primary, .btn.small.primary { font-size: .9rem; }
button.danger { color: var(--danger); border-color: rgba(255, 90, 82, .35); background: transparent; }
button.link { border: 0; background: none; color: var(--accent); padding: .2rem .3rem; }
button.small, .btn.small { padding: .32rem .65rem; font-size: .85rem; }
button:disabled { opacity: .55; cursor: default; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- auth ---------- */
.auth { max-width: 400px; margin: 7vh auto; padding: 0 16px; }
.auth .logo { text-align: center; margin-bottom: 1.4rem; }
.auth .logo img { width: 72px; }
.auth .logo h1 { font-size: 2.2rem; letter-spacing: .16em; margin-top: .6rem; }
.auth .logo h1::after { content: ""; display: block; width: 48px; height: 4px; background: var(--accent); margin: .5rem auto 0; }

/* ---------- workout logging ---------- */
.ex { border-left: 4px solid var(--accent); }
.ex h3 { font-size: 1.2rem; }
.ex .target { font-size: .9rem; color: var(--muted); }
.sets { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.sets th { font-size: .72rem; color: var(--muted); font-weight: 500; text-align: left; padding: 0 .3rem .25rem; text-transform: uppercase; letter-spacing: .06em; }
.sets td { padding: .2rem .3rem; }
.sets td:first-child { width: 2.4rem; color: var(--accent); font-family: var(--head); font-size: 1.2rem; font-weight: 700; text-align: center; }
.sets input { text-align: center; padding: .55rem .3rem; font-size: 1.05rem; font-weight: 600; }
.last { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* ---------- tables ---------- */
table.list { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.list th, table.list td { text-align: left; padding: .6rem .45rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list th { font-size: .72rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.scroll-x { overflow-x: auto; }

/* ---------- plan builder ---------- */
.day { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--surface); border-top: 3px solid var(--accent); }
.bex { display: grid; gap: .45rem; grid-template-columns: 2fr .6fr .8fr .8fr .8fr auto; align-items: end; margin-bottom: .6rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.bex .note { grid-column: 1 / -2; }
@media (max-width: 640px) {
  .bex { grid-template-columns: 1fr 1fr 1fr; }
  .bex .exsel, .bex .note { grid-column: 1 / -1; }
}

/* ---------- chart ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); }
.chart .lineplot { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart text { fill: var(--muted); font-size: 11px; }

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto; }
.modal-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); width: 100%; max-width: 640px; padding: 20px 16px; position: relative; }
.modal-close { position: absolute; top: 8px; right: 8px; border: 0; background: none; font-size: 1.2rem; color: var(--muted); }
.media img, .media video, .media iframe { width: 100%; border-radius: 10px; border: 0; margin-bottom: .6rem; background: #000; }
.media iframe { aspect-ratio: 16 / 9; height: auto; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 60; max-width: 90vw;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; padding: .65rem 1.1rem; border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
}
.toast.error { background: var(--danger); color: #fff; }
