/* Componentes do Planner, no padrão do 4Broker OS. Tokens: tema-metas.css. */
a { color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.tabular { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Shell */
.app-shell {
  --header-height: 64px;
  --sidebar-gutter: 12px;
  --sidebar-width: 264px;
  --sidebar-width-collapsed: 84px;
  --sidebar-radius: 28px;
  --sidebar-item-radius: 16px;
  display: flex;
  min-height: 100dvh;
}
.app-shell__sidebar-anchor {
  position: sticky;
  top: 0;
  z-index: 30;
  width: var(--sidebar-width-collapsed);
  height: 100dvh;
  flex: none;
  transition: width var(--motion-standard) var(--ease-standard);
}
.app-shell__sidebar-anchor[data-pinned="true"] { width: var(--sidebar-width); }
.app-body { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.app-main {
  width: 100%;
  max-width: 1600px;
  min-width: 0;
  flex: 1;
  margin: 0 auto;
  padding: 32px 32px calc(40px + env(safe-area-inset-bottom, 0px));
}
.app-shell[data-pinned="true"] .app-main { max-width: 1500px; }

/* ---------------------------------------------------------------- Sidebar */
.app-sidebar {
  --sidebar-label-opacity: 0;
  --sidebar-label-visibility: hidden;
  --sidebar-panel-bg: linear-gradient(180deg, color-mix(in srgb, var(--primary) 3%, var(--surface)) 0%, var(--surface) 42%, color-mix(in srgb, var(--primary) 5%, var(--surface)) 100%);
  --sidebar-panel-border: var(--border);
  --sidebar-panel-highlight: rgb(255 255 255 / 70%);
  position: absolute;
  top: var(--sidebar-gutter);
  bottom: var(--sidebar-gutter);
  left: var(--sidebar-gutter);
  display: flex;
  width: calc(var(--sidebar-width-collapsed) - var(--sidebar-gutter));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--sidebar-panel-border);
  border-radius: var(--sidebar-radius);
  background: var(--sidebar-panel-bg);
  box-shadow: inset 0 1px 0 var(--sidebar-panel-highlight), var(--shadow-sm);
  transition: width var(--motion-standard) var(--ease-standard), box-shadow var(--motion-standard) var(--ease-standard);
}
:root[data-theme="dark"] .app-sidebar {
  --sidebar-panel-bg: linear-gradient(180deg, #0e1520 0%, #0b101a 55%, #0a0e17 100%);
  --sidebar-panel-border: #161d29;
  --sidebar-panel-highlight: rgb(255 255 255 / 3%);
}
.app-shell__sidebar-anchor:is([data-pinned="true"], :has(:focus-visible)) .app-sidebar,
.app-shell__sidebar-anchor:not([data-hover-suppressed="true"]):hover .app-sidebar,
.app-sidebar--mobile {
  --sidebar-label-opacity: 1;
  --sidebar-label-visibility: visible;
  width: calc(var(--sidebar-width) - var(--sidebar-gutter));
}
.app-shell__sidebar-anchor:not([data-pinned="true"]):not([data-hover-suppressed="true"]):hover .app-sidebar,
.app-shell__sidebar-anchor:not([data-pinned="true"]):has(:focus-visible) .app-sidebar {
  box-shadow: inset 0 1px 0 var(--sidebar-panel-highlight), var(--shadow-md);
}
.app-sidebar--mobile { position: relative; inset: auto; width: 100%; height: 100%; border-left: 0; border-radius: 0 var(--sidebar-radius) var(--sidebar-radius) 0; }

.app-sidebar__header { position: relative; display: flex; flex: 0 0 76px; align-items: center; gap: 12px; padding-left: 13px; }
.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  border-radius: 13px;
  background: var(--brand-gradient);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-600) 24%, transparent);
}
.brand-mark span { width: 18px; height: 18px; border: 2.5px solid #fff; border-radius: 5px; transform: rotate(-10deg); }
.brand-name { display: grid; min-width: 0; line-height: 1.2; white-space: nowrap; opacity: var(--sidebar-label-opacity); visibility: var(--sidebar-label-visibility); transition: opacity var(--motion-fast) var(--ease-standard); }
.brand-name strong { font-size: 1rem; font-weight: 700; letter-spacing: -0.03em; }
.brand-name small { color: var(--text-muted); font-size: 11.5px; }
.app-sidebar__close { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); }

