/* ═══════════════════════════════════════════
   EXAM TRACKER — style.css
   Design: warm dark, DM type family, orange accent
═══════════════════════════════════════════ */

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

/* ── TOKENS ── */
:root {
  /* Dark mode — warm charcoal, not cold blue */
  --bg:       #131416;
  --bg2:      #1a1c1f;
  --surface:  #212428;
  --surface2: #2a2d33;
  --border:   #33373f;
  --border2:  #2d3038;
  --text:     #f0ede8;
  --text2:    #a09890;
  --muted:    #5a5650;
  --accent:        #f97316;
  --accent-h:      #fb923c;
  --accent-bg:     #1f1208;
  --accent-soft:   #7c2d12;
  --open:        #34d399;
  --open-bg:     #061f18;
  --open-border: rgba(52,211,153,.2);
  --upcoming:        #fbbf24;
  --closed:        #f87171;
  --closed-bg:     #250f0f;
  --closed-border: rgba(248,113,113,.2);
  --yes:      #34d399;
  --yes-check: #061f18;
  --no:       #f87171;
  --no-border: #7f1d1d;
  --no-hover:  #3d0a0a;
  --no-bg:    #2d0808;
  --r: 6px;
  --r-lg: 12px;
  --r-xl: 16px;
  --font: 'DM Sans', sans-serif;
  --mono: 'Inter', sans-serif;
  --serif: 'DM Serif Display', serif;
  --shadow: 0 4px 24px rgba(0,0,0,.6);
  --shadow-lg: 0 8px 48px rgba(0,0,0,.8);
  --topbar-h: 50px;
  --countdown-h: 84px;
  --filter-bar-h: 47px;
  --transition: .18s ease;
  /* Row distinction */
  --row-alt: #181a1d;
  --row-base: #131416;
  /* Urgency warn (deadline ≤7 days) */
  --warn: #ef4444;
  /* Vacancies chip */
  --chip-vac-bg:     rgba(59,130,246,.08);
  --chip-vac-border: rgba(59,130,246,.22);
  --chip-vac-label:  #6baed6;
  --chip-vac-val:    #93c5fd;
  /* Pay chip */
  --chip-pay: #4ade80;
}

[data-theme="light"] {
  /* Light mode — warm white, soft warm greys, not cold blue */
  --bg:       #faf9f7;
  --bg2:      #f2f0ec;
  --surface:  #ffffff;
  --surface2: #f7f6f3;
  --border:   #e0dbd4;
  --border2:  #e8e3dc;
  --text:     #1a1714;
  --text2:    #5c5549;
  --muted:    #9c9288;
  --accent:        #ea6c0a;
  --accent-h:      #f97316;
  --accent-bg:     #fff5ee;
  --accent-soft:   #fcd5b0;
  --open:        #0a7a46;
  --open-bg:     #edfff5;
  --open-border: #86efbd;
  --upcoming:        #92400e;
  --closed:        #c8191f;
  --closed-bg:     #fff2f2;
  --closed-border: #fbb0b0;
  --yes:      #0a7a46;
  --yes-check: #ffffff;
  --no:       #c8191f;
  --no-border: #fbb0b0;
  --no-hover:  #fee2e2;
  --no-bg:    #fff2f2;
  --shadow: 0 2px 16px rgba(26,23,20,.07);
  --shadow-lg: 0 6px 40px rgba(26,23,20,.12);
  /* Row distinction */
  --row-alt: #f7f5f2;
  --row-base: #ffffff;
  /* Urgency warn (deadline ≤7 days) */
  --warn: #dc2626;
  /* Vacancies chip */
  --chip-vac-bg:     rgba(59,130,246,.07);
  --chip-vac-border: rgba(59,130,246,.25);
  --chip-vac-label:  #2563eb;
  --chip-vac-val:    #1d4ed8;
  /* Pay chip */
  --chip-pay: #15803d;
}


/* ── BASE ── */
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

button { font-family: var(--font); cursor: pointer; }
input, textarea, select { font-family: var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }

/* ════════════════════════════════════════
   AUTH SCREEN
════════════════════════════════════════ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border2) 1px, transparent 1px),
    linear-gradient(90deg, var(--border2) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: .4;
  pointer-events: none;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
  animation: slideUp .4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Auth screen fading out before display:none */
.auth-screen.is-fading-out {
  animation: fadeOut .25s ease forwards;
  pointer-events: none;
}

/* App fading in on first show */
#app.is-fading-in {
  animation: fadeIn .3s ease forwards;
}

.auth-logo {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -.3px;
  text-align: center;
  margin-bottom: 4px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.auth-logo-mark {
  width: 36px; height: 36px;
  color: var(--text2);
}
.auth-logo span { color: var(--accent); }
.auth-tagline { font-family: var(--font); font-size: 10px; color: var(--muted); letter-spacing: .3px; font-weight: 400; margin-top: 2px; opacity: .8; }
.auth-sub { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 24px; }

.auth-tabs {
  display: flex;
  background: var(--bg2);
  border-radius: 100px;
  padding: 3px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 7px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: all .2s;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* Password show/hide wrapper */
.field-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.field-input-wrap .field-input {
  flex: 1;
  padding-right: 38px; /* room for the toggle button */
}
.pw-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  padding: 0;
  line-height: 0;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition);
}
.pw-toggle:hover { color: var(--text); }
.pw-eye { width: 16px; height: 16px; display: block; }

/* Disabled button — loading state */
button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.auth-error {
  background: var(--no-bg);
  color: var(--no);
  border: 1px solid var(--no-border);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 14px;
}
.auth-success {
  background: var(--open-bg);
  color: var(--open);
  border: 1px solid var(--open-border);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 14px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 11px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition);
}
.btn-google:hover {
  background: var(--surface2);
  border-color: var(--muted);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  padding: 4px 0;
  display: block;
  text-align: center;
  margin-top: 8px;
  width: 100%;
}
.btn-link:hover { color: var(--accent-h); }

/* ════════════════════════════════════════
   TOPBAR
════════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 8px;
}
.topbar-logo {
  font-family: var(--serif);
  letter-spacing: -.3px;
  margin-right: auto;
  color: var(--text);
  display: flex; align-items: center; gap: 8px; line-height: 1;
}
.logo-mark {
  width: 22px; height: 22px;
  color: var(--text2);
  flex-shrink: 0;
}
.topbar-logo-text { font-family: var(--serif); font-size: 20px; letter-spacing: -.3px; white-space: nowrap; line-height: 1; }
.logo-exam { color: var(--text); }
.logo-tracker { color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--muted); }

/* Theme toggle icons — driven by data-theme, no JS needed */
[data-theme="dark"]  #theme-icon-sun  { display: none; }
[data-theme="dark"]  #theme-icon-moon { display: block; }
[data-theme="light"] #theme-icon-moon { display: none; }
[data-theme="light"] #theme-icon-sun  { display: block; }

.data-dd-wrap { position: relative; }
.data-dd-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--r-lg); box-shadow: 0 8px 24px rgba(0,0,0,.35);
  z-index: 200; min-width: 160px; overflow: hidden;
}
.data-dd-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 10px 14px;
  background: none; border: none; border-bottom: 1px solid var(--border2);
  color: var(--text2); font-size: 12px; font-family: var(--font);
  cursor: pointer; text-align: left; transition: background .12s;
}
.data-dd-item:last-child { border-bottom: none; }
.data-dd-item:hover { background: var(--surface); color: var(--text); }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}
.avatar:hover { transform: scale(1.05); box-shadow: 0 0 0 3px var(--accent-soft); }


/* ════════════════════════════════════════
   COUNTDOWN STRIP
════════════════════════════════════════ */
.countdown-strip {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: var(--topbar-h);
  z-index: 95;
}
.countdown-strip::-webkit-scrollbar { display: none; }
.countdown-label {
  font-size: 9px; letter-spacing: 1.5px; color: var(--muted);
  text-transform: uppercase; font-weight: 600; white-space: nowrap; flex-shrink: 0;
}
.countdown-rings { display: flex; gap: 14px; align-items: center; flex: 1; }
.countdown-empty {
  font-size: 11px; color: var(--muted); font-style: italic;
  height: 64px; display: flex; align-items: center;
}

