/* ============================================================
   HR portal — shell, sidebar, KPIs, tables, seating, tickets.
   Tokens come from theme.css.
   ============================================================ */

/* ---------- login ---------- */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(900px 420px at 50% -120px, var(--brand-tint) 0%, transparent 70%),
    var(--bg);
}
.login-card { width: 100%; max-width: 400px; padding: 34px 30px; border-radius: 24px; }
.login-head { text-align: center; margin-bottom: 26px; }
.login-mark { display: grid; place-items: center; margin: 0 auto 16px; }
.login-mark .logo { height: 54px; }
.login-why {
  display: flex; gap: 9px; align-items: flex-start;
  margin-top: 18px; padding: 11px 13px;
  background: var(--surface-sunken);
  border-radius: var(--r-md);
  font-size: .76rem; color: var(--text-muted); font-weight: 500;
}
.login-why svg { width: 14px; height: 14px; flex: none; margin-top: 2px; opacity: .6; }
.login-hint {
  margin-top: 14px; text-align: center;
  font-size: .74rem; color: var(--text-faint); font-weight: 500;
}
.login-hint code {
  background: var(--surface-sunken);
  padding: 1px 6px; border-radius: 4px;
  font-weight: 700; color: var(--text-muted);
}

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

.sidebar {
  width: 240px;
  flex: none;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 40;
}
.side-head {
  padding: 18px 16px;
  border-block-end: 1px solid var(--border);
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; color: var(--brand); font-size: 1rem;
  letter-spacing: -0.02em;
}
.side-brand .logo { height: 32px; }

.side-nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 2px;
  border: none;
  background: transparent;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-weight: 600; font-size: .89rem;
  cursor: pointer;
  text-align: start;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item:hover { background: var(--surface-sunken); color: var(--text); }
.nav-item[aria-current="page"] {
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 700;
  position: relative;
}
/* Orange marker on the active tab — the accent's main job in the portal. */
.nav-item[aria-current="page"]::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-2);
}
body[dir="rtl"] .nav-item[aria-current="page"]::before { border-radius: 3px 0 0 3px; }
.nav-count {
  margin-inline-start: auto;
  background: var(--surface-sunken);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 700;
}
.nav-item[aria-current="page"] .nav-count { background: var(--brand-tint-strong); color: var(--brand); }
.nav-count.alert { background: var(--status-pending-tint); color: var(--status-pending); }

.side-foot { padding: 12px; border-block-start: 1px solid var(--border); }
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: var(--r-md);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-tint-strong); color: var(--brand);
  display: grid; place-items: center;
  font-weight: 800; font-size: .78rem; flex: none;
}
.user-name { font-weight: 700; font-size: .82rem; line-height: 1.2; }
.user-role { font-size: .7rem; color: var(--text-faint); font-weight: 600; }

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

.topbar-hr {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px;
  background: var(--surface);
  border-block-end: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.content { padding: 22px; flex: 1; }
.content-narrow { max-width: 1180px; margin: 0 auto; width: 100%; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 1.4rem; }
.page-head .sub { color: var(--text-muted); font-size: .85rem; font-weight: 500; margin-top: 3px; }

/* event switcher */
.ev-switch {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 12px 6px 8px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-weight: 700; font-size: .85rem;
  max-width: 340px;
  transition: border-color var(--t-fast) var(--ease);
}
.ev-switch:hover { border-color: var(--border-strong); }

/* Event identity mark — shared by the switcher, its modal and history
   cards. UI.partnerMark() sizes it inline; everything else lives here. */
.ev-logo,
.ev-logo-ph {
  border-radius: 7px;
  flex: none;
  object-fit: contain;
}
.ev-logo {
  background: #fff;
  border: 1px solid var(--border);
}
.ev-logo-ph {
  background: var(--brand-tint-strong);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: .68rem;
  font-weight: 800;
  overflow: hidden;
}
/* Unpartnered event: show the Saleem mark rather than initials. */
.ev-logo-saleem {
  background: #fff;
  border: 1px solid var(--border);
  padding: 3px;
}
.ev-logo-saleem img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ev-switch .ev-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-switch svg { width: 14px; height: 14px; opacity: .5; flex: none; }

/* live toggle */
.live-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1.5px solid;
  font-weight: 700; font-size: .8rem;
  cursor: pointer;
  background: transparent;
  transition: all var(--t-fast) var(--ease);
}
.live-btn.on { color: var(--live-on); border-color: rgba(34,160,107,.35); background: rgba(34,160,107,.08); }
.live-btn.off { color: var(--live-off); border-color: rgba(192,57,43,.3); background: rgba(192,57,43,.07); }
.live-btn:hover { filter: brightness(.95); }

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi::before {
  content: '';
  position: absolute;
  inset-block-start: 0; inset-inline-start: 0;
  width: 3px; height: 100%;
  background: var(--kpi-color, var(--brand));
}
.kpi-label {
  font-size: .74rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
  display: flex; align-items: center; gap: 6px;
}
.kpi-label svg { width: 13px; height: 13px; color: var(--kpi-color, var(--brand)); }
.kpi-value {
  font-size: 1.9rem; font-weight: 800; line-height: 1.1;
  margin-top: 6px; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: .74rem; color: var(--text-faint); font-weight: 600; margin-top: 2px; }

