/* ==========================================================================
   Shared app shell design system — White & Teal.
   Built for the Teacher Dashboard redesign; written to be reused by the
   Caller and Admin areas later without change (only --role-accent differs
   per area, set by a body class).
   ========================================================================== */

:root {
  /* Brand teal family, drawn from the school logo. */
  --brand-teal: #0d9488;
  --brand-teal-dark: #0f6f63;
  --brand-teal-light: #ccfbf1;
  --brand-aqua: #0891b2;      /* Teacher role accent */
  --brand-green: #059669;     /* Caller role accent */
  --brand-logo-dark: #0b3d33; /* The logo's own dark green — never used as a page background */

  /* Role accent — overridden per area via a body class. */
  --role-accent: var(--brand-aqua);
  --role-accent-light: #cffafe;

  /* Neutrals. */
  --bg-page: #f7f5f1;         /* light warm gray */
  --bg-card: #ffffff;
  --text-primary: #1f2a28;
  --text-secondary: #5f6b68;
  --text-muted: #8b948f;
  --border-subtle: #e8e4dc;

  /* Status tints — full-row backgrounds, not just badges. */
  --status-waiting-bg: #fdf6e3;
  --status-waiting-border: #f0dfa8;
  --status-waiting-text: #8a6d1d;
  --status-called-bg: #dbeafe;
  --status-called-border: #93c5fd;
  --status-called-text: #1d4ed8;
  --status-sent-bg: #eafaf1;
  --status-sent-border: #b9e8cd;
  --status-sent-text: #157a4a;

  /* Shape / elevation. */
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-soft: 0 1px 2px rgba(20, 30, 28, 0.04), 0 2px 8px rgba(20, 30, 28, 0.05);
  --shadow-soft-lg: 0 2px 4px rgba(20, 30, 28, 0.04), 0 8px 24px rgba(20, 30, 28, 0.06);

  --font-sans: "Segoe UI", "Segoe UI Variable", Tahoma, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

  --sidebar-width: 248px;
  --header-height: 60px;
}

body.app-body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Per-role accent — same shell, different subtle brand color. */
body.role-admin { --role-accent: var(--brand-teal); --role-accent-light: var(--brand-teal-light); }
body.role-teacher { --role-accent: var(--brand-aqua); --role-accent-light: #cffafe; }
body.role-caller { --role-accent: var(--brand-green); --role-accent-light: #d1fae5; }

.app-body [dir="rtl"],
.app-body .rtl-text {
  font-family: var(--font-sans);
}

/* ---- Shell layout ---- */

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

.app-sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 4px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 4px 18px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
  width: 100%;
  max-width: 208px;
  height: auto;
  display: block;
  object-fit: contain;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 0 auto;
  padding-top: 8px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-nav-link svg {
  flex-shrink: 0;
}

.sidebar-nav-link:hover {
  background: var(--bg-page);
  color: var(--text-primary);
}

.sidebar-nav-link.active {
  background: var(--role-accent-light);
  color: var(--role-accent);
  font-weight: 600;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--role-accent-light);
  color: var(--role-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  min-width: 0;
  line-height: 1.25;
}

.sidebar-user-name {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.74rem;
  color: var(--role-accent);
  font-weight: 600;
}

.sidebar-logout-form {
  padding: 4px 8px 0;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  min-height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-logout-btn:hover {
  background: #fdecec;
  border-color: #f3c8c8;
  color: #b3261e;
}

/* ---- Main column ---- */

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

.app-header {
  height: var(--header-height);
  flex: 0 0 var(--header-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 20;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--bg-page);
}

.app-page-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.app-content {
  flex: 1 1 auto;
  padding: 20px 24px 40px;
  width: 100%;
  max-width: 1400px;
}

/* ---- Footer: sits after the page content, never over it — .app-content's
   own flex-grow already pushes this to the bottom of the viewport on a short
   page, and it simply follows the content in normal flow on a long one. ---- */

.app-footer {
  flex: 0 0 auto;
  padding: 14px 24px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-page);
  border-top: 1px solid var(--brand-teal);
}

.app-footer strong {
  color: var(--text-secondary);
  font-weight: 700;
}

.sidebar-backdrop {
  display: none;
}

/* ---- Responsive: sidebar becomes off-canvas below desktop width ---- */

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-soft-lg);
  }

  [dir="rtl"] .app-sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
  }

  .app-shell.sidebar-open .app-sidebar {
    transform: none;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .app-shell.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 21, 0.4);
    z-index: 1040;
  }

  .app-content {
    padding: 16px 16px 32px;
  }

  .app-header {
    padding: 0 14px;
  }
}

@media (min-width: 992px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
  }
}

/* ---- Cards ---- */

.panel-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
  padding: 18px 20px;
}

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

.btn-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
  text-decoration: none; /* some pages apply .btn-app to an <a>, not just <button> */
}

.btn-app:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-app-primary {
  background: var(--role-accent);
  border-color: var(--role-accent);
  color: #ffffff;
  min-height: 44px;
  padding: 10px 18px;
  font-size: 0.95rem;
}

