:root {
  --bg: #0B0F14;
  --bg2: #0E141B;
  --panel: #101824;
  --panel2: #0F1722;
  --border: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --muted2: rgba(255, 255, 255, 0.52);
  --accent: #F2B84B;
  --accent2: #D99A2B;
  --accentGlow: rgba(242, 184, 75, 0.18);
  --success: #2ECC71;
  --warning: #F39C12;
  --danger: #FF4D4D;
  --info: #4DA3FF;
  --radius-card: 14px;
  --radius-ui: 12px;
  --radius-chip: 10px;
  --shadow-1: 0 14px 32px rgba(0, 0, 0, 0.28);
  --shadow-2: 0 2px 14px rgba(0, 0, 0, 0.24);
  --sidebar-width: 284px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-weight: 400;
  color: var(--text);
  background:
    radial-gradient(1200px 650px at -10% -15%, rgba(242, 184, 75, 0.07), transparent 45%),
    radial-gradient(1000px 620px at 110% -20%, rgba(77, 163, 255, 0.05), transparent 50%),
    linear-gradient(150deg, var(--bg), var(--bg2));
}

body[data-theme="light"] {
  --bg: #e9eef5;
  --bg2: #f4f7fb;
  --panel: #ffffff;
  --panel2: #f2f6fb;
  --border: rgba(15, 23, 42, 0.14);
  --text: rgba(15, 23, 42, 0.94);
  --muted: rgba(15, 23, 42, 0.72);
  --muted2: rgba(15, 23, 42, 0.56);
  --accentGlow: rgba(217, 154, 43, 0.22);
  --shadow-1: 0 14px 32px rgba(15, 23, 42, 0.12);
  --shadow-2: 0 2px 14px rgba(15, 23, 42, 0.1);
  background:
    radial-gradient(1200px 650px at -10% -15%, rgba(242, 184, 75, 0.14), transparent 45%),
    radial-gradient(1000px 620px at 110% -20%, rgba(77, 163, 255, 0.1), transparent 50%),
    linear-gradient(150deg, var(--bg), var(--bg2));
}

h1,
h2,
h3,
h4,
strong {
  letter-spacing: 0.01em;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
input,
select {
  min-height: 40px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem;
  background: linear-gradient(180deg, rgba(16, 24, 36, 0.95), rgba(15, 23, 34, 0.9));
  border-right: 1px solid var(--border);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 80;
}

.sidebar-top {
  display: grid;
  gap: 1rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: rgba(242, 184, 75, 0.16);
}

.brand-block strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
}

.brand-block.active,
.brand-block:hover {
  border-color: rgba(242, 184, 75, 0.34);
  box-shadow: inset 2px 0 0 var(--accent);
  background: linear-gradient(90deg, rgba(242, 184, 75, 0.12), rgba(242, 184, 75, 0.03));
}

.brand-block small {
  color: var(--muted2);
  font-size: 0.8rem;
}

.tabs {
  display: grid;
  gap: 0.42rem;
}

.sidebar-tools {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.tab-btn {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-ui);
  padding: 0.56rem 0.76rem;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.tab-btn:hover {
  border-color: var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(242, 184, 75, 0.12), rgba(242, 184, 75, 0.03));
  border-color: rgba(242, 184, 75, 0.34);
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-bottom {
  display: grid;
  gap: 0.5rem;
  padding-top: 0.15rem;
  background: transparent;
}

.user-pill {
  display: flex;
  gap: 0.58rem;
  align-items: center;
  padding: 0.18rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
}

.avatar-dot {
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0.22rem 0.62rem;
  font-size: 0.78rem;
  line-height: 1.2;
}

.version-text {
  color: var(--muted);
  font-size: 0.82rem;
}

.version-pill {
  justify-self: flex-start;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.theme-toggle-btn {
  padding: 0.24rem 0.54rem;
  font-size: 0.72rem;
  white-space: nowrap;
}

body[data-theme="light"] .sidebar-bottom,
body[data-theme="light"] .avatar-dot,
body[data-theme="light"] .user-pill {
  background: transparent;
}

.sidebar-overlay {
  display: none;
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.68rem;
}

.search-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-ui);
  padding: 0 0.58rem;
  background: rgba(255, 255, 255, 0.03);
  min-width: 240px;
}

.search-wrap input {
  border: 0;
  outline: 0;
  background: transparent;
  min-width: 0;
  width: 100%;
  padding: 0;
}

.sidebar-search {
  width: 100%;
  min-width: 0;
}

.sidebar-action {
  width: 100%;
  justify-content: center;
}

.quick-action {
  border: 1px solid rgba(242, 184, 75, 0.34);
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  color: #1a1305;
  border-radius: var(--radius-ui);
  padding: 0.5rem 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 0 0 var(--accentGlow);
}

.quick-action:hover {
  filter: brightness(1.05);
  box-shadow: 0 0 0 4px var(--accentGlow);
}

