/* ============================================================================
   Eurowings Staff — design system
   Built on Eurowings' real brand palette (magenta / dark magenta / blue /
   grey — airhex & brandcolorcode-sourced), not a generic purple.
   Structured, ops-tool feel rather than a soft rounded SaaS-dashboard look:
   flat rectangular surfaces, decisive color blocks, no left-accent-border
   cliché on every card. No page-load entrance animation — only
   interaction-driven animation (ripple, modals, toasts, bell, skeletons).
   ============================================================================ */

:root {
  /* Eurowings brand palette */
  --ew-magenta: #B4175E;
  --ew-magenta-dark: #8F174F;
  --ew-blue: #089BC9;
  --ew-blue-light: #7BCBE2;
  --ew-grey: #C8C4C3;

  --ew-accent: var(--ew-magenta);
  --ew-accent-strong: var(--ew-magenta-dark);
  --ew-accent-soft: rgba(180, 23, 94, 0.12);
  --ew-blue-soft: rgba(8, 155, 201, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-card: 0 1px 2px rgba(0,0,0,.35), 0 6px 18px -10px rgba(0,0,0,.4);
  --shadow-pop: 0 14px 38px -10px rgba(0,0,0,.5);

  --ease: cubic-bezier(.4,0,.2,1);
}

/* ---- Dark theme (default) ------------------------------------------------ */
:root,
:root[data-theme="dark"] {
  --bg: #15121a;
  --bg-elevated: #1c1821;
  --surface: #201c27;
  --surface-alt: #2a2432;
  --border: #37303f;
  --text: #f3f0f6;
  --text-muted: #aba1b6;
  --text-faint: #7d7389;
  --success: #38c796;
  --warning: #e2a93b;
  --danger: #e2573f;
}

/* ---- Light theme ----------------------------------------------------------*/
:root[data-theme="light"] {
  --bg: #f6f4f6;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f3eef1;
  --border: #e4dde2;
  --text: #241f26;
  --text-muted: #685f6c;
  --text-faint: #978d9c;
  --success: #1f9d72;
  --warning: #b9790f;
  --danger: #c43e2b;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f6f4f6;
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-alt: #f3eef1;
    --border: #e4dde2;
    --text: #241f26;
    --text-muted: #685f6c;
    --text-faint: #978d9c;
    --success: #1f9d72;
    --warning: #b9790f;
    --danger: #c43e2b;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

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

.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.brand-lockup {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px;
  background: linear-gradient(135deg, var(--ew-magenta-dark), var(--ew-magenta) 65%, var(--ew-blue) 140%);
  margin-bottom: 18px;
}
.brand-badge { width: 30px; height: 30px; border-radius: var(--radius-sm); overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--ew-accent); color: #fff; flex-shrink: 0; }
.brand-lockup .brand-badge { background: rgba(255,255,255,.18); }
.brand-logo-img { width: 100% !important; height: 100% !important; object-fit: cover; }
.brand-name { font-weight: 800; font-size: 14.5px; letter-spacing: .2px; color: #fff; }
.brand-sub { font-size: 10.5px; color: rgba(255,255,255,.75); text-transform: uppercase; letter-spacing: .5px; }

nav { padding: 0 12px; }
.nav-group { margin-bottom: 4px; }
.nav-group-label { font-size: 10.5px; text-transform: uppercase; font-weight: 700; letter-spacing: .6px; color: var(--text-faint); padding: 14px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 600;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-link:hover { background: var(--surface-alt); color: var(--text); }
.nav-link.active { background: var(--ew-accent); color: #fff; }
.nav-link .nav-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }

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

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; border-bottom: 1px solid var(--border); background: var(--bg-elevated);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 16px; font-weight: 800; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle, .icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.theme-toggle:hover, .icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.theme-toggle svg, .icon-btn svg { width: 16px; height: 16px; }

.content { padding: 24px 28px 60px; width: 100%; }

/* ---- Hero / welcome band ---------------------------------------------------*/
.hero-band {
  background: linear-gradient(120deg, var(--ew-magenta-dark) 0%, var(--ew-magenta) 55%, #3a1430 100%);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  color: #fff;
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.hero-band::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(115deg, rgba(255,255,255,.06) 0 2px, transparent 2px 46px);
}
.hero-avatar {
  width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 19px;
  flex-shrink: 0; position: relative; z-index: 1; border: 2px solid rgba(255,255,255,.35);
}
.hero-text { position: relative; z-index: 1; }
.hero-title { font-size: 19px; font-weight: 800; margin-bottom: 3px; }
.hero-sub { font-size: 13px; color: rgba(255,255,255,.85); }

/* ---- Cards -----------------------------------------------------------------*/
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 14.5px; font-weight: 800; }
.card-subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.stat-icon { width: 38px; height: 38px; border-radius: var(--radius-sm); background: var(--ew-accent-soft); color: var(--ew-accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon.blue { background: var(--ew-blue-soft); color: var(--ew-blue); }
.stat-icon svg { width: 18px; height: 18px; }
/* Home: three roomier cards instead of four tight ones */
.stat-grid.stat-grid-lg { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.stat-grid-lg .stat-card { padding: 22px 24px; gap: 18px; }
.stat-grid-lg .stat-icon { width: 52px; height: 52px; }
.stat-grid-lg .stat-icon svg { width: 26px; height: 26px; }
.stat-grid-lg .stat-label { font-size: 13px; margin-bottom: 4px; }
.stat-grid-lg .stat-value { font-size: 26px; }
.stat-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 2px; }
.stat-value { font-size: 20px; font-weight: 800; line-height: 1.1; }

/* ---- Buttons ---------------------------------------------------------------*/
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), opacity .15s var(--ease);
  text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--ew-accent); color: #fff; }
.btn-primary:hover { background: var(--ew-accent-strong); }
.btn-secondary { background: var(--surface-alt); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.9); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-ripple {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: rgba(255,255,255,.45); pointer-events: none;
  animation: ripple .6s var(--ease);
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* ---- Forms -----------------------------------------------------------------*/
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
input[type=text], input[type=date], input[type=password], input[type=email], input[type=file], input[type=url], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-alt); color: var(--text); transition: border-color .15s var(--ease);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ew-accent); }
.inline-note { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; border: 1px solid var(--border); background: var(--surface-alt); }
.inline-note-warn { border-color: rgba(226,169,59,.5); background: rgba(226,169,59,.12); }
.inline-note-danger { border-color: rgba(214,64,42,.5); background: rgba(214,64,42,.1); }
.inline-note-info { border-color: rgba(8,155,201,.45); background: var(--ew-blue-soft); }
select:disabled { opacity: .65; cursor: not-allowed; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-inline { display: grid; grid-template-columns: minmax(180px, 260px) 1fr auto; gap: 10px; align-items: end; }
.form-inline .form-group { margin-bottom: 0; }
@media (max-width: 720px) { .form-row, .form-inline { grid-template-columns: 1fr; } }

/* ---- User picker: searchable name box progressively replacing a plain
   <select class="user-select"> (see initUserPickers in app.js). The real
   select stays in the DOM — shrunk to nothing rather than display:none, so
   it's still focusable and still raises its native "required" validation
   if nothing gets picked. */
.user-picker { position: relative; flex: 1; min-width: 160px; }
.user-picker-input { width: 100%; }
select.user-select-native {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.user-picker-dropdown {
  display: none; position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 230px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 14px 34px rgba(0,0,0,.22);
}
.user-picker-dropdown.open { display: block; }
.user-picker-item { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.user-picker-item:hover { background: var(--surface-alt); }

/* ---- Multi picker: chips + search box replacing a <select multiple
   class="multi-select"> (see initMultiPickers in app.js) — for picking
   several departments or members to grant a role to at once. */
.multi-picker {
  position: relative; flex: 1; min-width: 200px; display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.multi-picker-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.multi-picker-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--ew-accent); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.multi-picker-chip button {
  background: rgba(255,255,255,.22); border: none; color: inherit; width: 16px; height: 16px; line-height: 1;
  border-radius: 50%; cursor: pointer; font-weight: 700; font-size: 11px;
}
.multi-picker-input {
  flex: 1; min-width: 110px; border: none !important; background: transparent !important; padding: 4px 2px !important;
}
.multi-picker-input:focus { outline: none; }
select.multi-select-native {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.multi-picker-dropdown {
  display: none; position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 230px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 14px 34px rgba(0,0,0,.22);
}
.multi-picker-dropdown.open { display: block; }
.multi-picker-item { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.multi-picker-item:hover { background: var(--surface-alt); }

/* ---- Tables ------------------------------------------------------------- */
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: .4px; color: var(--text-faint); padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }

/* ---- Badges ----------------------------------------------------------------*/
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.badge-pending { background: rgba(226,169,59,.16); color: var(--warning); }
.badge-approved { background: rgba(56,199,150,.16); color: var(--success); }
.badge-rejected { background: rgba(226,87,63,.16); color: var(--danger); }

/* ---- Tabs --------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 9px 14px; border: none; background: transparent; color: var(--text-muted); font-weight: 700; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s var(--ease), border-color .15s var(--ease); }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--ew-accent); border-color: var(--ew-accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Notification bell --------------------------------------------------- */
.bell-wrap { position: relative; }
.bell-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: none; border: 1.5px solid var(--bg-elevated); }
.bell-wrap.has-unread .bell-dot { display: block; }
.bell-wrap.ring .icon-btn svg { animation: bell-ring .4s var(--ease); }
@keyframes bell-ring { 0%,100%{transform:rotate(0)} 20%{transform:rotate(14deg)} 40%{transform:rotate(-12deg)} 60%{transform:rotate(8deg)} 80%{transform:rotate(-4deg)} }

.notif-dropdown {
  position: absolute; right: 0; top: calc(100% + 10px); width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); padding: 8px; display: none; z-index: 50;
  opacity: 0; transform: translateY(-6px) scale(.98); transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.notif-dropdown.open { display: block; }
.notif-dropdown.open.shown { opacity: 1; transform: translateY(0) scale(1); }
.notif-item { padding: 10px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.notif-item:hover { background: var(--surface-alt); }
.notif-item.unread { border-left: 2px solid var(--ew-accent); }
.notif-empty { padding: 20px; text-align: center; color: var(--text-faint); font-size: 13px; }

.skeleton { background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 37%, var(--surface-alt) 63%); background-size: 400% 100%; animation: shimmer 1.2s ease-in-out infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---- Modals ---------------------------------------------------------------*/
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,8,12,.6); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 24px; box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(10px) scale(.97); transition: opacity .18s var(--ease), transform .18s var(--ease); }
.modal-backdrop.open.shown .modal { opacity: 1; transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 15px; font-weight: 800; }

/* ---- Toasts -----------------------------------------------------------------*/
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--ew-accent); border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow-pop); font-size: 13px; min-width: 240px; opacity: 0; transform: translateX(16px); transition: opacity .2s var(--ease), transform .2s var(--ease); }
.toast.shown { opacity: 1; transform: translateX(0); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

/* ---- Loading veil + progress bar -------------------------------------------*/
.page-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--ew-accent); z-index: 300; transition: width .3s var(--ease), opacity .2s var(--ease); }
.page-progress.active { width: 70%; }
.page-progress.done { width: 100%; opacity: 0; }

