/* ============================================================
   DITUCALAN MERCHANDISING CORP. — HRMS v2
   Enterprise UI · Brand #030083
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Brand */
  --c-brand:        #030083;
  --c-brand-hover:  #0400a0;
  --c-brand-active: #020062;
  --c-brand-10:     rgba(3,0,131,0.08);
  --c-brand-20:     rgba(3,0,131,0.15);

  /* Surfaces */
  --c-white:        #ffffff;
  --c-bg:           #eef0f7;
  --c-surface:      #ffffff;
  --c-surface-2:    #f5f6fb;

  /* Borders */
  --c-border:       #dde0ef;
  --c-border-2:     #c8cce0;

  /* Text */
  --c-text:         #080920;
  --c-text-2:       #363856;
  --c-text-3:       #7a7d9e;
  --c-text-inv:     #ffffff;

  /* State */
  --c-success:      #0f7b41;
  --c-success-bg:   #e6f4ed;
  --c-warning:      #b45309;
  --c-warning-bg:   #fef3e2;
  --c-danger:       #c0202c;
  --c-danger-bg:    #fbeaea;
  --c-info:         #1d5fad;
  --c-info-bg:      #e8f0fb;

  /* Layout */
  --sidebar-w:       252px;
  --sidebar-w-icon:  64px;
  --topbar-h:        58px;

  /* Misc */
  --radius-sm:  4px;
  --radius:     8px;
  --radius-lg:  12px;
  --shadow-sm:  0 1px 3px rgba(3,0,131,0.07), 0 1px 2px rgba(3,0,131,0.04);
  --shadow:     0 4px 12px rgba(3,0,131,0.08), 0 1px 3px rgba(3,0,131,0.05);
  --shadow-lg:  0 12px 40px rgba(3,0,131,0.12), 0 4px 12px rgba(3,0,131,0.06);
  --transition: 150ms ease;
}

/* ── BASE ───────────────────────────────────────────── */
html { font-size: 14px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.5;
  min-height: 100vh;
}

body.auth-mode { background: var(--c-white); }

/* ── TYPOGRAPHY ─────────────────────────────────────── */
.t-display {
  font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.t-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-text-3);
}
.t-mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
}

/* ── SCROLLBAR ──────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border-2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-3); }

/* ============================================================
   LOGIN — SPLIT PANEL
   ============================================================ */
.login-root {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* LEFT — brand panel */
.login-brand-panel {
  background: var(--c-brand);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px 60px;
}

/* D-mark watermark pattern — signature element */
.login-brand-panel::before {
  content: '';
  position: absolute;
  bottom: -100px;
  right: -120px;
  width: 520px;
  height: 520px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M10 10h28c22.09 0 40 17.91 40 40s-17.91 40-40 40H10V10z' fill='none' stroke='rgba(255,255,255,0.04)' stroke-width='2'/%3E%3Crect x='10' y='38' width='22' height='24' rx='2' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='2'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  pointer-events: none;
}
.login-brand-panel::after {
  content: '';
  position: absolute;
  top: -80px;
  left: -100px;
  width: 360px;
  height: 360px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M10 10h28c22.09 0 40 17.91 40 40s-17.91 40-40 40H10V10z' fill='none' stroke='rgba(255,255,255,0.03)' stroke-width='2'/%3E%3Crect x='10' y='38' width='22' height='24' rx='2' fill='none' stroke='rgba(255,255,255,0.04)' stroke-width='2'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  pointer-events: none;
}

.login-geo-1 { display: none; }
.login-geo-2 { display: none; }

.login-brand-logo {
  position: relative;
  z-index: 1;
}

/* Horizontal white logo on dark panel */
.login-brand-logo-img {
  height: 36px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92;
  margin-bottom: 0;
}

/* Hide the old text fallback — replaced by real logo img */
.login-corp-name { display: none; }
.login-corp-sub  { display: none; }
.login-brand-mark { display: none; }

.login-brand-body {
  position: relative;
  z-index: 1;
}
.login-brand-headline {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 34px;
  color: #fff;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.login-brand-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.48);
  line-height: 1.75;
  max-width: 300px;
}

.login-brand-footer {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 24px;
}
.login-stat {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 14px;
}
.login-stat-num {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  line-height: 1.2;
}
.login-stat-lbl {
  font-size: 11px;
  color: rgba(255,255,255,0.38);
  margin-top: 3px;
  letter-spacing: 0.01em;
}

/* RIGHT — form panel */
.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 52px 60px;
  background: var(--c-white);
}