.ring-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex-shrink: 0; cursor: default;
}
.ring {
  position: relative; width: 48px; height: 48px;
}
.ring svg { width: 48px; height: 48px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 3.5; }
.ring-fg { fill: none; stroke-width: 3.5; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-days { font-size: 12px; font-weight: 700; line-height: 1; color: var(--text); }
.ring-unit { font-size: 7px; color: var(--muted); margin-top: 1px; font-family: var(--mono); }
.ring-name {
  font-size: 9px; color: var(--text2); text-align: center;
  max-width: 56px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ════════════════════════════════════════
   FILTER BAR
════════════════════════════════════════ */
.filter-bar {
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  position: fixed;
  top: calc(var(--topbar-h) + var(--countdown-h));
  left: 0; right: 0;
  z-index: 90;
  overflow: visible;
}
.filter-group { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.filter-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; flex-shrink: 0; }
.filter-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.btn-clear-all {
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid var(--no-border);
  background: transparent; color: var(--no);
  font-size: 11px; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: all .15s;
  font-family: var(--font);
}
.btn-clear-all:hover { background: var(--no-bg); }


/* Tag dropdown */
.tag-dd-wrap { position: relative; flex-shrink: 0; }
.tag-dd-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg2); color: var(--text2);
  font-size: 11px; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: all .15s;
}
.tag-dd-btn:hover { border-color: var(--muted); color: var(--text); }
.tag-dd-btn.has-active { background: var(--accent-bg); border-color: var(--accent-soft); color: var(--accent); }
.tag-active-count {
  background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 100px; line-height: 1.4;
}
.tag-dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
  animation: dropIn .15s ease;
}
@keyframes dropIn {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}
#tag-dd-list { padding: 6px; max-height: 260px; overflow-y: auto; }
.tag-dd-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--r);
  cursor: pointer; font-size: 12px; color: var(--text2);
  transition: background .12s;
}
.tag-dd-item:hover { background: var(--surface2); color: var(--text); }
.tag-dd-item.active { color: var(--text); }
.tag-dd-checkbox {
  width: 15px; height: 15px; border-radius: 3px;
  border: 1.5px solid var(--border);
  background: var(--bg2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.tag-dd-item.active .tag-dd-checkbox {
  background: var(--accent); border-color: var(--accent);
}
.tag-dd-item.active .tag-dd-checkbox::after {
  content: '';
  width: 8px; height: 5px;
  border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.tag-dd-empty { padding: 10px; font-size: 11px; color: var(--muted); text-align: center; }

/* Inline search */
.inline-search {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0 12px;
  transition: border-color var(--transition);
}
.inline-search:focus-within { border-color: var(--accent); }
.inline-search-icon { width: 13px; height: 13px; color: var(--muted); flex-shrink: 0; }
.inline-search-input {
  border: none; background: transparent;
  color: var(--text); font-size: 12px;
  padding: 6px 0; outline: none; width: 140px;
}
.inline-search-input::placeholder { color: var(--muted); }

.btn-add {
  padding: 6px 14px;
  border-radius: var(--r);
  border: 1px solid var(--accent-soft);
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
  transition: all var(--transition); white-space: nowrap;
}
.btn-add svg { width: 13px; height: 13px; }
.btn-add:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ════════════════════════════════════════
   EXAM TABLE
════════════════════════════════════════ */
.exam-list {
  padding: var(--filter-bar-h) 0 60px;
}

.list-empty {
  text-align: center; padding: 60px 20px;
}
.empty-icon { margin-bottom: 12px; color: var(--muted); opacity: .5; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text2); }
.empty-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.table-scroll { overflow-x: auto; overflow-y: visible; max-width: 100vw; }
.exam-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
}
.exam-table thead tr {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 10;
}
.exam-table th {
  padding: 8px 14px;
  text-align: left;
  font-size: 10px; font-weight: 700;
  letter-spacing: .7px; color: var(--muted);
  text-transform: uppercase; white-space: nowrap;
}
.th-expand-num { width: 48px; padding: 0; }
.th-name    { min-width: 200px; }
.th-agency  { min-width: 90px; }
.th-tag     { min-width: 90px; }
.th-deadline{ min-width: 80px; }
.th-status  { min-width: 75px; }
.th-applied { width: 48px; min-width: 48px; text-align: center; }
.th-pin     { width: 40px; min-width: 40px; text-align: center; }

/* Body rows */
.exam-table tbody tr.exam-row {
  border-bottom: 1px solid var(--border2);
  transition: background var(--transition);
  cursor: default;
}

/* Alternating row backgrounds — count only among .exam-row siblings so that
   interspersed detail-rows don't shift the stripe of subsequent rows. */
.exam-table tbody tr.exam-row:nth-child(odd of .exam-row)  { background: var(--row-base); }
.exam-table tbody tr.exam-row:nth-child(even of .exam-row) { background: var(--row-alt); }

/* Status-colored left border stripe via td-expand-num */
.exam-table tbody tr.exam-row td.td-expand-num {
  border-left: 3px solid transparent;
}
.exam-table tbody tr.exam-row[data-status="open"]     td.td-expand-num { border-left-color: var(--open); }
.exam-table tbody tr.exam-row[data-status="closed"]   td.td-expand-num { border-left-color: var(--muted); }

.exam-table tbody tr.exam-row:hover { background: var(--bg2); }
.exam-table tbody tr.exam-row.pinned-row { background: var(--accent-bg); }
.exam-table tbody tr.exam-row.pinned-row:hover { background: var(--accent-soft); }
.exam-table tbody tr.exam-row.pinned-row td.td-expand-num {
  border-left: 3px solid var(--accent) !important;
  padding-left: 6px;
}

.exam-table td {
  padding: 10px 14px;
  vertical-align: middle;
  color: var(--text2);
}

/* expand col */
td.td-expand-num {
  width: 48px; padding: 0; text-align: left;
  cursor: pointer; white-space: nowrap;
  padding-left: 8px;
}
td.td-expand-num:hover .expand-btn { color: var(--text); }
.expand-btn {
  background: none; border: none; color: var(--muted);
  padding: 10px 4px 10px 0; cursor: pointer;
  transition: color var(--transition); vertical-align: middle;
  display: inline-flex; align-items: center;
}
.expand-btn svg {
  transition: transform .2s ease;
  transform: rotate(0deg);
}
.expand-btn.open svg {
  transform: rotate(90deg);
}
.expand-btn:hover { color: var(--text); }
.row-num {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin-left: 3px; vertical-align: middle;
}

/* name col */
td.td-name { color: var(--text); font-weight: 500; font-size: 13px; }

/* agency */
td.td-agency { font-size: 11px; }

/* tag */
td.td-tag {}
.tag-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 100px;
  font-size: 10px; font-weight: 500;
  background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border2); white-space: nowrap;
}
.tag-more { font-size: 10px; color: var(--muted); margin-left: 3px; }

/* deadline */
td.td-deadline { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.deadline-normal { color: var(--text2); }
.deadline-past   { color: var(--muted); opacity: .5; }
.deadline-active { color: var(--text2); }
.deadline-warn   { color: var(--warn); }          /* ≤ 7 days  — urgent red */
.deadline-ok     { color: var(--upcoming); }   /* ≤ 30 days — amber */

/* status */
td.td-status {}
.status-pill {
  display: inline-block; padding: 3px 10px;
  border-radius: 100px; font-size: 10px; font-weight: 600; white-space: nowrap;
}
.status-pill.open     { background: var(--open-bg);     color: var(--open);    border: 1px solid var(--open-border); }
.status-pill.closed   { background: var(--closed-bg);   color: var(--closed);  border: 1px solid var(--closed-border); }
.status-pill.na       { background: transparent; color: var(--muted); border: 1px solid var(--border); }

/* applied / pin — centered */
td.td-applied, td.td-pin { text-align: center; }

/* checkbox */
/* Applied circle — mirrors mobile m-card-applied style */
.row-checkbox {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none; background: none;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0; position: relative;
}
/* faint ring when unchecked */
.row-checkbox::before {
  content: '';
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  position: absolute;
  transition: all var(--transition);
}
/* checkmark tick */
.row-checkbox::after {
  content: '';
  width: 7px; height: 5px;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg) translateY(-1px);
  position: relative; z-index: 1;
  transition: border-color var(--transition);
}
.row-checkbox:hover::before { border-color: var(--yes); }
/* checked: filled green circle + white tick */
.row-checkbox.checked::before {
  background: var(--yes);
  border-color: var(--yes);
}
.row-checkbox.checked::after {
  border-left-color: var(--yes-check);
  border-bottom-color: var(--yes-check);
}