.loading-veil { position: fixed; inset: 0; background: rgba(8,6,12,.35); backdrop-filter: blur(1px); display: none; align-items: center; justify-content: center; z-index: 250; }
.loading-veil.active { display: flex; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 36px 20px; color: var(--text-faint); font-size: 13px; }

/* ---- Login (split screen) -------------------------------------------------*/
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
@media (max-width: 860px) { .auth-shell { grid-template-columns: 1fr; } .auth-visual { display: none; } }

.auth-visual {
  background: linear-gradient(160deg, #26101f 0%, var(--ew-magenta-dark) 48%, var(--ew-magenta) 85%);
  position: relative; overflow: hidden; color: #fff; padding: 48px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.auth-visual::before {
  /* Abstract diagonal-stripe motif, nodding to the real livery without reproducing the logo artwork */
  content: ""; position: absolute; inset: -10% -10%;
  background:
    repeating-linear-gradient(115deg, transparent 0 64px, rgba(8,155,201,.22) 64px 90px, transparent 90px 154px),
    repeating-linear-gradient(115deg, transparent 0 18px, rgba(255,255,255,.05) 18px 20px);
}
.auth-visual-content { position: relative; z-index: 1; }
.auth-visual-title { font-size: 27px; font-weight: 800; line-height: 1.2; margin-bottom: 10px; }
.auth-visual-sub { font-size: 14px; opacity: .85; max-width: 380px; }

.auth-panel { background: var(--bg-elevated); display: flex; flex-direction: column; padding: 32px 48px; }
.auth-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: auto; }
.auth-form-wrap { max-width: 360px; width: 100%; margin: 0 auto; padding: 40px 0; }
.auth-heading { font-size: 23px; font-weight: 800; margin-bottom: 6px; }
.auth-subheading { font-size: 13.5px; color: var(--text-muted); margin-bottom: 26px; }

