@import url('https://fonts.cdnfonts.com/css/sf-pro-display');

/* =====================================================================
   Apple Design System — macOS Sequoia / iOS 18 HIG
   Clean, restrained, content-first. Every pixel intentional.
   ===================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
    'Helvetica Neue', Helvetica, Arial, sans-serif;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-alt: #f2f2f7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --muted: #86868b;
  --border: rgba(0, 0, 0, 0.06);
  --separator: rgba(60, 60, 67, 0.12);
  --primary: #007aff;
  --primary-hover: #0071e3;
  --soft: rgba(0, 122, 255, 0.08);
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --blue: #007aff;
  --purple: #af52de;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --nav: #1d1d1f;
  color-scheme: light;
}

body[data-theme=dark] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-alt: #2c2c2e;
  --text: #f5f5f7;
  --text-secondary: #aeaeb2;
  --muted: #8e8e93;
  --border: rgba(255, 255, 255, 0.08);
  --separator: rgba(84, 84, 88, 0.36);
  --primary: #0a84ff;
  --primary-hover: #409cff;
  --soft: rgba(10, 132, 255, 0.12);
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --blue: #0a84ff;
  --purple: #bf5af2;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --nav: #000000;
  color-scheme: dark;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.47;
  color: var(--text);
  background: var(--bg);
  letter-spacing: -0.08px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body, body *, body *::before, body *::after {
  font-family: var(--font);
}

button, input, select, textarea {
  font: inherit;
  letter-spacing: inherit;
  -webkit-tap-highlight-color: transparent;
}

button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.42; }

a { color: inherit; text-decoration: none; }
svg { width: 17px; height: 17px; stroke-width: 1.6; flex-shrink: 0; }

.muted { color: var(--muted); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- FOCUS ---- */
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.4);
  outline-offset: 2px;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 250px;
  background: var(--nav);
  position: fixed;
  inset: 0 auto 0 0;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  z-index: 30;
  padding: 28px 14px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
}

.brand strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.4px;
}

.brand-dot { color: var(--primary); }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 7px;
  flex-shrink: 0;
  background: var(--primary);
}

.brand-mark span {
  width: 5px;
  height: 13px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 1.5px;
}

.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 9px; }

.workspace-label {
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 30px 14px 8px;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.nav-link {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 7px;
  margin: 1px 0;
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  transition: background 0.15s, color 0.15s;
}

.nav-link svg { width: 17px; height: 17px; opacity: 0.7; }

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 500;
}

.nav-link.active svg { opacity: 1; }

.nav-link .nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
}

.nav-divider { height: 1px; background: rgba(255, 255, 255, 0.06); margin: 16px 12px; }

.sidebar-bottom { margin-top: auto; padding-top: 20px; }

.local-status {
  font-size: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.4);
}

.status-dot { width: 5px; height: 5px; background: var(--green); border-radius: 50%; display: inline-block; }

.local-pill {
  font-size: 9px;
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.3);
}

.sidebar-bottom p {
  font-size: 11px;
  line-height: 1.6;
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.3);
}

.profile {
  background: transparent;
  border: 0;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 16px 8px 4px;
  margin-top: 16px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 600;
}

.profile strong {
  font-size: 12px;
  font-weight: 500;
  display: block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.85);
}

.profile small {
  display: block;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 1px;
}

/* ---- TOP BAR ---- */
.app-shell { margin-left: 250px; }

.topbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 14px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.breadcrumb strong {
  font-weight: 600;
  color: var(--text);
}

.crumb-divider { color: var(--border); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.today {
  font-size: 12px;
  color: var(--muted);
  text-transform: capitalize;
}

.today svg { width: 14px; vertical-align: middle; margin-right: 6px; }

.top-divider { height: 20px; width: 1px; background: var(--border); }

.top-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--muted);
}

.icon-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  border-radius: 7px;
  transition: background 0.12s, color 0.12s;
}

.icon-button:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.topbar .icon-button { border-radius: 50%; }

.menu-toggle, .mobile-overlay { display: none; }
.skip-link { position: fixed; left: 10px; top: -50px; background: var(--primary); color: white; padding: 10px; z-index: 200; border-radius: 8px; }
.skip-link:focus { top: 10px; }

/* ---- MAIN CONTENT ---- */
main {
  padding: 28px 32px 24px;
  max-width: 1600px;
  margin: auto;
  min-height: calc(100vh - 100px);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 2px;
}

