/* ============================================================
   KOS v5 — Reusable Components
   ============================================================ */

/* ---------------- Sidebar nav item ---------------- */

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  color: var(--color-sidebar-text);
  text-align: left;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.nav-item:hover:not(:disabled) {
  background: var(--color-sidebar-active-bg);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(29, 90, 153, 0.28), rgba(29, 90, 153, 0.06));
  border-left-color: var(--accent-blue);
  color: #ffffff;
  font-weight: var(--font-weight-semibold);
  box-shadow: inset 0 0 0 1px rgba(29, 90, 153, 0.18);
}

.nav-item:disabled {
  color: var(--color-sidebar-text-muted);
  cursor: default;
}

.nav-item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}

.nav-item-icon svg {
  width: 17px;
  height: 17px;
}

.nav-item.active .nav-item-icon,
.nav-item:hover .nav-item-icon {
  opacity: 1;
}

/* ---------------- Header ---------------- */

.page-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.01em;
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-left: var(--space-4);
  border-left: 1px solid var(--color-border);
}

.user-email {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.logout-btn {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
  background: var(--surface-interactive);
}

.logout-btn:hover:not(:disabled) {
  background: var(--color-danger-soft);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.logout-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ---------------- Dashboard card ---------------- */

.card {
  background: var(--surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 140px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon svg {
  width: 16px;
  height: 16px;
}

.card-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.card-body {
  flex: 1;
  display: flex;
  align-items: center;
}

.card-empty-state {
  font-size: var(--font-size-sm);
  color: var(--color-text-subtle);
}

/* ---------------- View placeholder (Phase 4 routes) ---------------- */

.view-placeholder {
  max-width: 640px;
}

.view-placeholder-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
}

.view-placeholder-description {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
  line-height: 1.5;
}

.view-placeholder-empty {
  padding: var(--space-7);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   Phase 5 additions — Students module
   ============================================================ */

/* ---------------- Buttons ---------------- */

.btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: 0 1px 2px rgba(23, 53, 42, 0.25);
}
.btn--primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
  box-shadow: 0 2px 6px rgba(23, 53, 42, 0.3);
  transform: translateY(-1px);
}

.btn--secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn--secondary:hover:not(:disabled) {
  background: var(--color-bg);
  border-color: var(--color-text-subtle);
}

.btn--danger {
  background: var(--color-danger-soft);
  border-color: var(--color-danger);
  color: var(--color-danger);
}
.btn--danger:hover:not(:disabled) {
  background: var(--color-danger);
  color: var(--color-on-accent);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn--ghost:hover:not(:disabled) {
  color: var(--color-text);
  background: var(--color-bg);
}

/* Scoped fix, not a global .btn--ghost change: a quiet ghost button
   reads correctly as a secondary inline action in tables, but the
   SAME styling on a modal's primary Cancel action (sitting right
   next to nothing else) is easily mistaken for disabled. Give
   modal-level ghost buttons a visible border so Cancel always
   reads as active — every other .btn--ghost use (table row
   actions, etc.) is untouched. */
.modal-actions .btn--ghost {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.modal-actions .btn--ghost:hover:not(:disabled) {
  border-color: var(--color-text-subtle);
  background: var(--color-bg);
}

.btn--sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ---------------- Badges ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px 2px 7px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: capitalize;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge--status-active { background: var(--color-success-soft); color: var(--color-success); }
.badge--status-inactive { background: var(--color-warning-soft); color: var(--color-warning); }
.badge--status-archived { background: var(--color-neutral-soft); color: var(--color-text-muted); }

/* ---------------- Modal ---------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 19, 16, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 1000;
}

.modal-dialog {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal-dialog--small {
  max-width: 420px;
  padding: var(--space-5);
}

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

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.modal-message {
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  line-height: 1.5;
}

.modal-close {
  font-size: 22px;
  line-height: 1;
  color: var(--color-text-muted);
  padding: var(--space-1);
}

.modal-body {
  padding: var(--space-5);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
}

.modal-dialog--small .modal-actions {
  padding: var(--space-5) 0 0;
  border-top: none;
}

/* ---------------- Form ---------------- */

.form-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 var(--space-5);
}

.form-fieldset legend {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-3);
  padding: 0;
}

.form-field {
  margin-bottom: var(--space-3);
}

.form-field label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  margin-bottom: 4px;
}

.field-required {
  color: var(--color-danger);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.form-field--invalid input,
.form-field--invalid select,
.form-field--invalid textarea {
  border-color: var(--color-danger);
}

.field-error {
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-danger);
}

.form-error-summary {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--color-danger-soft);
  color: var(--color-danger);
  font-size: var(--font-size-sm);
}