.auth-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 700; font-size: 13.5px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; margin-bottom: 12px;
  transition: filter .15s var(--ease), background .15s var(--ease);
}
.auth-btn svg { width: 18px; height: 18px; }
.auth-btn-discord { background: #5865F2; color: #fff; }
.auth-btn-discord:hover { filter: brightness(.92); }
.auth-btn-roblox { background: var(--surface-alt); color: var(--text); border-color: var(--border); }
.auth-btn-roblox:hover { background: var(--border); }

.auth-btn-off { background: var(--surface-alt); color: var(--text-faint); border-color: var(--border); border-style: dashed; cursor: not-allowed; margin-bottom: 6px; }
.auth-btn-off svg { opacity: .6; }
.auth-off-note { font-size: 12.5px; color: var(--text-muted); margin: 0 2px 14px; line-height: 1.45; }
.auth-banners { max-width: 360px; width: 100%; margin: 24px auto 0; }
.auth-banners .ann-banner:last-child { margin-bottom: 0; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--text-faint); font-size: 11.5px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.auth-error { background: rgba(226,87,63,.12); border: 1px solid rgba(226,87,63,.3); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 18px; }

.auth-footer { margin-top: auto; font-size: 11.5px; color: var(--text-faint); display: flex; flex-direction: column; gap: 4px; }

/* ---- App footer / non-partner disclaimer ---------------------------------*/
.app-footer { padding: 18px 28px 28px; font-size: 11px; color: var(--text-faint); border-top: 1px solid var(--border); margin-top: 20px; }

/* ---- Mobile navigation + table scrolling (base, desktop-neutral) -----------*/
.nav-toggle { display: none; }
.nav-backdrop { display: none; }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Responsive -------------------------------------------------------------
   <= 900px: the sidebar becomes an off-canvas drawer opened from a burger
   button in the topbar; <= 720px: forms, pickers, tabs, modals and toasts
   are re-flowed for thumbs. Desktop layout is untouched above these widths. */
@media (max-width: 900px) {
  .nav-toggle { display: flex; flex-shrink: 0; }
  .topbar { padding: 10px 14px; gap: 10px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .topbar-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }

  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 90; width: min(280px, 84vw);
    overflow-y: auto; transform: translateX(-102%); transition: transform .22s var(--ease);
    box-shadow: var(--shadow-pop);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 80; background: rgba(10,8,12,.55);
    opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  .nav-link { padding: 11px 10px; font-size: 14px; }
  .content { padding: 18px 14px calc(48px + env(safe-area-inset-bottom)); }
  .app-footer { padding: 16px 14px 24px; }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  .card { padding: 15px 14px; border-radius: var(--radius-sm); }
  .card-header { margin-bottom: 12px; }

  /* Hero band: stack avatar above the text on narrow screens */
  .hero-band { padding: 18px 16px; gap: 14px; }
  .hero-title { font-size: 17px; }
  .hero-sub { font-size: 12.5px; }

  /* Two stat cards per row instead of one tall column */
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-grid.stat-grid-lg { grid-template-columns: 1fr; }
  .stat-grid-lg .stat-card { padding: 16px 18px; }
  .stat-grid-lg .stat-value { font-size: 22px; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-value { font-size: 17px; }

  /* 16px inputs stop iOS Safari zooming the page on focus; taller touch targets */
  input[type=text], input[type=date], input[type=password], input[type=email], input[type=file], select, textarea { font-size: 16px; padding: 11px 12px; }
  .btn { padding: 11px 16px; min-height: 42px; }
  .btn-sm { padding: 8px 12px; min-height: 36px; }
  .icon-btn, .theme-toggle { width: 38px; height: 38px; }

  /* Forms laid out as a flex row (picker + select + button) wrap and stack */
  form.flex { flex-wrap: wrap; }
  form.flex > input, form.flex > select, form.flex > .user-picker, form.flex > .multi-picker { flex: 1 1 100%; min-width: 0; }
  form.flex > .btn { flex: 1 1 auto; }
  .user-picker, .multi-picker { min-width: 0; }

  /* Tables keep one line per row and scroll sideways inside their card
     (see .table-scroll); action cells (Accept / Refuse / ...) stay on one line too */
  .data-table th, .data-table td { padding: 9px 10px; white-space: nowrap; }
  td.flex { flex-wrap: nowrap; }

  /* Tabs scroll sideways instead of wrapping onto a second line */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-bottom: 16px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex-shrink: 0; white-space: nowrap; padding: 10px 13px; }

  /* Notifications: pin the dropdown to the viewport edges so it can't spill off-screen */
  .notif-dropdown { position: fixed; left: 10px; right: 10px; top: calc(58px + env(safe-area-inset-top)); width: auto; max-height: 70vh; }

  /* Modals: near full width, scrollable, close to a bottom sheet */
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-width: none; max-height: 92vh; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-sm); }

  /* Toasts span the width, clear of the home indicator */
  .toast-stack { left: 10px; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; }

  /* Sign-in */
  .auth-panel { padding: 22px 18px; }
  .auth-form-wrap { padding: 28px 0; }
}
.items-center { align-items: center; }
.items-end { align-items: end; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }

/* ---- Schedule (weekly calendar) ------------------------------------------ */
.schedule-card { --sch-flight: var(--ew-magenta); --sch-mine: var(--ew-blue); --sch-cancelled: #7d7a7a; --sch-event: #1F9D74; --sch-leave: #E2A93B; --sch-suspended: #D6402A; }
.schedule-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.schedule-nav { display: flex; gap: 6px; }
.schedule-range { font-weight: 700; font-size: 15px; flex: 1 1 auto; }
.schedule-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-muted); }
.schedule-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sch-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.sch-dot-flight { background: var(--sch-flight); }
.sch-dot-mine { background: var(--sch-mine); }
.sch-dot-cancelled { background: var(--sch-cancelled); opacity: .6; }
.sch-dot-event { background: var(--sch-event); }
.sch-dot-leave { background: var(--sch-leave); }
.sch-dot-suspended { background: var(--sch-suspended); }

