:root {
  color-scheme: light;
  --p-black: #131a20;
  --p-blue: #0967d3;
  --p-blue-dark: #0756b2;
  --p-cyan: #06b6d4;
  --p-gray-50: hsl(216, 33%, 97%);
  --p-gray-100: hsl(214, 15%, 91%);
  --p-gray-200: hsl(210, 16%, 82%);
  --p-gray-300: hsl(211, 13%, 65%);
  --p-gray-400: hsl(211, 10%, 53%);
  --p-gray-500: hsl(211, 12%, 43%);
  --p-gray-600: hsl(209, 14%, 37%);
  --p-gray-700: hsl(209, 18%, 30%);
  --p-gray-800: hsl(209, 20%, 25%);
  --p-gray-900: hsl(210, 24%, 16%);

  --p-background: var(--p-gray-100);
  --p-surface: #ffffff;
  --p-surface-alt: var(--p-gray-50);
  --p-text: var(--p-gray-900);
  --p-muted: var(--p-gray-500);
  --p-border: var(--p-gray-200);
  --p-primary: var(--p-blue);
  --p-primary-hover: var(--p-blue-dark);
  --p-primary-soft: rgba(9, 103, 211, .12);
  --p-danger: #ef4444;
  --p-danger-soft: rgba(239, 68, 68, .12);
  --p-success: #10b981;
  --p-success-soft: rgba(16, 185, 129, .12);

  --p-sidebar: var(--p-black);
  --p-sidebar-text: var(--p-gray-300);
  --p-sidebar-active: rgba(9, 103, 211, .18);

  --p-radius: 3px;
  --p-radius-lg: 6px;
  --p-shadow: 0 1px 2px rgba(19, 26, 32, .08), 0 1px 3px rgba(19, 26, 32, .06);
  --p-shadow-lg: 0 8px 24px rgba(19, 26, 32, .18);
  --p-transition: 250ms ease;

  --sidebar-width: 240px;
  --topbar-height: 56px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --p-background: var(--p-gray-900);
  --p-surface: var(--p-gray-800);
  --p-surface-alt: var(--p-gray-700);
  --p-text: var(--p-gray-50);
  --p-muted: var(--p-gray-300);
  --p-border: var(--p-gray-700);
  --p-primary: #60a5fa;
  --p-primary-hover: #93c5fd;
  --p-primary-soft: rgba(96, 165, 250, .14);
  --p-danger: #f87171;
  --p-danger-soft: rgba(248, 113, 113, .14);
  --p-success: #34d399;
  --p-success-soft: rgba(52, 211, 153, .14);
  --p-sidebar: #0d1216;
  --p-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --p-shadow-lg: 0 8px 24px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "IBM Plex Sans", Roboto, system-ui, -apple-system, sans-serif;
  background: var(--p-background);
  color: var(--p-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--p-primary); text-decoration: none; }
a:hover { color: var(--p-primary-hover); }
button, input, select, textarea { font-family: inherit; }

i.fa-solid, i.fa-regular { font-size: 16px; line-height: 1; vertical-align: -2px; }

.overline {
  font-size: 11px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--p-primary);
}
.display-small { font-size: 24px; line-height: 30px; font-weight: 600; }
.headline-small { font-size: 20px; line-height: 28px; font-weight: 600; }
.title-large { font-size: 20px; line-height: 28px; font-weight: 600; }
.title-medium { font-size: 15px; line-height: 22px; font-weight: 600; }
.title-small { font-size: 14px; line-height: 20px; font-weight: 600; }
.body-large { font-size: 15px; line-height: 23px; }
.body-medium { font-size: 14px; line-height: 21px; }
.body-small { font-size: 12px; line-height: 17px; }
.label-large { font-size: 14px; font-weight: 600; }
.label-medium { font-size: 12px; font-weight: 600; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--p-sidebar);
  color: var(--p-sidebar-text);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}
.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: #fff;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: var(--p-radius);
  background: var(--p-blue);
  color: #fff;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.brand-mark i { font-size: 16px; }
.brand-text strong { display: block; font-size: 15px; line-height: 19px; font-weight: 600; letter-spacing: .2px; }
.brand-text span { display: block; font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: var(--p-gray-400); }

