/* ═══════════════════════════════════════════════════════════════
   HR Assist · base.css
   Shared design tokens, resets, and utility classes.
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Fonts ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

/* ── Design tokens — Dark (default) ────────────────────────────── */
:root {
  --bg:        #0e1117;
  --surface:   #161b24;
  --surface2:  #1d2433;
  --surface3:  #232b3e;
  --border:    #2a3347;
  --border2:   #3a4a6a;

  --teal:      #00e5c3;
  --teal2:     #00b89a;
  --teal-dim:  rgba(0,229,195,0.08);
  --teal-glow: rgba(0,229,195,0.18);

  --blue:   #4d9ef7;
  --amber:  #f5a623;
  --red:    #ff5c72;
  --green:  #3de87a;
  --purple: #a78bfa;

  --text:  #e8edf8;
  --text2: #8a97b0;
  --text3: #4d5c78;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow:    0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);

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

  --font: 'Inter', sans-serif;
  --mono: 'IBM Plex Mono', monospace;

  --transition: 0.15s ease;
}

/* ── Light theme ────────────────────────────────────────────────── */
html.light {
  --bg:        #f4f6fb;
  --surface:   #ffffff;
  --surface2:  #f0f2f7;
  --surface3:  #e5eaf4;
  --border:    #dde3ef;
  --border2:   #c4cee0;

  --teal:      #00967d;
  --teal2:     #007a6a;
  --teal-dim:  rgba(0,150,125,0.08);
  --teal-glow: rgba(0,150,125,0.15);

  --blue:   #2563eb;
  --amber:  #c97c0a;
  --red:    #dc2626;
  --green:  #16a34a;

  --text:  #1a2035;
  --text2: #4a5568;
  --text3: #94a3b8;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow:    0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
}

/* ── Base ──────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ────────────────────────────────────────────────── */
.text-xs  { font-size: 10px; }
.text-sm  { font-size: 11px; }
.text-base{ font-size: 13px; }
.text-lg  { font-size: 15px; }
.text-xl  { font-size: 18px; }
.text-2xl { font-size: 22px; }

.font-mono { font-family: var(--mono); }
.font-500  { font-weight: 500; }
.font-600  { font-weight: 600; }

.text-teal   { color: var(--teal); }
.text-blue   { color: var(--blue); }
.text-amber  { color: var(--amber); }
.text-red    { color: var(--red); }
.text-green  { color: var(--green); }
.text-muted  { color: var(--text2); }
.text-dim    { color: var(--text3); }

/* ── Layout helpers ────────────────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-4   { gap: 4px; }
.gap-6   { gap: 6px; }
.gap-8   { gap: 8px; }
.gap-10  { gap: 10px; }
.gap-12  { gap: 12px; }
.gap-14  { gap: 14px; }
.flex-1  { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.w-full  { width: 100%; }
.h-full  { height: 100%; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-sub {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 14px;
}
.card-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ── Form elements ─────────────────────────────────────────────── */
.field { margin-bottom: 11px; }
.field-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.required { color: var(--red); font-size: 10px; }
.field-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  transition: border-color var(--transition);
}
.field-input:focus { border-color: var(--teal2); }
.field-input.error { border-color: var(--red); }
.field-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  appearance: none;
  cursor: pointer;
}
.field-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition);
}
.field-textarea:focus { border-color: var(--teal2); }
.field-hint { font-size: 10px; color: var(--text3); margin-top: 3px; }
.field-error { font-size: 10px; color: var(--red); margin-top: 3px; }

/* ── Toggle ────────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-info .tl { font-size: 12px; color: var(--text); }
.toggle-info .ts { font-size: 10px; color: var(--text3); margin-top: 1px; }
.toggle {
  position: relative;
  width: 34px; height: 18px;
  flex-shrink: 0; cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 9px;
  transition: background 0.2s;
}
.toggle input:checked ~ .toggle-track { background: var(--teal2); border-color: var(--teal2); }
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%; background: #fff;
  transition: transform 0.2s;
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(16px); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: #000; }
.btn-primary:hover:not(:disabled) { background: var(--teal2); }
.btn-secondary { background: var(--blue); color: #fff; }
.btn-secondary:hover:not(:disabled) { background: #3b8de0; }
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(255,92,114,.3); }
.btn-danger:hover:not(:disabled) { background: rgba(255,92,114,.08); }
.btn-sm { padding: 4px 10px; font-size: 10px; }
.btn-lg { padding: 10px 20px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ── Status chips ──────────────────────────────────────────────── */
.chip {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
}
.chip-on   { background: rgba(61,232,122,.12); color: var(--green); border: 1px solid rgba(61,232,122,.25); }
.chip-off  { background: var(--surface3); color: var(--text3); border: 1px solid var(--border); }
.chip-err  { background: rgba(255,92,114,.12); color: var(--red); border: 1px solid rgba(255,92,114,.25); }
.chip-sync { background: rgba(77,158,247,.12); color: var(--blue); border: 1px solid rgba(77,158,247,.25); }
.chip-warn { background: rgba(245,166,35,.12); color: var(--amber); border: 1px solid rgba(245,166,35,.25); }

/* ── Role badges ───────────────────────────────────────────────── */
.rb { font-size: 9px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.rb-hr  { background: rgba(245,166,35,.12); color: var(--amber); border: 1px solid rgba(245,166,35,.2); }
.rb-mgr { background: rgba(61,232,122,.12); color: var(--green); border: 1px solid rgba(61,232,122,.2); }
.rb-emp { background: rgba(77,158,247,.12); color: var(--blue); border: 1px solid rgba(77,158,247,.2); }

/* ── Tables ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 11px; }
.tbl th {
  text-align: left;
  color: var(--text3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 500;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text2);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--teal-dim); }
.tbl .emp-name { color: var(--text); font-weight: 500; }

/* ── Callouts ──────────────────────────────────────────────────── */
.callout {
  background: var(--teal-dim);
  border: 1px solid rgba(0,229,195,.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 12px;
  line-height: 1.6;
}
.callout strong { color: var(--teal); }
.callout-warn {
  background: rgba(245,166,35,.07);
  border: 1px solid rgba(245,166,35,.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 12px;
  line-height: 1.6;
}
.callout-err {
  background: rgba(255,92,114,.07);
  border: 1px solid rgba(255,92,114,.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 12px;
  line-height: 1.6;
}

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

/* ── Toast notifications ───────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Spinner ───────────────────────────────────────────────────── */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc helpers ──────────────────────────────────────────────── */
.sep { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.mono-val { font-family: var(--mono); font-size: 11px; color: var(--teal); }
.section-hdr {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.search-bar {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text);
  font-size: 11px;
  width: 220px;
  outline: none;
  font-family: var(--font);
}
.search-bar:focus { border-color: var(--teal2); }
.info-tag {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(77,158,247,.1);
  color: var(--blue);
  border: 1px solid rgba(77,158,247,.2);
  font-weight: 500;
}
.divider-label {
  font-size: 9px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin: 18px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.divider-label::before, .divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.drag-over {
  border-color: var(--teal2) !important;
  background: var(--teal-dim) !important;
}
.upload-area {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface2);
}
.upload-area:hover { border-color: var(--teal2); background: var(--teal-dim); }
.upload-area input[type=file] { display: none; }

/* ── Progress bar ──────────────────────────────────────────────── */
.progress-bar-wrap {
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar {
  height: 100%;
  background: var(--teal);
  border-radius: 2px;
  transition: width 0.3s ease;
}

@media (max-width: 700px) {
  .card-row, .card-row3 { grid-template-columns: 1fr; }
}
