:root {
  --color-primary: #2d6a4f;
  --color-primary-dark: #1b4332;
  --color-primary-light: #40916c;
  --color-accent: #d4a373;
  --color-bg: #f4f6f5;
  --color-surface: #ffffff;
  --color-sidebar: #1b4332;
  --color-sidebar-text: #d8e2dc;
  --color-text: #1a1a1a;
  --color-text-muted: #5c5c5c;
  --color-border: #e0e6e3;
  --color-danger: #b42318;
  --color-danger-bg: #fef3f2;
  --color-success-bg: #ecfdf3;
  --color-success-text: #1b4332;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 3px rgba(27, 67, 50, 0.06);
  --shadow-md: 0 4px 20px rgba(27, 67, 50, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

em { font-family: var(--font-display); font-style: italic; color: var(--color-primary); }
.logo-accent { color: var(--color-accent); }

/* Layout */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand { padding: 0 1.25rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
}

.sidebar-logo small {
  font-weight: 500;
  font-size: 0.75rem;
  opacity: 0.7;
  margin-left: 0.25rem;
}

.sidebar-logo-img { border-radius: 6px; }

.sidebar-nav { flex: 1; padding: 1.25rem 0.75rem; }
.sidebar-nav ul { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--color-sidebar-text);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
}

.sidebar-link:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.sidebar-link.active { background: rgba(255,255,255,0.14); color: #fff; }
.sidebar-link-muted { font-size: 0.875rem; opacity: 0.85; }
.sidebar-icon { width: 1.25rem; text-align: center; opacity: 0.8; }

.sidebar-footer {
  padding: 1rem 1.25rem 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-user { font-weight: 600; color: #fff; font-size: 0.9375rem; margin-bottom: 0.25rem; }

.admin-main {
  padding: 2rem 2.5rem;
  min-width: 0;
  overflow-x: auto;
}

.admin-header { margin-bottom: 2rem; }
.admin-header h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 700; }
.admin-subtitle { color: var(--color-text-muted); margin-top: 0.25rem; }
.breadcrumb { margin-bottom: 0.5rem; font-size: 0.875rem; }

/* Stats */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: stretch;
}

.stat-card {
  width: 14.5rem;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-label { font-size: 0.875rem; color: var(--color-text-muted); }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--color-primary-dark); margin: 0.25rem 0; }
.stat-link { font-size: 0.875rem; font-weight: 600; }

/* Panels */
.admin-panels {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}
.admin-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.admin-panel:has(.admin-table) {
  width: max-content;
  max-width: 100%;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.panel-header h2 { font-size: 1.125rem; font-weight: 600; }
.catalog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}
.catalog-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.catalog-filters input,
.catalog-filters select,
.catalog-filters-actions .btn {
  box-sizing: border-box;
  height: 2.5rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  padding: 0 0.7rem;
  border-radius: var(--radius-sm);
}
.catalog-filters input,
.catalog-filters select {
  color: var(--color-text);
  border: 1px solid var(--color-border);
  background: #fff;
  min-width: 8.5rem;
}
.catalog-filters input[type="search"] {
  min-width: 14rem;
}
.catalog-filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: stretch;
}
.catalog-filters-actions .btn {
  border-width: 1px;
  padding: 0 0.9rem;
}
.catalog-filters button[hidden] {
  display: none !important;
}
.catalog-table[hidden],
[data-catalog-empty][hidden] {
  display: none !important;
}
.catalog-table .is-filtered-out {
  display: none !important;
}

.day-picker-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.day-picker-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.day-picker-form input[type="date"] {
  box-sizing: border-box;
  height: 2.5rem;
  font: inherit;
  font-size: 0.875rem;
  padding: 0 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: #fff;
}

/* Tables */
.admin-table { width: auto; border-collapse: collapse; font-size: 0.9375rem; }
.admin-table th, .admin-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.admin-table th { font-weight: 600; color: var(--color-text-muted); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.03em; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafbfa; }

