/* ============================================================
   IRONSTACK — WORKOUT SAVING PLANNER
   Design tokens:
   bg-0 #0A0A0D | bg-1 #131318 | bg-2 #1B1B22 | line rgba(255,255,255,.08)
   red #FF2E55 | purple #8B5CF6 | text #F2F2F5 | muted #85858F | ok #22C55E
   Display: Oswald (condensed/stamped) | Body: Inter | Numeric: JetBrains Mono
   Signature: barbell-load progress bar (plates fill the bar as % of goal)
   ============================================================ */
:root{
  --bg-0:#0A0A0D; --bg-1:#131318; --bg-2:#1B1B22; --bg-3:#232330;
  --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.14);
  --red:#FF2E55; --red-dim:#B0243E; --purple:#8B5CF6; --purple-dim:#6D46C7;
  --grad: linear-gradient(90deg, var(--red), var(--purple));
  --text:#F2F2F5; --muted:#8A8A93; --dim:#5C5C66; --ok:#22C55E; --warn:#F59E0B;
  --radius:16px; --radius-sm:10px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
*{box-sizing:border-box; margin:0; padding:0;}
html{-webkit-tap-highlight-color:transparent;}
body{
  background:radial-gradient(1200px 600px at 80% -10%, rgba(139,92,246,.12), transparent 60%),
             radial-gradient(1000px 500px at 0% 0%, rgba(255,46,85,.10), transparent 55%),
             var(--bg-0);
  color:var(--text);
  font-family:'Inter',sans-serif;
  min-height:100vh;
  overflow-x:hidden;
}
h1,h2,h3,.display{ font-family:'Oswald',sans-serif; text-transform:uppercase; letter-spacing:.02em; }
.mono{ font-family:'JetBrains Mono',monospace; }
button{ font-family:inherit; cursor:pointer; border:none; background:none; color:inherit; }
input, select{ font-family:inherit; }
::-webkit-scrollbar{width:8px; height:8px;}
::-webkit-scrollbar-thumb{background:var(--bg-3); border-radius:8px;}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.001ms !important; transition-duration:.001ms !important; }
}

/* ---------- layout shell ---------- */
#app{ display:flex; min-height:100vh; }
.sidebar{
  width:230px; flex-shrink:0; background:var(--bg-1); border-right:1px solid var(--line);
  padding:28px 16px; display:flex; flex-direction:column; gap:6px;
}
.brand{ display:flex; align-items:center; gap:10px; padding:0 8px 26px; }
.brand-mark{
  width:34px; height:34px; border-radius:9px; background:var(--grad);
  display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0;
}
.brand-name{ font-family:'Oswald',sans-serif; font-size:19px; letter-spacing:.03em; }
.brand-name span{ color:var(--red); }
.nav-item{
  display:flex; align-items:center; gap:12px; padding:11px 12px; border-radius:var(--radius-sm);
  color:var(--muted); font-weight:600; font-size:14px; transition:.15s;
}
.nav-item .ic{ font-size:17px; width:20px; text-align:center; }
.nav-item:hover{ background:var(--bg-2); color:var(--text); }
.nav-item.active{ background:var(--bg-2); color:var(--text); box-shadow:inset 3px 0 0 var(--red); }

.content{ flex:1; min-width:0; padding:28px 30px 100px; max-width:1080px; }
.page{ display:none; animation:fadeIn .35s ease; }
.page.active{ display:block; }
@keyframes fadeIn{ from{opacity:0; transform:translateY(6px);} to{opacity:1; transform:translateY(0);} }

.page-head{ display:flex; align-items:flex-end; justify-content:space-between; margin-bottom:22px; gap:12px; flex-wrap:wrap;}
.page-head h1{ font-size:26px; }
.page-head .sub{ color:var(--muted); font-size:13px; margin-top:4px; }
.eyebrow{ color:var(--red); font-size:11px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; margin-bottom:6px;}