.page-heading h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.6px;
  line-height: 1.14;
  margin: 0;
}

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

.heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---- BUTTONS ---- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
}

.button svg { height: 14px; width: 14px; }
.button:hover { background: var(--surface-alt); }
.button:active { transform: scale(0.97); }

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.button.primary:hover { background: var(--primary-hover); }

.button.danger {
  color: var(--red);
  background: transparent;
  border-color: var(--border);
}

.button.danger:hover { background: rgba(255, 59, 48, 0.08); }

.button.small { font-size: 12px; padding: 5px 10px; border-radius: 6px; }
.button.link { border: 0; background: transparent; padding: 0; color: var(--primary); font-size: 12px; }
.button.link:hover { text-decoration: underline; }

/* ---- METRICS ---- */
.section-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 12px;
}

.section-caption span:first-child { display: flex; align-items: center; gap: 6px; }
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: left;
  min-width: 0;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
}

button.metric:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.metric-icon {
  height: 30px;
  width: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--blue);
}

.metric-icon.green { background: rgba(52, 199, 89, 0.1); color: var(--green); }
.metric-icon.orange { background: rgba(255, 149, 0, 0.1); color: var(--orange); }
.metric-icon.red { background: rgba(255, 59, 48, 0.1); color: var(--red); }

.metric-value {
  display: block;
  font-size: 26px;
  letter-spacing: -0.8px;
  font-weight: 700;
  margin: 10px 0;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.metric-value.green { color: var(--green); }
.metric-value.red { color: var(--red); }

.metric-foot {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 4px;
  align-items: center;
}

.metric-foot svg { width: 12px; height: 12px; }

.secondary-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  padding: 16px 0;
}

.mini-metric {
  border: 0;
  border-right: 1px solid var(--border);
  background: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  text-align: left;
  color: var(--text);
}

.mini-metric:last-child { border: 0; }
.mini-metric:hover .mini-value { color: var(--primary); }

.mini-icon {
  height: 32px;
  width: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-alt);
  color: var(--muted);
}

.mini-label { display: block; font-size: 11px; color: var(--muted); }

.mini-value {
  font-weight: 700;
  font-size: 18px;
  display: block;
  letter-spacing: -0.4px;
  transition: color 0.12s;
}

.mini-value small {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 3px;
  letter-spacing: 0;
}

/* ---- PANELS ---- */
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
}

.panel-heading h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.2px;
}

.panel-heading p { font-size: 11px; color: var(--muted); margin: 2px 0 0; }
.panel-body { padding: 0; }

.dashboard-charts {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.lower-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* ---- CHARTS ---- */
.chart-wrap { height: 240px; position: relative; padding: 0 20px 18px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.chart-legend { display: flex; gap: 14px; align-items: center; font-size: 11px; color: var(--muted); }
.legend-dot { height: 6px; width: 6px; border-radius: 50%; display: inline-block; margin-right: 5px; }

.distribution-body { display: flex; align-items: center; padding: 0 20px 22px; gap: 24px; min-height: 240px; }
.donut-wrap { width: 155px; height: 155px; position: relative; flex-shrink: 0; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center span { font-size: 11px; color: var(--muted); }
.donut-center strong { font-size: 18px; letter-spacing: -0.5px; margin-top: 3px; font-weight: 700; }

.distribution-legend { flex: 1; min-width: 0; }
.distribution-legend div { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 11px; }
.distribution-legend div:last-child { border: 0; }
.distribution-legend strong { display: block; font-size: 14px; margin-top: 2px; font-weight: 600; padding-left: 11px; }

/* Chart fallback */
.chart-fallback { display: flex; gap: 12px; height: 100%; align-items: stretch; padding: 10px 0; }
.fallback-group { flex: 1; display: flex; flex-direction: column; justify-content: end; text-align: center; font-size: 10px; color: var(--muted); }
.fallback-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 4px; border-bottom: 1px solid var(--border); }
.fallback-bar { width: 25%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--primary); }
.fallback-bar:hover { filter: brightness(1.1); }
.fallback-group > span { padding-top: 8px; }
.fallback-donut { width: 100%; height: 100%; border-radius: 50%; position: relative; }
.fallback-donut::after { content: ''; position: absolute; inset: 23%; border-radius: 50%; background: var(--surface); }
.chart-data { font-size: 11px; margin: 0 20px 14px; color: var(--muted); }
.chart-data summary { cursor: pointer; }
.chart-data table { margin-top: 8px; }

/* ---- TABLES ---- */
.table-wrap { overflow: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 13px; text-align: left; }

th {
  background: var(--surface-alt);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-alt); }