/* pin icon */
.pin-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); opacity: 0.45; padding: 4px;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition), opacity var(--transition);
  display: inline-flex; align-items: center; justify-content: center;
}
.pin-btn:hover { color: var(--accent); background: var(--accent-bg); opacity: 1; }
.pin-btn.pinned { color: var(--accent); background: var(--accent-bg); opacity: 1; }

/* Expanded detail panel */
tr.detail-row td {
  padding: 0;
  background: var(--bg2);
  border-bottom: 2px solid var(--accent-soft);
}
.exp-panel {
  padding: 16px 16px 14px 48px;
  border-left: 2px solid var(--accent);
  display: flex; flex-direction: column; gap: 12px;
}

/* Block 1 — Info */
.exp-info { display: flex; flex-direction: column; gap: 6px; }
.exp-name { font-size: 13px; font-weight: 600; color: var(--text); }
.exp-subtitle { font-size: 11px; color: var(--muted); font-style: italic; }
.exp-meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.exp-meta-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text2); }
.exp-meta-item svg { width: 11px; height: 11px; color: var(--muted); flex-shrink: 0; }
.exp-meta-label { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin-right: 2px; }
.exp-meta-val { font-family: var(--mono); font-size: 11px; color: var(--text2); }

.exp-website-link { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text2); text-decoration: none; transition: color .15s; }
.exp-website-link:hover { color: var(--accent); }
.exp-website-link svg { width: 11px; height: 11px; flex-shrink: 0; }
.exp-job-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.exp-job-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 3px 10px; border-radius: var(--r); background: var(--surface2); border: 1px solid var(--border2); }
.chip-label { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.chip-val { font-weight: 600; color: var(--text); font-size: 11px; }

/* Vacancies chip — blue tint (count = factual/neutral) */
.exp-job-chip.chip-vacancies {
  background: var(--chip-vac-bg);
  border-color: var(--chip-vac-border);
}
.exp-job-chip.chip-vacancies .chip-label { color: var(--chip-vac-label); }
.exp-job-chip.chip-vacancies .chip-val   { color: var(--chip-vac-val); }

/* Pay chip — green tint (money = positive) */
.exp-job-chip.chip-pay {
  background: rgba(52,211,153,.08);
  border-color: rgba(52,211,153,.2);
}
.exp-job-chip.chip-pay .chip-label { color: var(--chip-pay); opacity: .75; }
.exp-job-chip.chip-pay .chip-val   { color: var(--chip-pay); }

/* exp-meta-val urgency colouring for Apply by date */
.exp-meta-item.meta-warn .exp-meta-val { color: var(--warn); }
.exp-meta-item.meta-ok   .exp-meta-val { color: var(--upcoming); }
.exp-meta-item.meta-past .exp-meta-val { color: var(--muted); opacity: .6; }
/* Also tint the label and icon when urgent */
.exp-meta-item.meta-warn .exp-meta-label,
.exp-meta-item.meta-warn svg { color: var(--warn); opacity: .8; }
.exp-meta-item.meta-ok .exp-meta-label,
.exp-meta-item.meta-ok svg   { color: var(--upcoming); opacity: .8; }
.exp-divider { height: 1px; background: var(--border); }

/* 3 field buttons in expanded row */
.exp-field-btns {
  display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
}
.exp-field-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
/* Filled field button — warm accent resting state */
.exp-field-btn:not(.empty) {
  border-color: var(--accent-soft);
  color: var(--accent);
  background: var(--accent-bg);
}
.exp-field-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.exp-field-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); filter: brightness(1.08); }
.exp-field-btn.empty { opacity: .5; border-style: dashed; border-color: var(--border); background: var(--surface); color: var(--muted); }
.exp-field-res { color: var(--text2); }
.exp-bar-sep { width: 1px; height: 16px; background: var(--border2); margin: 0 4px; flex-shrink: 0; }
.fbtn-empty { font-size: 9px; color: var(--muted); font-weight: 400; margin-left: 2px; }

/* ── Field View Panel ── */
.fv-panel {
  position: fixed; inset: 0;
  z-index: 215;
  display: flex; align-items: stretch; justify-content: flex-end;
  overflow: hidden;
}
.fv-inner {
  width: min(860px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 48px rgba(0,0,0,.5);
  display: flex; flex-direction: column;
  animation: slideInRight .22s ease;
  height: 100vh; height: 100dvh; overflow: hidden;
}

/* View mode */
#fv-view-mode { display: flex; flex-direction: column; height: 100%; }
.fv-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 12px;
}
.fv-back-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; color: var(--muted);
  font-size: 12px; font-weight: 600; cursor: pointer;
  padding: 6px 8px; border-radius: var(--r);
  transition: all .15s; white-space: nowrap; flex-shrink: 0;
  font-family: var(--font);
}
.fv-back-btn:hover { background: var(--surface2); color: var(--text); }
.fv-header-center { flex: 1; min-width: 0; }
.fv-title { font-family: var(--serif); font-size: 18px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.fv-edit-btn {
  padding: 7px 16px; border-radius: var(--r);
  border: 1px solid var(--accent-soft);
  background: var(--accent-bg); color: var(--accent);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .15s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.fv-edit-btn:hover { background: var(--accent); color: #fff; }
.fv-content {
  flex: 1; overflow-y: auto;
  padding: 24px 28px;
  font-size: 13px; line-height: 1.7; color: var(--text2);
}
/* fv-content uses larger headings than md-preview-content */
.fv-content h1 { font-size: 22px; }
.fv-content h2 { font-size: 17px; }
.fv-empty-state{padding:40px 0;text-align:center;color:var(--muted);font-size:13px;font-style:italic}

/* Edit mode — reuses md-panel styles, just needs flex structure */
#fv-edit-mode { display: flex; flex-direction: column; height: 100%; }

/* Bottom bar */
.exp-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.exp-tags-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
}
.exp-tags-label { font-size: 11px; color: var(--muted); }
.exp-tag {
  font-size: 10px; font-weight: 600; color: var(--accent);
  cursor: pointer; transition: all .15s;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
}
.exp-tag:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.exp-tag-add {
  font-size: 11px; color: var(--muted);
  background: none; border: none; cursor: pointer;
  transition: color .15s;
}
.exp-tag-add:hover { color: var(--text); }

.exp-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.exp-action-btn {
  padding: 5px 12px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--bg2);
  color: var(--text2); font-size: 11px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: all .15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
}
.exp-action-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--muted); }
.exp-action-btn.danger { color: var(--no); border-color: var(--no-border); background: var(--no-bg); }
.exp-action-btn.danger:hover { background: var(--no-hover); }

/* Expanded row highlight */
tr.exam-row.expanded { background: var(--bg2); }
tr.exam-row.expanded td { border-bottom: none; }

/* Year column */
.th-year { min-width: 80px; }
td.td-year { font-family: var(--mono); font-size: 11px; color: var(--text2); }

@media (max-width: 900px) {
  .exp-panel { padding: 14px 12px 12px 12px; }
}