.app-sidebar__nav { min-height: 0; flex: 1; overflow-y: auto; padding: 4px 10px 12px; overscroll-behavior: contain; scrollbar-width: none; }
.app-sidebar__nav::-webkit-scrollbar { width: 0; }
.app-sidebar__group + .app-sidebar__group { margin-top: 14px; }
.app-sidebar__group-label {
  position: relative;
  display: flex;
  height: 26px;
  align-items: center;
  margin: 0;
  padding-left: 14px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.app-sidebar__group-label::before {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 1px;
  background: var(--border);
  content: "";
  opacity: calc(1 - var(--sidebar-label-opacity));
  transition: opacity var(--motion-fast) var(--ease-standard);
}
.app-sidebar__group-label span, .app-sidebar__label, .app-sidebar__pin-label {
  opacity: var(--sidebar-label-opacity);
  visibility: var(--sidebar-label-visibility);
  transition: opacity var(--motion-fast) var(--ease-standard);
}
.app-sidebar__items { display: grid; gap: 4px; }
.app-sidebar__item, .app-sidebar__pin {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 46px;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--sidebar-item-radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-small);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  transition: background-color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.app-sidebar__item:not([aria-current="page"]):hover, .app-sidebar__pin:hover { background: color-mix(in srgb, var(--text-primary) 5%, transparent); color: var(--text-primary); }
.app-sidebar__item:focus-visible, .app-sidebar__pin:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.app-sidebar__item[aria-current="page"] {
  border-color: color-mix(in srgb, var(--primary) 26%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, transparent) 0%, color-mix(in srgb, var(--primary) 6%, transparent) 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 6%), 0 6px 18px color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-weight: 600;
}
:root[data-theme="dark"] .app-sidebar__item[aria-current="page"] { border-color: #1d3256; background: linear-gradient(90deg, #16284a 0%, #122039 100%); box-shadow: inset 0 1px 0 rgb(255 255 255 / 4%); color: #e6eefa; }
:root[data-theme="dark"] .app-sidebar__item, :root[data-theme="dark"] .app-sidebar__pin { color: #b0b7c5; }
.app-sidebar__item-icon { display: grid; width: 48px; height: 44px; place-items: center; }
.app-sidebar__label, .app-sidebar__pin-label { min-width: 0; overflow: hidden; padding-right: 10px; text-overflow: ellipsis; white-space: nowrap; }
.app-sidebar__footer { display: grid; flex: none; margin: 8px 10px 0; padding: 8px 0 12px; border-top: 1px solid var(--border); }
.app-sidebar__pin { min-height: 42px; }
.app-sidebar__pin[aria-pressed="true"] { color: var(--primary); }

/* Modo claro: sidebar em azul elétrico (#0147ff), itens em branco. O escuro segue o DS. */
:root:not([data-theme="dark"]) .app-sidebar {
  --sidebar-panel-bg: linear-gradient(180deg, #1452ff 0%, #0147ff 45%, #003fe6 100%);
  --sidebar-panel-border: #0140e6;
  --sidebar-panel-highlight: rgb(255 255 255 / 18%);
}
:root:not([data-theme="dark"]) .app-sidebar__item,
:root:not([data-theme="dark"]) .app-sidebar__pin { color: rgb(255 255 255 / 80%); }
:root:not([data-theme="dark"]) .app-sidebar__item:not([aria-current="page"]):hover,
:root:not([data-theme="dark"]) .app-sidebar__pin:hover { background: rgb(255 255 255 / 12%); color: #fff; }
:root:not([data-theme="dark"]) .app-sidebar__item[aria-current="page"] { border-color: transparent; background: #fff; box-shadow: 0 6px 18px rgb(0 20 90 / 25%); color: #0147ff; }
:root:not([data-theme="dark"]) .app-sidebar__item:focus-visible,
:root:not([data-theme="dark"]) .app-sidebar__pin:focus-visible { outline-color: #fff; }
:root:not([data-theme="dark"]) .app-sidebar__pin[aria-pressed="true"] { color: #fff; }
:root:not([data-theme="dark"]) .app-sidebar__group-label { color: rgb(255 255 255 / 62%); }
:root:not([data-theme="dark"]) .app-sidebar__group-label::before { background: rgb(255 255 255 / 28%); }
:root:not([data-theme="dark"]) .app-sidebar__footer { border-top-color: rgb(255 255 255 / 20%); }
:root:not([data-theme="dark"]) .app-sidebar .brand-mark { background: #fff; box-shadow: none; }
:root:not([data-theme="dark"]) .app-sidebar .brand-mark span { border-color: #0147ff; }
:root:not([data-theme="dark"]) .app-sidebar .brand-name strong { color: #fff; }
:root:not([data-theme="dark"]) .app-sidebar .brand-name small,
:root:not([data-theme="dark"]) .app-sidebar__close { color: rgb(255 255 255 / 72%); }
:root:not([data-theme="dark"]) .app-sidebar__close:hover { background: rgb(255 255 255 / 12%); color: #fff; }

.app-drawer { position: fixed; inset: 0; z-index: 50; }
.app-drawer[hidden] { display: none; }
.app-drawer__backdrop { position: absolute; inset: 0; border: 0; background: rgb(2 6 23 / 45%); backdrop-filter: blur(2px); }
.app-drawer__panel { position: relative; width: min(288px, calc(100% - 40px)); height: 100%; box-shadow: var(--shadow-md); animation: drawer-in var(--motion-standard) var(--ease-standard); }
@keyframes drawer-in { from { transform: translateX(-16px); opacity: 0; } }

/* ----------------------------------------------------------------- Topbar */
.app-topbar {
  --topbar-control-height: 44px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 76px;
  min-width: 0;
  flex: none;
  align-items: center;
  gap: 12px;
  padding: 0 32px;
  background: var(--topbar-surface);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.app-topbar::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--topbar-line) 18%, var(--topbar-line) 82%, transparent 100%);
  content: "";
  pointer-events: none;
}
.app-topbar__context { display: flex; min-width: 0; flex: 1; align-items: center; gap: 10px; color: var(--text-muted); font-size: var(--font-size-small); }
.app-topbar__context strong { color: var(--text-primary); font-weight: 600; }
.app-topbar__context span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar__controls { display: flex; flex: none; align-items: center; gap: 10px; }
.app-topbar__icon {
  position: relative;
  display: inline-grid;
  width: var(--topbar-control-height);
  height: var(--topbar-control-height);
  flex: none;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  transition: background-color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.app-topbar__icon:hover { border-color: var(--control-border); background: var(--control-glass); color: var(--text-primary); }
.app-topbar__icon:disabled { opacity: .45; pointer-events: none; }
.app-topbar__icon[aria-busy="true"] svg { animation: app-spin 800ms linear infinite; }
.app-topbar__divider { width: 1px; height: 32px; margin: 0 4px; background: var(--topbar-line); }
.app-topbar__status {
  display: inline-flex;
  height: var(--topbar-control-height);
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--control-border);
  border-radius: var(--radius-md);
  background: var(--control-glass);
  color: var(--text-primary);
  font-size: var(--font-size-small);
  font-weight: 500;
  white-space: nowrap;
  transition: border-color var(--motion-fast) var(--ease-standard);
}
.app-topbar__status:hover { border-color: var(--border-strong); }
.status-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--text-muted); }
.status-dot[data-tone="success"] { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot[data-tone="primary"] { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.status-dot[data-tone="danger"] { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.theme-segment { position: relative; display: grid; width: 84px; height: var(--topbar-control-height, 44px); flex: none; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 4px; border: 1px solid var(--control-border); border-radius: var(--radius-pill); background: var(--control-glass); }
.theme-segment__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 2);
  border: 1px solid color-mix(in srgb, var(--primary) 38%, transparent);
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 18%, transparent) 0%, color-mix(in srgb, var(--primary) 8%, transparent) 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%), 0 4px 14px color-mix(in srgb, var(--primary) 18%, transparent);
  transition: transform var(--motion-standard) var(--ease-standard);
}
:root[data-theme="dark"] .theme-segment__indicator { transform: translateX(100%); }
.theme-segment button { position: relative; z-index: 1; display: grid; min-width: 0; place-items: center; padding: 0; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-muted); transition: color var(--motion-fast) var(--ease-standard); }
.theme-segment button:hover { color: var(--text-primary); }
.theme-segment button[aria-pressed="true"] { color: var(--primary); }
:root[data-theme="dark"] .theme-segment button[aria-pressed="true"] { color: #fff; }
.theme-segment button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ------------------------------------------------------------- Page title */
.page { display: grid; gap: 24px; }
.page-title-bar { position: relative; z-index: 10; display: flex; flex-direction: column; gap: 12px; }
.page-title-bar h1 { margin: 0; color: var(--text-primary); font-size: var(--font-size-h2); font-weight: 600; letter-spacing: -0.03em; line-height: 1.18; }
.page-title-bar p { margin: 4px 0 0; color: var(--text-muted); font-size: var(--font-size-small); }
.page-title-bar p::first-letter { text-transform: uppercase; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (min-width: 768px) { .page-title-bar { flex-direction: row; align-items: flex-end; justify-content: space-between; } }

/* ----------------------------------------------------------------- Botões */
.btn {
  display: inline-flex;
  height: 44px;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-size: var(--font-size-small);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--motion-standard) var(--ease-standard), border-color var(--motion-standard) var(--ease-standard), color var(--motion-standard) var(--ease-standard), transform var(--motion-standard) var(--ease-standard);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn--sm { height: 36px; gap: 8px; padding: 0 12px; }
.btn--primary { border-radius: var(--radius-pill); background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--secondary { border-color: var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-primary); }
.btn--secondary:hover { border-color: var(--border-strong); background: var(--surface-subtle); }
.btn--ghost { border-radius: var(--radius-md); background: transparent; color: var(--text-secondary); }
.btn--ghost:hover { background: var(--surface-subtle); color: var(--text-primary); }
.btn--danger { border-radius: var(--radius-md); background: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-hover); }
.text-link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--primary); font-size: var(--font-size-small); font-weight: 500; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.text-link--danger { color: var(--danger); }
.icon-btn { display: inline-grid; width: 32px; height: 32px; flex: none; place-items: center; padding: 0; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard); }
.icon-btn:hover { background: var(--surface-subtle); color: var(--text-primary); }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }

/* Controles de filtro (40 px, raio 14, como o filtro de período). */
.control {
  display: inline-flex;
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font-size: var(--font-size-small);
}
.control > svg { flex: none; color: var(--primary); }
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap select { height: 40px; min-width: 96px; padding: 0 34px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-primary); font-size: var(--font-size-small); font-weight: 500; appearance: none; -webkit-appearance: none; transition: border-color var(--motion-fast) var(--ease-standard); }
.select-wrap select:hover { border-color: var(--border-strong); }
.select-wrap select:focus-visible { border-color: color-mix(in srgb, var(--primary) 55%, transparent); outline: none; box-shadow: 0 0 0 4px var(--focus); }
.select-wrap > svg { position: absolute; right: 11px; color: var(--text-muted); pointer-events: none; }
.select-wrap--icon select { padding-left: 38px; }
.select-wrap--icon > svg:first-child { right: auto; left: 12px; color: var(--primary); }

.segmented { display: inline-flex; height: 40px; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.segmented button { height: 32px; padding: 0 12px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--text-secondary); font-size: var(--font-size-small); font-weight: 500; transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard); }
.segmented button:hover { color: var(--text-primary); }
.segmented button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--primary) 22%, transparent); background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* ------------------------------------------------------------------ Cards */
.card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--motion-standard) var(--ease-standard), box-shadow var(--motion-standard) var(--ease-standard);
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card--flush { gap: 0; overflow: hidden; padding: 0; }
.card-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.card-title h2 { margin: 0; color: var(--text-primary); font-size: var(--font-size-body); font-weight: 600; letter-spacing: -0.01em; }
.card-title > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--font-size-small); }
.card-caption { margin: -10px 0 0; color: var(--text-muted); font-size: var(--font-size-caption); }
.section-label { margin: 0; color: var(--text-muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.grid-2 { display: grid; gap: 16px; }
.grid-kpi { display: grid; gap: 16px; }
@media (min-width: 1100px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
@media (min-width: 720px) { .grid-kpi { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); } }

.stat-icon { display: inline-grid; width: 32px; height: 32px; flex: none; place-items: center; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); transition: transform 200ms var(--ease-standard); }
.kpi:hover .stat-icon { transform: scale(1.1); }
.kpi { gap: 12px; }
.kpi__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi__label { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: var(--font-size-small); font-weight: 500; }
.kpi__value { margin: 0; color: var(--text-primary); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi__value small { color: var(--text-muted); font-size: var(--font-size-small); font-weight: 400; letter-spacing: 0; }
.kpi__foot { margin: 0; color: var(--text-muted); font-size: var(--font-size-caption); }

.badge { display: inline-flex; min-height: 24px; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-pill); box-shadow: inset 0 0 0 1px var(--badge-ring); background: var(--badge-bg); color: var(--badge-text); font-size: var(--font-size-caption); font-weight: 500; white-space: nowrap; }
.badge, .badge[data-tone="neutral"] { --badge-bg: var(--surface-subtle); --badge-text: var(--text-secondary); --badge-ring: var(--border); }
.badge[data-tone="primary"] { --badge-bg: var(--primary-soft); --badge-text: var(--primary); --badge-ring: color-mix(in srgb, var(--primary) 15%, transparent); }
.badge[data-tone="success"] { --badge-bg: var(--success-soft); --badge-text: var(--success); --badge-ring: color-mix(in srgb, var(--success) 15%, transparent); }
.badge[data-tone="warning"] { --badge-bg: var(--warning-soft); --badge-text: var(--warning); --badge-ring: color-mix(in srgb, var(--warning) 15%, transparent); }
.badge[data-tone="danger"] { --badge-bg: var(--danger-soft); --badge-text: var(--danger); --badge-ring: color-mix(in srgb, var(--danger) 15%, transparent); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); color: var(--text-muted); font-size: var(--font-size-caption); }
.pill strong { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.pin-swatch { width: 8px; height: 8px; border: 2px solid var(--text-primary); border-radius: 50%; background: var(--surface); box-sizing: content-box; }
.bar-swatch { width: 12px; height: 6px; border-radius: 999px; }
.tick-swatch { width: 2px; height: 12px; border-radius: 999px; background: color-mix(in srgb, var(--text-primary) 70%, transparent); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--text-muted); font-size: var(--font-size-caption); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* --------------------------------------------------------------- Progresso */
.progress { position: relative; width: 100%; height: 8px; border-radius: 999px; background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.progress--sm { height: 6px; }
.progress--lg { height: 12px; }
.progress__fill, .progress__projection { position: absolute; top: 0; bottom: 0; left: 0; border-radius: inherit; transform-origin: left; }
.progress__projection { opacity: .3; }
.progress__tick { position: absolute; top: -4px; width: 2px; height: calc(100% + 8px); border-radius: 999px; background: color-mix(in srgb, var(--text-primary) 70%, transparent); transform: translateX(-50%); }

.ring { position: relative; display: grid; flex: none; place-items: center; transition: transform 300ms var(--ease-standard); }
.ring:hover { transform: scale(1.04); }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ring__track { stroke: var(--surface-subtle); }
.ring__track-line { stroke: var(--border); stroke-opacity: .55; }
.ring__pin { fill: var(--surface); stroke: var(--text-primary); }
.ring__center { position: relative; display: grid; justify-items: center; text-align: center; }
.ring__value { color: var(--text-primary); font-weight: 500; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring__value[data-reached="true"] { color: var(--success); }
.ring__caption { margin-top: 4px; color: var(--text-muted); font-size: var(--font-size-caption); }

/* -------------------------------------------------------------- Hero card */
.hero { display: grid; }
.hero__main { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 24px; background: radial-gradient(120% 120% at 0% 0%, var(--primary-soft), transparent 65%); }
.hero__text { display: grid; width: 100%; min-width: 0; gap: 12px; }
.hero__label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-secondary); font-size: var(--font-size-small); font-weight: 500; }
.hero__label > span { display: inline-flex; align-items: center; gap: 8px; }
.hero__label svg { color: var(--primary); }
.hero__big { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 0; font-variant-numeric: tabular-nums; }
.hero__big strong { color: var(--text-primary); font-size: 3.25rem; font-weight: 600; letter-spacing: -0.045em; line-height: 1; }
.hero__big span { color: var(--text-muted); font-size: var(--font-size-h3); }
.hero__sentence { margin: 0; color: var(--text-primary); font-size: var(--font-size-small); }
.hero__pills { display: flex; flex-wrap: wrap; gap: 8px; }
.hero__side { display: grid; align-content: center; gap: 20px; padding: 24px; border-top: 1px solid var(--border); }
.tiles { display: grid; gap: 16px; }
.tile { display: grid; align-content: start; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface-subtle) 50%, transparent); transition: transform 200ms var(--ease-standard), box-shadow 200ms var(--ease-standard), border-color 200ms var(--ease-standard); }
.tile:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm), 0 8px 20px color-mix(in oklab, var(--primary) 8%, transparent); }
.tile__value { margin: 0; color: var(--text-primary); font-size: var(--font-size-h3); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile__value small { color: var(--text-muted); font-size: var(--font-size-caption); font-weight: 400; letter-spacing: 0; }
.tile dl { display: grid; gap: 6px; margin: 0; font-size: var(--font-size-caption); }
.tile dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tile dt { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.tile dd { margin: 0; color: var(--text-primary); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; }
.time-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: var(--font-size-small); }
.time-head > span:first-child { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.time-head > span:first-child svg { color: var(--primary); }
.time-head > span:last-child { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.time-head strong { color: var(--text-primary); font-weight: 600; }
.days { display: flex; height: 28px; align-items: stretch; gap: 3px; }
.days > span { position: relative; min-width: 0; flex: 1; transform-origin: bottom; transition: transform 180ms var(--ease-standard); }
.days > span > i { display: block; height: 100%; border-radius: 3px; background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.days > span[data-state="past"] > i { background-image: linear-gradient(0deg, var(--progress-primary-from), var(--progress-primary-to)); box-shadow: none; }
.days > span[data-state="today"] > i { background-image: linear-gradient(0deg, var(--progress-primary-from), var(--progress-primary-to)); box-shadow: 0 0 0 1px var(--surface), 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent); }
.days > span:hover { transform: translateY(-7px) scaleY(1.12); }
.days > span:has(+ span:hover), .days > span:hover + span { transform: translateY(-4px); }
.days > span > b { position: absolute; bottom: calc(100% + 10px); left: 50%; z-index: 20; padding: 4px 8px; border-radius: var(--radius-sm); background: var(--text-primary); color: var(--surface); font-size: var(--font-size-caption); font-weight: 500; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateX(-50%); transition: opacity 150ms; }
.days > span:hover > b { opacity: 1; }
@media (min-width: 640px) { .hero__main { flex-direction: row; padding: 28px; } .hero__side { padding: 28px; } .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } .hero__side { border-top: 0; border-left: 1px solid var(--border); } }

/* ----------------------------------------------------- Listas e linhas */
.list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.focus-list > * { transition: opacity 180ms var(--ease-standard); }
.focus-list:has(> *:hover) > *:not(:hover) { opacity: .55; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; padding: 12px; border-radius: var(--radius-md); transition: background-color var(--motion-fast) var(--ease-standard); }
.row:hover { background: var(--surface-subtle); }
.row__title { display: grid; min-width: 0; gap: 2px; }
.row__title strong { overflow: hidden; color: var(--text-primary); font-size: var(--font-size-small); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.row__title small { color: var(--text-muted); font-size: var(--font-size-caption); }
.row__end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.empty-line { margin: 0; padding: 20px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-subtle); color: var(--text-muted); font-size: var(--font-size-small); text-align: center; }

/* Linhas de meta (no formato do “Funil da meta”). */
.goal-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--surface-subtle); color: var(--text-muted); font-size: var(--font-size-caption); font-weight: 500; }
.goal-head > span:nth-child(2), .goal-head > span:nth-child(4), .goal-head > span:nth-child(5) { display: none; }
.goal-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 24px; padding: 14px 16px; border-radius: var(--radius-md); transition: background-color var(--motion-fast) var(--ease-standard); }
.goal-row:hover { background: var(--surface-subtle); }
.goal-row__name { display: grid; min-width: 0; gap: 2px; }
.goal-row__name strong { color: var(--text-primary); font-size: var(--font-size-small); font-weight: 600; line-height: 1.35; }
.goal-row__name small { font-size: var(--font-size-caption); }
.goal-row .progress { order: 9; grid-column: 1 / -1; }
.goal-row__value { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.goal-row__value strong { color: var(--text-primary); font-size: var(--font-size-body); font-weight: 600; }
.goal-row__value span { color: var(--text-muted); font-size: var(--font-size-small); }
.goal-row__pct { display: none; font-size: var(--font-size-small); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.goal-row__pct[data-reached="true"] { color: var(--success); }
.goal-row .row-actions { display: none; }
.goal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0 16px 10px; color: var(--text-muted); font-size: var(--font-size-caption); }
.goal-meta .chip-link { display: inline-flex; align-items: center; gap: 5px; }
.goal-meta details summary { color: var(--text-secondary); cursor: pointer; list-style: none; }
.goal-meta details summary::-webkit-details-marker { display: none; }
.goal-meta details summary:hover { color: var(--text-primary); }
.goal-meta details[open] { flex-basis: 100%; }
.entries { display: grid; gap: 2px; margin: 8px 0 0; padding: 0; list-style: none; }
.entries li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 2px 10px; border-radius: var(--radius-sm); background: var(--surface-subtle); }
.entries .icon-btn { width: 26px; height: 26px; }
.goal-mobile-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.status-text[data-tone="success"] { color: var(--success); }
.status-text[data-tone="primary"] { color: var(--primary); }
.status-text[data-tone="warning"] { color: var(--warning); }
.status-text[data-tone="neutral"] { color: var(--text-muted); }
@media (min-width: 760px) {
  .goal-head, .goal-row { grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr) 7rem 4rem 7.5rem; }
  .goal-head > span:nth-child(2), .goal-head > span:nth-child(4), .goal-head > span:nth-child(5) { display: block; }
  .goal-head > span:nth-child(3), .goal-head > span:nth-child(4) { text-align: right; }
  .goal-row .progress { order: 0; grid-column: auto; }
  .goal-row__pct, .goal-row .row-actions { display: flex; justify-content: flex-end; }
  .goal-mobile-actions { display: none; }
}