.nav-section { padding: 16px 8px 4px; }
.nav-section-title {
  padding: 4px 12px 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase;
  color: var(--p-gray-400);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 36px; padding: 0 12px; margin: 2px 0;
  border-radius: var(--p-radius);
  color: var(--p-sidebar-text);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--p-transition), color var(--p-transition);
}
.nav-item i { width: 16px; text-align: center; color: var(--p-gray-400); }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav-item.active {
  background: var(--p-sidebar-active);
  color: #fff;
  border-left-color: var(--p-primary);
}
.nav-item.active i { color: #60a5fa; }
.sidebar-spacer { flex: 1; }
.sidebar-footer { padding: 8px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-footer .nav-item { width: 100%; background: transparent; border: 0; font: inherit; cursor: pointer; text-align: left; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-height);
  flex: 0 0 var(--topbar-height);
  background: var(--p-surface);
  border-bottom: 1px solid var(--p-border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.menu-toggle { display: none; }
.topbar h1 { font-size: 15px; font-weight: 600; margin: 0; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 10px 3px 3px;
  border-radius: var(--p-radius);
  background: var(--p-surface-alt);
  border: 1px solid var(--p-border);
  color: var(--p-text);
}
.user-pill:hover { text-decoration: none; color: var(--p-text); }
.avatar {
  width: 32px; height: 32px; border-radius: var(--p-radius);
  background: var(--p-primary-soft);
  color: var(--p-primary);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
  flex: 0 0 auto;
}
.avatar.admin { background: rgba(6, 182, 212, .14); color: var(--p-cyan); }
.avatar-image {
  display: block; object-fit: cover;
  width: 32px; height: 32px;
  max-width: 32px; max-height: 32px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  background: var(--p-surface);
  flex: 0 0 32px;
  overflow: hidden;
}
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .text-muted { line-height: 1.35; }
.avatar-crop { display: grid; gap: 10px; margin: 12px 0 18px; }
.avatar-crop[hidden] { display: none; }
.avatar-crop__stage {
  position: relative; width: 100%; max-width: 240px; aspect-ratio: 1 / 1;
  margin: 0 auto; overflow: hidden; cursor: grab; touch-action: none;
  border: 1px solid var(--p-border); border-radius: var(--p-radius-lg);
  background: var(--p-surface);
}
.avatar-crop__stage.dragging { cursor: grabbing; }
.avatar-crop__image { position: absolute; user-select: none; pointer-events: none; }
.avatar-crop__controls { display: flex; align-items: center; gap: 10px; }
.avatar-crop__controls label { font-size: 12px; font-weight: 600; }
.avatar-crop__controls input[type="range"] { flex: 1; min-width: 0; }
.avatar-crop p { margin: 0; }
.user-pill .meta { line-height: 1.2; text-align: left; }
.user-pill .meta strong { font-size: 12px; display: block; font-weight: 600; }
.user-pill .meta small { font-size: 10px; color: var(--p-muted); text-transform: uppercase; letter-spacing: .5px; }

.content { padding: 28px 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-header { margin-bottom: 20px; }
.page-header h2 { margin: 2px 0 0; }
.page-header p { margin: 4px 0 0; color: var(--p-muted); font-size: 13px; }
.page-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.md-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--p-radius);
  font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background var(--p-transition), border-color var(--p-transition), color var(--p-transition);
  white-space: nowrap;
}
.md-btn i { font-size: 13px; }
.md-btn:hover { text-decoration: none; }
.md-btn:disabled { opacity: .5; cursor: not-allowed; }
.md-btn--filled { background: var(--p-primary); color: #fff; border-color: var(--p-primary); }
.md-btn--filled:hover { background: var(--p-primary-hover); border-color: var(--p-primary-hover); color: #fff; }
.md-btn--tonal { background: var(--p-primary-soft); color: var(--p-primary); }
.md-btn--tonal:hover { background: var(--p-primary-soft); color: var(--p-primary-hover); }
.md-btn--outlined { background: transparent; color: var(--p-primary); border-color: var(--p-border); }
.md-btn--outlined:hover { border-color: var(--p-primary); color: var(--p-primary-hover); }
.md-btn--text { background: transparent; color: var(--p-primary); padding: 0 8px; }
.md-btn--text:hover { color: var(--p-primary-hover); background: var(--p-primary-soft); }
.md-btn--danger { background: var(--p-danger); color: #fff; border-color: var(--p-danger); }
.md-btn--small { height: 28px; padding: 0 10px; font-size: 12px; }

.md-icon-btn {
  width: 30px; height: 30px; padding: 0; border: 1px solid var(--p-border); border-radius: var(--p-radius);
  background: var(--p-surface); color: var(--p-muted);
  display: inline-grid; place-items: center; cursor: pointer;
  text-decoration: none;
  transition: background var(--p-transition), color var(--p-transition), border-color var(--p-transition);
}
.md-icon-btn i { font-size: 13px; }
.md-icon-btn:hover { color: var(--p-primary); border-color: var(--p-primary); background: var(--p-primary-soft); text-decoration: none; }
.md-icon-btn.danger:hover { color: var(--p-danger); border-color: var(--p-danger); background: var(--p-danger-soft); }
.topbar .md-icon-btn { border-color: transparent; background: transparent; }
.topbar .md-icon-btn:hover { border-color: var(--p-border); }

.md-card {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  box-shadow: var(--p-shadow);
}
.md-card__head {
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--p-border);
}
.md-card__head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.md-card__body { padding: 20px; }
.md-card__foot { padding: 12px 20px; border-top: 1px solid var(--p-border); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  box-shadow: var(--p-shadow);
  padding: 16px; display: flex; align-items: center; gap: 14px;
}
.stat-card__icon {
  width: 42px; height: 42px; border-radius: var(--p-radius);
  display: grid; place-items: center; flex: 0 0 auto;
  background: var(--p-primary-soft);
  color: var(--p-primary);
}
.stat-card__icon i { font-size: 18px; }
.stat-card__icon.secondary { background: var(--p-success-soft); color: var(--p-success); }
.stat-card__icon.tertiary { background: rgba(6, 182, 212, .14); color: var(--p-cyan); }
.stat-card__value { font-size: 22px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card__label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--p-muted); }

.md-textfield {
  display: grid;
  grid-template-areas: "label" "input" "hint";
  gap: 5px;
  margin-bottom: 10px;
}
.md-textfield input,
.md-textfield select,
.md-textfield textarea {
  grid-area: input;
  width: 100%; min-height: 36px;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  color: var(--p-text);
  font-size: 14px;
  padding: 7px 10px;
  outline: none;
  transition: border-color var(--p-transition), box-shadow var(--p-transition);
}
.md-textfield textarea { min-height: 90px; resize: vertical; }
.md-textfield select { cursor: pointer; }
.md-textfield input:focus,
.md-textfield select:focus,
.md-textfield textarea:focus {
  border-color: var(--p-primary);
  box-shadow: 0 0 0 3px var(--p-primary-soft);
}
.md-textfield label {
  grid-area: label;
  font-size: 12px; font-weight: 600; color: var(--p-text);
}
.md-textfield__hint { grid-area: hint; font-size: 11px; color: var(--p-muted); margin: 0; }
.md-textfield select option { background: var(--p-surface); color: var(--p-text); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 4px 16px; align-items: start; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .md-textfield { min-height: 66px; }
.switch-field { display: flex; align-items: center; min-height: 66px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.profile-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 16px; align-items: start; }
.profile-avatar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.md-textfield input[type="file"] { padding: 7px 8px; font-size: 12px; }

.setup-link-card .md-card__body { display: grid; gap: 8px; }
.setup-link-row { display: flex; gap: 8px; align-items: center; }
.setup-link-row input {
  flex: 1; min-width: 0; min-height: 36px;
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: var(--p-radius); color: var(--p-text); padding: 7px 10px;
}
.setup-link-row .md-btn { flex: 0 0 auto; }

.permission-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--p-border); }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 16px; margin-top: 10px; }
.permission-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--p-border);
  border-radius: var(--p-radius); background: var(--p-surface); cursor: pointer;
}
.permission-card:hover { border-color: var(--p-primary); }
.permission-card input { margin-top: 2px; accent-color: var(--p-primary); }
.permission-card span { display: grid; gap: 2px; }
.permission-card small { color: var(--p-muted); font-size: 11px; line-height: 16px; }
.permission-group { padding: 14px 0; border-bottom: 1px solid var(--p-border); }
.permission-group:first-of-type { padding-top: 6px; }
.permission-group:last-of-type { border-bottom: 0; padding-bottom: 0; }
.permission-group__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.permission-group__icon {
  flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 9px; background: var(--p-primary-soft); color: var(--p-primary);
}
.permission-group__meta { display: grid; gap: 2px; }
.permission-group__meta strong { font-size: 13px; }
.permission-group__meta small { color: var(--p-muted); font-size: 11px; }
.permission-group .permission-grid { margin-top: 0; }

