/* Caderno de Treino · Design Mineral
 * Paleta: Cinzas naturais + ouro queimado + verde-escuro
 * Tipografia: Playfair (números), Inter (corpo)
 * Estilo: Swiss minimalista com materialidade de academia
 */

:root {
  /* Modo claro: bege natural */
  --bg: #f5f3f0;
  --card: #faf9f7;
  --surface: #f0eded;
  --elev: #ffffff;

  /* Cores estruturais */
  --text: #2a2622;
  --muted: #7a6f67;
  --faint: #a89e94;
  --border: #d4cfc7;
  --border-strong: #c9bfb5;

  /* Acentos */
  --warm: #d4a574;    /* Ouro queimado */
  --cool: #4a7c5e;    /* Verde-escuro */
  --good: #4a7c5e;
  --good-bg: rgba(74, 124, 94, 0.12);
  --warn: #b8860b;
  --warn-bg: rgba(184, 134, 11, 0.12);
  --bad: #8b4545;
  --bad-bg: rgba(139, 69, 69, 0.12);
  --info: #5a5a5a;
  --info-bg: rgba(90, 90, 90, 0.08);

  /* Variações de série (charts) */
  --s1: #5a6b7a;
  --s2: #c89060;
  --s3: #6b9b85;
  --s4: #b8956a;

  /* Shadow minimalista */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* Layout */
  --radius: 6px;
  --radius-sm: 4px;
  --tabs-h: 74px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Modo escuro: cinza mineral */
    --bg: #1a1a18;
    --card: #2a2a26;
    --surface: #323229;
    --elev: #2e2e2a;

    --text: #e8e8e6;
    --muted: #a89e94;
    --faint: #7a6f67;
    --border: #3d3d38;
    --border-strong: #4a4a44;

    --warm: #d4a574;
    --cool: #6ba583;
    --good: #7bc97b;
    --good-bg: rgba(123, 201, 123, 0.15);
    --warn: #daa520;
    --warn-bg: rgba(218, 165, 32, 0.15);
    --bad: #e88888;
    --bad-bg: rgba(232, 136, 136, 0.15);
    --info: #b8b8b8;
    --info-bg: rgba(184, 184, 184, 0.1);

    --s1: #7a8e9e;
    --s2: #d9a679;
    --s3: #7fb89c;
    --s4: #c9a876;

    --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, sans-serif;
  font-feature-settings: "tnum" 1;
  padding-top: env(safe-area-inset-top);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px calc(var(--tabs-h) + 34px + env(safe-area-inset-bottom));
}

body.no-tabs main {
  padding-bottom: 28px;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h2 {
  font-size: 11px;
  margin: 32px 0 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}

h3 {
  font-size: 16px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

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

.small {
  font-size: 12px;
}

.right {
  text-align: right;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.between {
  justify-content: space-between;
}

.wrap {
  flex-wrap: wrap;
}

.grow {
  flex: 1;
  min-width: 0;
}

.mt {
  margin-top: 14px;
}

.mt2 {
  margin-top: 24px;
}

.hidden {
  display: none !important;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* Cabeçalho de página */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 20px;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--warm);
}

/* Card base */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 14px;
}

.stack > * + * {
  margin-top: 14px;
}

/* Hero · Destaque do dia */
.hero {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--warm);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
  color: var(--text);
}

.hero .eyebrow {
  font-size: 11px;
  color: var(--muted);
}

.hero h3 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 48px;
  letter-spacing: -0.03em;
  margin: 8px 0 2px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--warm);
}

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

.hero-stats {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.hero-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-width: 80px;
}

.hero-stat b {
  display: block;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 20px;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--warm);
}

.hero-stat span {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  display: block;
}

.hero .btn {
  margin-top: 16px;
  background: var(--warm);
  color: #fff;
  border-color: transparent;
}

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

@media (min-width: 640px) {
  .kpis {
    grid-template-columns: repeat(3, 1fr);
  }
}

.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.kpi .ic {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(212, 165, 116, 0.12);
  color: var(--warm);
  margin-bottom: 10px;
}

.kpi .ic svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kpi .l {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.kpi .v {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 6px;
  line-height: 1.1;
  color: var(--warm);
}

.kpi .v small {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 4px;
}

.kpi .s {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Badges e pílulas */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.3;
}

.badge.good {
  background: var(--good-bg);
  color: var(--good);
}

.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.badge.info {
  background: var(--info-bg);
  color: var(--info);
}

.badge.mute {
  background: var(--surface);
  color: var(--muted);
}

.badge.brand {
  background: rgba(212, 165, 116, 0.12);
  color: var(--warm);
}

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 7px;
  letter-spacing: 0.02em;
}

.tag.force {
  color: var(--warm);
  background: rgba(212, 165, 116, 0.12);
  border-color: transparent;
}