.login-form-inner { width: 100%; max-width: 360px; }

/* Small stacked logo on form side */
.login-form-logo-wrap {
  margin-bottom: 36px;
}
.login-form-logo-img {
  height: 52px;
  width: auto;
  display: block;
}

.login-form-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-brand);
  margin-bottom: 6px;
}
.login-form-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 26px;
  color: var(--c-text);
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}
.login-form-sub {
  font-size: 13px;
  color: var(--c-text-3);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* ── FORM ELEMENTS ──────────────────────────────────── */
.field { margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.field-ctrl {
  position: relative;
  display: flex;
  align-items: center;
}
.field-ctrl i {
  position: absolute;
  left: 12px;
  font-size: 15px;
  color: var(--c-text-3);
  pointer-events: none;
}
.field-input {
  width: 100%;
  height: 40px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 0 12px 0 38px;
  font-size: 13px;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-input.no-icon { padding-left: 12px; }
.field-input:focus {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px var(--c-brand-10);
}
.field-input::placeholder { color: var(--c-text-3); }
textarea.field-input {
  height: 80px;
  padding-top: 10px;
  resize: vertical;
}
select.field-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237c7fa0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ── BUTTONS ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 36px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn i { font-size: 14px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14px; font-weight: 700; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--c-brand); color: #fff; }
.btn-primary:hover { background: var(--c-brand-hover); box-shadow: 0 4px 14px rgba(3,0,131,0.28); }
.btn-primary:active { background: var(--c-brand-active); box-shadow: none; }

.btn-ghost {
  background: transparent;
  color: var(--c-text-2);
  border: 1.5px solid var(--c-border);
}
.btn-ghost:hover { background: var(--c-surface-2); border-color: var(--c-border-2); color: var(--c-text); }

.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #a01822; }

.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #0a6535; }

.btn-text {
  background: transparent;
  color: var(--c-brand);
  border: none;
  padding: 0 6px;
  height: auto;
  font-weight: 600;
  font-size: 12px;
}
.btn-text:hover { text-decoration: underline; }

/* ── ALERT ──────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  border-left: 3px solid;
}
.alert i { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.alert-danger  { background: var(--c-danger-bg);  color: var(--c-danger);  border-color: var(--c-danger); }
.alert-success { background: var(--c-success-bg); color: var(--c-success); border-color: var(--c-success); }
.alert-warning { background: var(--c-warning-bg); color: var(--c-warning); border-color: var(--c-warning); }
.alert-info    { background: var(--c-info-bg);    color: var(--c-info);    border-color: var(--c-info); }

/* ============================================================
   APP SHELL
   ============================================================ */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--c-brand);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 100;
  transition: width var(--transition);
}

/* sidebar top bar */
.sidebar-header {
  padding: 0 18px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
/* Real logo in sidebar — hide the old SVG box */
.sidebar-logo-box { display: none; }

/* Horizontal logo (white) for sidebar */
.sidebar-logo-img {
  height: 22px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.88;
}

.sidebar-brand-text { display: none; }

/* user row */
.sidebar-user {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px;
}
.sidebar-nav::-webkit-scrollbar { width: 2px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.nav-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 14px 10px 5px;
}
.nav-group-label:first-child { padding-top: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  white-space: nowrap;
  position: relative;
}
.nav-item i {
  font-size: 16px;
  width: 18px;
  flex-shrink: 0;
  text-align: center;
}
.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}
.nav-item.active {
  background: rgba(255,255,255,0.13);
  color: #fff;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2.5px;
  background: #fff;
  border-radius: 0 2px 2px 0;
}
.nav-badge {
  margin-left: auto;
  background: #fff;
  color: var(--c-brand);
  font-size: 10px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* sidebar footer */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  width: 100%;
  font-family: inherit;
  transition: all var(--transition);
}
.sidebar-logout i { font-size: 16px; width: 18px; text-align: center; }
.sidebar-logout:hover {
  background: rgba(192,32,44,0.2);
  color: #ff6b78;
}

/* ── TOPBAR ─────────────────────────────────────────── */
.app-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
}
.topbar-hamburger {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--c-text-3);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 18px;
  transition: all var(--transition);
}
.topbar-hamburger:hover { background: var(--c-surface-2); color: var(--c-text); }
.topbar-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--c-text);
  letter-spacing: -0.01em;
}
.topbar-breadcrumb {
  font-size: 11px;
  color: var(--c-text-3);
  margin-top: 1px;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-time {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-3);
  font-family: 'JetBrains Mono', monospace;
  padding-right: 8px;
  border-right: 1px solid var(--c-border);
}
.topbar-action {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--c-text-3);
  font-size: 15px;
  position: relative;
  transition: all var(--transition);
}
.topbar-action:hover { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-border-2); }
.notif-pip {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-danger);
  border: 1.5px solid #fff;
}