/* ---------------- Toast ---------------- */

.toast-stack {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 2000;
}

.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--color-text);
  color: var(--color-on-accent);
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  max-width: 320px;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success { background: var(--color-success); }
.toast--error { background: var(--color-danger); }

/* ---------------- Page header / list controls ---------------- */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.page-header-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

.page-header-description {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-top: 2px;
}

.students-summary {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.summary-chip {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  background: var(--color-surface);
}

.summary-chip strong {
  color: var(--color-text);
  margin-left: 4px;
}

.summary-chip--total {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.students-controls {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.students-search {
  flex: 1;
  min-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.students-controls select {
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

/* ---------------- Data table ---------------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table th,
.data-table td {
  padding: var(--space-2) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
}

.data-table th {
  color: var(--color-text-subtle);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xs);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--color-bg);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--color-accent-soft);
}

.student-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.student-name {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.student-preferred-name {
  font-size: 12px;
  color: var(--color-text-subtle);
}

.col-actions {
  text-align: right;
}

/* ---------------- Empty / loading / error states ---------------- */

.empty-state,
.view-loading,
.view-error-state {
  padding: var(--space-7);
  text-align: center;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}

.view-error-state {
  border-style: solid;
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.empty-state .btn,
.view-error-state .btn {
  margin-top: var(--space-3);
}

/* ---------------- Student profile ---------------- */

.profile-header {
  margin-bottom: var(--space-5);
}

.profile-back-link {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  display: inline-block;
  margin-bottom: var(--space-3);
}

.profile-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.profile-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

.profile-preferred-name {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.profile-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.profile-meta-item {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-transform: capitalize;
}

.profile-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-5);
  overflow-x: auto;
}

.profile-tab {
  padding: var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.profile-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

.profile-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.profile-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.profile-section--wide {
  grid-column: 1 / -1;
}

.profile-section h3 {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-3);
}

.profile-fields div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
}

.profile-fields div:last-child {
  border-bottom: none;
}

.profile-fields dt {
  color: var(--color-text-muted);
}

.profile-fields dd {
  margin: 0;
  text-align: right;
  color: var(--color-text);
}

/* ---------------- Focus visibility ---------------- */

.btn:focus-visible,
.students-search:focus-visible,
.students-controls select:focus-visible,
.form-field input:focus-visible,
.form-field select:focus-visible,
.form-field textarea:focus-visible,
.profile-tab:focus-visible,
.student-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ============================================================
   Phase 6 additions — Schedule and Lesson Engine
   ============================================================ */

/* ---------------- Schedule tabs ---------------- */

.schedule-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
  overflow-x: auto;
}

.schedule-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.schedule-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

/* ---------------- Schedule agenda list ---------------- */

.schedule-day-group {
  margin-bottom: var(--space-5);
}

.schedule-day-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.schedule-day-events {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.schedule-event-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: background 0.1s ease;
}

.schedule-event-row:hover {
  background: var(--color-accent-soft);
}

.schedule-event-time {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  min-width: 76px;
  flex-shrink: 0;
}

.schedule-event-main {
  flex: 1;
  min-width: 0;
}

.schedule-event-title {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.schedule-event-meta {
  display: flex;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
  flex-wrap: wrap;
}

.schedule-event-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.payment-indicator {
  font-size: 11px;
  color: var(--color-text-subtle);
  text-transform: capitalize;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 1px 8px;
}

/* ---------------- Event status badges ---------------- */

.badge--event-status-scheduled { background: var(--color-accent-soft); color: var(--color-accent); }
.badge--event-status-rescheduled { background: var(--color-warning-soft); color: var(--color-warning); }
.badge--event-status-completed { background: var(--color-success-soft); color: var(--color-success); }
.badge--event-status-cancelled { background: var(--color-neutral-soft); color: var(--color-text-muted); }
.badge--event-status-no_show { background: var(--color-danger-soft); color: var(--color-danger); }

/* ---------------- Form extras ---------------- */

.form-field--checkbox label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
  font-size: var(--font-size-sm);
}

.form-field--checkbox input[type="checkbox"] {
  width: auto;
}

.form-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* ============================================================
   Phase 7 additions — Lesson Workspace
   ============================================================ */

/* ---------------- Workspace header & actions ---------------- */

.workspace-header {
  margin-bottom: var(--space-4);
}

.workspace-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.badge--notes-status {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  text-transform: capitalize;
}

.workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

/* ---------------- Workspace layout ---------------- */

.workspace-layout {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: var(--space-4);
  align-items: start;
}

.workspace-main,
.workspace-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---------------- Notes editor ---------------- */

.notes-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.notes-status-control {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.notes-status-control label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.notes-status-control select {
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.notes-save-state {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.notes-field {
  margin-bottom: var(--space-4);
}

.notes-field label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 4px;
}

.notes-textarea {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-family: inherit;
  font-size: var(--font-size-base);
  line-height: 1.5;
  resize: vertical;
}

.notes-textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.notes-textarea--private {
  background: var(--color-warning-soft);
  border-color: var(--color-warning);
}

/* ---------------- Message preview ---------------- */

.message-preview-block {
  margin-bottom: var(--space-4);
}

.message-preview-block h3 {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.message-preview-text {
  white-space: pre-wrap;
  font-family: inherit;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

/* ============================================================
   Phase 8 additions — Lesson Notes Delivery Milestone
   ============================================================ */

/* ---------------- Rich notes editor ---------------- */

.rich-editor {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.rich-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: var(--space-2);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.toolbar-btn {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--color-text);
  min-width: 28px;
}

.toolbar-btn:hover {
  background: var(--color-accent-soft);
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  margin: 0 4px;
}

.rich-editor-content {
  min-height: 200px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  line-height: 1.6;
}

.rich-editor-content:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.rich-editor-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: var(--space-2) 0;
}

.rich-editor-content h2 { font-size: var(--font-size-lg); margin: var(--space-3) 0 var(--space-2); }
.rich-editor-content h3 { font-size: var(--font-size-base); font-weight: var(--font-weight-semibold); margin: var(--space-3) 0 var(--space-2); }
.rich-editor-content p { margin: 0 0 var(--space-2); }
.rich-editor-content ul,
.rich-editor-content ol { padding-left: 1.4em; margin: 0 0 var(--space-2); }
.rich-editor-content ul { list-style: disc; }
.rich-editor-content ol { list-style: decimal; }
.rich-editor-content li { margin-bottom: 4px; }

.rich-editor-images {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.image-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.image-thumb {
  width: 96px;
}

.image-thumb img,
.image-thumb-broken {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--color-text-subtle);
  text-align: center;
}

.image-thumb-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
}

.image-thumb-actions .btn {
  padding: 2px 5px;
  font-size: 11px;
}

/* ---------------- Revision indicator ---------------- */

.revision-indicator {
  font-size: 12px;
  color: var(--color-warning);
  background: var(--color-warning-soft);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: var(--space-2);
}

/* ---------------- Message preview additions (Phase 8) ---------------- */

textarea.message-preview-text {
  width: 100%;
  white-space: pre-wrap;
  font-family: inherit;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  resize: vertical;
}

.line-share-block,
.confirm-sent-block {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   Phase 8.5 additions — Lesson Package & PDF Management
   ============================================================ */

.pdf-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* ============================================================
   Phase 8.6 additions — Teacher Workflow / UX refinement
   ============================================================ */

/* ---------------- Editable Lesson Overview ---------------- */

.profile-section--compact {
  padding: var(--space-4);
}

.lesson-overview-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  align-items: end;
}

.overview-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.overview-field label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}

.overview-field input {
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.overview-field--readonly span {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  padding: 6px 0;
}

.overview-field--action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ---------------- Section-heading toolbar buttons ---------------- */

.toolbar-btn--section {
  font-size: 12px;
  padding: 4px 8px;
}

/* ---------------- Legacy import banner ---------------- */

.legacy-import-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  background: var(--color-warning-soft);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-sm);
}

.legacy-import-banner .form-hint {
  margin: 0;
  color: var(--color-text);
}

/* ---------------- Image selection & resize handle ---------------- */

.rich-editor-content img.img-selected {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.img-resize-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-on-accent);
  box-shadow: var(--shadow-sm);
  cursor: nwse-resize;
  z-index: 20;
}

/* ============================================================
   Phase 8.6 addition — independent Document Title field
   ============================================================ */

.notes-title-input {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-family: inherit;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.notes-title-input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ============================================================
   Phase 9 additions — Financial Foundation
   ============================================================ */

.financial-card-value {
  font-size: 28px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.running-total-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.running-total-toggle input[type="checkbox"] {
  width: auto;
}

/* Payment/income status badges — same naming convention as the
   existing student-status badges (badge--status-active, etc.),
   just for a different value set (no overlap). */
.badge--status-paid,
.badge--status-received { background: var(--color-success-soft); color: var(--color-success); }
.badge--status-pending,
.badge--status-expected { background: var(--color-warning-soft); color: var(--color-warning); }
.badge--status-overdue { background: var(--color-danger-soft); color: var(--color-danger); }
.badge--status-partially_paid { background: var(--color-accent-soft); color: var(--color-accent); }
.badge--status-waived,
.badge--status-cancelled,
.badge--status-not_applicable,
.badge--status-refunded { background: var(--color-neutral-soft); color: var(--color-text-muted); }

/* ============================================================
   Phase 10 additions — Historical Financial Operations
   ============================================================ */

.historical-entry-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.historical-entry-row input[type="date"],
.historical-entry-row input[type="number"],
.historical-entry-row input[type="text"] {
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.historical-entry-received {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.historical-entry-received input[type="checkbox"] {
  width: auto;
}

/* ============================================================
   Phase 10 additions — corrections (shared fields, hidden utility)
   ============================================================ */

.hidden {
  display: none !important;
}

.historical-shared-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.historical-shared-grid label,
.modal-body > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}

.historical-shared-grid input,
.historical-shared-grid select,
.modal-body textarea#hist-notes,
.modal-body textarea#edit-notes {
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-weight: var(--font-weight-normal);
  color: var(--color-text);
}

/* ============================================================
   Phase 10 addition — inline multi-date calendar widget
   ============================================================ */

.hist-calendar {
  max-width: 320px;
}

.hist-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.hist-calendar-label {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
}

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

.hist-calendar-dow {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
  padding: 2px 0;
}

.hist-calendar-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.hist-calendar-cell:hover:not(:disabled) {
  border-color: var(--color-accent);
}

.hist-calendar-cell--selected {
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: var(--font-weight-semibold);
}

.hist-calendar-cell--empty {
  cursor: default;
  background: transparent;
}

.hist-calendar-cell:disabled {
  color: var(--color-text-muted);
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   Phase 10 addition — Financial Ledger filtered-totals footer
   ============================================================ */

.ledger-filtered-summary {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  max-width: 360px;
}

.ledger-filtered-summary h3 {
  margin-bottom: var(--space-2);
}

/* ============================================================
   Phase 11 additions — Unified Smart Scheduling Engine
   ============================================================ */

.wizard-type-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  cursor: pointer;
}

.wizard-type-option input[type="radio"] {
  width: auto;
  margin-top: 4px;
}

.wizard-preview-dates {
  list-style: disc;
  padding-left: 1.4em;
  margin: var(--space-2) 0;
  font-size: var(--font-size-sm);
}

/* ============================================================
   Phase 13 addition — compact Dashboard card content
   ============================================================ */

.dashboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dashboard-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
}

.dashboard-list li:last-child {
  border-bottom: none;
}

.dashboard-list-time {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.dashboard-highlight {
  font-size: 1.6rem;
  font-weight: var(--font-weight-semibold);
  margin: 0 0 4px;
}

/* Phase 16C addition — cancelled Akanon assignment rows stay visible but visually de-emphasized */
tr.row--cancelled {
  opacity: 0.55;
}

/* ============================================================
   Dashboard 2.0 Command Center (Final Visual + UX Revision)
   ============================================================ */
/* Semantic accent palette now lives in variables.css (shared
   across Dashboard, Leave, and other pages) — no longer duplicated
   here. */

.dashboard-grid--snapshot {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.card--snapshot {
  position: relative;
  padding: var(--space-4);
  overflow: hidden;
  min-height: 100px;
  background: var(--accent-soft-color);
  border: 1px solid transparent;
}

.card--snapshot::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: var(--accent-color);
  opacity: 0.10;
  border-radius: 50%;
  transform: translate(30%, -30%);
}

.snapshot-icon {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 7px;
  box-sizing: border-box;
  color: #fff;
  background: var(--accent-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}
.snapshot-icon svg { width: 100%; height: 100%; }

.snapshot-value {
  position: relative;
  font-family: var(--font-family-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--accent-color);
}

.snapshot-label {
  position: relative;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  opacity: 0.75;
  margin-top: 3px;
}

.card--accent-blue   { --accent-color: var(--accent-blue);   --accent-soft-color: var(--accent-blue-soft); }
.card--accent-green  { --accent-color: var(--accent-green);  --accent-soft-color: var(--accent-green-soft); }
.card--accent-purple { --accent-color: var(--accent-purple); --accent-soft-color: var(--accent-purple-soft); }
.card--accent-amber  { --accent-color: var(--accent-amber);  --accent-soft-color: var(--accent-amber-soft); }
.card--accent-red    { --accent-color: var(--accent-red);    --accent-soft-color: var(--accent-red-soft); }
.card--accent-orange { --accent-color: var(--accent-orange); --accent-soft-color: var(--accent-orange-soft); }
.card--accent-teal   { --accent-color: var(--accent-teal);   --accent-soft-color: var(--accent-teal-soft); }

/* Quick Actions — moved directly under summary cards */
.dashboard-panel--quick-actions {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: var(--space-4);
}
.dashboard-panel--quick-actions .dashboard-panel-title { margin-bottom: var(--space-2); }

.dashboard-quick-actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-3);
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2);
  border-radius: var(--radius-md);
  border: none;
  background: var(--btn-soft-color);
  color: var(--btn-color);
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.quick-action-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.quick-action-btn svg {
  width: 24px; height: 24px; padding: 5px; box-sizing: border-box;
  color: #fff; background: var(--btn-color); border-radius: var(--radius-sm);
}
.quick-action-btn span { font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); }

.quick-action-btn--blue   { --btn-color: var(--accent-blue);   --btn-soft-color: var(--accent-blue-soft); }
.quick-action-btn--green  { --btn-color: var(--accent-green);  --btn-soft-color: var(--accent-green-soft); }
.quick-action-btn--amber  { --btn-color: var(--accent-amber);  --btn-soft-color: var(--accent-amber-soft); }
.quick-action-btn--red    { --btn-color: var(--accent-red);    --btn-soft-color: var(--accent-red-soft); }
.quick-action-btn--orange { --btn-color: var(--accent-orange); --btn-soft-color: var(--accent-orange-soft); }
.quick-action-btn--teal   { --btn-color: var(--accent-teal);   --btn-soft-color: var(--accent-teal-soft); }

/* Main two-column layout */
.dashboard-main-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
  align-items: start;
  margin-bottom: var(--space-4);
}

.dashboard-side-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.dashboard-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.dashboard-panel-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  color: var(--color-text-subtle);
  margin: 0 0 var(--space-3);
}