/* ════════════════════════════════════════
   MODAL SYSTEM
════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: overlayIn .2s ease;
}
#discard-modal { z-index: 9999; }
#discard-modal .modal-footer {
  gap: 10px;
}
#discard-modal .btn-ghost,
#discard-modal .btn-danger {
  flex: 1; width: auto; margin-top: 0; text-align: center;
}
@keyframes overlayIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlayOut { from { opacity: 1; } to { opacity: 0; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: modalIn .25s ease;
  box-shadow: var(--shadow-lg);
}
.modal-sm { max-width: 400px; }

/* ── Pick Modal (selective export / import) ─────────── */
.pick-modal-inner { max-width: 480px; width: 100%; display: flex; flex-direction: column; max-height: 80vh; }
.pick-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.pick-sel-btn { padding: 4px 10px; font-size: 12px; }
.pick-count { margin-left: auto; font-size: 12px; color: var(--text2); }
.pick-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.pick-list::-webkit-scrollbar { width: 4px; }
.pick-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; transition: background .12s; }
.pick-item:hover { background: var(--surface2); }
.pick-cb { width: 15px; height: 15px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.pick-item-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pick-item-label { font-size: 13px; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-item-sub { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes modalOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(.96) translateY(10px); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-family: var(--serif); font-size: 18px; color: var(--text); }
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 16px; padding: 4px; line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  flex-shrink: 0;
}

/* ── FORM ELEMENTS ── */
.field-group { margin-bottom: 14px; }
.field-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text2); text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 5px;
}
.field-input {
  width: 100%; padding: 9px 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font-size: 13px; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-input::placeholder { color: var(--muted); }
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.field-textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.field-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6560' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; cursor: pointer; }

.form-row { display: flex; gap: 10px; }
.form-row .field-group { flex: 1; margin-bottom: 14px; }

/* Toggle */
.toggle-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 12px; color: var(--text2); user-select: none;
}
.toggle-check { display: none; }
.toggle-track {
  width: 32px; height: 18px; border-radius: 100px;
  background: var(--border); position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text2); transition: transform .2s, background .2s;
}
.toggle-check:checked + .toggle-track { background: var(--accent); }
.toggle-check:checked + .toggle-track::after { transform: translateX(14px); background: #fff; }

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn-primary {
  width: 100%; padding: 11px 20px;
  border-radius: var(--r); border: none;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 600;
  transition: background var(--transition), transform var(--transition);
  margin-top: 4px;
}
.btn-primary:hover { background: var(--accent-h); }
.btn-primary:active { transform: scale(.98); }

.btn-ghost {
  padding: 9px 18px;
  border-radius: var(--r); border: 1px solid var(--border);
  background: transparent; color: var(--text2);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-danger {
  padding: 9px 18px;
  border-radius: var(--r); border: 1px solid var(--no-border);
  background: var(--no-bg); color: var(--no);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition);
  width: 100%; margin-top: 4px;
}
.btn-danger:hover { background: var(--no-hover); }

/* ════════════════════════════════════════
   PROFILE MODAL STYLES
════════════════════════════════════════ */
.modal-profile { max-width: 480px; }
.modal-profile .modal-body { padding: 0; gap: 0; }

.profile-hero {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 22px 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; flex-shrink: 0;
  margin-bottom: 10px;
}
.profile-name { font-size: 16px; font-weight: 600; color: var(--text); }
.profile-email { font-size: 12px; color: var(--accent); margin-top: 3px; }

.profile-stats {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.profile-stat {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 14px 8px;
  border-right: 1px solid var(--border);
}
.profile-stat:last-child { border-right: none; }
.profile-stat-val { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1; }
.profile-stat-label { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

.pref-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted);
  padding: 14px 18px 6px;
}
.pref-list {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border2);
  border-bottom: 1px solid var(--border2);
  margin-bottom: 2px;
}
.pref-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px;
  background: none; border: none; border-bottom: 1px solid var(--border2);
  color: var(--text2); font-size: 13px; font-family: var(--font);
  cursor: pointer; text-align: left; transition: background .12s;
  width: 100%;
}
.pref-row:last-child { border-bottom: none; }
.pref-row:hover { background: var(--surface2); color: var(--text); }
.pref-row svg:first-child { width: 15px; height: 15px; flex-shrink: 0; color: var(--muted); }
.pref-row-label { flex: 1; }
.pref-chevron { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }

.pref-list-danger { border-color: rgba(248,113,113,.12); }
.pref-row-signout { color: var(--text2); }
.pref-row-signout svg:first-child { color: var(--muted); }
.pref-row-delete { color: var(--no); font-weight: 600; background: rgba(248,113,113,.05); }
.pref-row-delete svg:first-child { color: var(--no); }
.pref-row-delete:hover { background: rgba(248,113,113,.12); }
.pref-row-delete .pref-chevron { color: var(--no); opacity: .5; }

/* ════════════════════════════════════════
   TOAST
════════════════════════════════════════ */
.toast {
  position: fixed; bottom: max(80px, calc(16px + env(safe-area-inset-bottom))); left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); padding: 10px 18px; border-radius: 100px;
  font-size: 12px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300; white-space: nowrap;
  animation: toastIn .3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast.success { background: var(--open-bg); color: var(--open); border-color: var(--open-border); }
.toast.error   { background: var(--no-bg);   color: var(--no);   border-color: var(--no-border); }

/* ════════════════════════════════════════
   LOADING STATE
════════════════════════════════════════ */
.loading-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite; vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* md inline pencil trigger inside exam modal */
.md-inline-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); cursor: pointer; text-align: left;
  transition: border-color var(--transition);
}
.md-inline-btn svg { width: 13px; height: 13px; color: var(--accent); flex-shrink: 0; }
.md-inline-btn span { font-size: 12px; color: var(--muted); font-style: italic; }
.md-inline-btn.has-content span { color: var(--text2); font-style: normal; }
.md-inline-btn:hover { border-color: var(--accent); }


/* ════════════════════════════════════════
   MARKDOWN EDITOR PANEL
════════════════════════════════════════ */
.md-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
  z-index: 210;
}
.md-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(860px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 215;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 48px rgba(0,0,0,.5);
  animation: slideInRight .25s ease;
}
@keyframes slideInRight {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(60px); opacity: 0; }
}
.md-panel-inner { display: flex; flex-direction: column; height: 100%; }

.md-panel-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.md-back-btn {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 6px 8px;
  color: var(--text2); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center;
  transition: all var(--transition);
}
.md-back-btn:hover { background: var(--surface2); color: var(--text); }
.md-panel-title {
  font-size: 15px; font-weight: 600; color: var(--text);
}
.md-panel-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.md-panel-close {
  margin-left: auto; background: none; border: none;
  color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px;
  transition: color var(--transition); flex-shrink: 0;
}
.md-panel-close:hover { color: var(--text); }

