@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
  --bg: #0b1120;
  --surface: #131c31;
  --surface-2: #0d1526;
  --surface-hover: #1b2842;
  --border: #24334f;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

body.light-theme {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Cairo', "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

a { color: var(--primary); text-decoration: none; }
code {
  background: rgba(148, 163, 184, 0.14);
  padding: 2px 7px;
  border-radius: 6px;
  font-family: Consolas, monospace;
  font-size: 0.88em;
}

/* Top Navigation */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1340px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text);
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
}
.nav-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.nav-tabs a {
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  transition: 0.15s ease;
}
.nav-tabs a:hover {
  color: var(--text);
}
.nav-tabs a.active {
  background: var(--primary);
  color: #ffffff;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.container {
  max-width: 1340px;
  margin: 24px auto;
  padding: 0 22px 48px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h1, .card h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.2rem;
  font-weight: 800;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card { width: 100%; max-width: 430px; }
.install-card { width: 100%; max-width: 780px; }

.brand-badge {
  display: inline-block;
  background: rgba(14, 165, 233, 0.15);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.muted { color: var(--muted); font-size: 0.9rem; }
.sub-note { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }

label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], select {
  width: 100%;
  margin-top: 5px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.full-row { grid-column: 1 / -1; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.checkbox-row input { width: auto; margin: 0; }
hr.full-row { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inline-form input, .inline-form select {
  width: auto;
  margin-top: 0;
  padding: 7px 11px;
}
.wrap-form input { min-width: 190px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  transition: 0.15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.92rem;
  font-weight: 600;
}
.alert-error { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.4); color: #f87171; }
.alert-success { background: rgba(34, 197, 94, 0.14); border: 1px solid rgba(34, 197, 94, 0.4); color: #4ade80; }
.alert-warn { background: rgba(245, 158, 11, 0.14); border: 1px solid rgba(245, 158, 11, 0.4); color: #fbbf24; }

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}
.kpi-card.kpi-ok::before { background: var(--ok); }
.kpi-card.kpi-warn::before { background: var(--warn); }
.kpi-card.kpi-err::before { background: var(--err); }
.kpi-label { font-size: 0.84rem; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.65rem; font-weight: 800; margin-top: 4px; }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-err { color: var(--err); }

/* Toolbar & Filter Pills */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-pill {
  padding: 6px 13px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}
.filter-pill:hover { color: var(--text); border-color: var(--primary); }
.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead { background: var(--surface-2); }
th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
th { color: var(--muted); font-weight: 700; white-space: nowrap; font-size: 12.5px; }
tbody tr:hover { background: var(--surface-hover); }
.empty-cell { text-align: center; padding: 32px; color: var(--muted); }
.file-name-cell { max-width: 340px; word-break: break-word; font-weight: 600; }
.actions-cell { white-space: nowrap; }
.center-cell { text-align: center; }

/* Check badges for 4 report types */
.chk-yes {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.chk-yes:hover { background: rgba(34, 197, 94, 0.25); }
.chk-no {
  color: var(--muted);
  opacity: 0.45;
  font-weight: 700;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.pill-ok { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.pill-wait { background: rgba(245, 158, 11, 0.16); color: #f59e0b; }
.pill-miss { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.pill-info { background: rgba(14, 165, 233, 0.16); color: #0ea5e9; }
.pill-muted { background: rgba(148, 163, 184, 0.16); color: var(--muted); }
.pill-cat-daily { background: rgba(14, 165, 233, 0.16); color: #38bdf8; }
.pill-cat-inventory { background: rgba(168, 85, 247, 0.16); color: #c084fc; }
.pill-cat-hr { background: rgba(16, 185, 129, 0.16); color: #34d399; }
.pill-cat-evaluation { background: rgba(251, 146, 60, 0.16); color: #fb923c; }
.pill-cat-other { background: rgba(148, 163, 184, 0.16); color: var(--muted); }

/* Copy input group */
.copy-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.copy-group input {
  margin-top: 0 !important;
  font-family: Consolas, monospace;
  font-size: 12px !important;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  transition: 0.15s ease;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.08);
}
.drop-icon { font-size: 36px; margin-bottom: 8px; }
.drop-title { font-size: 1.05rem; margin-bottom: 4px; font-weight: 700; }

.upload-queue { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.q-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.q-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 13.5px; }
.q-bar-bg { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.q-bar-fill { height: 100%; width: 0%; background: var(--primary); transition: width 0.15s linear; }
.q-bar-fill.done { background: var(--ok); }
.q-bar-fill.err { background: var(--err); }
.q-status { font-size: 12px; color: var(--muted); margin-top: 5px; }

.code-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  font-size: 12.5px;
}
.token-input {
  font-family: Consolas, monospace;
  font-size: 11.5px !important;
  min-width: 190px;
  padding: 5px 8px !important;
  margin-top: 0 !important;
}