/* Compact empty states — no reserved height */
.empty-state--compact {
  padding: var(--space-3) 0;
  text-align: left;
}
.empty-state--compact p { margin: 0; color: var(--color-text-muted); font-size: var(--font-size-sm); }

/* Today's Schedule — timeline rows, not a table */
.schedule-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.timeline-row {
  display: grid;
  grid-template-columns: 60px 40px 1fr auto auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--tl-color, var(--color-border));
  background: var(--color-bg);
}

.timeline-row--upcoming    { --tl-color: var(--accent-blue); }
.timeline-row--completed   { --tl-color: var(--accent-green); }
.timeline-row--missed      { --tl-color: var(--accent-red); }
.timeline-row--needs-notes { --tl-color: var(--accent-amber); }

.timeline-time {
  font-family: var(--font-family-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-base);
}

.timeline-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: #fff;
  flex-shrink: 0;
}
.timeline-avatar--blue { background: var(--accent-blue); }
.timeline-avatar--teal { background: var(--accent-teal); }

.timeline-main { min-width: 0; }
.timeline-student { font-weight: var(--font-weight-semibold); font-size: var(--font-size-sm); }
.timeline-type-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  padding: 1px 7px;
  border-radius: 999px;
  margin-top: 2px;
}
.timeline-type-chip--blue { background: var(--accent-blue-soft); color: var(--accent-blue); }
.timeline-type-chip--teal { background: var(--accent-teal-soft); color: var(--accent-teal); }