/* ── CONTENT ────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--c-bg);
}

/* ── PAGE HEADER ────────────────────────────────────── */
.page-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--c-text);
  letter-spacing: -0.02em;
}
.page-sub {
  font-size: 12px;
  color: var(--c-text-3);
  margin-top: 2px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── STAT CARDS ─────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-card-header { display: flex; align-items: center; justify-content: space-between; }
.stat-card-label { font-size: 11px; font-weight: 600; color: var(--c-text-3); letter-spacing: 0.04em; text-transform: uppercase; }
.stat-card-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--c-brand-10);
  color: var(--c-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.stat-card-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 26px;
  color: var(--c-text);
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat-card-trend { font-size: 11px; color: var(--c-text-3); }
.stat-card-trend strong { color: var(--c-success); }
.stat-card-trend.down strong { color: var(--c-danger); }

/* ── CARD ───────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--c-text);
  letter-spacing: -0.01em;
}
.card-body { padding: 20px; }
.card-body-sm { padding: 14px 20px; }

/* ── TABLE ──────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-3);
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--c-border);
  white-space: nowrap;
  background: var(--c-surface-2);
}
tbody tr {
  border-bottom: 1px solid var(--c-border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--c-surface-2); }
td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--c-text);
  vertical-align: middle;
}
.td-name { font-weight: 600; color: var(--c-text); }
.td-sub  { font-size: 11px; color: var(--c-text-3); }
.td-mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* ── BADGE ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: var(--c-success-bg); color: var(--c-success); }
.badge-danger  { background: var(--c-danger-bg);  color: var(--c-danger);  }
.badge-warning { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-info    { background: var(--c-info-bg);    color: var(--c-info);    }
.badge-neutral { background: var(--c-surface-2);  color: var(--c-text-2);  border: 1px solid var(--c-border); }
.badge-brand   { background: var(--c-brand-10);   color: var(--c-brand);   }

/* ── FILTERS BAR ────────────────────────────────────── */
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--c-border);
}
.filters .field-input { height: 34px; font-size: 12px; max-width: 220px; }
.filters .field-input.no-icon { max-width: 160px; padding-left: 10px; }
/* ── ACTION BUTTONS (compact row / queue actions) ─── */
.queue-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text-2);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: var(--transition);
}
.action-btn:hover { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-text-3); }
.action-btn.approve { color: var(--c-success); }
.action-btn.approve:hover { background: var(--c-success-bg); border-color: var(--c-success); color: var(--c-success); }
.action-btn.reject { color: var(--c-danger); }
.action-btn.reject:hover { background: var(--c-danger-bg); border-color: var(--c-danger); color: var(--c-danger); }