/* ---------- distribution bars ---------- */
.dist-row {
  display: grid;
  grid-template-columns: minmax(90px, 150px) 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 5px 0;
}
.dist-name {
  font-size: .8rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dist-track {
  display: block;   /* spans default to inline, which drops height/width */
  height: 8px;
  background: var(--surface-sunken);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.dist-fill {
  display: block;
  height: 100%;
  min-width: 3px;   /* a count of 1 should still be visible */
  background: linear-gradient(90deg, var(--navy), var(--blue));
  border-radius: var(--r-pill);
  transition: width var(--t-med) var(--ease-out);
}
.dist-num { font-size: .78rem; font-weight: 800; color: var(--text-muted); min-width: 26px; text-align: end; font-variant-numeric: tabular-nums; }

/* ---------- event history cards ---------- */
.hist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.hist-card {
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.hist-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.hist-card.is-current {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.hist-head {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.hist-title {
  font-weight: 800;
  font-size: .95rem;
  line-height: 1.3;
  /* Two lines, then ellipsis — a one-line clamp cut every event name. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hist-partner { font-size: .74rem; color: var(--text-muted); font-weight: 600; }
.hist-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
}
.hist-date { font-size: .72rem; color: var(--text-faint); font-weight: 600; }

/* 2×2, not 1×4: four stats across a 300px card left every label
   ellipsised to "REGISTE…". */
.hist-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.hist-stat-val {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hist-stat-lbl {
  font-size: .64rem;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .02em;
  margin-top: 3px;
  line-height: 1.3;
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.search-box { position: relative; flex: 1; min-width: 190px; max-width: 340px; }
.search-box .input { padding-inline-start: 36px; }
.search-box svg {
  position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-faint); pointer-events: none;
}
.filter-select { width: auto; min-width: 130px; padding-block: 9px; }

/* ---------- table ---------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th {
  text-align: start;
  padding: 10px 13px;
  background: var(--surface-sunken);
  font-weight: 700; font-size: .74rem;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
  border-block-end: 1px solid var(--border);
  position: sticky; top: 0;
}
table.data td {
  padding: 10px 13px;
  border-block-end: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr { transition: background var(--t-fast) var(--ease); }
table.data tbody tr:hover { background: var(--brand-tint); }
table.data tbody tr:last-child td { border-block-end: none; }
.cell-name { font-weight: 700; }
.cell-sub { font-size: .74rem; color: var(--text-faint); font-weight: 500; }
.cell-mono { font-family: var(--font-en); font-weight: 700; direction: ltr; font-size: .8rem; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty-state { padding: 54px 20px; text-align: center; color: var(--text-faint); }
.empty-state svg { width: 38px; height: 38px; opacity: .35; margin-bottom: 11px; }
.empty-state p { font-weight: 600; font-size: .9rem; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(30, 23, 32, .45);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
  animation: fade-in var(--t-fast) var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  display: flex; flex-direction: column;
  animation: modal-in var(--t-med) var(--ease-out);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-lg { max-width: 780px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 17px 20px;
  border-block-end: 1px solid var(--border);
}
.modal-head h3 { font-size: 1.05rem; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  display: flex; gap: 9px; justify-content: flex-end;
  padding: 14px 20px;
  border-block-start: 1px solid var(--border);
  background: var(--surface-sunken);
  border-end-start-radius: var(--r-xl);
  border-end-end-radius: var(--r-xl);
}
.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: none; background: transparent;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

/* detail rows */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-item .dl { font-size: .72rem; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }
.detail-item .dv { font-weight: 600; margin-top: 2px; word-break: break-word; }

/* ---------- toggle switch ---------- */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 40px; height: 23px;
  background: var(--border-strong);
  border-radius: var(--r-pill);
  position: relative;
  transition: background var(--t-fast) var(--ease);
  flex: none;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px; inset-inline-start: 3px;
  width: 17px; height: 17px;
  background: #fff; border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast) var(--ease);
}
.switch input:checked + .switch-track { background: var(--status-approved); }
.switch input:checked + .switch-track::after { transform: translateX(17px); }
body[dir="rtl"] .switch input:checked + .switch-track::after { transform: translateX(-17px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch-label { font-weight: 600; font-size: .87rem; }

/* ---------- mobile ---------- */
.side-toggle { display: none; }
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset-block: 0; inset-inline-start: 0;
    transform: translateX(-100%);
    transition: transform var(--t-med) var(--ease);
    box-shadow: var(--shadow-lg);
  }
  body[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0) !important; }
  .side-toggle { display: grid; }
  .content { padding: 14px; }
  .topbar-hr { padding: 10px 14px; }
}
.side-scrim {
  position: fixed; inset: 0;
  background: rgba(30,23,32,.4);
  z-index: 39;
}