.timeline-actions { display: flex; gap: var(--space-1); }

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill--upcoming    { background: var(--accent-blue-soft);  color: var(--accent-blue); }
.status-pill--completed   { background: var(--accent-green-soft); color: var(--accent-green); }
.status-pill--missed      { background: var(--accent-red-soft);   color: var(--accent-red); }
.status-pill--needs-notes { background: var(--accent-amber-soft); color: var(--accent-amber); }

/* Action Center cards — colored per category */
.action-item-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  background: var(--ac-soft-color);
  color: var(--ac-color);
  transition: transform 0.1s ease;
}
.action-item-card:last-child { margin-bottom: 0; }
.action-item-card:hover { transform: translateX(2px); }
.action-item-card svg {
  width: 20px; height: 20px; padding: 4px; box-sizing: border-box;
  color: #fff; background: var(--ac-color); border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.action-item-card span { font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); }

.action-item-card--amber  { --ac-color: var(--accent-amber);  --ac-soft-color: var(--accent-amber-soft); }
.action-item-card--red    { --ac-color: var(--accent-red);    --ac-soft-color: var(--accent-red-soft); }
.action-item-card--green  { --ac-color: var(--accent-green);  --ac-soft-color: var(--accent-green-soft); }
.action-item-card--teal   { --ac-color: var(--accent-teal);   --ac-soft-color: var(--accent-teal-soft); }
.action-item-card--orange { --ac-color: var(--accent-orange); --ac-soft-color: var(--accent-orange-soft); }

/* ============================================================
   Leave — range preview
   ============================================================ */
.leave-preview {
  background: var(--accent-orange-soft);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-top: var(--space-3);
}
.leave-preview-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  color: var(--accent-orange);
  margin: 0 0 var(--space-2);
}
.leave-preview-days {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--accent-orange);
  margin: 2px 0;
}