/* Toolbar */
.md-toolbar {
  display: flex; flex-direction: column; gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.md-toolbar-row {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 6px 12px;
}
.md-toolbar-divider { height: 1px; background: var(--border); margin: 0; }
.md-tool {
  padding: 4px 8px; border-radius: var(--r);
  border: none; background: transparent;
  color: var(--text2); font-size: 12px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  font-family: var(--font);
  transition: all .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.md-tool:hover { background: var(--surface2); color: var(--text); }
.md-tool--text { font-size: 11px; font-weight: 700; padding: 4px 7px; letter-spacing: .3px; }
.md-tool-sep { width: 1px; height: 16px; background: var(--border); margin: 0 3px; flex-shrink: 0; }

/* Split pane */
.md-split {
  display: flex; flex: 1; overflow: hidden;
  min-height: 0;
}
.md-pane { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.md-pane-label {
  font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
  padding: 6px 12px; border-bottom: 1px solid var(--border2);
  background: var(--bg2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
}
.md-preview-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-bg);
  border: 1px solid var(--accent-soft); border-radius: 20px;
  padding: 2px 8px; cursor: pointer; transition: all .15s;
  font-family: var(--font);
}
.md-preview-toggle:hover { background: var(--accent); color: #fff; }
.md-preview-toggle--off { color: var(--muted); background: transparent; border-color: var(--border); }
.md-preview-toggle--off:hover { background: var(--surface2); color: var(--text); }
.md-divider { width: 1px; background: var(--border); flex-shrink: 0; }

.md-textarea {
  flex: 1; border: none; outline: none; resize: none;
  background: var(--bg);
  color: var(--text); font-family: var(--mono); font-size: 12px;
  line-height: 1.7; padding: 16px;
  overflow-y: auto;
}
.md-textarea::placeholder { color: var(--muted); }

.md-preview-content {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  font-size: 13px; line-height: 1.7; color: var(--text2);
}

/* ════════════════════════════════════════
   SHARED MARKDOWN RENDERED STYLES
   Applied to: .fv-content and .md-preview-content
   via the .md-rendered class on both elements.
════════════════════════════════════════ */
.md-rendered h1,.md-rendered h2,.md-rendered h3,.md-rendered h4 { color: var(--text); font-family: var(--serif); margin: 16px 0 8px; }
.md-rendered h1 { font-size: 20px; }
.md-rendered h2 { font-size: 16px; }
.md-rendered h3 { font-size: 14px; }
.md-rendered h4 { font-size: 13px; font-family: var(--font); font-weight: 600; color: var(--text2); }
.md-rendered p  { margin-bottom: 8px; }
.md-rendered strong { color: var(--text); font-weight: 700; }
.md-rendered em { font-style: italic; color: var(--text); }
.md-rendered u  { text-decoration: underline; text-underline-offset: 2px; }
.md-rendered s  { text-decoration: line-through; color: var(--muted); }
.md-rendered mark { background: rgba(251,191,36,.25); color: var(--text); padding: 1px 3px; border-radius: 3px; }
.md-rendered code {
  background: var(--surface2); padding: 1px 5px;
  border-radius: 3px; font-family: var(--mono); font-size: 11px; color: var(--accent);
}
.md-rendered pre {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px; overflow-x: auto; margin-bottom: 10px;
}
.md-rendered pre code { background: none; padding: 0; color: var(--text2); }
.md-rendered ul,.md-rendered ol { padding-left: 20px; margin-bottom: 8px; }
.md-rendered li { margin-bottom: 3px; font-size: 13px; color: var(--text2); }
.md-rendered blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 14px; margin: 10px 0;
  background: var(--accent-bg); border-radius: 0 var(--r) var(--r) 0;
  color: var(--text2);
}
.md-rendered hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.md-rendered table { border-collapse: collapse; width: 100%; margin-bottom: 12px; }
.md-rendered th {
  background: var(--bg2); color: var(--muted);
  font-size: 10px; letter-spacing: .6px; text-transform: uppercase;
  padding: 7px 12px; border: 1px solid var(--border); text-align: left;
}
.md-rendered td {
  padding: 7px 12px; border: 1px solid var(--border2);
  font-size: 12px; color: var(--text2);
}
.md-rendered tr:hover td { background: var(--bg2); }
.md-rendered a { color: var(--accent); }
.md-rendered .task-list { list-style: none; padding-left: 4px; }
.md-rendered .task-item { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 5px; }
.md-rendered .task-cb { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border: 1.5px solid var(--border2); border-radius: 3px; flex-shrink: 0; margin-top: 1px; cursor: pointer; background: none; padding: 0; transition: all .15s; }
.md-rendered .task-cb:hover { border-color: var(--accent); background: var(--accent-bg); }
.md-rendered .task-cb--checked { background: var(--accent); border-color: var(--accent); }
.md-rendered .task-cb--checked::after { content: ''; display: block; width: 8px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translateY(-1px); }
.md-rendered .task-done .task-label { text-decoration: line-through; color: var(--muted); opacity: .6; }
.md-rendered .md-callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); margin: 10px 0; font-size: 13px; line-height: 1.6; }
.md-rendered .callout-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.md-rendered .callout-body { color: var(--text2); flex: 1; }
.md-rendered .callout-info    { background: rgba(99,102,241,.08); border-left: 3px solid #6366f1; }
.md-rendered .callout-warn    { background: rgba(251,191,36,.1);  border-left: 3px solid #f59e0b; }
.md-rendered .callout-tip     { background: rgba(16,185,129,.08); border-left: 3px solid #10b981; }
.md-rendered .callout-success { background: rgba(34,197,94,.08);  border-left: 3px solid #22c55e; }
.md-rendered .md-collapsible { border: 1px solid var(--border); border-radius: var(--r); margin: 10px 0; overflow: hidden; }
.md-rendered .md-collapsible-title { display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; background: var(--bg2); list-style: none; user-select: none; }
.md-rendered .md-collapsible-title::before { content: '▶'; font-size: 9px; color: var(--muted); transition: transform .2s; flex-shrink: 0; }
.md-rendered .md-collapsible[open] .md-collapsible-title::before { transform: rotate(90deg); }
.md-rendered .md-collapsible-title::-webkit-details-marker { display: none; }
.md-rendered .md-collapsible-body { padding: 12px 14px; font-size: 13px; color: var(--text2); border-top: 1px solid var(--border); }

.md-panel-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.md-save-status { font-size: 11px; color: var(--muted); }

/* ════════════════════════════════════════
   SCROLLBAR
════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ════════════════════════════════════════
   RESPONSIVE — DESKTOP TWEAKS
════════════════════════════════════════ */
@media (max-width: 900px) {
  .md-fields-row { flex-direction: column; }
}

/* Mobile filter button — hidden on desktop, shown only inside the 640px media query */
.mobile-filter-btn { display: none; }

/* ════════════════════════════════════════
   MOBILE  (≤ 640px)
   Strategy: hide table → show cards
════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ══════════════════════════════════════
     Mobile layout: rings + filter bar stacking
     - Shrink rings to 40px so strip is a
       genuine 72px (pad 8px + ring 40px +
       name ~13px + gap = ~69px ≈ 72px)
     - Filter bar switches to sticky so it
       stacks naturally below countdown
       instead of relying on fixed + top
       calc that breaks when strip varies
     - exam-list padding only needs to
       clear the filter bar height (the
       topbar+countdown are sticky and
       scroll above it naturally)
  ══════════════════════════════════════ */

  :root {
    --filter-bar-h: 47px;  /* single-row filter bar (Filters pill replaces 3 dropdowns) */
    --countdown-h:  72px;  /* matches shrunk rings below */
  }

  /* ── auth ── */
  .auth-card { padding: 28px 18px; }

  /* ── topbar ── */
  .topbar { padding: 0 12px; position: sticky; top: 0; z-index: 100; }

  /* ── countdown strip: shrink rings to 40px so real height = 72px ── */
  .countdown-strip { padding: 8px 12px; gap: 10px; position: sticky; top: var(--topbar-h); z-index: 97; height: var(--countdown-h); }
  .ring-wrap { gap: 3px; }
  /* shrink rings to 40×40 so strip height matches --countdown-h */
  .ring       { width: 40px; height: 40px; }
  .ring svg   { width: 40px; height: 40px; }
  .ring-days  { font-size: 11px; }
  .ring-unit  { font-size: 6px; }
  .ring-name  { font-size: 8px; max-width: 46px; }
  /* collapse strip entirely when no exams pinned — zero dead space */
  .countdown-empty { display: none; }
  .countdown-strip:has(> .countdown-label + .countdown-rings > .countdown-empty:only-child) {
    display: none;
  }
  /* When no pinned exams: filter bar sticks right below topbar, no gap */
  #app.no-pinned .filter-bar {
    top: var(--topbar-h);
  }

  /* hide "PINNED" label on mobile — rings are self-explanatory,
     also frees horizontal room for more rings before scroll */
  .countdown-label { display: none; }

  /* filter bar: sticky on mobile, single row (3 dropdowns replaced by Filters pill) */
  .filter-bar {
    position: sticky;
    top: calc(var(--topbar-h) + var(--countdown-h));
    z-index: 97;
    flex-wrap: nowrap;
    padding: 6px 12px;
    gap: 6px;
    left: unset;
    right: unset;
  }

  /* Hide the 3 individual dropdowns on mobile — replaced by the Filters pill */
  #status-dd-wrap,
  #tag-dd-wrap,
  #sort-dd-wrap { display: none !important; }

  .filter-sep { display: none; }

  /* Clear button: icon-only on mobile to prevent 3rd row overflow */
  .btn-clear-all {
    padding: 5px 8px;
    font-size: 0;      /* hide text */
    min-width: 28px;
    display: flex; align-items: center; justify-content: center;
  }
  /* inject ✕ via pseudo so no HTML change needed */
  .btn-clear-all::before {
    content: '✕';
    font-size: 11px;
  }

  /* filter-right: takes remaining space on the single row */
  .filter-right {
    margin-left: 0;
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
    gap: 6px;
  }
  .inline-search { flex: 1; min-width: 0; max-width: 200px; }
  .inline-search-input { width: 100%; min-width: 0; }

  /* Add Exam: icon-only on mobile, frees ~60px for search input */
  .btn-add-text { display: none; }
  .btn-add { padding: 0; width: 34px; height: 34px; justify-content: center; flex-shrink: 0; }
  .btn-add svg { width: 16px; height: 16px; }

  /* hide Select & Delete-selected on mobile */
  .btn-select-mode,
  #btn-delete-selected { display: none !important; }

  /* sticky filter bar already occupies space in normal flow — no padding-top needed */
  .exam-list {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 80px;
  }

  /* ── HIDE TABLE, SHOW CARDS ── */
  .table-scroll { display: none !important; }
  #skeleton-loader { display: none !important; }

  /* Mobile exam card list */
  #mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 12px 0;
  }

  /* ── mobile exam card ── */
  .m-card {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--r-lg);
    transition: background var(--transition);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
  }
  /* tap feedback on touch — only when tapping the top bar itself, not the applied/pin buttons inside it */
  .m-card-top:active { background: var(--surface2); }
  .m-card-top:has(.m-card-applied:active, .m-card-pin:active) { background: inherit; }
  .m-card.pinned-card { background: var(--accent-bg); border-color: var(--accent-soft); border-left: 3px solid var(--accent); }
  .m-card.pinned-card .m-card-top { border-left: none; }

  .m-card-top {
    display: flex;
    align-items: center;
    padding: 11px 14px 11px 16px;
    gap: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .m-card-chevron {
    flex-shrink: 0;
    color: var(--muted);
    transition: transform .2s ease;
    display: flex; align-items: center;
  }
  .m-card-chevron svg { width: 13px; height: 13px; }
  .m-card.expanded .m-card-chevron { transform: rotate(90deg); }

  .m-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }

  .m-card-name {
    font-size: 14px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .m-card-subtitle {
    font-size: 11px; color: var(--muted); font-weight: 400;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    opacity: .8;
  }

  /* collapsed meta shows only agency + deadline (no year);
     year is shown in expanded detail instead */
  .m-card-meta {
    display: flex; align-items: center; gap: 6px;
    /* no flex-wrap: single line only — prevents multi-line card collapse height */
    flex-wrap: nowrap; overflow: hidden;
  }
  .m-card-agency {
    font-size: 12px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* year span in meta: hidden on mobile (shown in detail) */
  .m-card-meta .m-card-year { display: none; }

  .m-card-deadline {
    font-family: var(--mono); font-size: 12px; font-weight: 600;
    white-space: nowrap; flex-shrink: 0;
  }
  .m-card-deadline.past      { color: var(--muted); opacity: .5; }
  .m-card-deadline.active    { color: var(--text2); }
  .m-card-deadline.urgent    { color: var(--warn); font-weight: 700; }
  /* exam date row — only shown when applied=true + examDate set */
  .m-card-examdate {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; color: var(--yes); font-weight: 600;
    margin-top: 1px;
  }
  .m-card-examdate svg { opacity: .7; flex-shrink: 0; }
  .m-card-examdate-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; opacity: .7; }
  .m-card-examdate-val   { font-family: var(--mono); }
  .m-card-examdate.past  { color: var(--muted); opacity: .5; }
  .m-card-examdate.urgent { color: var(--warn); }

  .m-card-right {
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
  }
  /* status pill + deadline inline in card meta row */
  .m-card-status-date {
    display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  }
  .m-status-pill {
    display: inline-block;
    padding: 2px 7px; font-size: 10px; font-weight: 700;
    border-radius: 100px; white-space: nowrap;
  }
  .m-status-pill.open   { background: var(--open-bg);   color: var(--open);   border: 1px solid var(--open-border); }
  .m-status-pill.closed { background: var(--closed-bg); color: var(--closed); border: 1px solid var(--closed-border); }

  /* Applied indicator — circle icon, no box. Unchecked: faint ring. Checked: solid green circle + tick */
  .m-card-applied {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none; background: none;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; cursor: pointer;
    transition: background var(--transition);
    position: relative;
  }
  /* faint circle ring when unchecked */
  .m-card-applied::before {
    content: '';
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    position: absolute;
    transition: all var(--transition);
  }
  /* checkmark tick */
  .m-card-applied::after {
    content: '';
    width: 8px; height: 5px;
    border-left: 2px solid transparent;
    border-bottom: 2px solid transparent;
    transform: rotate(-45deg) translateY(-1px);
    position: relative; z-index: 1;
    transition: border-color var(--transition);
  }
  /* checked: filled green circle + white tick */
  .m-card-applied.checked::before {
    background: var(--yes);
    border-color: var(--yes);
  }
  .m-card-applied.checked::after {
    border-left-color: var(--yes-check);
    border-bottom-color: var(--yes-check);
  }
  .m-card-applied:hover::before { border-color: var(--yes); }


  /* Pin button — bookmark icon. 32×32 tap target. Unpinned: muted outline. Pinned: accent solid fill */
  .m-card-pin {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none; background: none;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; cursor: pointer;
    color: var(--muted);
    transition: color var(--transition), background var(--transition);
    opacity: 0.5;
  }
  .m-card-pin svg { width: 18px; height: 18px; flex-shrink: 0; }
  .m-card-pin:hover { color: var(--accent); background: var(--accent-bg); opacity: 1; }
  .m-card-pin.pinned {
    color: var(--accent);
    background: var(--accent-bg);
    opacity: 1;
  }

  /* expanded detail section */
  .m-card-detail {
    display: none;
    padding: 0 14px 14px 16px;
    border-top: 1px solid var(--border2);
    flex-direction: column;
    gap: 10px;
  }
  .m-card.expanded .m-card-detail { display: flex; }

  .m-detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-top: 10px; }
  .m-detail-meta-item {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; color: var(--text2);
  }
  .m-detail-meta-item svg { width: 11px; height: 11px; color: var(--muted); }
  .m-detail-meta-label { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
  .m-detail-meta-val { font-family: var(--mono); font-size: 11px; }

  .m-detail-chips { display: flex; gap: 6px; flex-wrap: wrap; }
  .m-detail-chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; padding: 3px 10px;
    border-radius: var(--r); background: var(--surface2); border: 1px solid var(--border2);
  }
  /* Vacancies chip — blue tint */
  .m-detail-chip.chip-vacancies {
    background: var(--chip-vac-bg); border-color: var(--chip-vac-border);
  }
  .m-detail-chip.chip-vacancies .m-chip-label { color: var(--chip-vac-label); }
  .m-detail-chip.chip-vacancies .m-chip-val   { color: var(--chip-vac-val); }
  /* Pay chip — green tint */
  .m-detail-chip.chip-pay {
    background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.2);
  }
  .m-detail-chip.chip-pay .m-chip-label { color: var(--chip-pay); opacity: .75; }
  .m-detail-chip.chip-pay .m-chip-val   { color: var(--chip-pay); }

  .m-chip-label { font-size: 9px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
  .m-chip-val   { font-weight: 600; color: var(--text); font-size: 11px; }

  .m-detail-field-btns { display: flex; gap: 6px; flex-wrap: wrap; }
  .m-detail-field-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 13px; border-radius: var(--r-lg);
    border: 1px solid var(--border);
    background: var(--surface); color: var(--text2);
    font-size: 12px; font-weight: 500; cursor: pointer;
    transition: all .15s; font-family: var(--font);
    text-decoration: none;
  }
  /* Filled mobile field buttons — match desktop warm accent */
  .m-detail-field-btn:not(.empty) {
    border-color: var(--accent-soft);
    color: var(--accent);
    background: var(--accent-bg);
  }
  .m-detail-field-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
  .m-detail-field-btn.empty { opacity: .5; border-style: dashed; border-color: var(--border); background: var(--surface); color: var(--muted); }
  .m-detail-field-btn { -webkit-tap-highlight-color: transparent; }
  .m-detail-field-btn:active { background: var(--accent); color: #fff; border-color: var(--accent); }
  /* Notification / Website links — accent tint to distinguish from field btns */
  .m-detail-link-btn {
    color: var(--accent);
    border-color: var(--accent-soft);
    background: var(--accent-bg);
  }

  .m-detail-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .m-detail-tags-label { font-size: 11px; color: var(--muted); }
  .m-detail-tag { font-size: 11px; font-weight: 500; color: var(--accent); cursor: pointer; }

  .m-detail-actions { display: flex; gap: 6px; padding-top: 2px; }
  .m-detail-action-btn {
    padding: 5px 12px; border-radius: var(--r);
    border: 1px solid var(--border); background: transparent;
    color: var(--muted); font-size: 11px; font-weight: 500;
    cursor: pointer; font-family: var(--font);
    display: flex; align-items: center; gap: 4px;
    transition: all .15s;
  }
  .m-detail-action-btn { -webkit-tap-highlight-color: transparent; }
  .m-detail-action-btn:active { background: var(--surface2); color: var(--text); }
  .m-detail-action-btn.danger {
    color: var(--no); border-color: var(--no-border); background: transparent;
    margin-left: auto;
  }

  /* ── empty states ── */
  .list-empty { padding: 50px 20px; }

  /* ══════════════════════════════════════
     Modal: bottom sheet on mobile
     - overflow: hidden on overlay prevents
       iOS keyboard push issues
     - width: 100% on modal ensures full
       sheet width on all devices
  ══════════════════════════════════════ */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
    overflow: hidden;  /* prevent iOS keyboard from pushing layout */
  }
  .modal {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: 92vh;
    max-width: 100%;
    width: 100%;
    min-height: 0;   /* allow shrinking without forcing scroll */
    /* slide up from bottom instead of scale in */
    animation: sheetIn .25s ease;
  }
  @keyframes sheetIn {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  .modal-overlay.is-closing .modal {
    animation: sheetOut .18s ease forwards;
  }
  @keyframes sheetOut {
    from { transform: translateY(0);    opacity: 1; }
    to   { transform: translateY(40px); opacity: 0; }
  }
  .modal-sm { max-width: 100%; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .form-row { flex-direction: column; gap: 0; }
  .form-row .field-group { flex: unset; }

  /* resources add row — stack on mobile */
  .res-add-row { flex-wrap: wrap; }
  .res-type-sel { width: 80px; }
  #res-url-input { min-width: 0; }

  /* ══════════════════════════════════════
     fv-panel editor on mobile
     - Hide live preview pane in edit mode
     - Give full height to textarea
     - View mode is still accessible for
       reading the rendered output
  ══════════════════════════════════════ */
  .fv-inner { width: 100vw; overflow-x: hidden; }

  /* In edit mode: hide preview pane entirely, textarea gets full height */
  #fv-edit-mode .md-preview-pane { display: none; }
  #fv-edit-mode .md-divider       { display: none; }
  #fv-edit-mode .md-split         { flex-direction: column; }
  #fv-edit-mode .md-write-pane    { flex: 1; min-height: 0; }
  #fv-edit-mode .md-pane-label    { display: none; } /* hide WRITE label when solo */

  /* md-panel (add/edit modal panels): also hide preview, textarea full height */
  .md-split {
    flex-direction: column;
  }
  .md-divider { width: 100%; height: 1px; }
  .md-pane { min-height: 160px; }
  .md-write-pane { flex: 1.2; }
  .md-preview-pane { flex: 1; }

  /* ── Pick modal on mobile ── */
  .pick-modal-inner { max-height: 85vh; max-width: 100%; }
  .pick-toolbar { gap: 6px; }
  .pick-sel-btn { padding: 5px 10px; font-size: 12px; }
  .pick-item { padding: 10px 8px; }
  .pick-item-label { font-size: 14px; }
  .pick-cb { width: 18px; height: 18px; }

  /* ── Mobile filter pill ── */
  .mobile-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border2);
    background: var(--surface);
    color: var(--text2);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    flex-shrink: 0;
    transition: all .15s;
  }
  .mobile-filter-btn:hover,
  .mobile-filter-btn.has-active {
    border-color: var(--accent-soft);
    background: var(--accent-bg);
    color: var(--accent);
  }
  .mobile-filter-badge {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    line-height: 1.4;
  }

  /* ── Mobile filter bottom sheet ── */
  #mobile-filter-sheet {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: flex-end;
  }
  .mfs-inner {
    width: 100%;
    background: var(--surface);
    border-radius: 18px 18px 0 0;
    padding: 0 0 env(safe-area-inset-bottom, 12px);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
  }
  .mfs-header {
    display: flex;
    align-items: center;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border2);
    gap: 8px;
  }
  .mfs-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    flex: 1;
  }
  .mfs-clear-btn {
    font-size: 12px;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-weight: 500;
    padding: 4px 8px;
  }
  .mfs-close-btn {
    background: var(--surface2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text2);
    flex-shrink: 0;
  }
  .mfs-body {
    overflow-y: auto;
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .mfs-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 8px;
  }
  .mfs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .mfs-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border2);
    background: var(--surface2);
    color: var(--text2);
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    transition: all .15s;
  }
  .mfs-chip.active {
    border-color: var(--accent-soft);
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
  }
  .mfs-no-tags {
    font-size: 12px;
    color: var(--muted);
  }
}