/* ---- PEOPLE ---- */
.person { display: flex; align-items: center; gap: 10px; }

.person .avatar {
  width: 32px;
  height: 32px;
  font-size: 10px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--muted);
  font-weight: 600;
}

.person .avatar.color-1 { background: #fef3e7; color: #a87f4f; }
.person .avatar.color-2 { background: #f0edf8; color: #7f6eab; }
.person .avatar.color-3 { background: #e8f5ed; color: #5a8c6f; }

.person strong { font-size: 13px; font-weight: 500; display: block; }
.person small { font-size: 11px; color: var(--muted); display: block; margin-top: 1px; }

.student-name {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 3px;
}

.student-name:hover { color: var(--primary); }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  background: var(--surface-alt);
  color: var(--muted);
}

.badge::before {
  content: '';
  height: 5px;
  width: 5px;
  background: currentColor;
  border-radius: 50%;
}

.badge.pago, .badge.ativo { background: rgba(52, 199, 89, 0.12); color: #1e8338; }
.badge.atraso, .badge.inativo { background: rgba(255, 59, 48, 0.1); color: #d42b20; }
.badge.hoje, .badge.pausado { background: rgba(255, 149, 0, 0.12); color: #a06200; }
.badge.cancelado { background: var(--surface-alt); color: var(--muted); }
.badge.excluido { background: var(--surface-alt); color: var(--muted); }

body[data-theme=dark] .badge.pago, body[data-theme=dark] .badge.ativo { background: rgba(48, 209, 88, 0.16); color: #30d158; }
body[data-theme=dark] .badge.atraso, body[data-theme=dark] .badge.inativo { background: rgba(255, 69, 58, 0.16); color: #ff453a; }
body[data-theme=dark] .badge.hoje, body[data-theme=dark] .badge.pausado { background: rgba(255, 159, 10, 0.16); color: #ff9f0a; }

.partial-label { font-size: 10px; display: block; color: var(--orange); margin-top: 2px; }

/* ---- LIST ROWS ---- */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border: 0; }
.list-row .person { flex: 1; }
.list-row .list-value { text-align: right; }
.list-row .list-value strong { font-size: 14px; font-weight: 600; display: block; }
.list-row .list-value small { font-size: 11px; color: var(--red); }

.rank-number { font-size: 12px; color: var(--muted); width: 18px; font-weight: 500; }
.rank-bar { height: 3px; background: var(--surface-alt); border-radius: 2px; width: 60px; margin: 5px 0 0 auto; }
.rank-bar span { display: block; height: 100%; background: var(--primary); border-radius: 2px; opacity: 0.6; }

.alert-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--soft);
  border: 1px solid rgba(0, 122, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  margin-bottom: 16px;
  color: var(--primary);
}

.alert-strip strong { font-size: 13px; font-weight: 500; display: block; }
.alert-strip p { font-size: 12px; margin: 2px 0 0; color: var(--muted); }
.alert-strip .button { margin-left: auto; }

/* ---- FILTERS ---- */
.filter-bar {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar label {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 130px;
  font-weight: 500;
}

.filter-bar label.search-filter { flex: 1.6; min-width: 190px; }

/* ---- FORM CONTROLS ---- */
input, select, textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 8px 11px;
  width: 100%;
  min-width: 0;
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:hover, select:hover, textarea:hover {
  border-color: rgba(60, 60, 67, 0.24);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
  outline: none;
}

textarea { resize: vertical; min-height: 80px; }

input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0;
  border: 1.5px solid rgba(60, 60, 67, 0.28);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

input[type=checkbox]:checked {
  background: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5.5 10 3 3L14.5 7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}

input[type=radio] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid rgba(60, 60, 67, 0.28);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

input[type=radio]:checked {
  border-color: var(--primary);
}

input[type=radio]:checked::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--primary);
}

select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%2386868b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
}

input[readonly] { background: var(--surface-alt); color: var(--muted); }

.filter-bar input, .filter-bar select { font-size: 13px; min-height: 34px; }

.month-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 6px 12px;
}

.month-picker input {
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  box-shadow: none !important;
  max-width: 150px;
}

/* ---- iOS SELECT ---- */
.ios-select { display: block; position: relative; min-width: 0; width: 100%; }

.ios-native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
}

.ios-select-trigger {
  display: block;
  width: 100%;
  min-height: 36px;
  text-align: left;
  padding: 8px 32px 8px 11px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.ios-select-trigger::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
}

.ios-select-trigger:hover { border-color: rgba(60, 60, 67, 0.24); }

.ios-select.is-open .ios-select-trigger,
.ios-select-trigger:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
  outline: none;
}

.ios-select-trigger[aria-invalid=true] { border-color: var(--red); }
.ios-select-error { display: block; color: var(--red); font-size: 11px; margin-top: 4px; }
.ios-select.is-open { z-index: 60; }

.ios-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 61;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: block;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}

