:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e8edf5;
  --text: #172033;
  --muted: #6c768a;
  --red: #d71920;
  --red-dark: #8f1015;
  --red-soft: #ffe9ea;
  --green: #15803d;
  --yellow: #b45309;
  --blue: #2563eb;
  --shadow: 0 12px 34px rgba(17, 24, 39, 0.08);
}

:root[data-theme='dark'],
body[data-theme='dark'] {
  --bg: #08101d;
  --card: #0f1727;
  --line: #22314a;
  --text: #f5f7fb;
  --muted: #96a3bb;
  --red: #e2232a;
  --red-dark: #a70f15;
  --red-soft: rgba(226, 35, 42, 0.16);
  --green: #4ade80;
  --yellow: #fbbf24;
  --blue: #60a5fa;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
label { display:block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; }
button { font: inherit; cursor: pointer; border: 0; }
h1, h2, h3, p { margin: 0; }
#map { height: 520px; border-radius: 18px; overflow: hidden; }

.login-page, .center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card, .card, .table-card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.login-card { width: 100%; max-width: 430px; padding: 32px; }
.login-card h1 { font-size: 30px; margin: 12px 0 10px; }
.hero-badge { width: 72px; height: 72px; border-radius: 20px; background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff; display:flex; align-items:center; justify-content:center; font-size: 22px; font-weight: 800; }
.login-hint { margin-top: 16px; color: var(--muted); font-size: 14px; }

.app-shell { display: grid; grid-template-columns: 290px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #101725 0%, #182033 100%); color: #fff; padding: 20px; display:flex; flex-direction:column; justify-content:space-between;
}
.content { padding: 24px; }
.brand-card { display:flex; align-items:center; gap: 14px; margin-bottom: 22px; }
.brand-logo { width: 52px; height: 52px; border-radius: 18px; background: linear-gradient(135deg, var(--red), #ff5a5f); display:grid; place-items:center; font-weight:800; }
.brand-title { font-size: 18px; font-weight: 700; }
.brand-subtitle { color: rgba(255,255,255,0.7); font-size: 13px; }
.nav-list { display:flex; flex-direction:column; gap: 8px; }
.nav-item { padding: 12px 14px; border-radius: 14px; color: rgba(255,255,255,0.82); font-weight: 600; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.12); color: #fff; }
.user-card { display:flex; justify-content:space-between; align-items:center; gap: 10px; background: rgba(255,255,255,0.08); border-radius: 18px; padding: 14px; }
.page-header {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 20px; display:flex; align-items:center; justify-content:space-between; gap: 12px;
}
.page-header.gradient { background: linear-gradient(135deg, #111827, #202b45); color: #fff; }
.page-header.gradient p { color: rgba(255,255,255,0.78); }
.page-header h1 { font-size: 28px; margin-bottom: 6px; }
.page-header p { color: var(--muted); }
.card { padding: 22px; }
.narrow { max-width: 760px; }
.table-card { overflow:auto; }
.table-card table { width:100%; border-collapse: collapse; background:#fff; }
.table-card th, .table-card td { padding: 16px; border-bottom: 1px solid var(--line); text-align:left; vertical-align: top; }
.table-card th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stats-grid { display:grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 22px; padding: 22px; }
.stat-card span { display:block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stat-card strong { font-size: 28px; }
.grid-2 { display:grid; grid-template-columns: repeat(2, 1fr); }
.gap-16 { gap: 16px; }
.form-grid { display:grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid.compact { gap: 10px; }
.span-2 { grid-column: span 2; }
.inline-actions, .actions-row, .toolbar { display:flex; align-items:center; gap: 10px; flex-wrap: wrap; }
.toolbar input { flex:1; min-width: 260px; }
.list-stack { display:flex; flex-direction:column; gap: 12px; }
.list-item, .list-edit-card { border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; background: #fff; }
.list-item { display:flex; justify-content:space-between; align-items:center; gap: 12px; }
.align-top { align-items:flex-start; }
.detail-list { display:grid; gap: 14px; }
.detail-list div { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.detail-list span { display:block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.section-title { display:flex; justify-content:space-between; align-items:center; margin-bottom: 14px; }
.section-title a { color: var(--red); font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }
.mt-16 { margin-top: 16px; }
.stack { display:flex; flex-direction:column; }
.gap-12 { gap: 12px; }
.empty-state { color: var(--muted); padding: 16px 0; }
.alert { display:flex; align-items:center; justify-content:space-between; gap: 12px; padding: 14px 16px; border-radius: 18px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-danger { background: #fff2f2; color: #8f1015; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap: 8px; border-radius: 14px; padding: 12px 16px;
  font-weight: 700; transition: .2s ease; border: 1px solid transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn-block { width:100%; }
.btn-small { padding: 8px 12px; font-size: 13px; }
.btn-primary { background: linear-gradient(135deg, var(--red), var(--red-dark)); color:#fff; }
.btn-danger { background: #fff2f2; color: #8f1015; border-color: #fecaca; }
.btn-outline { background:#fff; border-color: var(--line); color: var(--text); }
.btn-light { background: #fff; color: var(--text); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,0.2); }
.badge { padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: capitalize; }
.badge-success { background: #dcfce7; color: var(--green); }
.badge-warning { background: #fef3c7; color: var(--yellow); }
.badge-info { background: #dbeafe; color: var(--blue); }
.badge-neutral { background: #eef2ff; color: #4f46e5; }
.checkbox-line { display:flex; align-items:center; gap:10px; }
.checkbox-line input { width: 18px; height: 18px; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { padding-bottom: 12px; }
  .content { padding: 16px; }
  .stats-grid, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}
.stat-card-wide { grid-column: span 1; }
.wrap { flex-wrap: wrap; }
.photo-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.photo-card { display:flex; flex-direction:column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background:#fff; }
.photo-card img { width:100%; height:180px; object-fit:cover; border-radius: 14px; display:block; }
.photo-card span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: capitalize; }
textarea#appsScriptTemplate { min-height: 420px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
@media (min-width: 1101px) { .stat-card-wide { grid-column: span 1; } }


.table-card { -webkit-overflow-scrolling: touch; }
.table-card table { min-width: 860px; }

@media (max-width: 760px) {
  body { font-size: 14px; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 14px 12px;
    gap: 12px;
  }
  .brand-card { margin-bottom: 12px; }
  .brand-logo { width: 42px; height: 42px; border-radius: 14px; }
  .brand-title { font-size: 16px; }
  .brand-subtitle { font-size: 12px; }
  .nav-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }
  .nav-item {
    white-space: nowrap;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.08);
  }
  .user-card {
    margin-top: 10px;
    flex-direction: column;
    align-items: stretch;
  }
  .content { padding: 12px; }
  .page-header, .card, .table-card, .login-card { border-radius: 18px; }
  .page-header {
    padding: 18px;
    align-items: flex-start;
  }
  .page-header h1 { font-size: 22px; }
  .card { padding: 16px; }
  .stat-card { padding: 16px; border-radius: 18px; }
  .stat-card strong { font-size: 22px; }
  .btn { width: 100%; }
  .btn.btn-small { width: auto; }
  .actions-row > *, .inline-actions > * { flex: 1 1 100%; }
  .list-item {
    flex-direction: column;
    align-items: stretch;
  }
  .photo-grid { grid-template-columns: 1fr 1fr; }
  #map { height: 360px; }
}


.shell-body { min-width: 0; }
.content > * { min-width: 0; }
.no-shadow { box-shadow: none; border: 0; }
.mobile-topbar, .mobile-overlay, .mobile-close { display: none; }
.form-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 2px 0 6px; }
.form-grid > div, .form-grid > section, .actions-row, .inline-actions, .toolbar { min-width: 0; }
input, select, textarea { min-height: 44px; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%); background-position: calc(100% - 18px) calc(1.05em), calc(100% - 13px) calc(1.05em); background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.table-card.compact-table table { min-width: 0; }
.page-header .actions-row { justify-content: flex-end; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .toolbar input { min-width: 0; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .mobile-topbar {
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    position: sticky; top: 0; z-index: 40; padding: 10px 12px; background: #101725; color:#fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .mobile-topbar .brand-title-mobile { font-size: 15px; font-weight: 700; }
  .mobile-menu-btn, .mobile-close {
    display:inline-flex; align-items:center; justify-content:center; width:42px; height:42px; border-radius:12px;
    background: rgba(255,255,255,0.08); color:#fff; border:1px solid rgba(255,255,255,0.1);
  }
  .mobile-close { display:flex; }
  .mobile-overlay {
    display:none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 49;
  }
  body.menu-open .mobile-overlay { display:block; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: min(84vw, 320px);
    z-index: 50; transform: translateX(-100%); transition: transform .22s ease;
    padding: 16px 14px; overflow-y: auto; box-shadow: 0 18px 40px rgba(0,0,0,.25);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .nav-list { display:flex; flex-direction:column; overflow: visible; padding-bottom: 0; }
  .nav-item { white-space: normal; padding: 12px 14px; }
  .content { padding: 12px; }
  .page-header {
    padding: 14px; gap: 10px; flex-direction: column; align-items: stretch;
  }
  .page-header h1 { font-size: 20px; }
  .page-header p { font-size: 13px; }
  .card, .table-card { padding: 14px; border-radius: 16px; }
  .table-card table { min-width: 0; }
  .table-card thead { display: none; }
  .table-card tbody, .table-card tr, .table-card td { display: block; width: 100%; }
  .table-card tr {
    border-bottom: 1px solid var(--line); padding: 10px 0;
  }
  .table-card tr:last-child { border-bottom: 0; }
  .table-card td {
    border: 0; padding: 6px 0; text-align: left;
  }
  .table-card td[data-label]::before {
    content: attr(data-label); display:block; font-size:11px; letter-spacing:.04em; text-transform:uppercase; color: var(--muted); margin-bottom: 3px;
  }
  .table-card td:last-child { padding-top: 10px; }
  .stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-card { padding: 14px; }
  .stat-card strong { font-size: 20px; }
  .grid-2, .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .list-item, .list-edit-card { padding: 12px; }
  .toolbar, .actions-row, .inline-actions { display:grid; grid-template-columns: 1fr; gap: 8px; }
  .toolbar input, .btn, .btn.btn-small { width: 100%; }
  .btn { min-height: 44px; padding: 11px 14px; border-radius: 12px; }
  .btn.btn-small { padding: 10px 12px; font-size: 13px; }
  input, select, textarea { padding: 10px 12px; border-radius: 12px; font-size: 14px; }
  label { font-size: 12px; margin-bottom: 6px; }
  .photo-grid { grid-template-columns: 1fr; }
  .photo-card img { height: 220px; }
  .user-card { flex-direction: row; align-items: center; }
  #map { height: 320px; }
}


/* Ajustes para o mapa não sobrepor o menu mobile */
#map, .leaflet-container { position: relative; z-index: 1; }
.leaflet-pane,
.leaflet-top,
.leaflet-bottom,
.leaflet-control { z-index: 2 !important; }

@media (max-width: 760px) {
  body.menu-open #map,
  body.menu-open .leaflet-container,
  body.menu-open .leaflet-pane,
  body.menu-open .leaflet-control-container {
    pointer-events: none !important;
  }

  body.menu-open .content {
    overflow: hidden;
  }
}


.calendar-card { padding: 18px; }
.calendar-toolbar {
  display:flex; align-items:flex-start; justify-content:space-between; gap: 14px; margin-bottom: 18px;
}
.calendar-actions { display:flex; gap: 8px; flex-wrap: wrap; }
.agenda-calendar-layout {
  display:grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.95fr); gap: 16px; align-items:start;
}
.agenda-calendar-panel, .agenda-calendar-side {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid var(--line); border-radius: 20px; padding: 16px;
}
.agenda-calendar-head, .agenda-side-head {
  display:flex; align-items:flex-start; justify-content:space-between; gap: 12px; margin-bottom: 12px;
}
.agenda-calendar-head strong, .agenda-side-head strong { font-size: 18px; text-transform: capitalize; }
.agenda-calendar-weekdays {
  display:grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 8px;
}
.agenda-calendar-weekdays span {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align:center; padding: 6px 0;
}
.agenda-calendar-grid {
  display:grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px;
}
.agenda-day {
  min-height: 112px; padding: 10px; border-radius: 18px; border: 1px solid var(--line); background: #fff;
  display:flex; flex-direction:column; gap: 10px; align-items:stretch; text-align:left;
}
.agenda-day:hover { border-color: rgba(215,25,32,.28); box-shadow: 0 10px 24px rgba(17,24,39,.06); }
.agenda-day.is-outside { background: #f8fafc; color: var(--muted); opacity: .78; }
.agenda-day.is-today { border-color: rgba(215,25,32,.45); }
.agenda-day.is-selected {
  background: linear-gradient(180deg, #fff3f3 0%, #ffffff 100%);
  border-color: rgba(215,25,32,.55);
  box-shadow: 0 12px 28px rgba(215,25,32,.08);
}
.agenda-day-top {
  display:flex; align-items:center; justify-content:space-between; gap: 8px;
}
.agenda-day-top strong { font-size: 16px; }
.agenda-day-count {
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; display:inline-flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg, var(--red), var(--red-dark)); color:#fff; font-size: 12px; font-weight: 800;
}
.agenda-day-body {
  display:flex; flex-direction:column; gap: 6px; font-size: 12px; color: var(--text); min-height: 0;
}
.agenda-day-body span {
  display:block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 6px 8px; border-radius: 10px; background: #f8fafc; border: 1px solid #eef2f7;
}
.agenda-day-empty { color: var(--muted); }
.agenda-event-card {
  border: 1px solid var(--line); border-radius: 18px; padding: 14px; background:#fff;
  display:flex; flex-direction:column; gap: 8px;
}
.agenda-event-top {
  display:flex; align-items:flex-start; justify-content:space-between; gap: 10px;
}
.agenda-event-objective { font-weight: 600; }

@media (max-width: 1100px) {
  .agenda-calendar-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .calendar-card { padding: 14px; }
  .calendar-toolbar, .agenda-calendar-head, .agenda-side-head {
    flex-direction: column; align-items: stretch;
  }
  .calendar-actions { display:grid; grid-template-columns: 1fr; }
  .agenda-calendar-panel, .agenda-calendar-side { padding: 12px; border-radius: 16px; }
  .agenda-calendar-weekdays { gap: 4px; }
  .agenda-calendar-weekdays span { font-size: 10px; }
  .agenda-calendar-grid { gap: 4px; }
  .agenda-day {
    min-height: 86px; padding: 8px; border-radius: 14px; gap: 8px;
  }
  .agenda-day-top strong { font-size: 14px; }
  .agenda-day-count { min-width: 20px; height: 20px; font-size: 11px; }
  .agenda-day-body { gap: 4px; }
  .agenda-day-body span {
    padding: 4px 6px; font-size: 11px;
  }
}


.badge-warning { background:#fff7ed; color:#b45309; }
.permission-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 14px; margin-top: 8px; }
.permission-grid label { display:flex; align-items:center; gap:8px; font-size:14px; color: var(--text); }
.table-responsive { overflow:auto; }
.cancel-visit-form { display:grid; gap:8px; min-width: 220px; }
.cancel-visit-form input { min-height: 38px; }
.text-right { text-align:right; }
.mb-16 { margin-bottom: 16px; }
@media (max-width: 760px) {
  .cancel-visit-form { min-width: 100%; }
  .permission-grid { grid-template-columns: 1fr 1fr; }
}


.brand-logo-image { background: rgba(255,255,255,0.08); overflow: hidden; padding: 6px; }
.brand-logo-image img { width: 100%; height: 100%; object-fit: contain; display:block; }

.brand-title-mobile { display:flex; align-items:center; gap:10px; }
.brand-title-mobile img { width: 34px; height: 34px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,0.08); padding: 4px; }

.login-page-pro {
  background:
    radial-gradient(circle at top right, rgba(215, 25, 32, 0.18), transparent 28%),
    linear-gradient(135deg, #09111f 0%, #121b2d 52%, #1b2740 100%);
}
.login-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: stretch;
}
.login-brand-panel,
.login-card-pro {
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
.login-brand-panel {
  color: #fff;
  padding: 38px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    linear-gradient(135deg, #101725 0%, #18233a 55%, #121927 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-brand-badge {
  display:inline-flex; align-items:center; justify-content:center;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #ffd45a;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 20px;
}
.login-brand-logo {
  width: 164px;
  max-width: 48%;
  object-fit: contain;
  margin-bottom: 22px;
  filter: drop-shadow(0 18px 32px rgba(0,0,0,.28));
}
.login-brand-panel h1 {
  font-size: 42px;
  margin-bottom: 14px;
  color: #fff;
}
.login-brand-copy {
  max-width: 520px;
  font-size: 16px;
  line-height: 1.65;
  color: rgba(255,255,255,0.82);
}
.login-brand-points {
  display:flex; flex-wrap:wrap; gap:10px; margin-top: 26px;
}
.login-brand-points span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
  font-weight: 600;
}
.login-card-pro {
  max-width: none;
  padding: 32px;
  background: rgba(255,255,255,0.98);
  align-self: center;
}
.login-card-top {
  display:flex; align-items:center; gap:14px; margin-bottom: 14px;
}
.login-mini-logo {
  width: 58px; height: 58px; object-fit: contain; border-radius: 16px;
  background: var(--red-soft); padding: 8px;
}
.login-overline {
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  font-weight: 800;
}
.login-card-pro h2 {
  font-size: 28px;
  margin-top: 2px;
  margin-bottom: 0;
}
.login-form-pro { margin-top: 18px; }
.location-helper-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #fff, #fbfcff);
  padding: 14px;
}
.location-helper-label {
  font-size: 14px;
  margin-bottom: 6px;
}
.nested-grid { grid-template-columns: repeat(2, 1fr); }
.permission-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.permission-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.permission-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.permission-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  transition: .18s ease;
}
.permission-chip input:checked + span {
  background: var(--red-soft);
  border-color: rgba(215, 25, 32, 0.28);
  color: var(--red-dark);
}
.permission-chip input:disabled + span {
  opacity: .72;
  background: #f8fafc;
}
@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand-panel { padding: 28px; }
  .login-brand-panel h1 { font-size: 34px; }
}
@media (max-width: 760px) {
  .login-page-pro { padding: 14px; }
  .login-shell { gap: 14px; }
  .login-brand-panel,
  .login-card-pro { border-radius: 22px; }
  .login-brand-panel { padding: 22px; }
  .login-brand-logo { width: 120px; max-width: 42%; }
  .login-brand-panel h1 { font-size: 28px; }
  .login-brand-copy { font-size: 14px; }
  .login-card-pro { padding: 20px; }
  .brand-logo-image { padding: 5px; }
}


.clean-login-page {
  background: radial-gradient(circle at top, rgba(215,25,32,0.10), transparent 38%), linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}
.clean-login-card {
  max-width: 420px;
  width: 100%;
  padding: 34px;
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}
.clean-login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.clean-login-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 20px;
  background: #fff;
  padding: 6px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.clean-login-brand h1 {
  font-size: 28px;
  margin: 2px 0 0;
}
.clean-login-form { margin-top: 8px; }
.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.permission-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
}
.permission-chip input {
  width: 16px;
  height: 16px;
  margin: 0;
}
.compact-inline-actions { justify-content: flex-start; }
.location-helper-card input[type="hidden"] { display: none; }
@media (max-width: 760px) {
  .clean-login-card { padding: 24px 18px; border-radius: 22px; }
  .clean-login-logo { width: 58px; height: 58px; border-radius: 16px; }
  .clean-login-brand h1 { font-size: 24px; }
  .permission-grid { grid-template-columns: 1fr 1fr; }
}


body[data-theme='dark'] {
  background: linear-gradient(180deg, #08101d 0%, #0a1322 100%);
}
body[data-theme='dark'] input,
body[data-theme='dark'] select,
body[data-theme='dark'] textarea,
body[data-theme='dark'] .list-item,
body[data-theme='dark'] .list-edit-card,
body[data-theme='dark'] .table-card table,
body[data-theme='dark'] .agenda-day,
body[data-theme='dark'] .agenda-event-card,
body[data-theme='dark'] .agenda-calendar-panel,
body[data-theme='dark'] .agenda-calendar-side,
body[data-theme='dark'] .location-helper-card,
body[data-theme='dark'] .photo-card,
body[data-theme='dark'] .permission-chip,
body[data-theme='dark'] .clean-login-logo,
body[data-theme='dark'] .btn-outline,
body[data-theme='dark'] .btn-light {
  background: #111c2f;
  color: var(--text);
}
body[data-theme='dark'] .page-header.gradient {
  background: linear-gradient(135deg, #101b2f, #182742);
}
body[data-theme='dark'] .page-header.gradient p { color: rgba(255,255,255,0.7); }
body[data-theme='dark'] .agenda-day.is-outside { background: #0d1626; }
body[data-theme='dark'] .agenda-day-body span { background: #0d1626; border-color: #1c2a40; }
body[data-theme='dark'] .alert-danger { background: rgba(127,29,29,.24); color: #fecaca; border-color: rgba(248,113,113,.26); }
body[data-theme='dark'] .alert-warning { background: rgba(120,53,15,.24); color: #fde68a; border-color: rgba(251,191,36,.25); }
body[data-theme='dark'] .alert-success { background: rgba(20,83,45,.24); color: #bbf7d0; border-color: rgba(74,222,128,.24); }
body[data-theme='dark'] .btn-outline { border-color: var(--line); }
body[data-theme='dark'] .badge-neutral { background: rgba(99,102,241,.18); color: #c7d2fe; }
body[data-theme='dark'] .badge-info { background: rgba(59,130,246,.16); color: #bfdbfe; }
body[data-theme='dark'] .badge-warning { background: rgba(245,158,11,.16); color: #fde68a; }
body[data-theme='dark'] .badge-success { background: rgba(34,197,94,.16); color: #bbf7d0; }
body[data-theme='dark'] .clean-login-page {
  background: radial-gradient(circle at top, rgba(215,25,32,0.14), transparent 38%), linear-gradient(180deg, #08101d 0%, #0f1727 100%);
}
body[data-theme='dark'] .clean-login-card {
  background: rgba(15,23,39,.96);
  border-color: var(--line);
}
body[data-theme='dark'] .clean-login-logo { background: #0f1727; }
body[data-theme='dark'] .sidebar { background: linear-gradient(180deg, #0b1220 0%, #101a2e 100%); }
.theme-toggle-btn {
  display:inline-flex; align-items:center; gap:8px; min-height: 42px;
  padding: 10px 14px; border-radius: 14px; border:1px solid var(--line);
  background: var(--card); color: var(--text); font-weight: 700;
}
.theme-toggle-btn .theme-icon { font-size: 16px; }
.login-theme-toggle { margin-left: auto; margin-bottom: 14px; }
.sidebar-footer-tools { display:flex; flex-direction:column; gap:10px; margin-top: 12px; }
.sidebar-tools-row { display:flex; gap:10px; align-items:center; }
.mobile-topbar-actions { display:flex; align-items:center; gap:8px; }
.mobile-topbar .theme-toggle-btn,
.sidebar .theme-toggle-btn { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); color:#fff; }
.mobile-topbar .theme-toggle-btn { min-height:42px; padding: 0 12px; }
@media (max-width: 760px) {
  .mobile-topbar-actions .theme-toggle-btn .theme-label,
  .sidebar .theme-toggle-btn .theme-label { display:none; }
  .sidebar-footer-tools { gap:8px; }
}