.md-switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; }
.md-switch input { position: absolute; opacity: 0; pointer-events: none; }
.md-switch__track {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--p-gray-300);
  position: relative; transition: background var(--p-transition); flex: 0 0 auto;
}
.md-switch__track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform var(--p-transition);
}
.md-switch input:checked + .md-switch__track { background: var(--p-primary); }
.md-switch input:checked + .md-switch__track::after { transform: translateX(16px); }

.md-table-wrap { overflow-x: auto; }
.md-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.md-table th {
  text-align: left; padding: 10px 16px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--p-muted); font-weight: 700;
  background: var(--p-surface-alt);
  border-bottom: 1px solid var(--p-border);
  white-space: nowrap;
}
.md-table td { padding: 10px 16px; border-bottom: 1px solid var(--p-border); vertical-align: middle; }
.md-table tr:last-child td { border-bottom: 0; }
.md-table tbody tr:hover td { background: var(--p-surface-alt); }
.md-table .actions { display: flex; gap: 5px; justify-content: flex-end; }
.md-table .primary-cell { font-weight: 600; }

.md-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--p-radius);
  background: var(--p-surface-alt);
  border: 1px solid var(--p-border);
  color: var(--p-muted);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.md-chip.admin { background: var(--p-primary-soft); border-color: transparent; color: var(--p-primary); }