.ios-select-menu[hidden] { display: none; }
.ios-select.opens-up .ios-select-menu { top: auto; bottom: calc(100% + 4px); }

.ios-select-option {
  display: block;
  position: relative;
  border-radius: 6px;
  padding: 7px 10px 7px 28px;
  cursor: pointer;
  color: var(--text);
  white-space: normal;
  overflow-wrap: anywhere;
}

.ios-select-option[aria-selected=true]::before {
  content: '✓';
  position: absolute;
  left: 9px;
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
}

.ios-select-option:hover, .ios-select-option.highlighted {
  background: var(--primary);
  color: white;
}

.ios-select-option.highlighted::before, .ios-select-option:hover::before { color: white; }
.ios-select-option[aria-disabled=true] { opacity: 0.4; cursor: not-allowed; }
.filter-bar .ios-select-trigger { font-size: 13px; }

/* ---- TABS ---- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: 20px 0;
  overflow: auto;
}

.tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 400;
  transition: color 0.12s;
}

.tabs button:hover { color: var(--text); }

.tabs button.active {
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 500;
}

/* ---- DIALOGS ---- */
dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  max-width: 820px;
  width: calc(100% - 32px);
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-header h2 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.3px; }
.modal-header .icon-button { border-radius: 50%; background: var(--surface-alt); }

#modal-body { padding: 24px; }
#modal-body h3 { font-size: 15px; font-weight: 600; margin: 18px 0 10px; }
#modal-body .table-wrap { max-height: 300px; }
#modal-body .person strong { font-size: 13px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.detail-heading h3 { font-size: 20px !important; font-weight: 600 !important; margin: 0 !important; }
.detail-heading p { color: var(--muted); }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 18px 0; }
.detail-grid dt { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 500; }
.detail-grid dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }

.summary-strip {
  display: flex;
  gap: 24px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 16px 0;
}

.summary-strip > div { flex: 1; font-size: 11px; color: var(--muted); }
.summary-strip strong { display: block; font-size: 18px; font-weight: 600; color: var(--text); margin-top: 4px; }

/* ---- FORMS ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid label { font-size: 13px; font-weight: 500; display: flex; flex-direction: column; gap: 5px; }
.form-grid .check { display: flex; flex-direction: row; align-items: center; font-weight: 400; gap: 8px; }
.full { grid-column: 1 / -1; }
.form-note { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.7; }
.form-error { color: #d42b20; background: rgba(255, 59, 48, 0.08); padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.form-error:empty { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); margin-top: 6px; }

.form-section {
  margin: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.form-section legend { padding: 0 6px; font-weight: 600; font-size: 15px; color: var(--text); letter-spacing: -0.2px; }

.form-section legend span {
  display: inline-grid;
  place-items: center;
  background: var(--soft);
  color: var(--primary);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  margin-right: 7px;
}

.form-section > .form-note { margin: 0 0 14px; }
.form-section .notice { margin: 0; }

.guardian-preview { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-alt); }
.guardian-preview p { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.guardian-preview p:only-child { margin: 0; }

.deletion-choice {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.deletion-choice legend { padding: 0 6px; font-size: 14px; font-weight: 600; }
.deletion-choice .check + .check { margin-top: 10px; }
.deletion-choice input[type=radio] { margin: 2px 0 0; }

/* ---- PAYMENT ---- */
.payment-context { background: var(--surface-alt); border-radius: var(--radius-sm); padding: 16px; }
.payment-context p { font-size: 12px; color: var(--muted); }
.payment-context .summary-strip { margin-bottom: 0; background: var(--surface); }