.btn-app-primary:hover:not(:disabled) {
  filter: brightness(0.94);
}

.btn-app-success {
  background: #0f9d58;
  border-color: #0f9d58;
  color: #ffffff;
  min-height: 46px;
  padding: 10px 20px;
  font-size: 0.98rem;
}

.btn-app-success:hover:not(:disabled) {
  filter: brightness(0.95);
}

.btn-app-secondary {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.86rem;
}

.btn-app-secondary:hover:not(:disabled) {
  background: var(--bg-page);
  color: var(--text-primary);
}

.btn-app-icon {
  min-width: 40px;
  min-height: 40px;
  padding: 8px;
}

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

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: block;
}

.app-select,
.app-input {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text-primary);
  min-height: 40px;
  width: 100%;
}

.app-select:focus,
.app-input:focus {
  outline: none;
  border-color: var(--role-accent);
  box-shadow: 0 0 0 3px var(--role-accent-light);
}

.app-select:disabled {
  background: var(--bg-page);
  color: var(--text-muted);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--role-accent-light);
  color: var(--brand-teal-dark);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.6);
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.chip-remove:hover {
  background: rgba(255, 255, 255, 0.95);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.status-pill-waiting {
  background: #fbeec4;
  color: var(--status-waiting-text);
}

.status-pill-called {
  background: #bfdbfe;
  color: var(--status-called-text);
}

.status-pill-sent {
  background: #c7f0d8;
  color: var(--status-sent-text);
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.conn-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.conn-live { background: var(--status-sent-bg); color: var(--status-sent-text); }
.conn-warn { background: var(--status-waiting-bg); color: var(--status-waiting-text); }
.conn-down { background: #fbe2e2; color: #b3261e; }

.warning-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--status-waiting-bg);
  border: 1px solid var(--status-waiting-border);
  color: var(--status-waiting-text);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 500;
}

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

.app-table-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.app-table thead th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.app-table tbody td {
  padding: 10px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
}

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

.app-table tbody tr.row-waiting { background: var(--status-waiting-bg); }
.app-table tbody tr.row-called { background: var(--status-called-bg); }
.app-table tbody tr.row-sent { background: var(--status-sent-bg); }
.app-table tbody tr.row-error { background: #fbe2e2; }
.app-table tbody tr.row-skip { background: #ece9e2; opacity: 0.75; }

.app-table tbody tr.row-called td { border-bottom-color: var(--status-called-border); }
.app-table tbody tr.row-waiting td { border-bottom-color: var(--status-waiting-border); }
.app-table tbody tr.row-sent td { border-bottom-color: var(--status-sent-border); }

.student-name-en {
  font-weight: 600;
  color: var(--text-primary);
}

.student-name-ar {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 1px;
}

.table-empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 767.98px) {
  .app-table { font-size: 0.83rem; }
  .app-table thead th,
  .app-table tbody td { padding: 8px 10px; }
}

/* ---- Caller: prominent search ---- */

.search-hero {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-hero svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-hero-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  min-height: 32px;
}

.search-hero-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

@media (max-width: 575.98px) {
  .search-hero { padding: 14px 16px; }
  .search-hero-input { font-size: 1rem; }
}

/* ---- Caller: voice search (progressive enhancement — see Index.cshtml) ---- */

.voice-search-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-page);
  color: var(--role-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.voice-search-btn:hover { background: var(--role-accent-light); }

.voice-search-btn.voice-listening {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: #ffffff;
  animation: voice-search-pulse 1.4s ease-in-out infinite;
}

@keyframes voice-search-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.35); }
  50% { box-shadow: 0 0 0 9px rgba(5, 150, 105, 0); }
}

.voice-lang-btn {
  flex-shrink: 0;
  min-width: 42px;
  height: 44px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-page);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.voice-lang-btn:hover { background: var(--role-accent-light); color: var(--role-accent); }

/* ---- Caller: family selection bar ---- */

.family-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--role-accent-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  flex-wrap: wrap;
}

.family-bar-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.family-bar-select input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--role-accent);
  cursor: pointer;
}

/* ---- Caller: result cards ---- */

.student-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.student-card.card-called { background: var(--status-called-bg); border-color: var(--status-called-border); }
.student-card.card-sent { background: var(--status-sent-bg); border-color: var(--status-sent-border); }

.student-card-check {
  flex-shrink: 0;
  width: 22px;
  display: flex;
  justify-content: center;
}

.student-card-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--role-accent);
  cursor: pointer;
}

.student-card-info {
  flex: 1 1 auto;
  min-width: 0;
}

.student-card-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.student-card-meta {
  margin-top: 3px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.student-card-meta .meta-sep {
  color: var(--border-subtle);
}

.chip-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--role-accent-light);
  color: var(--brand-teal-dark);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 700;
}

.chip-sm.chip-fuzzy {
  background: #fde9c8;
  color: #8a5a1d;
}

.student-card-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 575.98px) {
  .student-card { flex-wrap: wrap; padding: 12px; }
  .student-card-actions { width: 100%; justify-content: flex-end; }
}