/* ── MODAL: MD-FIELDS-ROW (Eligibility · Syllabus · Pattern side by side) ── */
.md-fields-row {
  display: flex;
  gap: 8px;
}
.md-fields-row .field-group { flex: 1; }

/* ── MODAL: RESOURCES ── */
.res-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.res-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r); font-size: 12px;
}
.res-item .res-title { flex: 1; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-remove {
  background: none; border: none; color: var(--muted);
  font-size: 11px; cursor: pointer; padding: 0 2px; transition: color .15s;
}
.res-remove:hover { color: var(--no); }

.res-add-row { display: flex; gap: 6px; align-items: center; }
.res-type-sel { width: 72px; flex-shrink: 0; padding: 7px 6px; }
.res-add-btn {
  padding: 7px 12px; border-radius: var(--r);
  border: 1px solid var(--accent-soft);
  background: var(--accent-bg); color: var(--accent);
  font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: all .15s; flex-shrink: 0;
  font-family: var(--font);
}
.res-add-btn:hover { background: var(--accent); color: #fff; }

/* ── MODAL: RESOURCES ── */
.res-item .res-type-badge {
  font-size: 13px; flex-shrink: 0; line-height: 1;
}
.res-item .res-type-badge.res-pdf  { color: var(--chip-vac-val); }
.res-item .res-type-badge.res-link { color: var(--accent); }

/* ── RESOURCES POPOVER (expanded row) ── */
.res-popover-wrap { position: relative; }
.res-popover {
  position: fixed;
  z-index: 500;
  min-width: 260px;
  max-width: 340px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg, 10px);
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  overflow: hidden;
}
.res-pop-list { display: flex; flex-direction: column; }
.res-pop-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.res-pop-item:last-child { border-bottom: none; }
.res-pop-item:hover { background: var(--surface); }
.res-pop-title {
  flex: 1; font-size: 12px; color: var(--text2);
  text-decoration: none; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  transition: color .12s;
}
.res-pop-title:hover { color: var(--accent); }
.res-pop-empty { padding: 10px 14px; font-size: 12px; color: var(--muted); font-style: italic; }
.res-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--accent);
  border-radius: 20px; font-size: 10px; font-weight: 700;
  padding: 1px 6px; margin-left: 2px;
}
/* badge colors for popover (yt/pdf/web/note) */
/* PDF = download icon (blue), LINK = chain icon (accent) */
.res-pop-icon { width: 14px; height: 14px; flex-shrink: 0; }
.res-pop-icon-pdf  { color: var(--chip-vac-val); }
.res-pop-icon-link { color: var(--accent); }