.table-actions:not(td) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.inline-form { display: inline; }

.cell-title-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
}
.cell-title-row > a:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.cell-title-row .inline-form {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin: 0;
}
.cell-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
}
.catalog-table th,
.catalog-table td {
  vertical-align: middle;
}
.catalog-table .cell-with-actions {
  min-width: 0;
}
.catalog-table .btn-icon {
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
}
.catalog-table .cell-date-stack {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.35;
}
.catalog-table .cell-date-by {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-weight: 400;
}
.catalog-table .cell-date-by a {
  color: inherit;
}
.meta-list .meta-by {
  display: block;
  margin-top: 0.2rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.users-table th,
.users-table td {
  vertical-align: middle;
}
.users-table td.table-actions,
.users-table td.admin-status-cell {
  display: table-cell;
  vertical-align: middle;
}
.users-table .table-actions {
  min-width: 0;
}
.users-table .table-actions-inner,
.users-table .admin-status-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  min-height: 2.15rem;
}
.users-table .table-actions-inner {
  gap: 0.35rem;
}
.users-table .inline-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.users-table td.admin-status-cell {
  vertical-align: middle;
}

.admin-switch-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.admin-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 2.75rem;
  height: 1.65rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: #c5cdc8;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  vertical-align: middle;
}
.admin-switch.is-on {
  background: var(--color-primary);
}
.admin-switch-knob {
  position: absolute;
  top: 0.18rem;
  left: 0.18rem;
  width: 1.28rem;
  height: 1.28rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(27, 67, 50, 0.28);
  transition: transform 0.2s ease;
}
.admin-switch.is-on .admin-switch-knob {
  transform: translateX(1.1rem);
}
.admin-switch:hover:not(:disabled) {
  filter: brightness(0.96);
}
.admin-switch:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}
.admin-switch:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.admin-ban-row td {
  background: #f7f8f6;
  padding: 1rem;
}
.admin-table tbody tr.admin-ban-row:hover {
  background: transparent;
}
.admin-ban-row:hover td {
  background: #f7f8f6;
}
.admin-ban-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 36rem;
}
.admin-ban-panel label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--color-text-muted);
}
.admin-ban-panel select {
  font: inherit;
  width: fit-content;
  min-width: 8rem;
  padding: 0.5rem 2rem 0.5rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.admin-ban-panel textarea {
  font: inherit;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  min-height: 4.5rem;
  resize: vertical;
}
.admin-ban-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--color-bg);
  color: var(--color-text-muted);
}