/* ============================================================
   Memo Center — 3-pane app
   ============================================================ */
.memo-shell {
  display: grid;
  grid-template-columns: 200px 320px 1fr;
  gap: var(--space-3);
  height: calc(100vh - var(--header-height) - var(--space-5) * 2);
  min-height: 500px;
}

.memo-sidebar {
  background: var(--surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow-y: auto;
}

.memo-new-btn { width: 100%; }
.memo-search input { width: 100%; }

.memo-folder-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.memo-folder-item {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
}
.memo-folder-item:hover { background: var(--color-neutral-soft); }
.memo-folder-item.active {
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
  font-weight: var(--font-weight-semibold);
}

.memo-list-pane {
  background: var(--surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-y: auto;
  padding: var(--space-2);
}

.memo-list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  margin-bottom: 2px;
}
.memo-list-item:hover { background: var(--surface-interactive); }
.memo-list-item.active { background: var(--surface-selected); }

.memo-list-item-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}
.memo-list-item-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}
.memo-list-item-time {
  font-size: 10px;
  color: var(--color-text-subtle);
  white-space: nowrap;
}
.memo-list-item-preview {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin: 3px 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.memo-category-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
}

.memo-editor-pane {
  background: var(--surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.memo-editor-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-subtle);
  font-size: var(--font-size-sm);
}