.inline-total { display: flex; align-items: center; gap: 14px; margin: 14px 0 20px; font-size: 13px; }
.inline-total strong { font-size: 22px; color: var(--green); font-weight: 700; }
.inline-total .muted { margin-left: auto; font-size: 11px; }

/* ---- CALENDAR ---- */
.calendar-heading { display: flex; align-items: center; gap: 10px; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}

.calendar-weekday {
  text-align: center;
  padding: 10px 4px;
  background: var(--surface-alt);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.calendar-day {
  min-height: 110px;
  border: 0;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 8px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day:hover { background: var(--surface-alt); }
.calendar-day.outside { opacity: 0.3; }

.day-num { font-size: 12px; font-weight: 500; margin-bottom: 3px; }

.calendar-day.today .day-num {
  background: var(--red);
  color: white;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-weight: 600;
}

.calendar-date { border: 0; background: transparent; color: inherit; padding: 0; text-align: left; cursor: pointer; align-self: flex-start; }

.calendar-event {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 6px;
  border-radius: 4px;
  border-left: 3px solid var(--blue);
  background: var(--soft);
  color: var(--blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.calendar-event:hover { filter: brightness(0.95); }

.calendar-event.pago { background: rgba(52, 199, 89, 0.12); color: #1e8338; border-color: var(--green); }
.calendar-event.atraso { background: rgba(255, 59, 48, 0.1); color: #d42b20; border-color: var(--red); }
.calendar-event.hoje, .calendar-event.soon { background: rgba(255, 149, 0, 0.12); color: #a06200; border-color: var(--orange); }
.calendar-event.cancelado { background: var(--surface-alt); color: var(--muted); border-color: var(--muted); text-decoration: line-through; }
.calendar-event.previsao { background: rgba(175, 82, 222, 0.1); color: #7a2fa8; border-color: var(--purple); border-left-style: dashed; }

body[data-theme=dark] .calendar-event.pago { background: rgba(48, 209, 88, 0.15); color: #30d158; border-color: #30d158; }
body[data-theme=dark] .calendar-event.atraso { background: rgba(255, 69, 58, 0.15); color: #ff453a; border-color: #ff453a; }
body[data-theme=dark] .calendar-event.hoje, body[data-theme=dark] .calendar-event.soon { background: rgba(255, 159, 10, 0.15); color: #ff9f0a; border-color: #ff9f0a; }
body[data-theme=dark] .calendar-event.previsao { background: rgba(191, 90, 242, 0.15); color: #bf5af2; border-color: #bf5af2; }

.calendar-more { font-size: 10px; color: var(--muted); }
.legend-line { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 11px; color: var(--muted); }

/* ---- SETTINGS ---- */
.settings-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.settings-body { padding: 0 20px 20px; }
.settings-body p { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.settings-body .button { margin-right: 8px; margin-bottom: 8px; }
.settings-body hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.settings-body h3 { font-size: 15px; font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---- NOTICES ---- */
.notice {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--surface-alt);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
}

.empty { text-align: center; padding: 32px 16px; color: var(--muted); font-size: 13px; }
.empty svg { display: block; width: 28px; height: 28px; margin: 0 auto 8px; opacity: 0.5; }

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.pagination > div { display: flex; gap: 6px; align-items: center; }

/* ---- TOASTS ---- */
#toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  max-width: 360px;
}

.toast {
  background: var(--text);
  color: var(--surface);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  animation: toast-in 0.2s ease;
}

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

@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---- FOOTER ---- */
footer {
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--border);
  padding: 14px 32px;
  font-size: 11px;
  color: var(--muted);
}

footer > span:last-child { margin-left: auto; }

/* ---- REPORTS ---- */
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.report-notes { font-size: 12px; color: var(--muted); margin-bottom: 16px; line-height: 1.7; }
.pill-count { background: var(--surface-alt); border: 1px solid var(--border); font-size: 10px; padding: 2px 6px; border-radius: 4px; color: var(--muted); }

/* ---- MISC ---- */
.loading { padding: 60px; text-align: center; color: var(--muted); }
.fatal { padding: 40px; max-width: 700px; margin: auto; }
.fatal textarea { margin: 14px 0; }

.segmented-control { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-alt); }
.segmented-control button { border: 0; padding: 6px 14px; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; }
.segmented-control button.selected { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented-control button span { margin-left: 5px; opacity: 0.5; font-size: 10px; }

.people-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin: -2px 0 18px; }
.people-hint { color: var(--muted); display: flex; align-items: center; gap: 7px; font-size: 12px; }
.people-hint svg { width: 14px; height: 14px; }

/* ---- DARK MODE OVERRIDES ---- */
body[data-theme=dark] .person .avatar { background: #2c2c2e; color: #aeaeb2; }
body[data-theme=dark] .metric-icon { background: rgba(10, 132, 255, 0.15); color: #0a84ff; }
body[data-theme=dark] .metric-icon.green { background: rgba(48, 209, 88, 0.15); color: #30d158; }
body[data-theme=dark] .metric-icon.orange { background: rgba(255, 159, 10, 0.15); color: #ff9f0a; }
body[data-theme=dark] .metric-icon.red { background: rgba(255, 69, 58, 0.15); color: #ff453a; }
body[data-theme=dark] .form-error { background: rgba(255, 69, 58, 0.12); color: #ff453a; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (min-width: 1600px) {
  main { padding-top: 36px; }
  .metric-value { font-size: 30px; }
  .chart-wrap { height: 280px; }
  .distribution-body { min-height: 280px; }
  .donut-wrap { width: 175px; height: 175px; }
}

@media (max-width: 1200px) {
  .sidebar { width: 220px; padding-left: 10px; padding-right: 10px; }
  .app-shell { margin-left: 220px; }
  main { padding: 24px 20px; }
  .topbar { padding: 0 20px; }
  .metric { padding: 15px; }
  .metric-value { font-size: 22px; }
  .mini-metric { padding: 0 14px; gap: 8px; }
  .mini-icon { display: none; }
  .distribution-body { gap: 14px; padding: 0 14px 18px; }
  .donut-wrap { width: 130px; height: 130px; }
  .donut-center strong { font-size: 15px; }
  .panel-heading { padding: 16px 18px 12px; }
  .lower-grid, .dashboard-charts { grid-template-columns: 1.4fr 1fr; gap: 14px; }
  .page-heading h1 { font-size: 24px; }
}

@media (max-width: 980px) {
  .sidebar { width: 200px; }
  .app-shell { margin-left: 200px; }
  .nav-link { padding: 8px 10px; font-size: 12px; gap: 8px; }
  .brand { padding: 0 6px; }
  .brand strong { font-size: 16px; }
  .metrics { gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-charts, .lower-grid, .settings-grid { grid-template-columns: 1fr; }
  .distribution-body { min-height: 200px; justify-content: center; gap: 36px; }
  .distribution-legend { max-width: 210px; }
  .donut-wrap { width: 150px; height: 150px; }
  .today { display: none; }
  .page-heading { align-items: flex-start; }
  .heading-actions { flex-wrap: wrap; justify-content: flex-end; }
  .mini-metric { padding: 0 12px; }
  .secondary-metrics { padding: 12px 0; }
  .calendar-day { min-height: 90px; padding: 6px; }
  .calendar-event { font-size: 8px; padding: 2px 4px; }
  .report-grid { grid-template-columns: 1fr; }
  .brand-mark { width: 28px; height: 28px; padding: 5px; gap: 2px; }
  .brand-mark span { width: 4px; }
  .people-hint { display: none; }
  footer > span:nth-child(2) { display: none; }
}

@media (max-width: 700px) {
  .sidebar { transform: translateX(-100%); width: 260px; transition: transform 0.2s; box-shadow: none; }
  .menu-open .sidebar { transform: translateX(0); box-shadow: 8px 0 30px rgba(0, 0, 0, 0.1); }
  .menu-open .mobile-overlay { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); z-index: 29; }
  .app-shell { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .topbar { height: 48px; padding: 0 16px; }
  .breadcrumb { gap: 6px; font-size: 12px; }
  .breadcrumb > span:first-of-type { max-width: 110px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .topbar-actions { gap: 8px; }
  .top-avatar, .top-divider { display: none; }
  main { padding: 20px 16px; }
  .page-heading { flex-direction: column; gap: 14px; margin-bottom: 18px; }
  .heading-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .page-heading h1 { font-size: 26px; }
  .metrics { gap: 8px; }
  .metric { padding: 14px; }
  .metric-value { font-size: 22px; }
  .metric-top { font-size: 10px; }
  .metric-icon { width: 26px; height: 26px; border-radius: 6px; }
  .metric-foot { font-size: 9px; }
  .secondary-metrics { display: grid; grid-template-columns: 1fr 1fr; row-gap: 12px; }
  .mini-metric:nth-child(2) { border: 0; }
  .mini-label { font-size: 10px; }
  .mini-icon { display: grid; width: 28px; height: 28px; }
  .mini-value { font-size: 17px; }
  .section-caption { font-size: 9px; }
  .panel-heading { padding: 14px 16px 10px; }
  .panel-heading h2 { font-size: 14px; }
  .chart-wrap { height: 210px; padding: 0 12px 14px; }
  .distribution-body { gap: 20px; }
  .alert-strip { padding: 12px 16px; flex-wrap: wrap; }
  .alert-strip .button { margin-left: 24px; }
  .filter-bar { gap: 8px; padding: 12px; }
  .filter-bar label { min-width: calc(50% - 8px); }
  .filter-bar label.search-filter { min-width: 100%; }
  .filter-bar > .button { margin-left: auto; }
  .inline-total { flex-wrap: wrap; gap: 6px; }
  .inline-total .muted { margin-left: 0; width: 100%; }
  .calendar-panel { overflow: auto; }
  .calendar-grid { min-width: 570px; }
  .calendar-heading { width: 100%; justify-content: space-between; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid input, .form-grid select, .form-grid textarea { font-size: 16px; }
  .full { grid-column: auto; }
  .form-actions { flex-wrap: wrap; }
  .form-section { padding: 14px; border-radius: 12px; }
  .form-section .full { grid-column: 1 / -1; }
  .summary-strip { gap: 12px; padding: 12px; }
  .summary-strip strong { font-size: 16px; }
  .detail-grid { gap: 12px; }
  #modal-body { padding: 16px; }
  .modal-header { padding: 14px 16px; }
  .modal-header h2 { font-size: 16px; }
  dialog { width: calc(100% - 16px); max-height: 94vh; border-radius: 14px; }
  .modal-actions { justify-content: flex-start; }
  .list-row { padding: 10px 16px; }
  footer { padding: 12px 16px; font-size: 10px; }
  .today { display: none; }
  .notice { align-items: flex-start; }
  .topbar .breadcrumb strong { font-size: 12px; }
  #toasts { right: 12px; left: 12px; bottom: 12px; max-width: none; }
  .chart-legend { font-size: 9px; }
  .chart-legend .legend-dot { width: 5px; height: 5px; }
  .panel-heading p { font-size: 9px; }
  .donut-center strong { font-size: 16px; }
  .segmented-control { width: 100%; }
  .segmented-control button { flex: 1; padding: 7px 8px; }
  .tabs button { padding: 7px 10px; font-size: 12px; }
  .button { font-size: 12px; }
}

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

/* ---- LOGIN SCREEN (Apple Lock / Sign-in Style) ---- */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(0, 122, 255, 0.08), transparent 60%), var(--bg);
  padding: 20px;
  animation: login-fade-in 0.25s ease;
}

@keyframes login-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 30px 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  transition: transform 0.2s ease;
}

.login-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.login-avatar svg {
  width: 30px;
  height: 30px;
}

.login-card h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.4px;
  margin: 0 0 6px;
  color: var(--text);
}

.login-card p {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 22px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.login-form input {
  height: 40px;
  font-size: 13px;
  border-radius: 9px;
  padding: 0 12px;
  border: 1px solid var(--separator);
  background: var(--surface);
}

.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
}

.login-submit {
  margin-top: 6px;
  height: 40px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.login-submit:hover {
  background: var(--primary-hover);
}

.login-submit:active {
  transform: scale(0.98);
}

.login-error {
  background: rgba(255, 59, 48, 0.1);
  color: var(--red);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
  display: none;
  text-align: center;
}

.login-error.show {
  display: block;
}

.login-shake {
  animation: apple-shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes apple-shake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, 0, 0); }
  40%, 60% { transform: translate3d(7px, 0, 0); }
}

.login-footer-hint {
  margin-top: 20px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.logout-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 6px;
  width: 100%;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.12s, color 0.12s;
}

.logout-button:hover {
  background: rgba(255, 59, 48, 0.12);
  color: #ff453a;
}