/* ── MODAL ──────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8,9,32,0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 180ms ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@keyframes modalIn { from { opacity:0; transform:scale(0.97) translateY(8px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-header {
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--c-text);
  letter-spacing: -0.01em;
}
.modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--c-text-3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--c-surface-2); color: var(--c-text); }
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ── FORM ROWS ──────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.form-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-text-3);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-border);
}

/* ── SIDE PANEL ─────────────────────────────────────── */
.side-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8,9,32,0.45);
  backdrop-filter: blur(2px);
  z-index: 500;
  display: none;
}
.side-panel-backdrop.active { display: block; }
.side-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 400px;
  background: var(--c-surface);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 501;
  transform: translateX(100%);
  transition: transform 220ms ease;
}
.side-panel.open { transform: translateX(0); }
.side-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.side-panel-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--c-text);
}
.side-panel-body { flex: 1; overflow-y: auto; padding: 20px; }
.side-panel-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── DETAIL ROWS ────────────────────────────────────── */
.detail-row { display: flex; padding: 9px 0; border-bottom: 1px solid var(--c-border); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-lbl { width: 140px; color: var(--c-text-3); flex-shrink: 0; font-size: 12px; }
.detail-val { font-weight: 500; color: var(--c-text); }

/* ── TABS ───────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-border); margin-bottom: 20px; }
.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-3);
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  font-family: inherit;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--c-text); background: var(--c-surface-2); }
.tab-btn.active {
  color: var(--c-brand);
  font-weight: 600;
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 2px;
  background: var(--c-brand);
  border-radius: 2px 2px 0 0;
}

/* ── PAYSLIP ────────────────────────────────────────── */
.payslip {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 680px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.payslip-header {
  background: var(--c-brand);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.payslip-header-logo {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}
.payslip-company-name { display: none; } /* replaced by logo */
.payslip-company-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}
.payslip-period {
  margin-left: auto;
  text-align: right;
}
.payslip-period-lbl { font-size: 10px; color: rgba(255,255,255,0.4); letter-spacing: 0.06em; text-transform: uppercase; }
.payslip-period-val { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 14px; color: #fff; margin-top: 2px; }
.payslip-meta { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--c-border); }
.payslip-meta-item { padding: 12px 20px; border-right: 1px solid var(--c-border); }
.payslip-meta-item:last-child { border-right: none; }
.payslip-meta-label { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-text-3); margin-bottom: 3px; }
.payslip-meta-value { font-size: 13px; font-weight: 600; color: var(--c-text); }
.payslip-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.payslip-col { padding: 20px; }
.payslip-col:first-child { border-right: 1px solid var(--c-border); }
.payslip-col-title { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--c-text-3); margin-bottom: 12px; }
.payslip-line { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--c-border); }
.payslip-line:last-child { border-bottom: none; }
.payslip-line .lbl { color: var(--c-text-2); }
.payslip-line .amt { font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.payslip-line .ded { color: var(--c-danger); }
.payslip-subtotal { display: flex; justify-content: space-between; padding: 10px 0 0; font-size: 13px; font-weight: 700; border-top: 1.5px solid var(--c-border); margin-top: 6px; }
.payslip-footer {
  background: var(--c-brand);
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.payslip-net-lbl { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.6); }
.payslip-net-amt { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 26px; color: #fff; letter-spacing: -0.03em; }

/* ── CLOCK PAGE ─────────────────────────────────────── */
.clock-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 800px; margin: 0 auto; }
.clock-display-panel { display: flex; flex-direction: column; align-items: center; padding: 32px 24px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); }
.clock-time { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 52px; color: var(--c-brand); letter-spacing: -0.04em; line-height: 1; }
.clock-date { font-size: 13px; color: var(--c-text-3); margin-top: 6px; text-align: center; }
.webcam-area { width: 100%; aspect-ratio: 4/3; background: var(--c-brand); border-radius: var(--radius); overflow: hidden; position: relative; margin: 20px 0; }
.webcam-scan { position: absolute; width: 100%; height: 2px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent); animation: scan 2.5s linear infinite; }
@keyframes scan { 0% { top: 0; } 100% { top: 100%; } }
.webcam-face-ring { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.face-ring { width: 110px; height: 110px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.25); }
.webcam-status { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; font-size: 11px; color: rgba(255,255,255,0.5); letter-spacing: 0.05em; }
.clock-actions-panel { display: flex; flex-direction: column; padding: 24px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); gap: 12px; }
.clock-action-btn { height: 48px; border-radius: var(--radius); font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 9px; transition: all var(--transition); }
.clock-in  { background: var(--c-success); color: #fff; }
.clock-in:hover  { background: #0a6535; box-shadow: 0 4px 12px rgba(15,123,65,0.3); }
.clock-out { background: var(--c-danger); color: #fff; }
.clock-out:hover { background: #a01822; box-shadow: 0 4px 12px rgba(192,32,44,0.3); }
.clock-divider { height: 1px; background: var(--c-border); margin: 4px 0; }
.clock-status-note { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--c-success); background: var(--c-success-bg); border: 1px solid var(--c-success); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 4px; }
.clock-status-note.done { flex-direction: column; align-items: flex-start; gap: 3px; color: var(--c-text-2); background: var(--c-surface-2); border-color: var(--c-border); }
.clock-status-note.done span { font-weight: 600; color: var(--c-text); }

/* ── ESS HEADER ─────────────────────────────────────── */
.ess-header {
  background: var(--c-brand);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}
.ess-welcome { color: rgba(255,255,255,0.5); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
.ess-name { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 22px; color: #fff; letter-spacing: -0.025em; }
.ess-meta { font-size: 12px; color: rgba(255,255,255,0.45); margin-top: 4px; }
.ess-clock-status { font-size: 12px; color: rgba(255,255,255,0.4); margin-top: 8px; }
.ess-clock-status strong { color: rgba(255,255,255,0.85); }
.ess-leave-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.ess-leave-stat { text-align: right; border-left: 1px solid rgba(255,255,255,0.12); padding-left: 16px; }
.ess-leave-stat:first-child { border-left: none; padding-left: 0; }
.ess-leave-val { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 28px; color: #fff; line-height: 1; }
.ess-leave-lbl { font-size: 10px; color: rgba(255,255,255,0.38); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 3px; }

/* ── ANNOUNCEMENT ───────────────────────────────────── */
.ann-item { padding: 16px 0; border-bottom: 1px solid var(--c-border); display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; }
.ann-item:last-child { border-bottom: none; padding-bottom: 0; }
.ann-type-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-brand); flex-shrink: 0; margin-top: 7px; }
.ann-type-dot.pinned { background: var(--c-warning); }
.ann-title { font-size: 13px; font-weight: 600; color: var(--c-text); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.ann-body { font-size: 12px; color: var(--c-text-3); line-height: 1.6; margin-bottom: 6px; }
.ann-meta { font-size: 11px; color: var(--c-text-3); }
.ann-pinned-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; background: var(--c-warning-bg); color: var(--c-warning); padding: 1px 6px; border-radius: 2px; }

/* ── TOAST ──────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.toast {
  background: var(--c-text);
  color: #fff;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 200ms ease;
  border-left: 3px solid rgba(255,255,255,0.2);
}
.toast i { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.toast.success { border-left-color: #4ade80; }
.toast.error   { border-left-color: #f87171; }
.toast.warning { border-left-color: #fbbf24; }
.toast.out { animation: slideOut 200ms ease forwards; }

/* ── LOADING ────────────────────────────────────────── */
.loading-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 24px; gap: 14px; color: var(--c-text-3); }
.spinner { width: 22px; height: 22px; border: 2px solid var(--c-border); border-top-color: var(--c-brand); border-radius: 50%; animation: spin 0.7s linear infinite; }
.empty-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; gap: 10px; color: var(--c-text-3); text-align: center; }
.empty-panel i { font-size: 32px; color: var(--c-border-2); }
.empty-panel p { font-size: 13px; }

/* ── SIDEBAR OVERLAY (mobile) ───────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,9,32,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ── PRINT ──────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .filters, .page-actions, #toast-container { display: none !important; }
  .app-main { overflow: visible !important; }
  .content { padding: 0 !important; overflow: visible !important; background: white !important; }
  .payslip { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ── ANIMATIONS ─────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideOut{ to   { opacity: 0; transform: translateX(20px); } }
@keyframes spin    { to   { transform: rotate(360deg); } }
@keyframes panelIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.panel-enter { animation: panelIn 180ms ease; }

/* ── DIVIDER ────────────────────────────────────────── */
.divider { height: 1px; background: var(--c-border); margin: 16px 0; }

/* ── GRID HELPERS ───────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-sidebar { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.grid-sidebar-right { display: grid; grid-template-columns: 1fr 280px; gap: 16px; }
.flex-col { display: flex; flex-direction: column; gap: 16px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .topbar-hamburger { display: flex; }
  .sidebar {
    position: fixed;
    left: -100%;
    transition: left 250ms ease;
    z-index: 200;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.active { display: block; }

  .content { padding: 16px; }
  .topbar  { padding: 0 16px; }

  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-sidebar, .grid-sidebar-right, .grid-3 { grid-template-columns: 1fr; }
  .form-row, .form-row.cols3 { grid-template-columns: 1fr; }

  .clock-layout { grid-template-columns: 1fr; }
  .payslip-body { grid-template-columns: 1fr; }
  .payslip-col:first-child { border-right: none; border-bottom: 1px solid var(--c-border); }
  .payslip-meta { grid-template-columns: 1fr; }
  .payslip-meta-item { border-right: none; border-bottom: 1px solid var(--c-border); }

  .ess-header { flex-direction: column; }
  .ess-leave-stats { justify-content: flex-start; }
  .ess-leave-stat { text-align: left; }

  .login-root { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-form-panel { padding: 40px 28px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; border-radius: var(--radius) var(--radius) 0 0; align-self: flex-end; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
}

/* ============================================================
   RESPONSIVE ENHANCEMENTS  (extends the 1024/768/480 breakpoints
   above — adds mobile data-tables, filter stacking, and a few
   fixed-width fixes. No desktop rules are changed.)
   ============================================================ */

/* ── DATA TABLES → STACKED CARDS (phones/tablets) ──────────
   Wide HR tables (Employees, Requests, Payroll, Schedules, the
   11-column Attendance grid, etc.) become one labelled card per
   row instead of scrolling sideways. Labels come from each cell's
   data-label (set by labelizeTables() in app.js from the <thead>).
   Scoped to tables that have a header; narrow 2-column reference
   tables (no <thead>) keep their normal layout. */
@media (max-width: 768px) {
  .tbl-wrap { overflow-x: visible; }

  table.data-tbl:has(thead) { display: block; background: transparent; }
  table.data-tbl:has(thead) thead { display: none; }
  table.data-tbl:has(thead) tbody { display: block; }

  table.data-tbl:has(thead) tbody tr {
    display: block;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    margin-bottom: 10px;
    padding: 2px 0;
    box-shadow: var(--shadow-sm);
  }
  table.data-tbl:has(thead) tbody tr:last-child { margin-bottom: 0; }
  table.data-tbl:has(thead) tbody tr:hover { background: var(--c-surface); }

  table.data-tbl:has(thead) tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: auto;
    padding: 9px 14px;
    border: none;
    border-bottom: 1px solid var(--c-border);
    text-align: right;
    white-space: normal;
  }
  table.data-tbl:has(thead) tbody td:last-child { border-bottom: none; }

  /* field label, pulled from the header row */
  table.data-tbl:has(thead) tbody td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 40%;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--c-text-3);
  }
  /* action / unlabelled cells: let the buttons span the row */
  table.data-tbl:has(thead) tbody td:not([data-label]) { justify-content: flex-end; }
  table.data-tbl:has(thead) tbody td:not([data-label]) > * { flex: 0 1 auto; }

  /* keep value-side content from being squashed */
  table.data-tbl:has(thead) tbody td > * { min-width: 0; }
}