.btn{
  display:inline-flex; align-items:center; gap:8px; padding:11px 18px; border-radius:999px;
  font-weight:700; font-size:13.5px; transition:.15s; white-space:nowrap;
}
.btn-primary{ background:var(--grad); color:#fff; box-shadow:0 6px 18px rgba(255,46,85,.25); }
.btn-primary:hover{ filter:brightness(1.08); transform:translateY(-1px); }
.btn-ghost{ background:var(--bg-2); color:var(--text); border:1px solid var(--line-strong); }
.btn-ghost:hover{ background:var(--bg-3); }
.btn-danger{ background:rgba(255,46,85,.12); color:#ff6b84; border:1px solid rgba(255,46,85,.3); }
.btn-danger:hover{ background:rgba(255,46,85,.2); }
.btn-block{ width:100%; justify-content:center; }
.btn-sm{ padding:7px 13px; font-size:12px; }

/* ---------- cards / grid ---------- */
.grid{ display:grid; gap:14px; }
.grid-4{ grid-template-columns:repeat(4,1fr); }
.grid-2{ grid-template-columns:repeat(2,1fr); }
@media (max-width:900px){ .grid-4{grid-template-columns:repeat(2,1fr);} }
@media (max-width:560px){ .grid-4{grid-template-columns:1fr 1fr;} .grid-2{grid-template-columns:1fr;} }

.card{
  background:var(--bg-1); border:1px solid var(--line); border-radius:var(--radius);
  padding:18px; transition:.18s;
}
.card:hover{ border-color:var(--line-strong); }
.stat-card .ic{ font-size:20px; }
.stat-card .label{ color:var(--muted); font-size:11.5px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; margin:10px 0 4px; }
.stat-card .val{ font-family:'JetBrains Mono',monospace; font-size:20px; font-weight:700; }
.stat-card .val.small{ font-size:15px; }

/* ---------- hero / dashboard ---------- */
.hero{
  background:linear-gradient(160deg, var(--bg-2), var(--bg-1) 70%);
  border:1px solid var(--line); border-radius:20px; padding:26px; position:relative; overflow:hidden; margin-bottom:18px;
}
.hero::before{
  content:""; position:absolute; inset:-40% -20% auto auto; width:280px; height:280px;
  background:radial-gradient(circle, rgba(139,92,246,.25), transparent 65%); pointer-events:none;
}
.hero-top{ display:flex; justify-content:space-between; align-items:flex-start; gap:14px; flex-wrap:wrap;}
.hero-target-name{ font-size:24px; }
.hero-target-cat{ color:var(--muted); font-size:12.5px; margin-top:2px;}
.hero-numbers{ display:flex; gap:28px; margin-top:18px; flex-wrap:wrap; }
.hn-label{ font-size:11px; color:var(--muted); font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.hn-val{ font-family:'JetBrains Mono',monospace; font-weight:700; font-size:21px; margin-top:3px; }
.hn-val.target{ color:var(--text); }
.hn-val.terkumpul{ color:var(--ok); }
.hn-val.sisa{ color:#ffb0bf; }
.hn-val.progress{ background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent; }

/* barbell signature progress bar */
.barbell{ margin-top:22px; }
.barbell-labels{ display:flex; justify-content:space-between; font-size:11px; color:var(--muted); margin-bottom:8px; font-weight:600;}
.barbell-track{
  position:relative; height:34px; border-radius:999px;
  background:repeating-linear-gradient(90deg, #26262f 0px, #26262f 2px, #202028 2px, #202028 4px);
  border:1px solid var(--line-strong); overflow:hidden;
  box-shadow:inset 0 2px 6px rgba(0,0,0,.5);
}
.barbell-fill{
  position:absolute; inset:0; width:0%; border-radius:999px;
  background:var(--grad); transition:width 1s cubic-bezier(.16,1,.3,1);
  display:flex; align-items:center;
}
.barbell-plates{ position:absolute; inset:0; display:flex; align-items:center; justify-content:space-between; padding:0 4px; pointer-events:none;}
.barbell-plate{ width:22px; height:26px; border-radius:6px; background:rgba(0,0,0,.28); border:1px solid rgba(255,255,255,.06); }
.barbell-pct{
  position:absolute; right:12px; top:50%; transform:translateY(-50%);
  font-family:'JetBrains Mono',monospace; font-weight:700; font-size:13px; color:#fff; text-shadow:0 1px 3px rgba(0,0,0,.5); z-index:2;
}

/* ---------- target list / picker ---------- */
.target-switcher{ display:flex; gap:10px; overflow-x:auto; padding-bottom:6px; margin-bottom:18px; }
.target-pill{
  flex-shrink:0; padding:9px 16px; border-radius:999px; background:var(--bg-1); border:1px solid var(--line);
  font-size:13px; font-weight:600; color:var(--muted); white-space:nowrap; transition:.15s;
}
.target-pill.active{ background:var(--bg-2); border-color:var(--red); color:var(--text); }
.target-pill .pct{ color:var(--red); font-family:'JetBrains Mono',monospace; margin-left:6px; }

.target-card{
  background:var(--bg-1); border:1px solid var(--line); border-radius:var(--radius); padding:18px; margin-bottom:12px;
  display:flex; flex-direction:column; gap:12px;
}
.target-card-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px;}
.target-card-title{ font-size:17px; font-weight:800; font-family:'Oswald',sans-serif; text-transform:uppercase; }
.target-card-cat{ display:inline-block; background:var(--bg-2); color:var(--muted); font-size:10.5px; font-weight:700; padding:3px 9px; border-radius:6px; margin-top:5px; letter-spacing:.05em; text-transform:uppercase;}
.mini-bar{ height:8px; border-radius:999px; background:var(--bg-2); overflow:hidden; }
.mini-bar-fill{ height:100%; background:var(--grad); border-radius:999px; transition:width .8s ease; }
.target-card-meta{ display:flex; justify-content:space-between; font-size:12px; color:var(--muted); }
.target-card-actions{ display:flex; gap:8px; flex-wrap:wrap; }

/* ---------- forms / modal ---------- */
.overlay{
  position:fixed; inset:0; background:rgba(6,6,9,.72); backdrop-filter:blur(4px);
  display:none; align-items:flex-end; justify-content:center; z-index:100; padding:0;
}
.overlay.show{ display:flex; }
@media (min-width:640px){ .overlay{ align-items:center; padding:20px; } }
.modal{
  background:var(--bg-1); border:1px solid var(--line-strong); width:100%; max-width:520px;
  border-radius:22px 22px 0 0; padding:22px 22px 26px; max-height:92vh; overflow-y:auto;
  animation:slideUp .3s cubic-bezier(.16,1,.3,1);
}
@media (min-width:640px){ .modal{ border-radius:20px; } }
@keyframes slideUp{ from{ transform:translateY(30px); opacity:0;} to{ transform:translateY(0); opacity:1;} }
.modal-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.modal-head h2{ font-size:19px; }
.close-x{ font-size:20px; color:var(--muted); width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; }
.close-x:hover{ background:var(--bg-2); color:var(--text); }

.field{ margin-bottom:14px; }
.field label{ display:block; font-size:12.5px; font-weight:700; color:var(--muted); margin-bottom:7px; text-transform:uppercase; letter-spacing:.04em;}
.field input[type=text], .field input[type=number], .field select{
  width:100%; background:var(--bg-2); border:1px solid var(--line); border-radius:var(--radius-sm);
  padding:12px 13px; color:var(--text); font-size:14.5px; transition:.15s;
}
.field input:focus, .field select:focus{ outline:none; border-color:var(--red); background:var(--bg-3); }
.field .hint{ font-size:11.5px; color:var(--dim); margin-top:5px; }
.field .err{ font-size:11.5px; color:var(--red); margin-top:5px; display:none; font-weight:600;}
.field.has-err input{ border-color:var(--red); }
.field.has-err .err{ display:block; }
.rp-prefix{ position:relative; }
.rp-prefix span{ position:absolute; left:13px; top:50%; transform:translateY(-50%); color:var(--muted); font-size:14px; font-weight:600;}
.rp-prefix input{ padding-left:38px !important; }

.chip-group{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{
  padding:9px 14px; border-radius:999px; background:var(--bg-2); border:1px solid var(--line);
  font-size:13px; font-weight:600; color:var(--muted); transition:.15s;
}
.chip.selected{ background:var(--grad); color:#fff; border-color:transparent; }
.cat-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.cat-item{
  background:var(--bg-2); border:1px solid var(--line); border-radius:12px; padding:12px 8px; text-align:center;
  font-size:12px; font-weight:600; color:var(--muted); transition:.15s;
}
.cat-item .ic{ font-size:20px; display:block; margin-bottom:6px; }
.cat-item.selected{ border-color:var(--red); color:var(--text); background:var(--bg-3); }

.schedule-toggle{ display:flex; background:var(--bg-2); border-radius:999px; padding:4px; border:1px solid var(--line); margin-bottom:12px;}
.schedule-toggle button{ flex:1; padding:9px; border-radius:999px; font-size:12.5px; font-weight:700; color:var(--muted); }
.schedule-toggle button.active{ background:var(--grad); color:#fff; }
.day-pick{ display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.day-pick .chip{ padding:9px 0; text-align:center; font-size:11.5px; }

/* ---------- schedule / checklist page ---------- */
.week-nav{ display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.week-nav .lbl{ font-weight:700; font-size:14px; }
.day-row{
  display:flex; align-items:center; justify-content:space-between; background:var(--bg-1);
  border:1px solid var(--line); border-radius:var(--radius-sm); padding:13px 15px; margin-bottom:9px; transition:.15s;
}
.day-row.today{ border-color:var(--purple); }
.day-row.done{ background:rgba(34,197,94,.06); border-color:rgba(34,197,94,.3); }
.day-row.off{ opacity:.5; }
.day-row-left{ display:flex; align-items:center; gap:12px; }
.day-badge{ width:44px; height:44px; border-radius:12px; background:var(--bg-2); display:flex; flex-direction:column; align-items:center; justify-content:center; font-size:10px; font-weight:700; color:var(--muted); line-height:1.1;}
.day-badge .num{ font-size:15px; color:var(--text); font-family:'JetBrains Mono',monospace;}
.day-name{ font-weight:700; font-size:14px; }
.day-amount{ font-size:12px; color:var(--muted); font-family:'JetBrains Mono',monospace; margin-top:2px;}
.check-btn{
  width:38px; height:38px; border-radius:50%; border:2px solid var(--line-strong); background:var(--bg-2);
  display:flex; align-items:center; justify-content:center; font-size:16px; transition:.2s; flex-shrink:0;
}
.check-btn.checked{ background:var(--ok); border-color:var(--ok); color:#04140a; animation:pop .35s ease; }
.check-btn.locked{ opacity:.35; cursor:not-allowed; }
.check-btn.missed{ border-color:var(--red-dim); color:var(--red); }
@keyframes pop{ 0%{transform:scale(.7);} 60%{transform:scale(1.15);} 100%{transform:scale(1);} }
.off-tag{ font-size:11px; color:var(--dim); font-weight:700; letter-spacing:.05em;}

/* ---------- history ---------- */
.hist-group-date{ font-size:11.5px; color:var(--muted); font-weight:700; margin:16px 0 8px; letter-spacing:.05em; text-transform:uppercase;}
.hist-row{ display:flex; justify-content:space-between; align-items:center; padding:12px 15px; background:var(--bg-1); border:1px solid var(--line); border-radius:var(--radius-sm); margin-bottom:8px;}
.hist-amt{ color:var(--ok); font-weight:700; font-family:'JetBrains Mono',monospace; }
.hist-total{ font-size:11px; color:var(--muted); font-family:'JetBrains Mono',monospace; margin-top:2px;}
.empty{ text-align:center; padding:50px 20px; color:var(--muted); }
.empty .ic{ font-size:38px; margin-bottom:12px; }
.empty h3{ color:var(--text); font-size:16px; margin-bottom:6px; text-transform:none; font-family:'Inter'; }

/* ---------- stats page ---------- */
.chart-wrap{ background:var(--bg-1); border:1px solid var(--line); border-radius:var(--radius); padding:20px; }
.bar-chart{ display:flex; align-items:flex-end; gap:8px; height:140px; margin-top:16px; }
.bar-col{ flex:1; display:flex; flex-direction:column; align-items:center; gap:8px; height:100%; justify-content:flex-end;}
.bar-fill{ width:100%; border-radius:6px 6px 3px 3px; background:var(--grad); min-height:3px; transition:height .8s cubic-bezier(.16,1,.3,1); }
.bar-lbl{ font-size:10px; color:var(--muted); font-weight:700; }

/* ---------- settings ---------- */
.settings-item{ display:flex; justify-content:space-between; align-items:center; padding:16px 4px; border-bottom:1px solid var(--line); gap:14px;}
.settings-item:last-child{ border-bottom:none; }
.settings-item .t{ font-weight:600; font-size:14px; }
.settings-item .d{ font-size:12px; color:var(--muted); margin-top:3px; }

/* ---------- celebration ---------- */
.celebrate-overlay{
  position:fixed; inset:0; background:linear-gradient(180deg, rgba(10,10,13,.94), rgba(19,19,24,.98));
  z-index:200; display:none; align-items:center; justify-content:center; flex-direction:column; text-align:center; padding:30px; overflow:hidden;
}
.celebrate-overlay.show{ display:flex; }
.celebrate-emoji{ font-size:60px; animation:bounce 1.2s ease infinite; }
@keyframes bounce{ 0%,100%{transform:translateY(0);} 50%{transform:translateY(-14px);} }
.celebrate-overlay h1{ font-size:30px; margin:18px 0 10px; background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent; }
.celebrate-overlay p{ color:var(--muted); font-size:14.5px; max-width:340px; line-height:1.6; margin-bottom:26px;}
.celebrate-actions{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; z-index:2; }
.confetti-piece{ position:absolute; top:-10px; width:8px; height:14px; opacity:.9; animation:fall linear forwards; }
@keyframes fall{ to{ transform:translateY(110vh) rotate(540deg); opacity:0; } }

/* ---------- toast ---------- */
#toast{
  position:fixed; bottom:100px; left:50%; transform:translateX(-50%) translateY(20px); opacity:0;
  background:var(--bg-3); border:1px solid var(--line-strong); padding:12px 20px; border-radius:999px;
  font-size:13px; font-weight:600; z-index:300; transition:.25s; pointer-events:none; box-shadow:var(--shadow);
  display:flex; align-items:center; gap:8px;
}
#toast .icon{ font-size:15px; color:var(--red); }
#toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }

/* ---------- bottom nav (mobile) ---------- */
.bottom-nav{ display:none; }
@media (max-width:900px){
  .sidebar{ display:none; }
  .content{ padding:20px 16px 92px; }
  .bottom-nav{
    display:flex; position:fixed; bottom:0; left:0; right:0; background:rgba(19,19,24,.92); backdrop-filter:blur(14px);
    border-top:1px solid var(--line); z-index:50; padding:8px 4px calc(8px + env(safe-area-inset-bottom));
  }
  .bn-item{ flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; padding:6px 2px; color:var(--muted); font-size:10px; font-weight:700; border-radius:12px;}
  .bn-item .ic{ font-size:19px; }
  .bn-item.active{ color:var(--text); }
  .bn-item.active .ic{ filter:drop-shadow(0 0 8px rgba(255,46,85,.5)); }
  .fab{
    position:fixed; right:18px; bottom:90px; width:54px; height:54px; border-radius:50%; background:var(--grad);
    display:flex; align-items:center; justify-content:center; font-size:24px; color:#fff; box-shadow:0 10px 25px rgba(255,46,85,.4); z-index:60;
  }
}
.fab{ display:none; }
@media (max-width:900px){ .fab{ display:flex; } }
.icon{ display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; }
.icon svg{ width:1em; height:1em; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; display:block; }
.nav-item .icon, .bn-item .icon{ font-size:18px; }
.brand-mark .icon{ font-size:19px; color:#fff; }
.stat-card .icon{ font-size:20px; }
.hn-label .icon, .hero-target-cat .icon{ font-size:12px; vertical-align:-2px; }
.empty .icon{ font-size:38px; margin-bottom:12px; color:var(--dim); }
.close-x.icon{ font-size:16px; }
.celebrate-emoji .icon{ font-size:56px; color:var(--red); }
.cat-item .icon{ font-size:20px; display:block; margin:0 auto 6px; color:var(--muted); }
.cat-item.selected .icon{ color:var(--text); }
.target-card-title .icon{ font-size:16px; vertical-align:-2px; margin-right:2px; }
.hist-row .icon{ font-size:18px; color:var(--ok); }
.toast-inner{ display:flex; align-items:center; gap:9px; }
.fab .icon{ font-size:22px; }

/* ---------- loading screen ---------- */
#loading-screen{
  position:fixed; inset:0; z-index:999; overflow:hidden;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px;
  background:var(--bg-0);
  transition:opacity .5s ease, visibility .5s ease;
}
#loading-screen.hide{ opacity:0; visibility:hidden; pointer-events:none; }
.ls-glow{
  position:absolute; width:900px; height:900px; border-radius:50%;
  background:radial-gradient(circle, rgba(255,46,85,.18), rgba(139,92,246,.12) 45%, transparent 70%);
  animation:lsPulse 2.6s ease-in-out infinite;
}
@keyframes lsPulse{ 0%,100%{ transform:scale(.9); opacity:.7;} 50%{ transform:scale(1.05); opacity:1;} }
.ls-mark{
  position:relative; z-index:1;
  width:76px; height:76px; border-radius:22px;
  display:flex; align-items:center; justify-content:center;
  background:var(--grad); box-shadow:0 12px 34px rgba(255,46,85,.35);
  animation:lsLift 1.1s ease-in-out infinite;
}
.ls-dumbbell{ width:38px; height:38px; color:#fff; }
@keyframes lsLift{ 0%,100%{ transform:translateY(0) rotate(0deg);} 50%{ transform:translateY(-8px) rotate(-6deg);} }
.ls-brand{
  position:relative; z-index:1; font-size:26px; font-weight:700; letter-spacing:.06em; color:var(--text);
}
.ls-brand span{ color:var(--red); }
.ls-tag{
  position:relative; z-index:1; font-size:13px; color:var(--muted); text-align:center; padding:0 30px;
}
.ls-bar-track{
  position:relative; z-index:1; width:220px; height:8px; border-radius:6px;
  background:var(--bg-2); border:1px solid var(--line); overflow:hidden; margin-top:6px;
}
.ls-bar-fill{
  height:100%; width:0%; border-radius:6px; background:var(--grad);
  transition:width .2s linear;
}
.ls-pct{
  position:relative; z-index:1; font-family:'JetBrains Mono',monospace; font-size:12px; color:var(--muted);
}