.memo-editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.memo-editor-title {
  border: none;
  background: transparent;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  padding: 0;
  margin-bottom: var(--space-3);
}
.memo-editor-title:focus { outline: none; }

.memo-editor-body {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  padding: 0;
}
.memo-editor-body:focus { outline: none; }

.memo-editor-footer {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-3);
}

/* Akanon Forms — missing-info warning badge */
.badge--status-warning {
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
}

/* ============================================================
   Leave — balance cards with real accent treatment (was previously
   generic .card with unused accent variables — see audit finding)
   ============================================================ */
.card--leave-balance {
  background: var(--accent-orange-soft);
  border: none;
  position: relative;
  overflow: hidden;
  gap: var(--space-2);
}

.card--leave-balance::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: var(--accent-orange);
  opacity: 0.10;
  border-radius: 50%;
  transform: translate(30%, -30%);
}

.leave-balance-icon {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 7px;
  box-sizing: border-box;
  color: #fff;
  background: var(--accent-orange);
  border-radius: var(--radius-md);
}
.leave-balance-icon svg { width: 100%; height: 100%; }

.leave-balance-header {
  position: relative;
  display: flex;
  flex-direction: column;
}
.leave-balance-header .card-title { color: var(--accent-orange); }

.leave-balance-remaining {
  position: relative;
  font-family: var(--font-family-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--accent-orange);
  margin: 0;
}
.leave-balance-unit {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  opacity: 0.7;
}

.leave-balance-breakdown {
  position: relative;
  display: flex;
  gap: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  opacity: 0.85;
}
.leave-balance-breakdown strong { font-weight: var(--font-weight-semibold); }

.card--leave-balance .btn--ghost {
  align-self: flex-start;
  position: relative;
  border-color: rgba(179, 89, 26, 0.3);
  color: var(--accent-orange);
}
.card--leave-balance .btn--ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.5);
}

/* Akanon Monthly Submission Checklist */
.checklist-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-neutral-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: var(--space-2) 0 var(--space-4);
}
.checklist-progress-fill {
  height: 100%;
  background: var(--accent-teal);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.checklist-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ============================================================
   Appearance Engine (Settings → Appearance)
   ============================================================
   --user-accent/--user-accent-soft are set live via JS
   (utils/appearance.js) on document.documentElement. Applied to
   the GLOBAL brand accent only (primary buttons, active nav, page
   title) — the per-page SEMANTIC colors (Leave=orange, Akanon=teal,
   Dashboard's per-card-type colors, Memo=amber) are intentionally
   left untouched, since those communicate meaning per the earlier
   visual-identity work and shouldn't shift with a brand-color
   preference.
   ============================================================ */

.btn--primary {
  background: var(--user-accent, var(--color-accent));
}
.btn--primary:hover:not(:disabled) {
  background: var(--user-accent-hover, var(--color-accent-hover));
}

.nav-item.active {
  background: linear-gradient(90deg, var(--user-accent-soft, rgba(29,90,153,0.28)), transparent);
  border-left-color: var(--user-accent, var(--accent-blue));
}

.quick-action-btn:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--user-accent, var(--color-accent));
  outline-offset: 1px;
}