.icon-btn,
button.secondary,
button.ghost,
button.danger,
button.warning,
button {
  border-radius: var(--radius-ui);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

#sidebarToggle {
  display: none;
}

.content-area {
  padding: 1rem 1.2rem 1.4rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.95rem;
}

.section-help {
  color: var(--muted2);
  margin-top: 0.3rem;
  font-size: 0.88rem;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(320px, 450px) minmax(0, 1fr);
  gap: 0.9rem;
}

.panel {
  background: linear-gradient(180deg, rgba(16, 24, 36, 0.95), rgba(15, 23, 34, 0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  padding: 1rem;
}

.panel h3 {
  margin-bottom: 0.78rem;
  font-size: 1rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.kpi-card {
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16, 24, 36, 0.98), rgba(15, 23, 34, 0.95));
  padding: 0.75rem;
  box-shadow: var(--shadow-2);
  min-height: 118px;
  position: relative;
}

.kpi-card::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.4rem;
  height: 2px;
  border-radius: 3px;
  opacity: 0.7;
}

.kpi-warning::after {
  background: var(--warning);
}

.kpi-info::after {
  background: var(--info);
}

.kpi-danger::after {
  background: var(--danger);
}

.kpi-accent::after {
  background: var(--accent);
}

.kpi-card p {
  color: var(--muted);
  font-size: 0.84rem;
}

.kpi-card strong {
  display: block;
  margin: 0.35rem 0 0.2rem;
  font-size: 2rem;
  font-weight: 700;
}

.kpi-card small {
  color: var(--muted2);
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr);
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

.dashboard-secondary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.36rem;
}

.calendar-weekday,
.calendar-day {
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  padding: 0.34rem;
}

.calendar-weekday {
  min-height: auto;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.calendar-day {
  min-height: 92px;
  text-align: left;
  cursor: pointer;
}

.calendar-day:hover {
  border-color: rgba(242, 184, 75, 0.35);
  background: rgba(242, 184, 75, 0.08);
}

.calendar-day.today {
  border-color: rgba(242, 184, 75, 0.5);
  box-shadow: inset 0 0 0 1px rgba(242, 184, 75, 0.45);
}

.calendar-day.outside {
  opacity: 0.42;
}

.day-number {
  font-size: 0.78rem;
  font-weight: 600;
}

.day-sessions {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}

.day-sessions li {
  font-size: 0.7rem;
  border-radius: 8px;
  background: rgba(77, 163, 255, 0.12);
  border: 1px solid rgba(77, 163, 255, 0.26);
  padding: 0.12rem 0.28rem;
}

.task-block {
  margin-bottom: 0.68rem;
}

.task-block h4 {
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.task-block ul,
.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.task-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
}

.task-meta {
  display: grid;
  gap: 0.2rem;
}

.task-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.task-subtitle {
  color: var(--muted2);
  font-size: 0.78rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.55rem;
}

.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  padding: 0.56rem;
  background: rgba(255, 255, 255, 0.02);
}

.stat-card small {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.45rem;
}

.log-list li {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
}

.entity-form {
  display: grid;
  gap: 0.62rem;
}

.entity-form label,
.entity-form fieldset {
  display: grid;
  gap: 0.28rem;
}

.entity-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-ui);
  padding: 0.55rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-ui);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0.52rem 0.6rem;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted2);
}

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

button {
  border: 1px solid rgba(242, 184, 75, 0.32);
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  color: #1a1305;
  padding: 0.5rem 0.78rem;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.06);
}

button.secondary {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-color: var(--border);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

button.ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

button.warning {
  background: rgba(243, 156, 18, 0.18);
  border-color: rgba(243, 156, 18, 0.5);
  color: #ffd48e;
}

button.danger {
  background: rgba(255, 77, 77, 0.16);
  border-color: rgba(255, 77, 77, 0.5);
  color: #ffb5b5;
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.76rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  padding: 0.56rem;
  vertical-align: top;
}

th {
  background: #111a27;
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 3;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.poster {
  width: 56px;
  height: 84px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.32rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-chip);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.28rem 0.42rem;
  margin-right: 0.2rem;
  margin-bottom: 0.2rem;
}

.chip-state {
  border-color: rgba(242, 184, 75, 0.35);
  background: rgba(242, 184, 75, 0.14);
  color: #ffd382;
}

.chip-type {
  border-color: rgba(77, 163, 255, 0.35);
  background: rgba(77, 163, 255, 0.12);
  color: #95c8ff;
}

.chip-danger {
  border-color: rgba(255, 77, 77, 0.45);
  background: rgba(255, 77, 77, 0.14);
  color: #ffb3b3;
}

.chip-info {
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--muted);
}

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, rgba(16, 24, 36, 0.98), rgba(15, 23, 34, 0.98));
  color: var(--text);
  width: min(90vw, 760px);
  max-width: 760px;
  box-shadow: var(--shadow-1);
}