.schedule-scroll { position: relative; max-height: 72vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); transition: opacity .15s var(--ease); }
.schedule-scroll.is-loading { opacity: .55; }
.sch-grid { display: grid; grid-template-columns: 56px repeat(7, minmax(116px, 1fr)); }
.sch-corner, .sch-dayhead { position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--border); }
.sch-corner { left: 0; z-index: 6; }
.sch-dayhead { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border-left: 1px solid var(--border); }
.sch-dow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.sch-dom { font-size: 18px; font-weight: 800; line-height: 1.1; }
.sch-dayhead.is-today .sch-dow { color: var(--ew-accent); }
.sch-dayhead.is-today .sch-dom { background: var(--ew-accent); color: #fff; border-radius: 999px; min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }

.sch-dayhead.is-suspended { background: linear-gradient(rgba(214,64,42,.18), rgba(214,64,42,.18)), var(--surface); }
.sch-dayhead.is-leave { background: linear-gradient(rgba(226,169,59,.2), rgba(226,169,59,.2)), var(--surface); }
.sch-daychip { margin-top: 3px; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .02em; color: #fff; background: var(--sch-suspended); white-space: nowrap; }
.sch-daychip.is-leave { background: var(--sch-leave); color: #1B1405; }
.sch-grid .sch-cell.is-suspended { background: repeating-linear-gradient(135deg, rgba(214,64,42,.16) 0 8px, rgba(214,64,42,.09) 8px 16px); box-shadow: inset 3px 0 0 var(--sch-suspended); }
.sch-grid .sch-cell.is-leave { background: repeating-linear-gradient(135deg, rgba(226,169,59,.18) 0 8px, rgba(226,169,59,.1) 8px 16px); }
.sch-tip-bio { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); white-space: pre-wrap; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.sch-hour { position: sticky; left: 0; z-index: 3; background: var(--surface); min-height: 34px; padding: 6px 8px 0 0; text-align: right; font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--border); }
.sch-hour.is-busy { min-height: 54px; color: var(--text); font-weight: 600; }
.sch-cell { min-height: 34px; padding: 3px; display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); min-width: 0; }
.sch-cell.is-busy { min-height: 54px; }
.sch-cell.is-today { background: var(--ew-accent-soft); }
.sch-cell.is-now { box-shadow: inset 0 2px 0 var(--danger); }

.sch-event { display: flex; flex-direction: column; gap: 1px; width: 100%; flex: none; text-align: left; overflow: hidden; cursor: pointer; font: inherit; color: #fff;
  padding: 5px 8px; border: 0; border-left: 3px solid rgba(255,255,255,.55); border-radius: 6px;
  background: var(--sch-flight); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .12s var(--ease), box-shadow .12s var(--ease), filter .12s var(--ease); }
.sch-event:hover, .sch-event:focus-visible { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.35); filter: brightness(1.08); outline: none; }
.sch-event.is-mine { background: var(--sch-mine); }
.sch-event.is-event { background: var(--sch-event); }
.sch-event.is-cancelled { background: var(--sch-cancelled); opacity: .6; }
.sch-event.is-cancelled .sch-ev-code { text-decoration: line-through; }
.sch-ev-top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.sch-ev-code { font-weight: 800; font-size: 12.5px; line-height: 1.25; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sch-ev-time { font-size: 11px; opacity: .92; }
.sch-ev-route { font-size: 11.5px; opacity: .95; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.schedule-tip { position: fixed; z-index: 400; min-width: 210px; max-width: 280px; padding: 12px 14px; pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); font-size: 13px; }
.schedule-tip[hidden] { display: none; }
.sch-tip-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 15px; }
.sch-tip-status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ew-accent-soft); color: var(--ew-accent); }
.sch-tip-status.is-cancelled { background: rgba(125,122,122,.2); color: var(--text-muted); }
.sch-tip-row { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; }
.sch-tip-label { color: var(--text-muted); flex-shrink: 0; }
.sch-tip-value { text-align: right; font-weight: 600; }
.sch-tip-row.is-mine { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.sch-tip-row.is-mine .sch-tip-value { color: var(--ew-blue); }

@media (max-width: 720px) {
  .schedule-range { flex-basis: 100%; order: 2; }
  .schedule-legend { order: 3; }
  .sch-grid { grid-template-columns: 46px repeat(7, 112px); }
}

/* ---- Announcements (banners + popups) ------------------------------------- */
.ann-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 14px; border-radius: var(--radius-md);
  background: var(--ann-bg, var(--ew-accent)); color: var(--ann-fg, #fff); box-shadow: 0 4px 14px -6px rgba(0,0,0,.35);
  transition: opacity .2s var(--ease), transform .2s var(--ease), max-height .2s var(--ease); }
.ann-banner.is-leaving { opacity: 0; transform: translateY(-6px); }
.ann-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
.ann-text { flex: 1 1 auto; min-width: 0; font-size: 13.5px; line-height: 1.5; }
.ann-title { font-weight: 800; margin-right: 6px; }
.ann-text a, .ann-popup-body a { color: inherit; text-decoration: underline; }
.ann-btn { flex-shrink: 0; padding: 6px 14px; border-radius: 999px; border: 1.5px solid currentColor; color: inherit; font-size: 12.5px; font-weight: 700; text-decoration: none; white-space: nowrap; }
a.ann-btn:hover { background: rgba(255,255,255,.18); }
.ann-close { flex-shrink: 0; background: transparent; border: 0; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; opacity: .8; padding: 0 4px; }
.ann-close:hover { opacity: 1; }

body.ann-lock { overflow: hidden; }
.ann-popup-backdrop { position: fixed; inset: 0; z-index: 250; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10,8,12,.62); opacity: 0; transition: opacity .2s var(--ease); }
.ann-popup-backdrop[hidden] { display: none; }
.ann-popup-backdrop.is-open { opacity: 1; }
.ann-popup { width: 100%; max-width: 460px; max-height: 88vh; overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); transform: translateY(12px) scale(.97); transition: transform .22s var(--ease); }
.ann-popup-backdrop.is-open .ann-popup { transform: none; }
.ann-popup-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; background: var(--ann-bg, var(--ew-accent)); color: var(--ann-fg, #fff); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.ann-popup-head .ann-title { flex: 1 1 auto; margin: 0; font-size: 16px; }
.ann-popup-body { padding: 18px; font-size: 14px; line-height: 1.6; }
.ann-popup-body a { color: var(--ew-accent); }
.ann-popup-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 0 18px 18px; }
.ann-popup-actions .btn { text-decoration: none; }

/* admin */
.ann-login-page { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.login-method { padding: 14px 0; border-top: 1px solid var(--border); }
.login-method:first-of-type { border-top: 0; padding-top: 4px; }
.login-method-switch { font-size: 14px; align-items: center; margin: 0; }
.login-method-switch input { width: 18px; height: 18px; margin: 0; }
.ann-chip { display: inline-block; max-width: 220px; padding: 3px 10px; border-radius: 999px; background: var(--ann-bg); color: var(--ann-fg); font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.ann-preview-wrap { margin-bottom: 18px; padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius-md); background: var(--surface-alt); }
.ann-preview-label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.ann-preview .ann-banner { margin: 0; }
.ann-preview .ann-banner .ann-body { white-space: pre-wrap; }
.ann-popup-static { max-width: 420px; margin: 0 auto; transform: none; }
.ann-popup-static .ann-popup-body { white-space: pre-wrap; }
.ann-popup-static .btn { cursor: default; }
.ann-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.ann-swatch { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; cursor: pointer; font-weight: 600; }
.ann-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.ann-swatch span { display: inline-flex; align-items: center; justify-content: center; width: 54px; height: 38px; border-radius: 10px; font-weight: 800; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--border); transition: transform .12s var(--ease); }
.ann-swatch .ann-swatch-custom { background: conic-gradient(#B4175E, #089BC9, #1F9D74, #E2A93B, #B4175E); color: #fff; }
.ann-swatch em { font-style: normal; font-size: 11px; color: var(--text-muted); }
.ann-swatch input:checked + span { border-color: var(--text); transform: scale(1.06); }
.ann-swatch input:focus-visible + span { outline: 2px solid var(--ew-accent); outline-offset: 2px; }
.ann-check { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 6px; font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer; }
.ann-check input { margin-top: 3px; flex-shrink: 0; }
.ann-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 14px; margin-top: 8px; }
.ann-checks.is-disabled { opacity: .45; }
input[type=color] { width: 100%; height: 40px; padding: 3px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-alt); cursor: pointer; }
[hidden] { display: none !important; }

