/* ANA FIT - Nexo Theme (Dark Blue Cybernetic Gradient) */
:root {
  color-scheme: dark;
  --bg: #030913;
  --bg2: #081622;
  --card: rgba(7, 20, 34, 0.88);
  --line: rgba(83, 185, 230, 0.16);
  --cy: #58e2ff;
  --cy2: #26aef6;
  --green: #4bdfb9;
  --purple: #ad88ff;
  --amber: #ffc47b;
  --white: #f6fcff;
  --muted: #97aec4;
  --dim: #6a839a;
  --red: #ff5263;
  --shadow: 0 18px 40px rgba(1, 7, 14, 0.65);
}

* {
  box-sizing: border-box;
}

html, body {
  padding: 0;
  margin: 0;
  min-height: 100%;
  font-family: Inter, Manrope, "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(ellipse 65% 28% at 52% 19%, #082f49 0, transparent 82%),
              radial-gradient(ellipse 55% 45% at 95% 80%, #102039 0, transparent 80%),
              var(--bg);
  color: var(--white);
  line-height: 1.5;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

a {
  color: var(--cy);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.loading {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

/* Login */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, #0d2f4d 0%, #030913 80%);
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  background: linear-gradient(155deg, rgba(13, 34, 56, 0.95), rgba(5, 19, 34, 0.95));
  border: 1px solid rgba(88, 226, 255, 0.3);
  border-radius: 20px;
  padding: 36px;
  box-shadow: 0 0 50px rgba(0, 183, 255, 0.15), var(--shadow);
  backdrop-filter: blur(16px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 850;
  letter-spacing: .15em;
  color: var(--white);
}

.logo span {
  background: linear-gradient(135deg, var(--cy), var(--cy2));
  color: #030913;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 0 16px rgba(88, 226, 255, 0.4);
}

.logo small {
  font-weight: 300;
  color: var(--cy);
  margin-left: 4px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.login-card label, .field label {
  display: block;
  font-size: 11px;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--cy);
  text-transform: uppercase;
  margin-bottom: 7px;
}

.login-card input, .field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  background: #081a2c;
  color: var(--white);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.login-card input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--cy);
  box-shadow: 0 0 12px rgba(88, 226, 255, 0.25);
}

.login-card .field {
  margin: 16px 0;
}

/* Buttons */
.btn {
  background: #091a29;
  color: #c7eaf3;
  border: 1px solid rgba(51, 118, 156, 0.45);
  padding: 11px 18px;
  font-weight: 750;
  font-size: 13px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .15s ease;
}

.btn:hover {
  border-color: var(--cy);
  color: var(--white);
}

.btn.primary {
  background: linear-gradient(115deg, #62eeff, #1ab5ef);
  color: #041321;
  font-weight: 850;
  border: 0;
  box-shadow: 0 0 20px rgba(0, 183, 255, 0.35);
}

.btn.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn.dark {
  background: #0a192a;
  border: 1px solid var(--line);
  color: var(--white);
}

.btn.danger {
  background: rgba(255, 82, 99, 0.15);
  border: 1px solid rgba(255, 82, 99, 0.4);
  color: #ff949f;
}

.btn.danger:hover {
  background: rgba(255, 82, 99, 0.25);
  border-color: var(--red);
}

.btn.ghost {
  border: 1px solid var(--line);
  background: rgba(8, 22, 36, 0.6);
  color: var(--muted);
}

.btn.ghost:hover {
  border-color: var(--cy);
  color: var(--white);
}

.btn.small {
  font-size: 11px;
  padding: 7px 12px;
}

.btn.full {
  width: 100%;
}

.btn:focus-visible, .navbtn:focus-visible {
  outline: 2px solid var(--cy);
  outline-offset: 3px;
}

/* Main App Shell */
.app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  background: rgba(4, 13, 24, 0.95);
  border-right: 1px solid var(--line);
  color: var(--white);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100dvh;
  backdrop-filter: blur(12px);
}

.sidebar .logo {
  font-size: 20px;
  padding: 0 8px;
}

.nav {
  display: grid;
  gap: 6px;
}

.navbtn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 11px 15px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all .15s ease;
}

.navbtn:hover {
  background: rgba(88, 226, 255, 0.08);
  color: var(--white);
  border-color: rgba(88, 226, 255, 0.2);
}

.navbtn.active {
  background: linear-gradient(90deg, rgba(88, 226, 255, 0.15), rgba(38, 174, 246, 0.05));
  border-left: 3px solid var(--cy);
  border-color: rgba(88, 226, 255, 0.3);
  color: var(--white);
  font-weight: 750;
  box-shadow: 0 0 15px rgba(88, 226, 255, 0.1);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 10px;
  font-size: 11px;
  color: var(--dim);
  border-top: 1px solid var(--line);
}

.sidebar-footer b {
  display: block;
  color: var(--white);
  margin: 4px 0 10px;
  font-size: 13px;
}

/* Main Area */
.main {
  min-width: 0;
}

.top {
  background: linear-gradient(180deg, rgba(8, 27, 44, 0.7) 0%, transparent 100%);
  border-bottom: 1px solid var(--line);
  color: var(--white);
  padding: 32px 40px 70px;
  position: relative;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-brand {
  display: none;
}

.profile {
  font-size: 11px;
  letter-spacing: .08em;
  padding: 7px 14px;
  background: rgba(88, 226, 255, 0.1);
  border: 1px solid rgba(88, 226, 255, 0.25);
  border-radius: 40px;
  color: var(--cy);
  text-transform: uppercase;
}

.top h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.03em;
  margin: 20px 0 6px;
  background: linear-gradient(100deg, #fff 0%, #58d9ff 60%, #628bff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.top p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.content {
  max-width: 1280px;
  margin: -40px auto 0;
  padding: 0 32px 100px;
  position: relative;
}

/* Cards & Panels */
.card {
  background: linear-gradient(150deg, rgba(15, 36, 55, 0.95), rgba(5, 16, 29, 0.9));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 25px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
}

.card h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 20px;
  color: #def8ff;
}

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi {
  background: linear-gradient(150deg, rgba(15, 36, 55, 0.95), rgba(5, 16, 29, 0.9));
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.kpi span {
  color: #82a0b7;
  font-size: 11px;
  letter-spacing: .08em;
  font-weight: 700;
  text-transform: uppercase;
}

.kpi b {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.03em;
  display: block;
  margin: 10px 0 4px;
  color: var(--cy);
}

.kpi small {
  font-size: 11px;
  color: var(--green);
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.row.start {
  justify-content: flex-start;
}

.muted {
  color: var(--muted);
}

.hint {
  color: var(--dim);
  font-size: 12px;
  line-height: 1.6;
}

/* Tags */
.tag {
  display: inline-block;
  border-radius: 6px;
  padding: 5px 10px;
  background: rgba(88, 226, 255, 0.12);
  border: 1px solid rgba(88, 226, 255, 0.25);
  color: var(--cy);
  font-size: 11px;
  font-weight: 700;
}

.tag.green {
  color: var(--green);
  border-color: rgba(75, 223, 185, 0.3);
  background: rgba(75, 223, 185, 0.12);
}

.tag.gray {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}

/* Lists */
.list {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--line);
  background: rgba(8, 22, 36, 0.5);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.item b {
  font-size: 14px;
  color: var(--white);
  display: block;
  margin-bottom: 5px;
}

.item small {
  color: var(--muted);
  font-size: 12px;
}

.item p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 6px 0 0;
}

/* Empty State */
.empty {
  text-align: center;
  padding: 36px 16px;
  border: 1px dashed rgba(83, 185, 230, 0.25);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(5, 16, 29, 0.4);
}

.empty .empty-icon {
  font-size: 26px;
  background: rgba(88, 226, 255, 0.12);
  color: var(--cy);
  border: 1px solid rgba(88, 226, 255, 0.25);
  border-radius: 50%;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  box-shadow: 0 0 16px rgba(88, 226, 255, 0.2);
}

.empty b {
  display: block;
  color: var(--white);
  margin-bottom: 6px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field.full {
  grid-column: 1 / -1;
}

.field textarea {
  min-height: 95px;
  resize: vertical;
}

.field input[type=checkbox] {
  width: auto;
  min-height: auto;
  margin-right: 8px;
  accent-color: var(--cy);
}

.actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
}

.sectiontop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.sectiontop h2 {
  margin: 0;
}

.workout-card {
  border: 1px solid var(--line);
  background: rgba(8, 22, 36, 0.5);
  padding: 18px;
  border-radius: 14px;
  margin-bottom: 12px;
}

.workout-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--cy);
}