dialog::backdrop {
  background: rgba(5, 8, 12, 0.72);
}

.entity-dialog {
  display: grid;
  gap: 0.8rem;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

#distribuidoraDialog {
  width: min(92vw, 840px);
  max-width: 840px;
}

.distribuidoras-grid {
  display: grid;
  gap: 1rem;
}

.distribuidora-card {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow-1);
}

.distribuidora-card-head {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.distribuidora-card-body {
  display: grid;
  gap: 0.72rem;
  padding: 1rem;
}

.distribuidora-line {
  color: var(--text);
  line-height: 1.45;
}

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

.distribuidora-contactos {
  display: grid;
  gap: 0.28rem;
}

.distribuidora-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

pre {
  border-radius: var(--radius-ui);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.75rem;
  max-height: 58vh;
  overflow: auto;
}

.day-detail-content {
  display: grid;
  gap: 0.68rem;
  max-height: 58vh;
  overflow: auto;
  margin-bottom: 0.7rem;
}

.day-detail-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.62rem;
  background: rgba(255, 255, 255, 0.03);
}

.day-detail-section h4 {
  margin-bottom: 0.45rem;
}

.day-detail-section ul {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.28rem;
}

.notice {
  color: var(--muted2);
  font-style: italic;
}

.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;
}

body[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(242, 246, 251, 0.92));
  box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.05);
}

body[data-theme="light"] .brand-block,
body[data-theme="light"] .sidebar-bottom,
body[data-theme="light"] .avatar-dot,
body[data-theme="light"] .badge,
body[data-theme="light"] .search-wrap,
body[data-theme="light"] .icon-btn,
body[data-theme="light"] .task-line,
body[data-theme="light"] .stat-card,
body[data-theme="light"] .log-list li,
body[data-theme="light"] .calendar-weekday,
body[data-theme="light"] .calendar-day,
body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea,
body[data-theme="light"] .day-detail-section,
body[data-theme="light"] pre {
  background: rgba(15, 23, 42, 0.03);
}

body[data-theme="light"] .tab-btn:hover {
  background: rgba(15, 23, 42, 0.06);
}

body[data-theme="light"] .tab-btn.active {
  background: linear-gradient(90deg, rgba(242, 184, 75, 0.2), rgba(242, 184, 75, 0.04));
}

body[data-theme="light"] .topbar {
  background: rgba(248, 250, 252, 0.88);
}

body[data-theme="light"] .sidebar-bottom,
body[data-theme="light"] .avatar-dot,
body[data-theme="light"] .user-pill {
  background: transparent !important;
}

body[data-theme="light"] .avatar-dot {
  border: 0 !important;
  box-shadow: none !important;
}

body[data-theme="light"] .panel {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
}

body[data-theme="light"] .kpi-card {
  background: linear-gradient(180deg, #ffffff, #f2f6fb);
}

body[data-theme="light"] .calendar-day:hover {
  background: rgba(242, 184, 75, 0.14);
}

body[data-theme="light"] .day-sessions li {
  background: rgba(77, 163, 255, 0.18);
  border-color: rgba(77, 163, 255, 0.34);
  color: #103e72;
}

body[data-theme="light"] button.secondary {
  background: rgba(15, 23, 42, 0.03);
}

body[data-theme="light"] button.secondary:hover,
body[data-theme="light"] button.ghost:hover,
body[data-theme="light"] .icon-btn:hover {
  background: rgba(15, 23, 42, 0.08);
}

body[data-theme="light"] th {
  background: #e7edf5;
}

body[data-theme="light"] td,
body[data-theme="light"] th {
  border-bottom-color: rgba(15, 23, 42, 0.1);
}

body[data-theme="light"] tbody tr:hover {
  background: rgba(15, 23, 42, 0.03);
}

body[data-theme="light"] dialog {
  background: linear-gradient(180deg, #ffffff, #f2f6fb);
}

body[data-theme="light"] dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.tab-btn:focus-visible,
.calendar-day:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accentGlow);
}

@media (max-width: 1280px) {
  .search-wrap {
    min-width: 180px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-main-grid,
  .dashboard-secondary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1023px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--border);
    background: rgba(14, 20, 27, 0.86);
    backdrop-filter: blur(8px);
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    height: 100vh;
    transform: translateX(-106%);
    transition: transform 0.2s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  #sidebarToggle {
    display: inline-flex;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(5, 8, 12, 0.6);
    z-index: 70;
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .content-area {
    padding: 0.88rem;
  }

  .section-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .topbar {
    justify-content: flex-start;
  }

  .quick-action {
    flex: 1;
    min-width: 148px;
  }

  .section-header {
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .entity-form fieldset {
    grid-template-columns: 1fr;
  }

  .calendar-weekday,
  .calendar-day {
    min-height: 74px;
    padding: 0.26rem;
  }

  .day-sessions li {
    font-size: 0.66rem;
  }
}