@media (max-width: 720px) {
  .ann-banner { flex-wrap: wrap; padding: 12px; }
  .ann-text { flex-basis: calc(100% - 70px); }
  .ann-popup-backdrop { align-items: flex-end; padding: 10px; }
  .ann-popup { max-width: none; }
}

/* Sanction justification shown under the reason */
.sanction-justification { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--border); background: var(--surface-alt); border-radius: 0 6px 6px 0; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; max-width: 460px; color: var(--text-muted, var(--text)); }
.sanction-justification .text-faint { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }

/* Events lasting several hours: one colour band through every hour they cover */
.sch-event.is-span-start { flex: 1 1 auto; margin-bottom: -3px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sch-event.is-cont { flex: 1 1 auto; min-height: 28px; border-radius: 0; margin: -3px 0; box-shadow: none; justify-content: flex-start; padding-top: 5px; padding-bottom: 3px; }
.sch-event.is-cont:hover, .sch-event.is-cont:focus-visible { transform: none; }
.sch-event.is-cont.is-span-end { margin-bottom: 0; border-radius: 0 0 6px 6px; }
.sch-event.is-cont .sch-ev-code { font-size: 11.5px; }

/* Home: sub departments widget */
.sub-dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.sub-dept { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; }
.sub-dept-name { font-weight: 700; font-size: 14px; }

/* Row of buttons / inline forms (the older "flex" helper class has no display rule) */
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-row > form { margin: 0; }

/* Department responsibles as removable chips */
.resp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.resp-chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 6px 4px 12px; background: var(--ew-accent-soft); border: 1px solid var(--border); border-radius: 999px; font-size: 13px; font-weight: 600; }
.resp-chip button { border: 0; background: rgba(0,0,0,.07); color: var(--danger); font: inherit; font-size: 11.5px; font-weight: 700; line-height: 1; padding: 5px 10px; border-radius: 999px; cursor: pointer; }
.resp-chip button:hover { background: var(--danger); color: #fff; }

/* Home: base change + department change as two small cards on one row */
.mini-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: stretch; }
.mini-row > .card { margin-bottom: 0; }
.card-compact { padding: 14px 16px; }
.card-compact .card-header { margin-bottom: 10px; }
.card-compact .card-title { font-size: 14px; }
.mini-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px 10px; align-items: end; }
.mini-form .form-group { margin: 0; min-width: 0; }
.mini-form label { font-size: 11px; margin-bottom: 3px; }
.mini-form select, .mini-form input[type="text"] { height: 34px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.mini-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.35; align-self: center; }
@media (max-width: 760px) {
  .mini-row { grid-template-columns: 1fr; }
  .mini-form { grid-template-columns: 1fr; }
  .mini-form select, .mini-form input[type="text"] { font-size: 16px; height: 40px; }
  .mini-form .btn { justify-self: start; }
}

/* Home stat cards: small line under the value (department responsibles, base supervisors) */
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.3; }

/* ===========================================================================
   Forms (builder, fill page, results) and Base File
   =========================================================================== */
:root { --fc1: #b4175e; --fc2: #3a86d9; --fc3: #1f9d72; --fc4: #d9962b; --fc5: #7a5ad6; --fc6: #d9553f; --fc7: #2aa7b8; --fc8: #8a8f98; }
.inline-form { display: inline-flex; margin: 0; }
a.tab-btn { text-decoration: none; display: inline-block; }
.nav-badge { margin-left: auto; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--ew-accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 16px; }
.nav-link.active .nav-badge { background: #fff; color: var(--ew-accent); }

/* Home hint */
.form-hint { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--ew-accent); border-radius: var(--radius-md); background: var(--ew-accent-soft); color: var(--text); text-decoration: none; font-size: 13.5px; }
.form-hint strong { font-weight: 700; }
.form-hint .form-hint-go { margin-left: auto; font-weight: 700; color: var(--ew-accent); white-space: nowrap; }

/* Forms page: tiles */
.form-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.form-tile { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-alt); color: var(--text); text-decoration: none; border-top: 4px solid var(--ew-accent); transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.form-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.14); }
.form-tile-title { font-weight: 700; font-size: 15px; }
.form-tile-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.4; }
.form-tile-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; }
.form-tile-cta { font-size: 12.5px; font-weight: 700; color: var(--ew-accent); }