.pill {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 26px;
  padding: 0 8px;
  border-radius: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
}

.pills {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  vertical-align: middle;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  min-width: 48px;
  height: 44px;
  padding: 0 12px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip.on {
  background: var(--warm);
  border-color: var(--warm);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.chip:active {
  transform: scale(0.98);
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:active {
  transform: scale(0.96);
}

.btn.primary {
  background: var(--warm);
  border-color: var(--warm);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.btn.danger {
  color: var(--bad);
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  background: var(--card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow);
  flex: none;
  transition: all 0.15s;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.busy svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 6px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23a89e94' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  accent-color: var(--warm);
  cursor: pointer;
}

textarea {
  min-height: 80px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--warm);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.15);
}

.chip:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible,
summary:focus-visible,
.seg button:focus-visible {
  outline: 2px solid var(--warm);
  outline-offset: 2px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

/* Busca */
.search-wrap {
  position: relative;
  margin: 16px 0 4px;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.search {
  padding-left: 42px;
  background: var(--card);
  border-color: var(--border);
}

/* Segmented control */
.seg {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.seg button.on {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar select {
  flex: 1;
  min-width: 160px;
  background-color: var(--card);
}

/* Acordeão genérico */
details > summary {
  list-style: none;
  cursor: pointer;
}

details > summary::-webkit-details-marker {
  display: none;
}

.chev {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  flex: none;
  transition: transform 0.22s ease;
}

.chev svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

details[open] > summary .chev {
  transform: rotate(180deg);
}

.fold {
  animation: fold 0.22s ease;
}

@keyframes fold {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* Treino: Rotinas */
.routine {
  background: var(--card);
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.routine + .routine {
  margin-top: 0;
  border-top: 1px solid var(--border);
}

.routine > summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.routine[open] > summary {
  border-bottom: 2px solid var(--warm);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex: none;
  letter-spacing: -0.02em;
  background: var(--warm);
}

.avatar.alt1 {
  background: #a86649;
}

.avatar.alt2 {
  background: #5a9d7b;
}

.avatar.alt3 {
  background: #a88559;
}

.routine .r-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.routine .r-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.routine .r-body {
  border-top: 1px solid var(--border);
  padding: 8px 0;
}

/* Treino: Exercício (abre detalhe) */
.ex {
  border-radius: 0;
  transition: background 0.15s;
}

.ex + .ex {
  border-top: 1px solid var(--border);
}

.ex > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 12px 16px;
}

.ex[open] {
  background: var(--surface);
}

.ex .name {
  font-weight: 650;
  letter-spacing: -0.005em;
}

.ex .sub {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 3px;
  flex-wrap: wrap;
}

.next {
  text-align: right;
  white-space: nowrap;
  line-height: 1.1;
}

.next .v {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--warm);
}

.next .u {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.next .arr {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 800;
  margin-left: 4px;
  vertical-align: 3px;
  font-style: normal;
  background: var(--surface);
  color: var(--muted);
}

.next.up .arr {
  background: var(--good-bg);
  color: var(--good);
}

.next.down .arr {
  background: var(--bad-bg);
  color: var(--bad);
}

.next small {
  display: block;
  font-size: 11px;
  color: var(--faint);
  font-weight: 600;
  margin-top: 3px;
}

.ex-body {
  padding: 12px 16px 16px;
}

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

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.stat .l {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.stat .v {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--warm);
}

.goal {
  margin-top: 10px;
}

.note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

/* Banner de pendências */
.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: 650;
}

.banner .count {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 800;
  flex: none;
}

.banner .go {
  margin-left: auto;
  color: var(--warm);
  font-weight: 700;
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  margin-right: 6px;
  vertical-align: 1px;
  box-shadow: 0 0 0 3px var(--warn-bg);
}

/* Log: Sessões */
.day {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.day + .day {
  margin-top: 14px;
}

.day-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.day[open] > .day-head {
  border-bottom: 2px solid var(--warm);
}

.datebox {
  width: 48px;
  flex: none;
  text-align: center;
  border-radius: 4px;
  padding: 6px 0;
  background: rgba(212, 165, 116, 0.12);
  color: var(--warm);
}

.datebox .w {
  display: block;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.datebox .d {
  display: block;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.datebox .m {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.8;
}

.day-head .t {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.day-head .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  gap: 8px 10px;
  flex-wrap: wrap;
}

.day-body {
  border-top: 1px solid var(--border);
  padding: 0;
}

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.entry:last-child {
  border-bottom: 0;
}

.entry:hover {
  background: var(--surface);
}

.entry .n {
  font-weight: 650;
}

.entry .d {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.entry .r {
  text-align: right;
  white-space: nowrap;
}

.entry .r b {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--warm);
}

.entry .r small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.entry .r small.up {
  color: var(--good);
}

.entry .r small.down {
  color: var(--bad);
}

/* Semanas */
.week {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.week + .week {
  margin-top: 14px;
}

.week > summary {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.week[open] > summary {
  border-bottom: 2px solid var(--warm);
}

.week .w-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.week .w-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.week .w-mini {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.mini {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.mini b {
  display: block;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--warm);
}

.mini span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  display: block;
  margin-top: 2px;
}

.week .w-body {
  border-top: 1px solid var(--border);
  padding: 16px;
}

.mgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 560px) {
  .mgrid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.mtile {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.mtile .l {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.mtile .v {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--warm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.subhead {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 10px;
}

.bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 40px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-row .track {
  height: 8px;
  border-radius: 2px;
  background: var(--surface);
  overflow: hidden;
}

.bar-row .fill {
  height: 100%;
  border-radius: 2px;
  background: var(--warm);
}

.bar-row .val {
  text-align: right;
  font-weight: 700;
  font-family: "Playfair Display", Georgia, serif;
  color: var(--warm);
}

.info-card {
  font-size: 13px;
  color: var(--muted);
}

.info-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.legend-zones {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

/* Painel */
.status-list {
  display: grid;
  gap: 1px;
}

.status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.status:last-child {
  border-bottom: 0;
}

.status .ico {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex: none;
}

.status .ico.good {
  background: var(--good-bg);
  color: var(--good);
}

.status .ico.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.status .ico.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.status .ico.mute {
  background: var(--surface);
  color: var(--muted);
}

.status .t {
  font-weight: 650;
  font-size: 14px;
}

.status .sub {
  font-size: 12px;
  color: var(--muted);
}

.status .val {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
  font-size: 18px;
  text-align: right;
  color: var(--warm);
}

.keys {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 620px) {
  .keys {
    grid-template-columns: 1fr 1fr;
  }
}

.key {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.key .select-title {
  min-height: 36px;
  padding: 7px 34px 7px 12px;
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--radius-sm);
  background-color: var(--card);
  background-position: right 12px center;
  width: 100%;
}

.key .big {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 12px;
}

.key .big b {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--warm);
}

.key .big span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.key .stats {
  margin-top: 12px;
}

.key .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 720px) {
  .charts {
    grid-template-columns: 1fr 1fr;
  }

  .charts .wide {
    grid-column: 1 / -1;
  }
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.chart-box {
  height: 240px;
  position: relative;
}

.chart-card canvas {
  max-width: 100%;
}

/* Listas */
.list > a,
.list > .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px;
  border-top: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
}

.list > :first-child {
  border-top: 0;
}

.list .lead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.list .tile {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: var(--surface);
  flex: none;
}

.list .go {
  color: var(--faint);
  font-size: 18px;
}

.list .chev {
  background: transparent;
}

/* Navegação flutuante */
#tabs {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  justify-content: space-around;
  max-width: 520px;
  margin: 0 auto;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--card) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

#tabs a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

#tabs svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#tabs a.on {
  color: var(--warm);
  background: rgba(212, 165, 116, 0.1);
}

/* Avisos */
#offline {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--warn-bg);
  color: var(--warn);
  text-align: center;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs-h) + 22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--card);
  color: var(--text);
  padding: 11px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  max-width: 92vw;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: pop 0.25s ease;
}

.toast.bad {
  background: var(--bad);
  color: #fff;
}

.toast.good {
  background: var(--good);
  color: #fff;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}

/* Modal (bottom sheet) */
#modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.2s ease;
}

#modal[hidden] {
  display: none;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.sheet {
  background: var(--elev);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow: auto;
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  animation: up 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: 1px solid var(--border);
}

.sheet::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  margin: 0 auto 14px;
}

@keyframes up {
  from {
    transform: translateY(30px);
    opacity: 0.4;
  }
}

@media (min-width: 640px) {
  #modal {
    align-items: center;
  }

  .sheet {
    border-radius: 12px;
  }
}

.sheet h2 {
  margin: 0 0 4px;
  font-size: 20px;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--text);
  font-weight: 800;
}

.sheet .stats {
  margin-top: 14px;
}

.sheet .stat {
  background: var(--surface);
}

/* Login */
.auth {
  max-width: 380px;
  margin: 9vh auto 0;
}

.auth .logo {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-lg);
}

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

.empty .big-ic {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
}

.skeleton {
  height: 78px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--card), var(--surface), var(--card));
  background-size: 200% 100%;
  animation: sh 1.2s infinite;
  margin-top: 12px;
  border: 1px solid var(--border);
}

.skeleton:first-child {
  height: 170px;
}

@keyframes sh {
  to {
    background-position: -200% 0;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
