:root {
  --dna: #182077;
  --accent: #2563EB;
  --accent-light: #3B82F6;
  --bg: #0a0f1e;
  --surface: #0f1628;
  --card: #141d35;
  --card2: #1a2540;
  --border: #1e2d4a;
  --border2: #243256;
  --text: #f0f4ff;
  --muted: #6b7db3;
  --muted2: #3a4d7a;
  --success: #5F8060;
  --warning: #C89659;
  --error: #A64040;
  --info: #6B8299;
  --wine: #8B1A1A;
  --mev-ease: cubic-bezier(0.32,0.72,0.24,1);
  --radius-sm: 5px;
  --radius-md: 9px;
  --radius-lg: 14px;
  --radius-xl: 22px;
  --radius-2xl: 36px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; min-height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* === LOGIN === */
.login-screen {
  position: fixed; inset: 0; background: linear-gradient(135deg, #0a0f1e 0%, #182077 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 9999;
}
.login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 30px 24px; width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 24px; }
.logo-mark {
  width: 44px; height: 44px; background: var(--accent); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px; color: #fff; letter-spacing: -1px;
}
.logo-text { font-weight: 800; font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: #fff; text-align: left; }
.logo-sub { font-size: 9px; color: rgba(255,255,255,0.5); letter-spacing: 1px; margin-top: 2px; text-align: left; }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 20px; }

.pin-dots { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; }
.pin-dots span {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border2); transition: all 200ms;
}
.pin-dots span.filled { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 12px rgba(37,99,235,0.5); }
.pin-hidden-input { position: absolute; opacity: 0; pointer-events: none; }

.pin-pad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px;
}
.pin-pad button {
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  font-size: 22px; font-weight: 600; padding: 18px 0; border-radius: var(--radius-md);
  transition: all 150ms var(--mev-ease);
}
.pin-pad button:hover { background: var(--border2); border-color: var(--accent); }
.pin-pad button:active { transform: scale(0.95); background: var(--accent); }
.pin-pad button.pad-action { background: transparent; font-size: 16px; color: var(--muted); }
.pin-pad button.pad-action:hover { color: var(--text); background: var(--card2); }

.login-error {
  background: rgba(166,64,64,0.15); color: #FCA5A5; border: 1px solid rgba(166,64,64,0.3);
  padding: 8px 12px; border-radius: var(--radius-md); font-size: 12px; margin-top: 12px;
}
.login-email-toggle {
  margin-top: 20px; text-align: left; padding-top: 16px; border-top: 1px solid var(--border);
}
.login-email-toggle summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.email-login-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.email-login-form input {
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-md); font-size: 13px;
}
.email-login-form button {
  background: var(--accent); color: #fff; border: none; padding: 10px;
  border-radius: var(--radius-md); font-weight: 600;
}
.login-footer { margin-top: 20px; font-size: 11px; color: var(--muted2); }
#api-status { color: var(--success); font-size: 16px; }
#api-status.offline { color: var(--error); }