/* ---------------- Theme mode ---------------- */

html[data-theme="dark"] {
  --surface-base: #17181a;
  --surface-raised: #1e2023;
  --surface-card: #23262a;
  --surface-interactive: #2a2d31;
  --surface-selected: #2f3338;
  --color-bg: #17181a;
  --color-surface: #23262a;
  --color-text: #eceae6;
  --color-text-muted: #a6a49d;
  --color-text-subtle: #7c7a74;
  --color-border: #34373b;
  --color-border-strong: #45484d;
  --color-neutral-soft: #2a2d31;
}

html[data-theme="dark"] .app-header {
  background: var(--surface-raised);
  border-bottom-color: var(--color-border);
}

html[data-theme="dark"] .data-table,
html[data-theme="dark"] .dashboard-panel,
html[data-theme="dark"] .modal-dialog {
  background: var(--surface-card);
  border-color: var(--color-border);
}

/* ---------------- Sidebar style ---------------- */

html[data-sidebar-style="gradient"] .sidebar {
  background: linear-gradient(160deg, var(--color-sidebar-bg) 0%, var(--user-accent, var(--accent-teal)) 220%);
}

html[data-sidebar-style="glass"] .sidebar {
  background: rgba(18, 20, 18, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ---------------- Card style ---------------- */

html[data-card-style="flat"] .card {
  box-shadow: none;
  border-width: 1px;
}
html[data-card-style="flat"] .card:hover {
  box-shadow: none;
  transform: none;
}

html[data-card-style="glass"] .card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255, 255, 255, 0.4);
}
html[data-theme="dark"][data-card-style="glass"] .card {
  background: rgba(35, 38, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
}

/* ---------------- Density ---------------- */

html[data-density="compact"] {
  --space-3: 8px;
  --space-4: 12px;
  --space-5: 16px;
}
html[data-density="spacious"] {
  --space-3: 16px;
  --space-4: 22px;
  --space-5: 32px;
}

/* ---------------- Border radius ---------------- */

html[data-radius="sharp"] {
  --radius-sm: 2px;
  --radius-md: 2px;
  --radius-lg: 2px;
}
html[data-radius="rounded"] {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* ============================================================
   Leave — dedicated redesign pass. Every new rule below is scoped
   with a .leave-* class or [data-status="leave-*"] modifier — none
   of it touches .modal-dialog--form, .data-table, .card, or any
   other shared base class used by other pages.
   ============================================================ */

.leave-page-header { align-items: flex-start; }
.leave-header-actions { display: flex; gap: var(--space-2); }
.leave-header-actions .btn--primary svg { width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; }

/* ---------------- Balance cards ---------------- */

.card--leave-balance {
  position: relative;
}

.leave-card-edit-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 26px;
  height: 26px;
  padding: 5px;
  box-sizing: border-box;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
  color: var(--accent-orange);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background-color 0.12s ease;
}
.leave-card-edit-btn svg { width: 100%; height: 100%; }
.card--leave-balance:hover .leave-card-edit-btn { opacity: 1; }
.leave-card-edit-btn:hover { background: rgba(255, 255, 255, 0.85); }

.leave-balance-remaining {
  font-size: 34px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.leave-balance-unit {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.leave-balance-progress-track {
  position: relative;
  width: 100%;
  height: 5px;
  background: rgba(179, 89, 26, 0.15);
  border-radius: 999px;
  overflow: hidden;
  margin: 2px 0 var(--space-1);
}
.leave-balance-progress-fill {
  height: 100%;
  background: var(--accent-orange);
  border-radius: 999px;
}

.leave-adjustment-tag {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  margin-left: 4px;
}

/* ---------------- Modals: sectioned, less "CRUD form" ---------------- */

.leave-modal .modal-body {
  padding-top: var(--space-2);
}

.leave-modal-section {
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.leave-modal-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.leave-modal-section--quiet {
  opacity: 0.92;
}

.leave-modal-section-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  color: var(--accent-orange);
  margin: 0 0 var(--space-3);
}

.leave-modal .btn--primary {
  background: var(--accent-orange);
}
.leave-modal .btn--primary:hover:not(:disabled) {
  background: #8f4512;
}

/* ---------------- Leave preview panel ---------------- */

.leave-preview {
  background: var(--accent-orange-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-2);
}
.leave-preview--loading { display: flex; align-items: center; justify-content: center; min-height: 60px; }

.leave-preview-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  color: var(--accent-orange);
  margin: 0 0 var(--space-2);
}

.leave-preview-range {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  margin: 0;
}
.leave-preview-arrow { opacity: 0.5; margin: 0 4px; }

.leave-preview-days {
  font-family: var(--font-family-mono);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: var(--font-weight-bold);
  color: var(--accent-orange);
  margin: 4px 0 var(--space-3);
}
.leave-preview-days span {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  opacity: 0.75;
  margin-left: 4px;
}

.leave-preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(179, 89, 26, 0.2);
}
.leave-preview-stats > div { display: flex; flex-direction: column; }
.leave-preview-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text);
  opacity: 0.6;
  margin-bottom: 2px;
}
.leave-preview-stat-value {
  font-family: var(--font-family-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}
.leave-preview-stat-value--deduction { color: var(--accent-red); }
.leave-preview-stat-value--after { color: var(--accent-green); }

/* ---------------- History table + status pills ---------------- */

.leave-history-panel { padding-top: var(--space-2); }
.leave-history-table td, .leave-history-table th { vertical-align: middle; }

.status-pill--leave-approved  { background: var(--accent-green-soft); color: var(--accent-green); }
.status-pill--leave-pending   { background: var(--accent-amber-soft); color: var(--accent-amber); }
.status-pill--leave-cancelled { background: var(--accent-red-soft);   color: var(--accent-red); }

/* ============================================================
   Leave Polish — additive refinements only (Final Completion Sprint)
   ============================================================ */

/* Balance cards: stronger typography/spacing, clearer hierarchy */
.card--leave-balance {
  padding: var(--space-5);
}
.leave-balance-header .card-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.005em;
}
.leave-balance-remaining {
  margin-top: 2px;
  margin-bottom: 4px;
}
.leave-balance-breakdown {
  padding-top: var(--space-2);
  border-top: 1px solid rgba(179, 89, 26, 0.15);
  margin-top: var(--space-1);
}