.workout-card ol {
  padding-left: 20px;
  font-size: 13px;
  color: #b2c5d5;
  line-height: 1.8;
}

.progress {
  height: 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 10px;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cy), var(--green));
  box-shadow: 0 0 10px var(--cy);
}

/* Metrics Grid */
.metricgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid var(--line);
  background: rgba(8, 22, 36, 0.7);
  padding: 16px;
  border-radius: 12px;
}

.metric b {
  font-size: 22px;
  display: block;
  margin-top: 6px;
  color: var(--cy);
}

.metric small {
  font-size: 11px;
  color: var(--muted);
}

/* Notes & Warnings */
.note {
  background: rgba(10, 31, 51, 0.65);
  border-left: 3px solid var(--cy);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.65;
  color: #c5e1f0;
}

.warn {
  background: rgba(49, 37, 28, 0.65);
  border-left: 3px solid var(--amber);
  color: #ffe5bf;
}

.codebox {
  background: #061523;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-wrap: anywhere;
  font-family: monospace;
  font-size: 12px;
  color: var(--cy);
}

.smallcaps {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cy);
  font-weight: 750;
  margin-bottom: 9px;
}

.separator {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

/* Toast */
#toast {
  position: fixed;
  z-index: 100;
  bottom: 22px;
  right: 22px;
  max-width: 420px;
  padding: 0;
}