/* Anéis de ritmo */
.rings { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.ring-tile { display: grid; justify-items: center; gap: 10px; padding: 16px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface-subtle) 50%, transparent); text-align: center; transition: transform 200ms var(--ease-standard), border-color 200ms var(--ease-standard), box-shadow 200ms var(--ease-standard); }
.ring-tile:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.ring-tile strong { display: -webkit-box; overflow: hidden; color: var(--text-primary); font-size: var(--font-size-small); font-weight: 600; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ring-tile small { color: var(--text-muted); font-size: var(--font-size-caption); font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- Hábitos */
.habit-cell { display: inline-grid; width: 32px; height: 32px; place-items: center; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: #fff; transition: transform 150ms var(--ease-standard), border-color 150ms var(--ease-standard), box-shadow 150ms var(--ease-standard); }
.habit-cell svg { opacity: 0; transform: scale(.6); transition: opacity 150ms var(--ease-standard), transform 150ms var(--ease-standard); }
.habit-cell:hover:not(:disabled) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.habit-cell:active:not(:disabled) { transform: scale(.92); }
.habit-cell[aria-pressed="true"] { border-color: transparent; background-image: linear-gradient(135deg, var(--progress-primary-from), var(--progress-primary-to)); box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 28%, transparent); }
.habit-cell[aria-pressed="true"] svg { opacity: 1; transform: none; }
.habit-cell:disabled { border-style: dashed; background: transparent; cursor: default; opacity: .5; }
.habit-cell--sm { width: 28px; height: 28px; border-radius: 9px; }

.table-scroll { margin: 0 -20px; overflow-x: auto; padding: 0 20px; }
.table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.table th { padding: 10px 8px; background: var(--surface-subtle); color: var(--text-muted); font-size: var(--font-size-caption); font-weight: 500; text-align: center; }
.table th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding-left: 16px; text-align: left; }
.table th:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.table th b { display: block; color: var(--text-secondary); font-weight: 600; }
.table th[data-today="true"] b, .table th[data-today="true"] { color: var(--primary); }
.table td { padding: 14px 8px; border-top: 1px solid var(--border); text-align: center; vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr { transition: background-color var(--motion-fast) var(--ease-standard); }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-subtle) 60%, transparent); }
.table td:first-child { padding-left: 16px; text-align: left; }
.habit-name { display: grid; gap: 6px; }
.habit-name strong { overflow: hidden; color: var(--text-primary); font-size: var(--font-size-small); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.habit-name small { color: var(--text-muted); font-size: var(--font-size-caption); font-variant-numeric: tabular-nums; }

.heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.heatmap { display: grid; grid-template-rows: repeat(7, 14px); grid-auto-columns: 14px; grid-auto-flow: column; gap: 4px; width: max-content; }
.heat-cell { width: 14px; height: 14px; border-radius: 4px; background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); transition: transform 150ms var(--ease-standard); }
.heat-cell:hover { transform: scale(1.3); }
.heat-cell[data-on="true"] { background-image: linear-gradient(135deg, var(--progress-primary-from), var(--progress-primary-to)); box-shadow: none; }
.heat-cell[data-today="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--primary) 45%, transparent); }
.heat-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: var(--font-size-caption); }
.heat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.heat-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.heat-legend i[data-on="true"] { background-image: linear-gradient(135deg, var(--progress-primary-from), var(--progress-primary-to)); box-shadow: none; }
.history { display: grid; gap: 20px; }
.history__map { display: grid; width: max-content; max-width: 100%; min-width: 0; gap: 12px; }
@media (min-width: 900px) { .history { grid-template-columns: minmax(0, 1fr) 240px; align-items: start; } }
.history-stats { display: grid; gap: 4px; margin: 0; }
.history-stats > div { display: grid; gap: 2px; padding: 8px 10px; border-radius: var(--radius-sm); transition: background-color 180ms var(--ease-standard); }
.history-stats > div:hover { background: var(--surface-subtle); }
.history-stats dt { color: var(--text-muted); font-size: var(--font-size-caption); }
.history-stats dd { margin: 0; color: var(--text-primary); font-size: var(--font-size-body); font-weight: 600; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- Calendário */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav strong { min-width: 170px; color: var(--text-primary); font-size: var(--font-size-body); font-weight: 600; text-align: center; text-transform: capitalize; }
.cal-grid { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); }
.cal-weekdays, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays span { padding: 10px 4px; background: var(--surface-subtle); color: var(--text-muted); font-size: var(--font-size-caption); font-weight: 500; text-align: center; }
.cal-day { display: flex; min-width: 0; min-height: 104px; flex-direction: column; gap: 4px; padding: 8px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); transition: background-color var(--motion-fast) var(--ease-standard); }
.cal-day:nth-child(7n + 1) { border-left: 0; }
.cal-day:hover { background: color-mix(in srgb, var(--surface-subtle) 70%, transparent); }
.cal-day > b { display: inline-grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; color: var(--text-secondary); font-size: var(--font-size-caption); font-weight: 600; }
.cal-day[data-outside="true"] > b { color: var(--text-muted); opacity: .55; }
.cal-day[data-today="true"] > b { background: var(--primary); color: #fff; }
.cal-event { overflow: hidden; padding: 4px 8px; border-radius: var(--radius-xs); background: var(--primary-soft); color: var(--primary); font-size: 11.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { padding-left: 4px; color: var(--text-muted); font-size: 11px; }
.event-date { display: grid; width: 44px; height: 44px; flex: none; place-content: center; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); text-align: center; line-height: 1.1; }
.event-date strong { font-size: var(--font-size-body); font-weight: 600; }
.event-date small { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.event-row { display: flex; align-items: center; gap: 12px; }
.event-row .row__title { flex: 1; }
.week-list { display: grid; gap: 8px; }
.week-day { display: grid; gap: 4px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.week-day[data-today="true"] { border-color: color-mix(in srgb, var(--primary) 35%, transparent); background: color-mix(in srgb, var(--primary-soft) 45%, transparent); }
.week-day h3 { margin: 0; color: var(--text-primary); font-size: var(--font-size-small); font-weight: 600; text-transform: capitalize; }
.week-day .row { padding: 8px 0; }
.week-day .row:hover { background: transparent; }

/* --------------------------------------------------------- Avisos e estados */
.notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-subtle); color: var(--text-secondary); font-size: var(--font-size-small); animation: app-enter 300ms var(--ease-standard) both; }
.notice > span { display: flex; align-items: center; gap: 10px; }
.notice > span > svg { flex: none; color: var(--primary); }
.notice strong { color: var(--text-primary); font-weight: 600; }
.notice[data-tone="danger"] { border-color: color-mix(in srgb, var(--danger) 25%, transparent); background: var(--danger-soft); color: var(--text-primary); }
.notice[data-tone="danger"] > span > svg { color: var(--danger); }
.empty { display: flex; min-height: 208px; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-subtle); text-align: center; }
.empty__icon { display: grid; width: 44px; height: 44px; margin-bottom: 16px; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--primary); }
.empty h3 { margin: 0; color: var(--text-primary); font-size: var(--font-size-body); font-weight: 600; }
.empty p { max-width: 28rem; margin: 8px 0 0; color: var(--text-muted); font-size: var(--font-size-small); }
.empty .btn { margin-top: 20px; }
.skeleton { border-radius: var(--radius-sm); background: var(--surface-subtle); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.caption { margin: 0; color: var(--text-muted); font-size: var(--font-size-caption); }

/* ---------------------------------------------------------------- Diálogo */
.editor-dialog { width: min(520px, calc(100vw - 24px)); max-height: min(90dvh, 760px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface-raised); box-shadow: var(--shadow-md); color: var(--text-primary); }
.editor-dialog[open] { animation: app-enter 220ms var(--ease-standard); }
.editor-dialog::backdrop { background: rgb(2 6 23 / 45%); backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 24px 8px; }
.dialog-head h2 { margin: 0; font-size: var(--font-size-h3); font-weight: 600; letter-spacing: -0.02em; }
.dialog-head p { margin: 4px 0 0; color: var(--text-muted); font-size: var(--font-size-small); }
.dialog-body { display: grid; max-height: 60dvh; gap: 16px; overflow: auto; padding: 16px 24px 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 24px; border-top: 1px solid var(--border); }
.field { display: grid; gap: 6px; color: var(--text-secondary); font-size: var(--font-size-small); font-weight: 500; }
.input { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-primary); font-size: var(--font-size-small); font-weight: 400; transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard); }
.input:hover { border-color: var(--border-strong); }
.input:focus { border-color: color-mix(in srgb, var(--primary) 55%, transparent); outline: none; box-shadow: 0 0 0 4px var(--focus); }
.input::placeholder { color: var(--text-muted); }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-repeat: no-repeat; background-size: 5px 5px; padding-right: 36px; }
textarea.input { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-hint { margin: 0; color: var(--text-muted); font-size: var(--font-size-caption); line-height: 1.5; }
.form-context { margin: 0; padding: 12px 14px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary); font-size: var(--font-size-small); font-weight: 600; }
.settings-status { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-subtle); }
.settings-status strong { display: block; font-size: var(--font-size-small); }
.settings-status span { color: var(--text-muted); font-size: var(--font-size-caption); }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.divider { margin: 4px 0; border: 0; border-top: 1px solid var(--border); }
details.advanced summary { color: var(--primary); cursor: pointer; font-size: var(--font-size-small); font-weight: 500; }
details.advanced[open] { display: grid; gap: 12px; }