/* History: row spacing + readability */
.leave-history-table th,
.leave-history-table td {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}
.leave-history-table tbody tr:hover {
  background: var(--accent-orange-soft);
}

/* Modals: clearer section grouping already established — tighten
   label prominence and inter-field spacing a touch further. */
.leave-modal label {
  margin-bottom: var(--space-3);
}
.leave-modal-section-label {
  padding-bottom: var(--space-1);
  border-bottom: 2px solid var(--accent-orange);
  display: inline-block;
}

/* ============================================================
   Akanon Monthly Summary Polish
   ============================================================ */
.akanon-summary-section-label { margin-top: var(--space-5); }
.akanon-summary-section-label:first-child { margin-top: 0; }
.akanon-summary-totals { margin-bottom: var(--space-2); }
.akanon-summary-date { font-family: var(--font-family-mono); font-variant-numeric: tabular-nums; }
.akanon-summary-table th, .akanon-summary-table td { padding-top: var(--space-2); padding-bottom: var(--space-2); }

.status-pill--akanon-main      { background: var(--accent-teal-soft); color: var(--accent-teal); }
.status-pill--akanon-assistant { background: var(--accent-blue-soft); color: var(--accent-blue); }
.status-pill--akanon-other     { background: var(--color-neutral-soft); color: var(--color-text-muted); }

/* ============================================================
   Memo Center Polish — layout consistency, spacing, typography
   ============================================================ */
.memo-shell { gap: var(--space-4); }
.memo-sidebar { gap: var(--space-4); padding: var(--space-4); }
.memo-folder-item { font-size: var(--font-size-sm); padding: 7px var(--space-3); }
.memo-list-item { padding: var(--space-4); }
.memo-list-item-title { font-size: var(--font-size-base); }
.memo-editor-pane { padding: var(--space-6); }
.memo-editor-title { line-height: 1.3; }
.memo-editor-body { line-height: 1.7; }

/* Akanon Checklist — per-item evidence attachment */
.checklist-list--with-evidence li.checklist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-2) 0;
}
.checklist-evidence-slot {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.checklist-evidence-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  padding: 3px 10px;
  border-radius: 999px;
  border: none;
  background: var(--accent-teal-soft);
  color: var(--accent-teal);
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Settings — Work Schedule day toggles */
.work-schedule-day-toggles {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.work-schedule-day-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-sm);
  user-select: none;
}
.work-schedule-day-toggle:has(input:checked) {
  background: var(--user-accent-soft, var(--color-accent-soft));
  border-color: var(--user-accent, var(--color-accent));
}