/* ── FILTER BAR (search + selects) ─────────────────────────
   Let controls grow and wrap to full width instead of sitting at
   fixed widths with ragged gaps. Matters most for panels with
   several filter dropdowns (e.g. Attendance, Section 12). */
@media (max-width: 768px) {
  .filters { padding: 12px 16px; gap: 10px; }
  .filters .search-box   { flex: 2 1 220px; min-width: 0; }
  .filters .search-input { width: 100%; }
  .filters .filter-select,
  .filters select        { flex: 1 1 150px; min-width: 0; max-width: none; }
  /* keep the legacy field-input filters (if any) consistent */
  .filters .field-input,
  .filters .field-input.no-icon { flex: 1 1 150px; min-width: 0; max-width: none; }
}

/* ── TABS: scroll instead of overflow when many are present ── */
@media (max-width: 768px) {
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { height: 0; }
}

/* ── SIDE PANEL: full width on small screens ─────────────── */
@media (max-width: 480px) {
  .side-panel { width: 100%; max-width: 100%; }
}

/* ── PAGE HEADER ACTIONS + TOPBAR on phones ──────────────── */
@media (max-width: 480px) {
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  /* free up space in the cramped top bar */
  .topbar { gap: 10px; padding: 0 14px; }
  .topbar-time { display: none; }
}