/* Builder */
.fb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.fb-side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.fb-side .card { margin-bottom: 0; }
.fb-head { border-top: 6px solid var(--ew-accent); }
.fb-title { font-size: 22px; font-weight: 700; border: 0; border-bottom: 2px solid var(--border); border-radius: 0; background: transparent; padding-left: 0; }
.fb-title:focus { border-bottom-color: var(--ew-accent); }
.fb-desc { margin-top: 10px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; padding-left: 0; resize: vertical; font-size: 13.5px; }
.fb-questions { display: flex; flex-direction: column; }
.fb-q { position: relative; padding: 18px 18px 12px 42px; border-left: 4px solid transparent; }
.fb-q:focus-within { border-left-color: var(--ew-accent); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.fb-q-section { border-left-color: var(--fc2); background: var(--surface-alt); }
.fb-handle { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); cursor: grab; color: var(--text-faint); font-size: 16px; letter-spacing: -3px; user-select: none; padding: 8px 2px; }
.fb-handle:active { cursor: grabbing; }
.fb-q-top { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 10px; }
.fb-q-label { font-size: 15px; font-weight: 600; background: var(--surface-alt); }
.fb-q-help { margin-top: 8px; font-size: 12.5px; border: 0; border-bottom: 1px dashed var(--border); border-radius: 0; background: transparent; padding-left: 0; }
.fb-q-body { margin-top: 12px; }
.fb-ghost { color: var(--text-faint); border-bottom: 1px dotted var(--border); padding: 6px 0; font-size: 13px; max-width: 60%; }
.fb-ghost-tall { padding: 16px 0; max-width: 90%; }
.fb-choices { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.fb-choice { display: flex; align-items: center; gap: 10px; }
.fb-choice-mark { width: 14px; height: 14px; border: 2px solid var(--text-faint); flex-shrink: 0; }
.fb-choice-mark.rd { border-radius: 50%; }
.fb-choice-mark.sq { border-radius: 3px; }
.fb-choice-num { width: 20px; color: var(--text-faint); font-size: 13px; text-align: right; flex-shrink: 0; }
.fb-choice-input { border: 0; border-bottom: 1px solid transparent; border-radius: 0; background: transparent; padding-left: 2px; }
.fb-choice-input:hover, .fb-choice-input:focus { border-bottom-color: var(--border); }
.fb-scale { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.fb-scale-pick select { width: auto; display: inline-block; padding: 5px 8px; }
.fb-scale-labels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fb-q-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.fb-q-foot .icon-btn:disabled { opacity: .35; cursor: default; }
.fb-required { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.fb-required input { width: auto; }
.fb-add { margin: 4px 0 24px; }
.fb-dragging { opacity: .45; }
.fb-drop-before { box-shadow: 0 -4px 0 var(--ew-accent); }
.fb-drop-after { box-shadow: 0 4px 0 var(--ew-accent); }
.fb-radio { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin-bottom: 8px; cursor: pointer; font-weight: 400; }
.fb-radio input { width: auto; margin-top: 3px; }
.fb-link-row { display: flex; gap: 6px; }
.fb-link-row input { font-size: 12px; }
.fb-target { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.fb-target select { font-size: 12.5px; padding: 7px 8px; }
.fb-save { margin-top: 2px; }
@media (max-width: 980px) {
  .fb-layout { grid-template-columns: 1fr; }
  .fb-side { position: static; }
  .fb-q-top { grid-template-columns: 1fr; }
}

/* Fill page */
.fill-wrap { max-width: 760px; margin: 0 auto; }
.fill-head { border-top: 6px solid var(--ew-accent); }
.fill-title { margin: 0 0 6px; font-size: 24px; }
.fill-desc { color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.fill-wrap .inline-note { margin-bottom: 14px; }
.fq { padding: 18px 20px; }
.fq-section { background: var(--surface-alt); border-left: 4px solid var(--fc2); }
.fq-section .fq-title { font-size: 16px; }
.fq-title { font-size: 15px; font-weight: 600; }
.fq-req { color: var(--danger); }
.fq-help { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.fq-body { margin-top: 12px; }
.fq-body input[type=text], .fq-body input[type=date], .fq-body select { max-width: 420px; }
.fq-choice { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; cursor: pointer; font-weight: 400; }
.fq-choice input { width: auto; }
.fq-scale { display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap; }
.fq-scale-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; min-width: 40px; font-weight: 600; }
.fq-scale-opt input { width: auto; }
.fq-scale-end { font-size: 12px; color: var(--text-muted); align-self: center; max-width: 120px; }

/* Results */
.fr-progress { height: 8px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.fr-progress span { display: block; height: 100%; background: var(--ew-accent); border-radius: 999px; }
.fr-rates { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-bottom: 22px; }
.fr-q { padding: 16px 0; border-top: 1px solid var(--border); }
.fr-q-title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.fr-section { margin: 20px 0 0; padding: 8px 12px; background: var(--surface-alt); border-left: 4px solid var(--fc2); font-weight: 700; border-radius: 0 6px 6px 0; }
.fr-chart-row { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.fr-donut { width: 130px; height: 130px; border-radius: 50%; position: relative; flex-shrink: 0; }
.fr-donut::after { content: ''; position: absolute; inset: 28px; background: var(--surface); border-radius: 50%; }
.fr-donut span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1; font-weight: 700; font-size: 20px; }
.fr-bars { flex: 1 1 280px; min-width: 0; }
.fr-bar-row { display: grid; grid-template-columns: minmax(90px, 220px) minmax(0, 1fr) 90px; gap: 10px; align-items: center; margin: 5px 0; font-size: 13px; }
.fr-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-bar { height: 12px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.fr-bar span { display: block; height: 100%; border-radius: 999px; min-width: 2px; }
.fr-bar-val { font-size: 12px; color: var(--text-muted); text-align: right; white-space: nowrap; }
.fr-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.fr-hist { display: flex; align-items: flex-end; gap: 8px; height: 150px; }
.fr-hist-col { flex: 1; max-width: 64px; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.fr-hist-bar { width: 100%; flex: 1; display: flex; align-items: flex-end; background: var(--surface-alt); border-radius: 6px 6px 0 0; overflow: hidden; }
.fr-hist-bar span { display: block; width: 100%; background: var(--fc1); min-height: 2px; }
.fr-hist-n { font-size: 12px; color: var(--text-muted); }
.fr-hist-l { font-size: 12px; font-weight: 600; }
.fr-texts { display: flex; flex-direction: column; gap: 8px; }
.fr-text { padding: 8px 12px; background: var(--surface-alt); border-radius: 8px; font-size: 13.5px; line-height: 1.45; }
.fr-split { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.fr-people { max-height: 640px; overflow-y: auto; }
.fr-person { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; color: var(--text); text-decoration: none; background: var(--surface); }
.fr-person:hover { background: var(--surface-alt); }
.fr-person.active { border-color: var(--ew-accent); background: var(--ew-accent-soft); }
.fr-person-name { font-weight: 600; font-size: 13.5px; }
.fr-person.unread .fr-person-name { font-weight: 800; }
.fr-person-meta { grid-column: 1; font-size: 11.5px; color: var(--text-faint); }
.fr-new { grid-row: 1; grid-column: 2; background: var(--ew-accent); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; align-self: center; }
.fr-detail { min-width: 0; }
.fr-answer { padding: 10px 0; border-bottom: 1px solid var(--border); }
.fr-answer-q { font-size: 12.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 3px; }
.fr-answer-a { font-size: 14px; line-height: 1.5; }
.fr-read { margin: 0; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; }
@media (max-width: 860px) {
  .fr-split { grid-template-columns: 1fr; }
  .fr-people { max-height: 260px; }
  .fr-bar-row { grid-template-columns: minmax(70px, 120px) minmax(0, 1fr) 80px; }
}

/* Base file */
.bf-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 20px; }
.bf-facts > div { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.bf-facts .text-faint { font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.bf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.bf-grid > .card { margin-bottom: 16px; }
.bf-depts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.bf-dept { padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-alt); color: var(--text); text-decoration: none; font-size: 12.5px; }
.bf-dept strong { margin-left: 4px; color: var(--ew-accent); }
.bf-dept.active, .bf-dept:hover { border-color: var(--ew-accent); background: var(--ew-accent-soft); }

/* ===========================================================================
   Forms: graded forms, more question types, files, marks
   =========================================================================== */
.fq-pts { margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--ew-accent-soft); color: var(--ew-accent); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.fq-order-hint { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.fq-order { list-style: decimal; margin: 0; padding-left: 26px; display: flex; flex-direction: column; gap: 6px; max-width: 520px; }
.fq-order-item { padding: 6px 8px 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-alt); }
.fq-order-item::marker { font-weight: 700; color: var(--text-faint); }
.fq-order-item { display: list-item; }
.fq-order-item .fq-order-text { display: inline-block; vertical-align: middle; width: calc(100% - 78px); }
.fq-order-btns { float: right; display: inline-flex; gap: 4px; }
.fq-match { display: flex; flex-direction: column; gap: 8px; max-width: 620px; }
.fq-match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; }
.fq-match-left { padding: 8px 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.fq-file { padding: 4px 0; font-size: 13.5px; }
.fq-review { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.fq-score { align-self: flex-start; padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: 12.5px; background: var(--surface-alt); }
.fq-score.ok { background: rgba(56,199,150,.16); color: var(--success); }
.fq-score.part { background: rgba(226,169,59,.16); color: var(--warning); }
.fq-score.ko { background: rgba(226,87,63,.16); color: var(--danger); }
.fq-correct, .fq-comment { padding: 6px 10px; border-left: 3px solid var(--border); background: var(--surface-alt); border-radius: 0 6px 6px 0; }
.fq-correct .text-faint, .fq-comment .text-faint { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.fill-mark { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; border-top: 6px solid var(--success); }
.fill-mark-score { font-size: 34px; font-weight: 800; }
.fill-mark-score span { font-size: 18px; color: var(--text-muted); font-weight: 600; }
.fill-mark-pct { font-size: 18px; font-weight: 700; color: var(--text-muted); }
.fill-mark-feedback { flex-basis: 100%; padding: 8px 12px; background: var(--surface-alt); border-radius: 8px; font-size: 13.5px; line-height: 1.5; }
.fill-mark-feedback .text-faint { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.mark-score { font-weight: 800; font-size: 15px; }
.mark-score.ok { color: var(--success); }
.mark-score.ko { color: var(--danger); }

/* Builder additions */
.fb-grade { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; padding: 8px 12px; background: var(--ew-accent-soft); border-radius: 8px; font-size: 13px; }
.fb-grade label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; }
.fb-points { width: 80px; padding: 5px 8px; }
.fb-correct { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 12.5px; font-weight: 600; color: var(--success); cursor: pointer; white-space: nowrap; }
.fb-correct input { width: auto; }
.fb-key-title { font-size: 12.5px; color: var(--text-muted); margin: 8px 0 6px; }
.fb-key-inline, .fb-num-key label { display: inline-flex; align-items: center; gap: 8px; margin: 10px 14px 0 0; font-size: 13px; font-weight: 600; }
.fb-num-key { display: flex; flex-wrap: wrap; }
.fb-num-key input, .fb-key-inline input { width: 150px; }
.fb-pairs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.fb-pair { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.fb-pair-arrow { text-align: center; color: var(--text-faint); }
.fb-partial { display: inline-flex; align-items: center; gap: 6px; margin: 8px 16px 0 0; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.fb-partial input { width: auto; }
.fb-file-opts { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0 4px; font-size: 13px; }
.fb-file-opts label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.fb-file-opts select { width: auto; }
.fb-file-types { display: flex; flex-wrap: wrap; }
.fb-choice-mark.ok { border: 0; color: var(--success); font-weight: 800; width: 14px; text-align: center; }
.fb-tf-text { flex: 1; font-size: 14px; }
.fb-total { font-size: 13.5px; margin: 8px 0; }

/* Results: grading */
.fr-success { font-size: 12.5px; margin: -4px 0 10px; color: var(--text-muted); }
.fr-success-pct { font-weight: 800; }
.fr-success-pct.ok { color: var(--success); }
.fr-success-pct.ko { color: var(--danger); }
.fr-grade-total { margin-bottom: 8px; font-size: 14px; }
.fr-total-score { font-size: 22px; font-weight: 800; }
.fr-grade-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.fr-grade-row label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 700; font-size: 13px; white-space: nowrap; }
.fr-points { width: 70px; padding: 5px 8px; text-align: right; }
.fr-comment-input { flex: 1 1 220px; min-width: 0; padding: 6px 10px; font-size: 13px; }
.fr-expected { margin-top: 6px; font-size: 12.5px; padding: 4px 10px; border-left: 3px solid var(--success); background: var(--surface-alt); border-radius: 0 6px 6px 0; }
.fr-expected .text-faint { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }
.fr-person-score { grid-column: 2; grid-row: 2; font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-align: right; }
.fr-person-score.todo { color: var(--warning); }
.fr-marks-pub { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-alt); }
.fr-pub-form { flex: 1 1 360px; }

/* Marks typed in by hand (Results > Marks) */
.fr-manual { margin: 0 0 14px; }
.fr-manual > summary, .fr-manual-row > summary { list-style: none; cursor: pointer; display: inline-flex; }
.fr-manual > summary::-webkit-details-marker, .fr-manual-row > summary::-webkit-details-marker { display: none; }
.fr-manual-box { margin-top: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-alt); max-width: 460px; }
.fr-manual-row[open] .fr-manual-box { position: absolute; right: 24px; z-index: 30; box-shadow: var(--shadow-pop); background: var(--surface); }
.fr-manual-form .form-group { margin-bottom: 10px; }

/* ---- My Warnings: one card per record, severity colour on the left, who issued it at the bottom ---- */
.disc-head { margin: 0 0 18px; }
.disc-title { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.disc-sub { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.disc-card { --disc-accent: var(--success); position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px 24px 20px 26px; overflow: hidden; box-shadow: var(--shadow-card); }
.disc-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--disc-accent); }
.disc-warn { --disc-accent: var(--warning); }
.disc-danger { --disc-accent: var(--danger); }
.disc-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.disc-icon { display: inline-flex; color: var(--text-muted); }
.disc-icon svg { width: 18px; height: 18px; }
.disc-type { margin: 0; font-size: 17px; font-weight: 700; flex: 1; min-width: 0; }
.disc-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.disc-label { font-size: 11.5px; color: var(--text-faint); margin-bottom: 3px; }
.disc-value { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.disc-value svg { width: 14px; height: 14px; color: var(--text-muted); }
.disc-block { margin-bottom: 14px; }
.disc-text { font-size: 14px; line-height: 1.55; white-space: normal; overflow-wrap: anywhere; }
.disc-muted { color: var(--text-muted); font-size: 13.5px; }
.disc-foot { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.disc-issuer { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.disc-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: var(--surface-alt); flex-shrink: 0; }
.disc-avatar-wrap { position: relative; display: inline-flex; width: 42px; height: 42px; flex-shrink: 0; }
.disc-avatar-img { position: absolute; inset: 0; }
.disc-avatar-fallback { display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--ew-accent); }
.disc-issuer-name { font-weight: 700; font-size: 14px; }
.disc-issuer-role { font-size: 12.5px; color: var(--text-muted); }
.disc-proof { margin-left: auto; }
@media (max-width: 480px) { .disc-facts { grid-template-columns: 1fr; } }

/* ---- Audit log ---- */
.badge-neutral { background: var(--surface-alt); color: var(--text-muted); }
.audit-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.audit-filters input[type=text], .audit-filters select { min-width: 150px; flex: 1 1 150px; }
.audit-date { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.audit-when { white-space: nowrap; font-size: 13px; color: var(--text-muted); }
.audit-details summary { cursor: pointer; list-style: none; }
.audit-details summary::-webkit-details-marker { display: none; }
.audit-desc { margin: 8px 0 0; font-size: 13.5px; color: var(--text-muted); }
.audit-fields { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 4px; font-size: 13px; }
.audit-fields dt { color: var(--text-faint); }
.audit-fields dd { margin: 0; overflow-wrap: anywhere; }
.audit-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
@media (max-width: 640px) { .audit-fields { grid-template-columns: 1fr; } .audit-when { white-space: normal; } }

/* ---- Documents ---- */
.doc-body { font-size: 15px; line-height: 1.65; max-width: 78ch; overflow-wrap: anywhere; }
.doc-body h3 { font-size: 20px; margin: 22px 0 8px; } .doc-body h4 { font-size: 17px; margin: 18px 0 6px; } .doc-body h5 { font-size: 15px; margin: 14px 0 4px; }
.doc-body p { margin: 0 0 12px; } .doc-body ul, .doc-body ol { margin: 0 0 12px; padding-left: 22px; } .doc-body li { margin: 3px 0; }
.doc-body a { color: var(--ew-accent); text-decoration: underline; text-underline-offset: 2px; }
.doc-body hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.doc-ack { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 22px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--warning); background: rgba(226,169,59,.1); }
.doc-ack-done { border-color: var(--success); background: rgba(56,199,150,.1); }
.doc-textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; line-height: 1.55; min-height: 280px; }
.doc-group-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin: 18px 0 8px; }
.doc-list { display: grid; gap: 8px; }
.doc-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; color: inherit; text-decoration: none; background: var(--surface); transition: border-color .15s, transform .15s; }
.doc-item:hover { border-color: var(--ew-accent); transform: translateY(-1px); }
.doc-item-todo { border-left: 4px solid var(--warning); }
.doc-item-icon { display: inline-flex; color: var(--text-muted); } .doc-item-icon svg { width: 20px; height: 20px; }
.doc-item-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }

/* ---- Staff score / profile ---- */
.prof-card { border-top: 4px solid var(--prof); background: linear-gradient(135deg, color-mix(in srgb, var(--prof) 14%, var(--surface)) 0%, var(--surface) 55%); }
.prof-hero { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; padding: 8px 0 4px; }
.prof-ring { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.prof-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.prof-ring circle { fill: none; stroke-width: 9; }
.prof-ring-bg { stroke: var(--border); }
.prof-ring-fg { stroke: var(--prof); stroke-linecap: round; }
.prof-ring-text { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 48px; color: var(--prof); }
.prof-score { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.prof-max { font-size: 14px; font-weight: 700; margin-left: 2px; color: var(--text-muted); }
.prof-name-row { display: flex; align-items: center; gap: 12px; }
.prof-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 3px solid var(--prof); background: var(--surface-alt); }
.prof-name { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.prof-tier { margin-top: 6px; font-size: 15px; font-weight: 700; color: var(--prof); }
.prof-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.prof-total td { border-top: 2px solid var(--border); }
.score-pill { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 10px; border-radius: 999px; font-weight: 800; font-size: 14px; color: var(--prof); background: color-mix(in srgb, var(--prof) 16%, transparent); border: 1px solid color-mix(in srgb, var(--prof) 45%, transparent); }
.score-pill-tier { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.score-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 10px 22px; }
.score-param { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; font-weight: 600; }
.score-param small { display: block; font-weight: 400; font-size: 11.5px; margin-top: 1px; }
.score-param input { width: 96px; flex-shrink: 0; }

.pwa-box { display: grid; gap: 16px; }

/* ---- Documents: file or link ---- */
.doc-kind-row { display: flex; gap: 10px; flex-wrap: wrap; }
.doc-kind-choice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; min-width: 190px; font-weight: 400; }
.doc-kind-choice:has(input:checked) { border-color: var(--ew-accent); background: color-mix(in srgb, var(--ew-accent) 8%, transparent); }
.doc-kind-choice input { margin-top: 3px; }
.doc-kind-choice small { display: block; color: var(--text-faint); font-size: 12px; margin-top: 2px; }
.doc-edit:has(input[name=kind][value=file]:checked) [data-kind="link text"] { display: none; }
.doc-edit:has(input[name=kind][value=link]:checked) [data-kind="file"], .doc-edit:has(input[name=kind][value=text]:checked) [data-kind="file"] { display: none; }
.doc-current-file { font-size: 13px; margin-bottom: 8px; color: var(--text-muted); }
.doc-file { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-alt); margin: 4px 0 14px; }
.doc-file-icon { display: inline-flex; color: var(--ew-accent); } .doc-file-icon svg { width: 28px; height: 28px; }
.doc-file-main { display: flex; flex-direction: column; flex: 1; min-width: 160px; overflow-wrap: anywhere; }
.doc-image { max-width: 100%; max-height: 560px; border-radius: 12px; border: 1px solid var(--border); }

/* Password + passkey sign-in (login page) and the Security page */
.auth-btn-passkey { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); cursor: pointer; width: 100%; font: inherit; font-weight: 600; }
.auth-btn-passkey:hover { background: var(--border); }
.auth-btn-passkey:disabled { opacity: .6; cursor: progress; }
.auth-btn-password { background: var(--ew-accent); color: #fff; border: 0; cursor: pointer; width: 100%; font: inherit; font-weight: 600; }
.auth-btn-password:hover { filter: brightness(.92); }
.auth-password { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 14px; }
.auth-password > summary { cursor: pointer; padding: 12px 0; font-size: 13.5px; font-weight: 600; color: var(--text-muted); }
.auth-password[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.auth-password form { padding-bottom: 14px; }
.sec-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.sec-method { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt); font-weight: 600; font-size: 13.5px; }
.sec-method .text-faint { font-weight: 400; font-size: 12.5px; }
.sec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); flex: none; }
.sec-dot.sec-on { background: var(--success, #2f9e6b); }
.sec-rename { display: flex; gap: 8px; align-items: center; }
.sec-rename input { min-width: 140px; }
.sec-add { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.sec-add input { flex: 1 1 220px; }
.sec-form { max-width: 420px; }
.sec-remove { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.sec-remove > summary { cursor: pointer; color: var(--danger); font-size: 13.5px; font-weight: 600; margin-bottom: 12px; }
.sec-table td { vertical-align: middle; }

/* Account card at the bottom of the sidebar, with its menu opening upwards */
@media (min-width: 901px) {
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; align-self: flex-start; }
}
.acct { position: sticky; bottom: 0; margin-top: auto; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--bg-elevated); border-top: 1px solid var(--border); }
.acct-chip { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 8px; background: none; color: var(--text); border: 0; border-radius: 10px; cursor: pointer; font: inherit; text-align: left; }
.acct-chip:hover, .acct-chip[aria-expanded="true"] { background: var(--surface-alt); }
.acct-chip:focus-visible { outline: 2px solid var(--ew-accent); outline-offset: 1px; }
.acct-avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; flex: none; overflow: hidden; background: var(--surface-alt); border: 1px solid var(--border); color: var(--ew-accent); font-weight: 800; }
.acct-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface-alt); }
.acct-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.acct-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-text small { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-chev { width: 18px; height: 18px; flex: none; color: var(--text-muted); }
.acct-menu { position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 5; }
.acct-menu[hidden] { display: none; }
.acct-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; color: var(--text); text-decoration: none; font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.acct-item svg { width: 17px; height: 17px; flex: none; color: var(--text-muted); }
.acct-item:hover, .acct-item:focus-visible { background: var(--surface-alt); outline: none; }
.acct-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.acct-logout, .acct-logout svg { color: var(--danger); }
.acct-menu form { margin: 0; }