.empty-state-block {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px;
}

/* ---- Caller: inline family cluster (name/code search that hits a student
   with linked siblings — see Index.cshtml) ---- */

.family-cluster {
  border: 1px solid var(--role-accent);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.family-cluster-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--role-accent-light);
  padding: 10px 14px;
  flex-wrap: wrap;
}

.family-cluster-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--brand-teal-dark);
}

.family-cluster-list {
  padding: 10px;
}

.family-cluster-list .student-card {
  box-shadow: none;
  border-color: var(--border-subtle);
}

.family-cluster-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 10px 10px;
}

/* ---- Caller: QR scan overlay (progressive enhancement — see Index.cshtml) ---- */

.qr-scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080;
  background: rgba(15, 23, 21, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.qr-scan-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.qr-scan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--role-accent-light);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--brand-teal-dark);
}

.qr-scan-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--brand-teal-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.qr-scan-close:hover { background: rgba(15, 23, 21, 0.08); }

.qr-scan-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  overflow: hidden;
}

.qr-scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qr-scan-frame {
  position: absolute;
  inset: 12%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-md);
  pointer-events: none;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25);
}

.qr-scan-hint {
  margin: 0;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---- Admin: panel title, banners, state badges, tabs, danger button ---- */

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.88rem;
  border: 1px solid transparent;
}

.banner ul { margin: 0; padding-left: 1.1em; }

.banner-success { background: var(--status-sent-bg); border-color: var(--status-sent-border); color: var(--status-sent-text); }
.banner-danger { background: #fbe2e2; border-color: #f3c8c8; color: #b3261e; }
.banner-warning { background: var(--status-waiting-bg); border-color: var(--status-waiting-border); color: var(--status-waiting-text); }
.banner-info { background: var(--role-accent-light); border-color: var(--border-subtle); color: var(--text-primary); }

.state-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.state-badge-active { background: #c7f0d8; color: var(--status-sent-text); }
.state-badge-inactive { background: #ece9e2; color: var(--text-secondary); }
.state-badge-pending { background: #fbeec4; color: var(--status-waiting-text); }
.state-badge-neutral { background: #ece9e2; color: var(--text-secondary); }

.btn-app-danger {
  background: var(--bg-card);
  border-color: #f3c8c8;
  color: #b3261e;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.86rem;
}

.btn-app-danger:hover:not(:disabled) {
  background: #fdecec;
  border-color: #eeb3b3;
}

.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}

.tab-link {
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-link:hover { color: var(--text-primary); }

.tab-link.active {
  color: var(--role-accent);
  border-bottom-color: var(--role-accent);
}

.dashboard-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 20px;
  text-decoration: none;
  color: var(--text-primary);
  height: 100%;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.dashboard-tile:hover {
  box-shadow: var(--shadow-soft-lg);
  transform: translateY(-1px);
  color: var(--text-primary);
}

.dashboard-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--role-accent-light);
  color: var(--role-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dashboard-tile h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.dashboard-tile p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.crumb-nav {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.crumb-nav a {
  color: var(--role-accent);
  text-decoration: none;
  font-weight: 600;
}

.crumb-nav a:hover { text-decoration: underline; }

.crumb-sep { color: var(--border-subtle); }

.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.page-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

.page-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 575.98px) {
  .page-header h2 { font-size: 1.1rem; }
}

/* ---- Shared authentication pages (Login, Change Password, Access Denied,
   Logout — role-agnostic, so no body.role-* class sets --role-accent yet).
   Teal explicitly, not the default aqua --role-accent resolves to pre-login,
   so .btn-app-primary/.app-input focus rings read as the school's teal
   branding here rather than Teacher's aqua. ---- */

body.role-auth { --role-accent: var(--brand-teal); --role-accent-light: var(--brand-teal-light); }

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  font-family: var(--font-sans);
  color: var(--text-primary);
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 32px 28px;
}

.auth-logo {
  display: block;
  max-width: 170px;
  height: auto;
  margin: 0 auto 18px;
}

.auth-title {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 2px;
}

.auth-subtitle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 22px;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field-error {
  display: block;
  font-size: 0.78rem;
  color: #b3261e;
  margin-top: 4px;
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap .app-input {
  padding-right: 42px;
}

.auth-password-toggle {
  position: absolute;
  right: 3px;
  top: 3px;
  bottom: 3px;
  width: 36px;
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.auth-password-toggle:hover { background: var(--bg-page); color: var(--text-secondary); }

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  cursor: pointer;
}

.auth-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-teal);
  cursor: pointer;
  flex-shrink: 0;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  min-height: 46px;
  font-size: 1rem;
}

.auth-banner {
  margin-bottom: 16px;
}

.auth-banner a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  margin-left: 4px;
}

.auth-footer-note {
  text-align: center;
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-footer-note a {
  color: var(--brand-teal);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer-note a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .auth-page { padding: 16px 12px; }
  .auth-card { padding: 24px 18px; }
}