.md-chip.inactive { background: var(--p-danger-soft); border-color: transparent; color: var(--p-danger); }
.md-chip i { font-size: 11px; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 56px 24px; min-height: 320px;
}
.empty-state__icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--p-primary-soft);
  color: var(--p-primary);
  display: grid; place-items: center; margin-bottom: 18px;
}
.empty-state__icon i { font-size: 28px; }
.empty-state h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.empty-state p { margin: 0; color: var(--p-muted); max-width: 420px; font-size: 13px; }

.snackbar {
  position: fixed; right: 24px; bottom: 24px;
  background: var(--p-surface);
  color: var(--p-text);
  border: 1px solid var(--p-border);
  border-left: 3px solid var(--p-primary);
  border-radius: var(--p-radius);
  padding: 10px 12px;
  box-shadow: var(--p-shadow-lg);
  display: flex; align-items: center; gap: 10px;
  z-index: 100; max-width: min(420px, 92vw);
  font-size: 13px;
  animation: snackbar-in var(--p-transition);
}
.snackbar.error { border-left-color: var(--p-danger); }
.snackbar.success { border-left-color: var(--p-success); }
.snackbar > i { color: var(--p-primary); }
.snackbar.error > i { color: var(--p-danger); }
.snackbar.success > i { color: var(--p-success); }
.snackbar .md-icon-btn { width: 24px; height: 24px; border: 0; background: transparent; }
@keyframes snackbar-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 12% 10%, rgba(9,103,211,.24), transparent 40%),
    radial-gradient(circle at 88% 90%, rgba(6,182,212,.16), transparent 42%),
    var(--p-black);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  padding: 28px;
  box-shadow: var(--p-shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .brand-mark { width: 40px; height: 40px; }
.login-brand .brand-mark i { font-size: 18px; }
.login-brand h1 { font-size: 18px; margin: 0; font-weight: 600; }
.login-brand p { margin: 0; font-size: 10px; color: var(--p-muted); text-transform: uppercase; letter-spacing: .8px; }
.login-card .md-btn--filled { width: 100%; height: 38px; margin-top: 6px; }
.login-links { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.login-inline-form { display: inline; }
.login-note { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--p-border); font-size: 11px; color: var(--p-muted); text-align: center; }

.info-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--p-primary-soft);
  color: var(--p-text);
  border-left: 3px solid var(--p-primary);
  border-radius: var(--p-radius);
  padding: 12px 14px; margin-bottom: 16px; font-size: 13px;
}
.info-banner > i { color: var(--p-primary); margin-top: 2px; }
.info-banner.error { background: var(--p-danger-soft); border-left-color: var(--p-danger); }
.info-banner.error > i { color: var(--p-danger); }
.section-divider { height: 1px; background: var(--p-border); margin: 20px 0; }
.text-muted { color: var(--p-muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.calendar-form-card { margin-bottom: 18px; }
.calendar-form-card .md-card__head h2 { display: flex; align-items: center; gap: 8px; }
.calendar-check-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px; margin-top: 8px; max-height: 220px; overflow-y: auto;
  padding: 2px;
}
.calendar-check {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 11px; border: 1px solid var(--p-border);
  border-radius: var(--p-radius); background: var(--p-surface); cursor: pointer;
  font-size: 12px;
}
.calendar-check:hover { border-color: var(--p-primary); background: var(--p-surface-alt); }
.calendar-check input { margin-top: 2px; accent-color: var(--p-primary); flex: 0 0 auto; }
.calendar-check span { display: grid; gap: 2px; line-height: 1.35; }
.calendar-check small { color: var(--p-muted); font-size: 10px; }
.calendar-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 18px 0 10px;
}
.calendar-toolbar strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.calendar-card { overflow: hidden; }
.calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--p-surface-alt); border-bottom: 1px solid var(--p-border);
}
.calendar-weekdays span {
  padding: 9px 10px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px; color: var(--p-muted);
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-day {
  min-height: 108px; padding: 8px; border-right: 1px solid var(--p-border);
  border-bottom: 1px solid var(--p-border); display: flex; flex-direction: column; gap: 5px;
}
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { background: var(--p-surface-alt); }
.calendar-day.today .calendar-day__number {
  background: var(--p-primary); color: #fff; border-radius: 50%;
  width: 22px; height: 22px; display: grid; place-items: center;
}
.calendar-day__number { font-size: 11px; font-weight: 700; color: var(--p-muted); }
.calendar-event {
  display: flex; flex-direction: column; gap: 2px;
  padding: 5px 7px; border-radius: var(--p-radius);
  background: var(--p-primary-soft); color: var(--p-primary);
  text-decoration: none; font-size: 11px; overflow: hidden;
}
.calendar-event:hover { background: var(--p-primary); color: #fff; text-decoration: none; }
.calendar-event__time { font-size: 9px; font-variant-numeric: tabular-nums; opacity: .85; }
.calendar-event__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-detail { margin-top: 18px; }
.calendar-detail .actions { display: flex; gap: 6px; }
.calendar-detail__meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--p-muted); }
.calendar-detail__meta i { color: var(--p-primary); margin-right: 5px; }
.calendar-detail__description { white-space: pre-line; margin: 16px 0 0; font-size: 13px; line-height: 1.6; }
.calendar-detail__section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--p-border); }
.calendar-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; }

.backdrop { position: fixed; inset: 0; background: rgba(19,26,32,.55); z-index: 25; display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform var(--p-transition); box-shadow: var(--p-shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .backdrop { display: block; }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 14px; }
  .content { padding: 20px 16px; }
  .form-grid, .permission-grid, .profile-layout { grid-template-columns: 1fr; }
  .calendar-day { min-height: 88px; padding: 6px; }
  .calendar-event__title { font-size: 10px; }
}

@media (max-width: 560px) {
  .login-card { padding: 24px 20px; }
  .user-pill .meta { display: none; }
  .user-pill { padding: 3px; }
  .stats-grid { grid-template-columns: 1fr; }
  .snackbar { right: 12px; bottom: 12px; }
  .setup-link-row { align-items: stretch; flex-direction: column; }
}