.toast {
  background: #081a2b;
  border: 1px solid var(--line);
  color: var(--white);
  padding: 14px 20px;
  border-radius: 12px;
  margin: 6px;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.err {
  background: #311117;
  border-color: var(--red);
  color: #ffd8dc;
}

.healthRow {
  display: grid;
  grid-template-columns: 170px 1fr 1fr 135px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px 6px;
  font-size: 13px;
}

.healthRow.head {
  font-weight: 750;
  color: var(--cy);
  border-bottom: 1px solid rgba(88, 226, 255, 0.3);
}

.foot {
  font-size: 11px;
  color: var(--dim);
  margin-top: 24px;
}

/* Mobile & Responsive */
@media(max-width: 1020px) {
  .sidebar { width: 210px; }
  .app { grid-template-columns: 210px 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 0 20px 100px; }
  .top { padding-left: 28px; }
  .grid2 { grid-template-columns: 1fr; }
}

@media(max-width: 700px) {
  .app { display: block; }
  .sidebar { display: none; }
  .top { padding: 20px 20px 80px; }
  .mobile-brand {
    display: block;
    color: var(--white);
    font-size: 14px;
    font-weight: 850;
    letter-spacing: .15em;
  }
  .top h1 { font-size: 26px; margin-top: 24px; }
  .profile { font-size: 10px; }
  .content { margin-top: -50px; padding: 0 16px 100px; }
  .card { padding: 18px; border-radius: 14px; }
  .kpis { gap: 10px; }
  .kpi { padding: 16px; }
  .kpi b { font-size: 24px; }
  .kpi span { font-size: 10px; }
  .grid3, .grid2, .split, .fields { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  
  .bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    background: rgba(4, 13, 24, 0.95);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-around;
    padding: 8px 2px calc(8px + env(safe-area-inset-bottom));
  }
  
  .bottom button {
    width: 20%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    padding: 5px 0;
  }
  
  .bottom button b {
    font-size: 18px;
    font-weight: 400;
  }
  
  .bottom button.on {
    color: var(--white);
  }
  
  .bottom button.on b {
    color: var(--cy);
    text-shadow: 0 0 10px rgba(88, 226, 255, 0.5);
  }
  
  .healthRow {
    grid-template-columns: 100px 1fr 1fr;
    font-size: 12px;
  }
  .healthRow span:last-child { display: none; }
  .item { align-items: start; }
  .actions .btn { flex: 1; }
  .foot { margin-bottom: 20px; }
}

@media(min-width: 701px) {
  .bottom { display: none; }
  .content { padding-bottom: 32px; }
}

@media(prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; }
}
