/* ==========================================================================
   Forge — theme on top of AdminKit Pro
   Ember orange on charcoal; Barlow Condensed for numbers, Inter for text.
   ========================================================================== */

@font-face { font-family: 'Inter'; src: url('/public/vendor/fonts/inter-var.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/public/vendor/fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/public/vendor/fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/public/vendor/fonts/barlow-condensed-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
    --ember: #ff6b2c;
    --ember-2: #ff8a3d;
    --ember-dark: #e2541a;
    --ember-soft: rgba(255, 107, 44, .12);
    --ink: #16181d;
    --ink-2: #1f232b;
    --ok: #1cbb8c;
    --warn: #fcb92c;
    --bad: #dc3545;
    --muted: #6c757d;
    --card-line: rgba(22, 24, 29, .08);
    --num: 'Barlow Condensed', 'Inter', system-ui, sans-serif;
    --bs-font-sans-serif: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-primary: #ff6b2c;
    --bs-primary-rgb: 255, 107, 44;
    --bs-link-color: #e2541a;
    --bs-link-hover-color: #c4440f;
}
body.forge { font-family: var(--bs-font-sans-serif); -webkit-tap-highlight-color: transparent; }
.forge-dark { --card-line: rgba(255, 255, 255, .08); --bs-link-color: #ff8a3d; }
.num, .stat-value, .display-num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: .2px; }

/* ---------- Primary colour → ember ---------- */
.btn-primary, .btn-ember { --bs-btn-bg: var(--ember); --bs-btn-border-color: var(--ember); --bs-btn-hover-bg: var(--ember-dark); --bs-btn-hover-border-color: var(--ember-dark); --bs-btn-active-bg: #c4440f; --bs-btn-active-border-color: #c4440f; --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-disabled-bg: var(--ember); --bs-btn-disabled-border-color: var(--ember); background-color: var(--bs-btn-bg); border-color: var(--bs-btn-border-color); color: #fff; }
.btn-primary:hover, .btn-ember:hover { background-color: var(--ember-dark); border-color: var(--ember-dark); color: #fff; }
.btn-outline-primary { --bs-btn-color: var(--ember-dark); --bs-btn-border-color: var(--ember); --bs-btn-hover-bg: var(--ember); --bs-btn-hover-border-color: var(--ember); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--ember-dark); --bs-btn-active-border-color: var(--ember-dark); color: var(--ember-dark); border-color: var(--ember); }
.btn-outline-primary:hover { background: var(--ember); color: #fff; }
.text-primary, .text-ember { color: var(--ember) !important; }
.bg-primary, .bg-ember { background-color: var(--ember) !important; }
.badge.bg-primary { background-color: var(--ember) !important; }
.bg-ember-soft { background: var(--ember-soft) !important; }
.progress-bar { background-color: var(--ember); }
.form-control:focus, .form-select:focus { border-color: var(--ember-2); box-shadow: 0 0 0 .2rem rgba(255, 107, 44, .2); }
.form-check-input:checked { background-color: var(--ember); border-color: var(--ember); }
.form-range::-webkit-slider-thumb { background: var(--ember); }
.form-range::-moz-range-thumb { background: var(--ember); }
.nav-pills .nav-link.active { background: var(--ember); }
.nav-tabs .nav-link.active { border-bottom-color: transparent; color: var(--ember-dark); font-weight: 600; }
a { color: var(--bs-link-color); }
.page-link { color: var(--ember-dark); }
.page-item.active .page-link { background: var(--ember); border-color: var(--ember); }
.btn-ghost { background: transparent; border: 0; color: inherit; }
.btn-ghost:hover { background: rgba(0, 0, 0, .05); }
.forge-dark .btn-ghost:hover { background: rgba(255, 255, 255, .06); }
.feather-sm { width: 16px; height: 16px; }
.feather-xs { width: 13px; height: 13px; }

/* ---------- Sidebar ---------- */
.sidebar, .sidebar-content, .sidebar-link, a.sidebar-link, .sidebar-brand { background: var(--ink); }
.sidebar-item.active > .sidebar-link, .sidebar-item.active .sidebar-link:hover { background: linear-gradient(90deg, rgba(255, 107, 44, .16), rgba(255, 107, 44, .04) 60%, transparent); border-left-color: var(--ember); color: #fff; }
.sidebar-item.active > .sidebar-link i, .sidebar-item.active > .sidebar-link svg { color: var(--ember-2); }
.sidebar-link:hover { color: rgba(233, 236, 239, .9); }
.sidebar-header { color: rgba(233, 236, 239, .35); letter-spacing: .08em; font-size: .7rem; }
.forge-brand { display: flex; align-items: center; gap: .6rem; font-family: var(--num); font-size: 1.55rem; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
.forge-mark svg { display: block; }
.forge-topbar-brand { display: flex; align-items: center; gap: .45rem; font-family: var(--num); font-weight: 800; font-size: 1.35rem; text-transform: uppercase; color: inherit; text-decoration: none; }

.forge-avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.forge-initials { color: #fff; font-weight: 700; line-height: 1; }

/* ---------- Top bar ---------- */
.forge-live-pill { display: inline-flex; align-items: center; gap: .35rem; border-radius: 99px; padding: .3rem .8rem; font-weight: 600; }
.forge-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

/* ---------- Content ---------- */
.content { padding: 1.5rem 1.5rem 1rem; }
@media (max-width: 991.98px) {
    .content { padding: 1rem .85rem calc(84px + env(safe-area-inset-bottom)); }
}
h1.h3, .page-title { font-weight: 700; letter-spacing: -.2px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: .15rem; }
.card { border: 1px solid var(--card-line); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); border-radius: .8rem; }
.card-header { background: transparent; border-bottom: 1px solid var(--card-line); }
.card-title { font-weight: 700; }
.card-link-row { color: inherit; text-decoration: none; display: block; }
.card-link-row:hover { background: rgba(0, 0, 0, .02); }
.forge-dark .card-link-row:hover { background: rgba(255, 255, 255, .03); }
.list-row { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-top: 1px solid var(--card-line); }
.list-row:first-child { border-top: 0; }
.muted, .text-muted { color: var(--muted) !important; }
.tiny { font-size: .78rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: rgba(108, 117, 125, .12); color: inherit; white-space: nowrap; }
.chip-ember { background: var(--ember-soft); color: var(--ember-dark); }
.chip-ok { background: rgba(28, 187, 140, .14); color: #12936d; }
.chip-warn { background: rgba(252, 185, 44, .18); color: #a26f00; }
.chip-bad { background: rgba(220, 53, 69, .12); color: #c22b3a; }
.forge-dark .chip-ember { color: var(--ember-2); }
.forge-dark .chip-ok { color: #4fe0b5; }
.forge-dark .chip-warn { color: #ffd166; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.empty-state { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty-state .big { font-size: 2.4rem; margin-bottom: .4rem; }

/* ---------- Stat tiles ---------- */
.kpi { padding: 1rem 1.1rem; }
.stat-label { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 2.1rem; font-weight: 700; line-height: 1.05; margin-top: .25rem; }
.stat-value small { font-size: 1rem; font-weight: 600; color: var(--muted); margin-left: .15rem; }
.stat-foot { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.ring { --p: 0; --c: var(--ember); width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(108, 117, 125, .15) 0); display: grid; place-items: center; flex-shrink: 0; }
.ring::before { content: ''; width: 50px; height: 50px; border-radius: 50%; background: var(--bs-card-bg, #fff); grid-area: 1 / 1; }
.forge-dark .ring::before { background: #222e3c; }
.ring span { grid-area: 1 / 1; font-family: var(--num); font-weight: 700; font-size: 1.05rem; position: relative; }

/* ---------- Hero: next workout ---------- */
.hero { position: relative; overflow: hidden; color: #fff; background: radial-gradient(120% 140% at 100% 0%, #3a2216 0%, var(--ink) 55%); border: 0; }
.hero::after { content: ''; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 107, 44, .35), transparent 70%); pointer-events: none; }
.hero .eyebrow { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ember-2); font-weight: 700; }
.hero h2 { color: #fff; font-family: var(--num); font-weight: 800; font-size: 2.3rem; text-transform: uppercase; margin: .15rem 0 .35rem; line-height: 1; }
.hero .meta { color: rgba(255, 255, 255, .7); font-size: .88rem; }
.hero .plan-line { display: flex; justify-content: space-between; gap: .75rem; padding: .45rem 0; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .9rem; }
.hero .plan-line .w { font-family: var(--num); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.hero .btn-ember { font-weight: 700; padding: .65rem 1.3rem; border-radius: .7rem; }
.status-up { color: #4fe0b5; }
.status-miss, .status-deload { color: #ffd166; }

/* ---------- Heatmap ---------- */
.heatmap { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.heatmap .hcol { display: flex; flex-direction: column; gap: 4px; }
.heatmap .cell { width: 14px; height: 14px; border-radius: 3px; background: rgba(108, 117, 125, .14); }
.heatmap .l1 { background: rgba(255, 107, 44, .3); }
.heatmap .l2 { background: rgba(255, 107, 44, .55); }
.heatmap .l3 { background: rgba(255, 107, 44, .8); }
.heatmap .l4 { background: #e2541a; }
.heatmap .future { opacity: .35; }
.heatmap .today { outline: 2px solid var(--ember); outline-offset: 1px; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: .72rem; color: var(--muted); }
.heat-legend .cell { width: 11px; height: 11px; border-radius: 2px; }

/* ---------- Muscle bars ---------- */
.mbar { display: grid; grid-template-columns: 92px 1fr 34px; align-items: center; gap: .6rem; font-size: .85rem; margin: .35rem 0; }
.mbar .track { height: 8px; border-radius: 99px; background: rgba(108, 117, 125, .14); overflow: hidden; }
.mbar .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--ember-2), var(--ember-dark)); }
.mbar .n { text-align: right; font-family: var(--num); font-weight: 700; }

/* ---------- Tiles (workouts, programs) ---------- */
.tile { position: relative; display: block; height: 100%; color: inherit; text-decoration: none; border-radius: .8rem; transition: transform .12s ease, box-shadow .12s ease; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16, 24, 40, .08); color: inherit; }
.tile .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: .8rem 0 0 .8rem; }
.tile h5 { font-weight: 700; margin-bottom: .2rem; }
.tile .ex-list { font-size: .82rem; color: var(--muted); margin: .45rem 0 0; }

/* ---------- Phone tab bar ---------- */
.forge-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: flex; justify-content: space-around; align-items: flex-end; background: rgba(22, 24, 29, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, .06); }
.forge-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: rgba(255, 255, 255, .55); font-size: .66rem; font-weight: 600; text-decoration: none; padding: 4px 0; }
.forge-tabbar a svg { width: 21px; height: 21px; }
.forge-tabbar a.active { color: var(--ember-2); }
.forge-tab-fab { width: 52px; height: 52px; margin-top: -24px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--ember-2), var(--ember-dark)); color: #fff; box-shadow: 0 6px 18px rgba(255, 107, 44, .45); border: 4px solid var(--ink); }
.forge-tab-fab svg { width: 22px !important; height: 22px !important; }
.forge-tab-main.live .forge-tab-fab { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 6px 18px rgba(255, 107, 44, .45); } 50% { box-shadow: 0 6px 28px rgba(255, 107, 44, .9); } }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; width: 100%; display: grid; place-items: center; padding: 1.5rem 1rem; background: radial-gradient(90% 70% at 85% 0%, #3a2216 0%, var(--ink) 60%); }
.auth-card { width: 100%; max-width: 420px; border-radius: 1.1rem; border: 0; box-shadow: 0 30px 60px rgba(0, 0, 0, .35); }
.auth-crew { width: 112px; height: 112px; border-radius: 28px; display: block; margin: 0 auto .9rem; box-shadow: 0 12px 30px rgba(0, 0, 0, .45), 0 0 0 4px rgba(255, 107, 44, .5); object-fit: cover; }
.auth-title { font-family: var(--num); font-weight: 800; font-size: 2.6rem; text-transform: uppercase; color: #fff; text-align: center; line-height: 1; letter-spacing: 1px; }
.auth-tag { color: rgba(255, 255, 255, .6); text-align: center; margin: .3rem 0 1.3rem; }

/* ---------- Template editor ---------- */
.te-row { border: 1px solid var(--card-line); border-radius: .7rem; padding: .75rem; margin-bottom: .6rem; background: var(--bs-card-bg, #fff); }
.forge-dark .te-row { background: rgba(255, 255, 255, .02); }
.te-row .handle { cursor: grab; color: var(--muted); touch-action: none; }
.te-row .te-name { font-weight: 700; }
.te-row .form-control, .te-row .form-select { padding: .3rem .5rem; font-size: .88rem; }
.te-row label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: .1rem; }
.te-superset { border-left: 4px solid var(--ember); }
.gu-mirror { position: fixed !important; z-index: 9999 !important; opacity: .85; }
.gu-hide { display: none !important; }
.gu-transit { opacity: .25; }

/* ---------- Exercise picker ---------- */
.picker-list { max-height: 55vh; overflow-y: auto; }
.picker-item { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .75rem; border-radius: .5rem; cursor: pointer; }
.picker-item:hover, .picker-item:focus { background: var(--ember-soft); outline: none; }
.picker-item.na { opacity: .45; }
.picker-filters { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .4rem; }
.picker-filters .btn { white-space: nowrap; }

/* ---------- History list ---------- */
.session-row { display: flex; gap: .9rem; align-items: center; padding: .8rem 1rem; border-top: 1px solid var(--card-line); color: inherit; text-decoration: none; }
.session-row:first-child { border-top: 0; }
.session-row:hover { background: rgba(0, 0, 0, .02); color: inherit; }
.date-badge { width: 48px; text-align: center; flex-shrink: 0; border-radius: .6rem; padding: .3rem 0; background: rgba(108, 117, 125, .1); }
.date-badge .d { font-family: var(--num); font-size: 1.45rem; font-weight: 700; line-height: 1; }
.date-badge .m { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.set-table td, .set-table th { padding: .35rem .5rem; }
.pr-badge { display: inline-flex; align-items: center; gap: .2rem; background: linear-gradient(135deg, #ffd166, #ff8a3d); color: #3b1d00; font-weight: 700; font-size: .7rem; padding: .1rem .45rem; border-radius: 99px; }

/* ---------- Calendar ---------- */
.fc .fc-button-primary { background: var(--ink-2); border-color: var(--ink-2); }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--ember); border-color: var(--ember); }
.fc .fc-daygrid-day.fc-day-today { background: var(--ember-soft); }


.fc .fc-toolbar-title { font-size: 1.25rem; font-weight: 700; }
@media (max-width: 575px) { .fc .fc-toolbar { flex-wrap: wrap; gap: .4rem; } .fc .fc-toolbar-title { font-size: 1.05rem; } }

/* ---------- Plates ---------- */
.plates { display: flex; align-items: center; justify-content: center; gap: 2px; min-height: 64px; }
.plates .bar { width: 52px; height: 8px; border-radius: 4px; background: #9aa0a8; }
.plates .sleeve { width: 12px; height: 12px; background: #c1c6cc; border-radius: 2px; }
.plate { width: 12px; border-radius: 3px; display: grid; place-items: center; color: #fff; font-size: .55rem; font-weight: 700; writing-mode: vertical-rl; }

/* ---------- Misc ---------- */
.swatch-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.swatch-row input { display: none; }
.swatch-row label { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; }
.swatch-row input:checked + label { border-color: var(--bs-body-color, #222); box-shadow: 0 0 0 2px #fff inset; }
.day-toggle { display: flex; gap: .3rem; flex-wrap: wrap; }
.day-toggle input { display: none; }
.day-toggle label { min-width: 44px; text-align: center; padding: .4rem .5rem; border-radius: .5rem; border: 1px solid var(--card-line); cursor: pointer; font-weight: 600; font-size: .85rem; user-select: none; }
.day-toggle input:checked + label { background: var(--ember); border-color: var(--ember); color: #fff; }
.equip-item { display: flex; align-items: center; gap: .55rem; padding: .55rem .7rem; border: 1px solid var(--card-line); border-radius: .6rem; cursor: pointer; user-select: none; margin: 0; }
.equip-item input { margin: 0; }
.equip-item.on { border-color: var(--ember); background: var(--ember-soft); }
.equip-item .emo { font-size: 1.2rem; width: 1.6rem; text-align: center; }
.goal-bar { height: 10px; border-radius: 99px; background: rgba(108, 117, 125, .14); overflow: hidden; }
.goal-bar > div { height: 100%; background: linear-gradient(90deg, var(--ember-2), var(--ember-dark)); border-radius: 99px; }
.goal-bar.done > div { background: linear-gradient(90deg, #4fe0b5, #1cbb8c); }
.crew-card img { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; }
.table > :not(caption) > * > * { border-bottom-color: var(--card-line); }
@media (max-width: 575px) { .stat-value { font-size: 1.75rem; } .hero h2 { font-size: 1.9rem; } }
.forge-crew-mark { border-radius: 9px; box-shadow: 0 0 0 2px rgba(255, 107, 44, .7); object-fit: cover; display: block; }
.forge-brand { font-size: 1.32rem; line-height: 1.05; }
.forge-topbar-brand .forge-crew-mark { width: 26px; height: 26px; border-radius: 7px; }
.tile, .tile:hover, .session-row, .session-row:hover, .card-link-row:hover { text-decoration: none; }
.hero .btn { padding: .65rem 1.3rem; border-radius: .7rem; font-weight: 700; }
.fc-event.planned { background: transparent !important; border-style: dashed !important; }
.hero .btn-outline-light { color: #fff; border-color: rgba(255, 255, 255, .35); background: transparent; }
.hero .btn-outline-light:hover { background: rgba(255, 255, 255, .1); color: #fff; }
@media (max-width: 991.98px) { .forge-topbar-brand { white-space: nowrap; font-size: 1.15rem; } }
@media (max-width: 380px) { .forge-topbar-brand { font-size: 1rem; } }
