/* ==================================================
   Visitor Management System — Design System
   Direction: "security checkpoint" — precise, structured,
   trustworthy. Graphite/navy shell, amber signal accent,
   monospace for badge numbers & IDs, ID-card motifs for
   visitor records.
   ================================================== */

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

:root {
  --ink-950: #0D1015;
  --ink-900: #12161C;
  --ink-800: #1B212B;
  --ink-700: #262E3A;
  --ink-600: #3A4453;
  --paper-50: #F7F7F5;
  --paper-100: #EFEFEB;
  --paper-white: #FFFFFF;
  --line: #E2E1DB;

  --amber: #E8A33D;
  --amber-dark: #C6822A;
  --teal: #1F9D74;
  --teal-dark: #167A5A;
  --red: #D6483F;
  --red-dark: #B23A32;
  --slate: #6B7280;

  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 2px rgba(13,16,21,0.06), 0 4px 16px rgba(13,16,21,0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--paper-50);
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--font-mono); }

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

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--ink-900);
  color: #DDE1E7;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
  border-bottom: 1px solid var(--ink-700);
  margin-bottom: 16px;
}
.sidebar-brand .mark {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: linear-gradient(145deg, var(--amber), var(--amber-dark));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--ink-950); font-size: 14px;
}
.sidebar-brand .name { font-weight: 600; font-size: 14px; color: #fff; line-height: 1.2; }
.sidebar-brand .name small { display:block; font-weight: 400; color: #8A93A3; font-size: 11px; }

.nav-group { margin-bottom: 18px; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #6B7686; padding: 0 10px 6px; font-weight: 600;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: #C4CAD4; font-size: 13.5px; font-weight: 500;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--ink-800); color: #fff; }
.nav-link.active { background: var(--ink-800); color: var(--amber); }
.nav-link .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; flex-shrink:0; }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--ink-700); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--ink-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
}
.user-chip .who { line-height: 1.25; }
.user-chip .who .name { font-size: 13px; color: #fff; font-weight: 500; }
.user-chip .who .role { font-size: 11px; color: #8A93A3; text-transform: capitalize; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 60px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--paper-white); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; }
.content { padding: 24px; flex: 1; }

/* ---------- Cards & grid ---------- */
.card {
  background: var(--paper-white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; }
.card-header h2 { font-size: 14.5px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--paper-white); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-card);
}
.stat-card .label { font-size: 11.5px; color: var(--slate); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-card .value { font-family: var(--font-mono); font-size: 28px; font-weight: 600; margin-top: 6px; color: var(--ink-900); }
.stat-card .delta { font-size: 12px; margin-top: 4px; color: var(--teal-dark); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-md); border: 1px solid transparent;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  font-family: var(--font-sans);
}
.btn-primary { background: var(--ink-900); color: #fff; }
.btn-primary:hover { background: var(--ink-800); }
.btn-accent { background: var(--amber); color: var(--ink-950); }
.btn-accent:hover { background: var(--amber-dark); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink-900); }
.btn-outline:hover { background: var(--paper-100); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-dark); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-700); margin-bottom: 14px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 9px 11px; font-size: 13.5px; font-family: var(--font-sans);
  background: var(--paper-white); color: var(--ink-900);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(232,163,61,0.18); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-help { font-size: 11.5px; color: var(--slate); font-weight: 400; margin-top: 4px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--slate); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line);
}
tbody td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--paper-50); }
.table-wrap { overflow-x: auto; }

/* ---------- Pills / status ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  text-transform: capitalize;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: rgba(31,157,116,0.12); color: var(--teal-dark); }
.pill-pending { background: rgba(232,163,61,0.15); color: var(--amber-dark); }
.pill-danger { background: rgba(214,72,63,0.12); color: var(--red-dark); }
.pill-neutral { background: rgba(107,114,128,0.12); color: var(--slate); }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 16px; }
.alert-ok { background: rgba(31,157,116,0.1); color: var(--teal-dark); border: 1px solid rgba(31,157,116,0.25); }
.alert-danger { background: rgba(214,72,63,0.1); color: var(--red-dark); border: 1px solid rgba(214,72,63,0.25); }
.alert-info { background: rgba(232,163,61,0.1); color: var(--amber-dark); border: 1px solid rgba(232,163,61,0.25); }

/* ---------- ID / Badge card motif ---------- */
.id-card {
  position: relative;
  background: var(--ink-900); color: #fff;
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  width: 320px;
  overflow: hidden;
}
.id-card::before {
  content: '';
  position: absolute; top: 0; bottom: 0; left: 0; width: 6px;
  background: repeating-linear-gradient(180deg, var(--amber) 0 8px, transparent 8px 16px);
}
.id-card .id-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; padding-left: 8px; }
.id-card .id-header .org { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #8A93A3; }
.id-card .id-header .type { font-size: 11px; font-weight: 600; color: var(--amber); }
.id-card .id-name { font-size: 17px; font-weight: 600; padding-left: 8px; margin-bottom: 2px; }
.id-card .id-meta { font-size: 12px; color: #A6ADBA; padding-left: 8px; margin-bottom: 12px; }
.id-card .id-number { font-family: var(--font-mono); font-size: 13px; color: var(--amber); padding-left: 8px; letter-spacing: .04em; }
.id-card .id-qr { position: absolute; right: 16px; bottom: 14px; width: 64px; height: 64px; background: #fff; border-radius: 6px; padding: 4px; }
.id-card .id-qr img { width: 100%; height: 100%; }

/* ---------- Auth pages ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--ink-900); }
.auth-card { background: var(--paper-white); border-radius: var(--radius-lg); padding: 32px 30px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.auth-title { font-size: 19px; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--slate); margin-bottom: 20px; }
.auth-card .btn { width: 100%; margin-top: 4px; }

/* ---------- Kiosk (public check-in) ---------- */
.kiosk-body { background: var(--ink-900); min-height: 100vh; display:flex; align-items:center; justify-content:center; padding: 24px; }
.kiosk-card { background: var(--paper-white); border-radius: 20px; width: 480px; max-width: 100%; padding: 34px; text-align: center; }
.kiosk-card h1 { font-size: 22px; margin-bottom: 6px; }
.kiosk-card p.lead { color: var(--slate); margin-bottom: 22px; }

/* ---------- Misc ---------- */
.text-muted { color: var(--slate); }
.flex { display:flex; align-items:center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-16 { margin-top:16px; }
.mb-0 { margin-bottom:0; }
.empty-state { text-align:center; padding: 40px 20px; color: var(--slate); }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .form-row { grid-template-columns: 1fr; }
}