.badge-admin,
.badge-community { background: #d8f3dc; color: var(--color-primary-dark); }
.badge-banned { background: #fef3c7; color: #92400e; }
.badge-unverified { background: #e0e7ff; color: #3730a3; }
.badge-approved { background: var(--color-success-bg); color: var(--color-success-text); }

/* Presence panel */
.presence-panel {
  width: max-content;
  min-width: 22rem;
  max-width: 100%;
  margin-bottom: 1.5rem;
}

.presence-heading { display: flex; align-items: center; gap: 0.6rem; }

.presence-live-dot {
  position: relative;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}
.presence-live-dot::after {
  content: '';
  position: absolute;
  inset: -0.3rem;
  border-radius: 50%;
  background: var(--color-success-bg);
  z-index: -1;
  animation: presence-pulse 2.4s ease-out infinite;
}
@keyframes presence-pulse {
  from { transform: scale(0.6); opacity: 0.9; }
  to { transform: scale(2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .presence-live-dot::after { animation: none; }
}

.presence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.presence-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 1rem 0.4rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.presence-chip:hover {
  border-color: var(--color-primary-light);
  background: var(--color-success-bg);
}

.presence-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--color-success-bg);
  color: var(--color-primary-dark);
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.presence-info { display: flex; flex-direction: column; line-height: 1.3; }
.presence-name { font-weight: 600; font-size: 0.9rem; color: var(--color-text); }
.presence-time { font-size: 0.78rem; color: var(--color-text-muted); }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-rejected { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-sizing: border-box;
  margin: 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.05rem;
  min-height: 2.4rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
  text-decoration: none;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

.btn:hover { text-decoration: none; }
.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); border-color: var(--color-primary-dark); color: #fff; }
.btn-outline { background: var(--color-surface); color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover:not(:disabled) { background: rgba(45, 106, 79, 0.08); color: var(--color-primary-dark); }
.btn-danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover:not(:disabled) { background: #912018; border-color: #912018; color: #fff; }
.btn-sm { padding: 0.4rem 0.85rem; min-height: 2.15rem; font-size: 0.8125rem; }
.btn-block { width: 100%; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  margin: 0;
  padding: 0;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}
.btn-icon svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.btn-icon-label {
  width: auto;
  min-height: 2.15rem;
  height: 2.15rem;
  padding: 0 0.65rem 0 0.4rem;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.btn-icon:hover {
  color: var(--color-primary-dark);
  border-color: var(--color-primary);
  background: rgba(45, 106, 79, 0.08);
  text-decoration: none;
}
.btn-icon-admin-on {
  color: var(--color-primary);
  background: #d8f3dc;
  border-color: #b7e4c7;
}
.btn-icon-admin-on:hover {
  color: #fff;
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-icon-admin-off {
  color: #8a918c;
  background: var(--color-surface);
  border-color: var(--color-border);
}
.btn-icon-admin-off:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: rgba(45, 106, 79, 0.08);
}
.btn-icon-danger {
  color: var(--color-danger);
  border-color: var(--color-border);
  background: var(--color-surface);
}
.btn-icon-danger:hover {
  color: #fff;
  background: var(--color-danger);
  border-color: var(--color-danger);
}
.btn-icon-primary {
  color: #fff;
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-icon-primary:hover {
  color: #fff;
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

/* Flash messages */
.admin-flash {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.admin-flash.success { background: var(--color-success-bg); color: var(--color-success-text); }
.admin-flash.error { background: var(--color-danger-bg); color: var(--color-danger); }

/* Detail pages */
.detail-meta { margin-bottom: 1rem; }
.meta-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.meta-list dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }
.meta-list dd { font-weight: 500; margin-top: 0.15rem; }

.content-preview {
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  line-height: 1.7;
}

.detail-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }

.login-shell { width: 100%; max-width: 420px; }

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.login-brand { text-align: center; margin-bottom: 1rem; }
.login-brand img {
  display: block;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
}
.login-brand h1 { font-family: var(--font-display); font-size: 1.5rem; }
.login-subtitle { text-align: center; color: var(--color-text-muted); margin-bottom: 1.5rem; font-size: 0.9375rem; }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: 0.875rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.35rem; }
.form-group input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.25rem;
}

.form-row .form-group {
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
}

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  background: #fff;
  color: var(--color-text);
}

.form-row .form-group select {
  width: max-content;
  max-width: 100%;
  min-width: 7.5rem;
}

.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.form-group textarea {
  min-height: 16rem;
  resize: vertical;
  line-height: 1.55;
}

.admin-edit-form {
  margin-top: 0.5rem;
}

.admin-edit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.admin-edit-actions .inline-form {
  display: inline-flex;
  margin: 0;
}

@media (max-width: 700px) {
  .form-row .form-group,
  .form-row .form-group select {
    width: 100%;
  }
}

/* Responsive */
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 1rem;
  }
  .sidebar-brand { border-bottom: none; padding: 0; }
  .sidebar-nav { padding: 0; flex: 1 1 100%; order: 3; }
  .sidebar-nav ul { flex-direction: row; flex-wrap: wrap; }
  .sidebar-footer { border-top: none; flex-direction: row; flex-wrap: wrap; gap: 1rem; padding: 0; }
  .admin-main { padding: 1.25rem; }
}

@media (max-width: 1200px) {
  .admin-panel:has(.catalog-table) {
    width: 100%;
  }
  .catalog-table thead { display: none; }
  .catalog-table,
  .catalog-table tbody,
  .catalog-table tr,
  .catalog-table td {
    display: block;
    width: 100%;
  }
  .catalog-table tr {
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
  }
  .catalog-table tr:last-child { border-bottom: none; }
  .catalog-table td {
    border: none;
    padding: 0.25rem 0;
  }
  .catalog-table td[data-label] {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
  }
  .catalog-table td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 6.5rem;
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
}

.stat-hint {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  margin: 0 0 0.5rem;
}

.usage-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  margin: 0 0 0.75rem;
}

.usage-panels {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.usage-tables {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.usage-users-panel {
  margin-top: 1.5rem;
}

.usage-chart-panel {
  width: max-content;
  max-width: 100%;
}

.usage-chart {
  width: 820px;
  max-width: 100%;
  overflow-x: auto;
}

.usage-chart svg {
  display: block;
  width: 820px;
  height: 260px;
}

.usage-chart-grid {
  stroke: var(--color-border);
  stroke-width: 1;
}

.usage-chart-tick {
  stroke: var(--color-border);
  stroke-width: 1;
}

.usage-chart-line {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.usage-chart-dot {
  fill: #fff;
  stroke: var(--color-primary);
  stroke-width: 2;
}

.usage-chart-dot:hover {
  r: 5;
}

.usage-chart-axis {
  fill: var(--color-text-muted);
  font-size: 11px;
  font-family: var(--font-body);
}

.usage-chart-xlabel {
  font-size: 11px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-main > .admin-panel + .admin-panel {
  margin-top: 1.5rem;
}

.subject-add-form,
.subject-rename-form,
.subject-delete-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.subject-add-form input[type="text"],
.subject-rename-form input[type="text"] {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.subject-add-form input[type="text"] {
  min-width: 16rem;
}

.subject-name {
  display: inline-block;
  min-width: 12rem;
  font-weight: 500;
  cursor: pointer;
}

.subject-rename-form input[type="text"] {
  min-width: 12rem;
}

.subject-rename-form.is-editing .subject-name,
.subject-rename-form.is-editing [data-rename-start],
.subject-rename-form:not(.is-editing) [data-rename-save],
.subject-rename-form:not(.is-editing) [data-rename-cancel],
.subject-rename-form:not(.is-editing) [data-rename-input] {
  display: none !important;
}

.btn[hidden],
a.btn[hidden],
.btn-icon[hidden],
input[hidden] {
  display: none !important;
}

.admin-edit-form .form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 1rem 1.25rem;
}

.admin-edit-form .form-row .form-group {
  flex: 0 1 16rem;
  width: 16rem;
  max-width: 100%;
}

.admin-edit-form .form-row .form-group select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

textarea.rich-source {
  display: none !important;
}

.rich-editor {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
}

.rich-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-primary-dark);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.rich-toolbar button:hover,
.rich-toolbar button:focus-visible {
  border-color: var(--color-primary);
  color: var(--color-primary);
  outline: none;
}

.rich-toolbar button.is-active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(45, 106, 79, 0.12);
}

.rich-toolbar button svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.rich-editor.is-painting .rich-surface {
  cursor: copy;
}

.rich-status {
  margin-left: auto;
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-danger);
}

.rich-status.is-hint {
  color: var(--color-primary-dark);
}

.rich-toolbar button b,
.rich-toolbar button i,
.rich-toolbar button u {
  font-family: inherit;
  color: inherit;
}

.rich-surface {
  min-height: 10rem;
  padding: 0.875rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  outline: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  word-break: break-word;
}

.rich-editor-tall {
  max-height: calc(100dvh - 8rem);
  overflow: hidden;
}

.rich-editor-tall .rich-surface {
  flex: 1 1 auto;
  min-height: 0;
}

.rich-surface.is-empty:before {
  content: attr(data-placeholder);
  color: var(--color-text-muted);
  pointer-events: none;
}

.rich-editor:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12);
}

.rich-surface p {
  margin: 0 0 1em;
}

.rich-surface p:last-child {
  margin-bottom: 0;
}

.rich-surface ul {
  list-style: disc;
  padding-left: 1.4em;
  margin: 0 0 1em;
}

.rich-surface ol {
  list-style: decimal;
  padding-left: 1.4em;
  margin: 0 0 1em;
}

.rich-surface li {
  margin: 0.15em 0;
}

.rich-surface h2,
.rich-surface h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-style: normal;
  color: var(--color-primary-dark);
  margin: 0 0 0.55em;
  line-height: 1.2;
}