/* ════════════════════════════════════════
   MODIFIER CLASSES (consolidated from inline styles)
════════════════════════════════════════ */

/* btn-primary variants */
.btn-primary--auto { width: auto; padding: 9px 20px; margin: 0; }
.btn-primary--cta  { width: auto; padding: 10px 24px; margin-top: 16px; }

/* field-group flex variants */
.field-group--flex-1  { flex: 1; }
.field-group--flex-15 { flex: 1.5; }
.field-group--flex-2  { flex: 2; }

/* field-input flex variants */
.field-input--flex-1  { flex: 1; }
.field-prefix-wrap { position: relative; display: flex; align-items: center; }
.field-prefix { position: absolute; left: 10px; font-size: 13px; color: var(--text2); pointer-events: none; z-index: 1; }
.field-input--prefixed { padding-left: 22px; }
.field-input--flex-15 { flex: 1.5; }

/* form-row variants */
.form-row--toggles { gap: 20px; align-items: center; padding-top: 4px; }

/* modal-body variants */
.modal-body--flush { gap: 0; padding: 0; }

/* pref-list spacing variant */
.pref-list--mt { margin-top: 8px; }

/* label hint text */
.label-hint { color: var(--muted); font-weight: 400; }

/* confirm modal content */
.confirm-message { color: var(--text2); font-size: 13px; line-height: 1.6; }
.confirm-password-group { margin-top: 12px; }