/* === HEADER === */
.header {
  background: var(--dna); border-bottom: 1px solid rgba(37,99,235,0.3);
  padding: 14px 16px 12px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.header-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logo-block { display: flex; align-items: center; gap: 10px; }
.header-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.h-pill {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md); padding: 5px 10px;
  display: flex; flex-direction: column; align-items: center; min-width: 56px;
}
.h-pill .v { font-weight: 700; font-size: 14px; line-height: 1; color: #fff; }
.h-pill .l { font-size: 9px; color: rgba(255,255,255,0.5); margin-top: 2px; letter-spacing: 0.6px; text-transform: uppercase; }
.pv { color: #93C5FD !important; }
.cv { color: #FCA5A5 !important; }
.fv { color: #6EE7B7 !important; }
.kv { color: #FDE68A !important; }
.btn-profile {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent-light);
  color: #fff; font-weight: 700; border: 2px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
}

/* === TABS === */
.tabs-wrapper { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 12px; position: sticky; top: 64px; z-index: 90; }
.tabs-inner { max-width: 1100px; margin: 0 auto; }
.tabs { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; padding: 12px 14px 10px; background: transparent; border: none;
  border-bottom: 2px solid transparent;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 12px; white-space: nowrap;
  transition: all 180ms var(--mev-ease);
}
.tab:hover { color: var(--text); border-bottom-color: var(--border2); }
.tab.active { color: var(--accent-light); border-bottom-color: var(--accent); }
.tab .td { font-weight: 700; font-size: 14px; letter-spacing: 0.5px; }
.tab .tt { font-size: 9px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.5px; }

/* === MAIN === */
.main { max-width: 1100px; margin: 0 auto; padding: 20px 14px 80px; }

.panel-title { font-weight: 800; font-size: 22px; margin-bottom: 16px; letter-spacing: 0.3px; }
.panel-subtitle { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

/* === CARDS === */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px; }
.card.elev { box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.card-title { font-weight: 700; font-size: 16px; }
.card-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* === DASHBOARD === */
.day-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.day-title { font-weight: 800; font-size: 26px; letter-spacing: 0.3px; }
.day-badge { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; padding: 4px 12px; border-radius: var(--radius-2xl); }
.badge-musc { background: rgba(37,99,235,0.15); color: #93C5FD; border: 1px solid rgba(37,99,235,0.3); }
.badge-thai { background: rgba(166,64,64,0.15); color: #FCA5A5; border: 1px solid rgba(166,64,64,0.3); }
.badge-duplo { background: rgba(200,150,89,0.15); color: #FDE68A; border: 1px solid rgba(200,150,89,0.3); }
.badge-corr { background: rgba(95,128,96,0.15); color: #86EFAC; border: 1px solid rgba(95,128,96,0.3); }
.badge-desc { background: rgba(107,125,179,0.1); color: var(--muted); border: 1px solid var(--border); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; }
.stat-box .lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.stat-box .val { font-weight: 800; font-size: 22px; line-height: 1; }
.stat-box .sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.stat-box .progress-bar { height: 6px; background: var(--border); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.stat-box .progress-fill { height: 100%; background: var(--accent); transition: width 300ms; }
.progress-fill.green { background: var(--success); }
.progress-fill.warn { background: var(--warning); }
.progress-fill.red { background: var(--error); }

/* === MEALS === */
.meal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 8px; overflow: hidden; transition: border-color 200ms; }
.meal.checked { border-color: var(--success); background: linear-gradient(180deg, var(--card), rgba(95,128,96,0.05)); }
.meal.wine { border-color: rgba(139,26,26,0.4); }
.meal-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.meal-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.meal-check {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 14px; color: transparent; background: transparent; transition: all 200ms;
}
.meal.checked .meal-check { background: var(--success); border-color: var(--success); color: #fff; }
.meal-ico { font-size: 18px; flex-shrink: 0; }
.meal-name { font-weight: 600; font-size: 14px; }
.meal-time { font-size: 11px; color: var(--muted); margin-top: 1px; }
.macros { display: flex; gap: 4px; flex-wrap: wrap; }
.mac { font-size: 10px; padding: 3px 7px; border-radius: var(--radius-sm); font-weight: 600; letter-spacing: 0.3px; white-space: nowrap; }
.mp { background: rgba(37,99,235,0.15); color: #93C5FD; }
.mc { background: rgba(166,64,64,0.15); color: #FCA5A5; }
.mf { background: rgba(95,128,96,0.15); color: #86EFAC; }
.mk { background: rgba(200,150,89,0.15); color: #FDE68A; }
.mw { background: rgba(139,26,26,0.2); color: #FCA5A5; }
.meal-body { padding: 0 14px 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.meal.collapsed .meal-body { display: none; }
.food-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.food-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #c5ceea; line-height: 1.4; }
.food-list li::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 6px; }
.tip { margin-top: 10px; padding: 9px 12px; border-radius: var(--radius-md); background: rgba(255,255,255,0.03); font-size: 11px; color: var(--muted); border-left: 2px solid var(--warning); font-style: italic; }
.tip.blue { border-left-color: var(--accent); }
.tip.red { border-left-color: var(--error); color: #FCA5A5; }
.tip.green { border-left-color: var(--success); color: #86EFAC; }

.recipe-block { margin-top: 12px; padding: 12px; background: rgba(37,99,235,0.06); border: 1px solid rgba(37,99,235,0.15); border-radius: var(--radius-md); }
.recipe-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-light); margin-bottom: 8px; }
.recipe-steps { list-style: none; display: flex; flex-direction: column; gap: 5px; counter-reset: step; }
.recipe-steps li { font-size: 12px; color: #a0aece; display: flex; gap: 8px; line-height: 1.5; counter-increment: step; }
.recipe-steps li::before { content: counter(step); width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.vasilha-tag { display: inline-block; padding: 3px 10px; background: rgba(200,150,89,0.12); border: 1px solid rgba(200,150,89,0.25); border-radius: var(--radius-2xl); font-size: 11px; color: #FDE68A; margin-top: 8px; }

/* === BUTTONS === */
.btn { background: var(--accent); color: #fff; border: none; padding: 10px 16px; border-radius: var(--radius-md); font-weight: 600; font-size: 13px; transition: all 150ms; }
.btn:hover { background: var(--accent-light); }
.btn-primary { background: var(--accent); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); color: #1a1a1a; }
.btn-error { background: var(--error); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border2); }
.btn-ghost:hover { background: var(--card2); }
.btn-sm { padding: 6px 10px; font-size: 11px; }

/* === FORMS === */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-row label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.form-row input, .form-row select, .form-row textarea {
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-md); font-size: 14px; width: 100%;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--accent); }

/* === WATER === */
.water-vis { display: flex; flex-direction: column; align-items: center; padding: 20px; }
.water-cup { position: relative; width: 120px; height: 180px; border: 4px solid var(--accent); border-top: none; border-radius: 0 0 30px 30px; overflow: hidden; background: var(--card2); }
.water-fill { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(180deg, #3B82F6, #1d4ed8); transition: height 600ms var(--mev-ease); }
.water-fill::before { content: ''; position: absolute; top: -6px; left: 0; right: 0; height: 8px; background: rgba(255,255,255,0.3); border-radius: 50%; transform: scaleX(0.95); }
.water-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; z-index: 2; pointer-events: none; }
.water-amount { font-size: 24px; font-weight: 800; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.water-target { font-size: 11px; color: rgba(255,255,255,0.7); }
.water-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }

/* === CHART === */
.chart-wrap { padding: 12px 0; overflow-x: auto; }
.chart-svg { width: 100%; min-width: 300px; height: 200px; }

/* === FOOTER === */
.footer { max-width: 1100px; margin: 30px auto 0; padding: 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.footer-logo { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; }
.footer-info { font-size: 11px; color: var(--muted2); }

/* === TOAST === */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--card2); border: 1px solid var(--accent); padding: 12px 20px;
  border-radius: var(--radius-md); z-index: 10000; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); animation: toastIn 200ms;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* === INSTALL BANNER === */
.install-banner {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--dna);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--accent); z-index: 9000; gap: 10px; flex-wrap: wrap;
}

/* === SECTION SWITCH === */
.section-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.stab { padding: 7px 14px; border-radius: var(--radius-2xl); font-size: 12px; font-weight: 600; background: transparent; border: 1px solid var(--border2); color: var(--muted); }
.stab:hover { border-color: var(--accent); color: var(--accent-light); }
.stab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* === DAY SELECTOR === */
.day-pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.day-pills::-webkit-scrollbar { display: none; }
.day-pill {
  flex-shrink: 0; padding: 8px 16px; background: var(--card); border: 1px solid var(--border);
  color: var(--muted); border-radius: var(--radius-2xl); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.day-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-pill.today { box-shadow: 0 0 0 2px var(--accent); }

/* === SHOPPING === */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.shop-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.shop-card-head { padding: 12px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.shop-card-ico { width: 32px; height: 32px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.shop-card-title { font-weight: 700; font-size: 14px; }
.shop-card-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.shop-items { padding: 10px 14px; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.shop-items li { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; font-size: 13px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.shop-items li:last-child { border-bottom: none; padding-bottom: 0; }
.shop-item-qty { font-weight: 600; font-size: 12px; color: var(--accent-light); white-space: nowrap; }
.shop-total-bar { padding: 10px 14px; background: rgba(37,99,235,0.08); border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }

/* === TRAININGS === */
.training-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 8px; gap: 10px; flex-wrap: wrap; }
.training-row.done { border-color: var(--success); background: linear-gradient(180deg, var(--card), rgba(95,128,96,0.05)); }
.training-info { display: flex; align-items: center; gap: 10px; }
.training-icon { font-size: 20px; }
.training-name { font-weight: 600; font-size: 14px; }
.training-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* === RESPONSIVE === */
@media (max-width: 600px) {
  .day-title { font-size: 20px; }
  .h-pill { min-width: 50px; padding: 4px 8px; }
  .h-pill .v { font-size: 12px; }
  .main { padding: 16px 12px 80px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .login-card { padding: 24px 18px; }
  .pin-pad button { padding: 14px 0; font-size: 18px; }
}