.rich-surface h2 {
  font-size: 1.28rem;
}

.rich-surface h3 {
  font-size: 1.12rem;
}

.rich-surface em,
.rich-surface i {
  font-family: inherit;
  font-style: italic;
  color: inherit;
}

.rich-surface u {
  text-decoration: underline;
}

.rich-surface blockquote {
  margin: 0 0 1em;
  padding: 0.15em 0 0.15em 0.9em;
  border-left: 3px solid var(--color-primary);
  color: var(--color-text-muted);
}

.rich-surface img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.75rem 0;
  border-radius: var(--radius-md);
}

.pretty-select {
  position: relative;
  width: 100%;
}

.pretty-select select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.pretty-select-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 0.65rem 2.5rem 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  text-align: left;
  color: var(--color-text);
  background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232d6a4f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.9rem center;
  cursor: pointer;
  appearance: none;
}

.pretty-select-toggle.is-placeholder {
  color: var(--color-text-muted);
}

.pretty-select-toggle:hover:not(:disabled) {
  border-color: var(--color-primary-light);
}

.pretty-select-toggle:focus-visible,
.pretty-select.is-open .pretty-select-toggle {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.pretty-select-list {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 50;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  max-height: 16.5rem;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.pretty-select-option {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  color: var(--color-text);
  cursor: pointer;
  line-height: 1.35;
}

.pretty-select-option.is-placeholder {
  color: var(--color-text-muted);
}

.pretty-select-option.is-active,
.pretty-select-option:hover {
  background: rgba(45, 106, 79, 0.1);
  color: var(--color-primary-dark);
}

.pretty-select-option[aria-selected="true"] {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

.pretty-select-option[aria-selected="true"].is-placeholder {
  background: rgba(45, 106, 79, 0.08);
  color: var(--color-text-muted);
  font-weight: 500;
}

.pretty-select-option[aria-selected="true"].is-active,
.pretty-select-option[aria-selected="true"]:hover {
  background: var(--color-primary-dark);
  color: #fff;
}

@media (max-width: 700px) {
  .admin-edit-form .form-row {
    display: flex;
  }

  .admin-edit-form .form-row .form-group {
    width: 100%;
    flex: 1 1 100%;
  }
}

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

.exercise-editor {
  margin-bottom: 0.35rem;
}

.exercise-editor [hidden] {
  display: none !important;
}

.qcm-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.15rem 0 0;
}

.exercise-format-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.15rem;
}

.exercise-format-pick {
  cursor: pointer;
}

.exercise-format-pick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.exercise-format-pick span {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.95rem;
  min-height: 2.15rem;
  border: 1.5px solid var(--color-primary);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-primary-dark);
  font-size: 0.9rem;
  font-weight: 600;
}

.exercise-format-pick input:checked + span {
  background: var(--color-primary);
  color: #fff;
}

.exercise-format-pick input:focus-visible + span {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.qcm-question-card {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.qcm-question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.qcm-question-label,
.qcm-choices-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  margin: 0;
}

.qcm-choices-label {
  margin: 0 0 0.45rem;
}

.qcm-choices-label span {
  font-weight: 500;
  color: var(--color-text-muted);
}

.qcm-choices {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.qcm-choice-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.qcm-choice-row input[type="text"] {
  flex: 1 1 auto;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font: inherit;
}

.qcm-choice-row input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}