/* ------------------------------------------------------------------ Toast */
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: flex; max-width: min(420px, calc(100vw - 48px)); align-items: flex-start; gap: 10px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-raised); box-shadow: var(--shadow-md); color: var(--text-primary); font-size: var(--font-size-small); line-height: 1.45; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 200ms var(--ease-standard), transform 200ms var(--ease-standard); }
.toast svg { flex: none; margin-top: 1px; color: var(--success); }
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.toast.error svg { color: var(--danger); }

/* --------------------------------------------------------------- Responsivo */
@media (min-width: 1024px) { .app-topbar__menu, .app-drawer { display: none !important; } }
@media (max-width: 1023px) {
  .app-shell__sidebar-anchor { display: none; }
  .app-main { padding: 24px 24px calc(32px + env(safe-area-inset-bottom, 0px)); }
  .app-topbar { padding: 0 24px; }
}
@media (max-width: 767px) { .app-topbar__status-label { display: none; } .app-topbar__status { padding: 0 14px; } }
@media (max-width: 639px) {
  .app-topbar { --topbar-control-height: 40px; height: 64px; padding: 0 16px; gap: 8px; }
  .app-topbar__divider, .app-topbar__date { display: none; }
  .app-main { padding: 20px 16px calc(28px + env(safe-area-inset-bottom, 0px)); }
  .page-title-bar h1 { font-size: 1.5rem; }
  .page-actions > .btn--primary { flex: 1; }
  .card { padding: 16px; }
  .table-scroll { margin: 0 -16px; padding: 0 16px; }
  .hero__big strong { font-size: 2.75rem; }
  .cal-nav { width: 100%; justify-content: space-between; }
  .cal-nav strong { min-width: 0; flex: 1; }
  .cal-day { min-height: 64px; padding: 4px; }
  .cal-event { height: 6px; padding: 0; font-size: 0; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toast { right: 16px; bottom: 16px; left: 16px; max-width: none; }
}

/* Itens compactos do Início e relatórios */
.mini-goal { display: grid; gap: 10px; padding: 12px; border-radius: var(--radius-md); transition: background-color var(--motion-fast) var(--ease-standard); }
.mini-goal:hover { background: var(--surface-subtle); }
.mini-goal__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mini-goal__pct { color: var(--text-primary); font-size: var(--font-size-small); font-weight: 600; font-variant-numeric: tabular-nums; }
.mini-goal__pct[data-reached="true"] { color: var(--success); }
.habit-today { display: flex; min-width: 0; align-items: center; gap: 12px; }
.goal-row--report .row-actions { display: none !important; }
.goal-mobile-actions { order: 10; grid-column: 1 / -1; }
@media (max-width: 759px) { .card-title .legend { display: none; } }
@media (min-width: 760px) {
  .goal-row--report, .goal-head--report { grid-template-columns: minmax(10rem, 18rem) minmax(0, 1fr) 8rem 4rem; }
}