/* data-dd-item label cursor */
.data-dd-item--label { cursor: pointer; }

/* panel footer button row */
.panel-footer-actions { display: flex; gap: 8px; }

/* md-split fill variant (fv edit mode) */
.md-split--fill { flex: 1; min-height: 0; }

/* md-back-btn SVG size */
.md-back-icon { width: 14px; height: 14px; }

/* tag-dd-btn inline SVG sizes */
.dd-btn-icon    { width: 12px; height: 12px; flex-shrink: 0; }
.dd-btn-chevron { width: 10px; height: 10px; flex-shrink: 0; }

/* ════════════════════════════════════════
   BATCH SELECTION
════════════════════════════════════════ */
.btn-select-mode {
  padding: 6px 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
  transition: all var(--transition); white-space: nowrap;
  font-family: var(--font);
}
.btn-select-mode:hover { background: var(--surface2); color: var(--text); border-color: var(--muted); }
.btn-select-mode.active { background: var(--accent-bg); border-color: var(--accent-soft); color: var(--accent); }

.btn-delete-selected {
  padding: 6px 14px;
  border-radius: var(--r);
  border: 1px solid var(--no-border);
  background: var(--no-bg);
  color: var(--no);
  font-size: 12px; font-weight: 600;
  white-space: nowrap; transition: all .15s;
  font-family: var(--font);
}
.btn-delete-selected:hover { background: var(--no-hover); }

/* Row select checkbox (in td-expand-num when selection mode) */
.row-select-cb {
  width: 16px; height: 16px; border-radius: 3px;
  border: 1.5px solid var(--border);
  background: var(--bg2);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
  margin: 0 auto;
}
.row-select-cb.checked {
  background: var(--accent); border-color: var(--accent);
}
.row-select-cb.checked::after {
  content: '';
  width: 8px; height: 5px;
  border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

/* Header select-all checkbox centering */
.th-expand-num { text-align: center; }

/* Selected row highlight */
tr.exam-row.selected-row { background: var(--accent-bg) !important; }
tr.exam-row.selected-row td { color: var(--text); }

/* ════════════════════════════════════════
   SKELETON LOADER
════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.sk {
  border-radius: 4px;
  height: 10px;
  background: linear-gradient(
    90deg,
    var(--surface2) 25%,
    var(--border)   50%,
    var(--surface2) 75%
  );
  background-size: 600px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

/* Width variants */
.sk-icon  { width: 16px; height: 16px; border-radius: 3px; margin: 0 auto; }
.sk-name  { width: 72%; }
.sk-short { width: 38px; }
.sk-med   { width: 80px; }
.sk-tag   { width: 56px; height: 18px; border-radius: 100px; }
.sk-pill  { width: 48px; height: 18px; border-radius: 100px; }

/* Width jitter — applied via class on individual rows */
.sk-w60 { width: 60%; }
.sk-w70 { width: 70%; }
.sk-w75 { width: 75%; }
.sk-w80 { width: 80%; }
.sk-w90 { width: 90%; }

/* Skeleton table rows */
.skeleton-table tbody tr.skeleton-row {
  border-bottom: 1px solid var(--border2);
}
.skeleton-table tbody tr.skeleton-row td {
  padding: 13px 14px;
  vertical-align: middle;
}
/* Stagger shimmer start per row so they don't pulse in sync */
.skeleton-row:nth-child(1) .sk { animation-delay: 0s;     }
.skeleton-row:nth-child(2) .sk { animation-delay: 0.15s;  }
.skeleton-row:nth-child(3) .sk { animation-delay: 0.3s;   }
.skeleton-row:nth-child(4) .sk { animation-delay: 0.45s;  }
.skeleton-row:nth-child(5) .sk { animation-delay: 0.6s;   }
/* Modal overlay closing */
.modal-overlay.is-closing {
  animation: overlayOut .18s ease forwards;
  pointer-events: none;
}
/* Modal box closing */
.modal-overlay.is-closing .modal {
  animation: modalOut .18s ease forwards;
}
/* Slide panel closing */
.md-panel.is-closing,
.fv-panel.is-closing {
  animation: slideOutRight .2s ease forwards;
}
/* ════════════════════════════════════════
   DRAG-TO-REORDER
════════════════════════════════════════ */
.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  cursor: grab;
  opacity: 0;
  vertical-align: middle;
  transition: color var(--transition), opacity var(--transition);
  user-select: none;
}
.exam-row:hover .drag-handle { opacity: 0.6; color: var(--text2); }
.exam-row:hover .drag-handle:hover { opacity: 1; color: var(--accent); }
.drag-handle:active { cursor: grabbing; }

/* ── Desktop row being dragged: ghost slot ── */
tr.exam-row.drag-dragging {
  opacity: 0.35;
  background: var(--surface2) !important;
  outline: 1px dashed var(--border) !important;
}
tr.exam-row.drag-dragging td {
  color: transparent !important;
}

/* ── Desktop drop-target: sharp accent line above ── */
tr.exam-row.drag-over > td {
  border-top: 2px solid var(--accent) !important;
  background: transparent;
}
tr.exam-row.drag-over {
  background: color-mix(in srgb, var(--accent) 5%, transparent) !important;
}

/* ════════════════════════════════════════
   MOBILE TOUCH DRAG
════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Drag handle — 6-dot grid icon */
  .m-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 100%;
    padding: 0 2px;
    color: var(--muted);
    opacity: 0.4;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    cursor: grab;
  }
  .m-drag-handle svg { display: block; }

  /* Source card — dimmed slot while being dragged */
  .m-card.mc-dragging-src {
    opacity: 0;
    pointer-events: none;
  }

  /* Floating ghost card following the finger */
  .mc-ghost {
    border-radius: var(--r-lg);
    background: var(--surface2);
    border: 1.5px solid var(--accent);
    box-shadow: 0 12px 40px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
    transform: scale(1.025);
    opacity: 0.96;
    overflow: hidden;
    transition: none;
  }

  /* Placeholder slot where the card will land */
  .mc-placeholder {
    border-radius: var(--r-lg);
    background: transparent;
    border: 1.5px dashed var(--accent);
    opacity: 0.5;
    flex-shrink: 0;
    transition: height .1s ease;
  }

  /* Drop-above indicator on the card the dragged item will land before */
  .m-card.mc-drop-above {
    border-top: 2px solid var(--accent) !important;
  }
}
