/* Visitor Management System — shared styles
   Tokens follow the validated reference palette (light + dark). */

:root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --page:           #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11,11,11,0.10);
  --accent:         #2a78d6;   /* series-1 / sequential blue */
  --accent-strong:  #1c5cab;
  --good:           #0ca30c;
  --warning:        #fab219;
  --serious:        #ec835a;
  --critical:       #d03b3b;
  --success-text:   #006300;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --page:           #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255,255,255,0.10);
    --accent:         #3987e5;
    --accent-strong:  #104281;
    --good:           #0ca30c;
    --warning:        #fab219;
    --serious:        #ec835a;
    --critical:       #e66767;
    --success-text:   #0ca30c;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  row-gap: 8px;
}

.topbar .brand {
  font-weight: 600;
  font-size: 16px;
}

/* --- Brand logos: NARCL always left, IDRCL always right --- */
.brand-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.brand-logos.stacked {
  margin: 4px 0 26px;
}
.brand-logo {
     height: 30px;
     width: 110px;
     object-fit: contain;
     object-position: center;
     display: block;
     background: #fff;
   }
   .brand-logos.stacked .brand-logo { height: 44px; width: 160px; }
.brand-divider {
  width: 1px;
  height: 22px;
  background: var(--baseline);
  flex-shrink: 0;
}
.brand-logos.stacked .brand-divider { height: 30px; }

/* --- Entity badge (NARCL / IDRCL) shown next to visit records --- */
.entity-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.entity-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.entity-tag.narcl::before { background: #e34948; }
.entity-tag.idrcl::before { background: #2a78d6; }

.topbar nav a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 20px;
  font-size: 14px;
}
.topbar nav a.active { color: var(--text-primary); font-weight: 600; }
.topbar .user-chip {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 20px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  width: 100%;
  flex: 1;
}

.container.narrow { max-width: 460px; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 14px; }
.subtitle { color: var(--text-secondary); font-size: 14px; margin: 0 0 20px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 6px;
  color: var(--text-secondary);
}
label:first-of-type { margin-top: 0; }

input[type=text], input[type=tel], input[type=password], input[type=date], select {
  width: 100%;
  padding: 11px 12px;
  font-size: 15px;
  border: 1px solid var(--baseline);
  border-radius: 7px;
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: inherit;
}
input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--accent-strong); }
.btn.full { width: 100%; margin-top: 22px; }
.btn.secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--baseline);
}
.btn.secondary:hover { background: var(--gridline); }
.btn.danger { background: var(--critical); }
.btn.small { padding: 6px 12px; font-size: 13px; }

.error-box {
  background: color-mix(in srgb, var(--critical) 12%, var(--surface-1));
  border: 1px solid var(--critical);
  color: var(--critical);
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 14px;
  margin-bottom: 16px;
}
.success-box {
  background: color-mix(in srgb, var(--good) 12%, var(--surface-1));
  border: 1px solid var(--good);
  color: var(--success-text);
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 14px;
  margin-bottom: 16px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.stat-tile .label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.stat-tile .value { font-size: 30px; font-weight: 600; margin-top: 6px; font-variant-numeric: proportional-nums; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--baseline);
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--gridline);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge.in { background: color-mix(in srgb, var(--good) 16%, var(--surface-1)); color: var(--success-text); }
.badge.out { background: var(--gridline); color: var(--text-secondary); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}
.toolbar .field { min-width: 150px; }
.toolbar label { margin: 0 0 4px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.footer-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 20px;
}

.checkmark-circle {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--good) 16%, var(--surface-1));
  color: var(--good);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
}

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .topbar nav a { margin-left: 0; margin-right: 16px; }
}
