:root {
  --gate-ink: #163047;
  --gate-muted: #627486;
  --gate-line: #d9e4ec;
  --gate-surface: #ffffff;
  --gate-soft: #eef8fb;
  --gate-primary: #0f766e;
  --gate-primary-dark: #0a5b55;
  --gate-danger: #b42318;
  --gate-shadow: 0 12px 30px rgba(19, 50, 72, 0.1);
}

.gate-toolbar,
.gate-toolbar .toolbar,
.gate-toolbar .toolbar__center,
.gate-toolbar .toolbar__left {
  background: #dff4fb;
  color: var(--gate-ink);
}

.gate-shell {
  min-height: 100%;
  box-sizing: border-box;
  padding: 14px 12px 36px;
  background: linear-gradient(180deg, #dff4fb 0, #f5f8fa 240px);
}

.gate-hero {
  display: flex;
  gap: 14px;
  align-items: center;
  max-width: 820px;
  margin: 0 auto 14px;
  padding: 10px 4px 4px;
}

.gate-hero img {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
}

.gate-hero h1,
.gate-card h2,
.gate-hero p {
  margin: 0;
}

.gate-hero h1 {
  color: var(--gate-ink);
  font-size: 25px;
  line-height: 1.15;
}

.gate-hero p:not(.gate-eyebrow) {
  margin-top: 5px;
  color: var(--gate-muted);
  font-size: 13px;
  line-height: 1.45;
}

.gate-eyebrow {
  color: var(--gate-primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.gate-local-notice {
  max-width: 820px;
  margin: 0 auto 12px;
  border: 1px solid #f5c36a;
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff8e7;
  color: #7a4c00;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}

.gate-presence-summary {
  display: grid;
  max-width: 820px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 auto 14px;
}

.gate-summary-card {
  font: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 106px;
  box-sizing: border-box;
  border: 1px solid var(--gate-line);
  border-radius: 14px;
  padding: 13px 14px;
  background: #fff;
  box-shadow: var(--gate-shadow);
}

.gate-summary-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--summary-color);
  content: '';
}

.gate-summary-card[aria-expanded="true"],
.gate-summary-card:focus-visible {
  outline: 3px solid var(--summary-color);
  outline-offset: 2px;
}

#gateSummaryPanel[hidden] { display: none; }
.gate-summary-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gate-summary-list { max-height: 460px; overflow-y: auto; }
#gateSummaryDescription { color: var(--gate-muted); font-size: 13px; }

#gateMyKadField[hidden], #gateMyKadPreview[hidden] { display: none; }
#gateIdCameraPanel[hidden] { display: none; }
.gate-camera-video { display: block; width: 100%; max-width: 560px; max-height: 360px; background: #163047; border-radius: 8px; margin: 10px 0; object-fit: contain; }
.gate-id-photo { display: block; max-width: 100%; width: 320px; max-height: 220px; object-fit: contain; margin: 10px 0; border-radius: 8px; }
.gate-photo-reference summary { cursor: pointer; color: var(--gate-primary); padding: 10px 0; font-weight: 700; }
#gateMyKadHelp, #gateMyKadStatus { color: var(--gate-muted); font-size: 12px; line-height: 1.4; }

.gate-summary-entered {
  --summary-color: #2563eb;
}

.gate-summary-inside {
  --summary-color: #d97706;
}

.gate-summary-exited {
  --summary-color: #0f766e;
}

.gate-summary-label {
  display: block;
  color: var(--gate-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gate-summary-card strong {
  display: block;
  margin: 3px 0 1px;
  color: var(--gate-ink);
  font-size: 31px;
  line-height: 1.05;
}

.gate-summary-card small {
  color: var(--gate-muted);
  font-size: 10px;
  line-height: 1.3;
}

.gate-card {
  max-width: 820px;
  box-sizing: border-box;
  margin: 0 auto 14px;
  border: 1px solid rgba(217, 228, 236, 0.85);
  border-radius: 16px;
  padding: 16px;
  background: var(--gate-surface);
  box-shadow: var(--gate-shadow);
}

.gate-section-heading {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.gate-section-heading > span {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  place-items: center;
  border-radius: 50%;
  background: var(--gate-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.gate-section-heading h2 {
  color: var(--gate-ink);
  font-size: 17px;
  line-height: 1.25;
}

.gate-section-heading p {
  margin: 3px 0 0;
  color: var(--gate-muted);
  font-size: 12px;
  line-height: 1.35;
}

.gate-section-heading-compact {
  margin-bottom: 10px;
}

.gate-label,
.gate-field > span,
.gate-type-group legend {
  display: block;
  margin-bottom: 7px;
  color: var(--gate-ink);
  font-size: 12px;
  font-weight: 700;
}

.gate-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #c8d7e2;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--gate-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.3;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.gate-input:focus {
  border-color: var(--gate-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

.gate-uppercase {
  text-transform: uppercase;
}

.gate-unit-results {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.gate-unit-option {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--gate-line);
  border-radius: 10px;
  padding: 10px 11px;
  background: #fff;
  color: var(--gate-ink);
  text-align: left;
  cursor: pointer;
}

.gate-unit-option:hover,
.gate-unit-option:focus {
  border-color: var(--gate-primary);
  background: var(--gate-soft);
}

.gate-unit-option strong {
  font-size: 14px;
}

.gate-unit-option small {
  color: var(--gate-muted);
  font-size: 11px;
}

.gate-selected-unit {
  margin-top: 10px;
  border: 1px solid #9ed5cd;
  border-radius: 11px;
  padding: 11px 12px;
  background: #ecfdf8;
  color: var(--gate-ink);
  font-size: 13px;
  line-height: 1.4;
}

.gate-selected-unit strong,
.gate-selected-unit span {
  display: block;
}

.gate-selected-unit span {
  margin-top: 2px;
  color: var(--gate-muted);
  font-size: 11px;
}

.gate-type-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 15px;
  border: 0;
  padding: 0;
}

.gate-type-group legend {
  width: 100%;
}

.gate-type-group label {
  position: relative;
  flex: 1 1 110px;
}

.gate-type-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gate-type-group label span {
  display: block;
  border: 1px solid var(--gate-line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
  color: var(--gate-muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.gate-type-group input:checked + span {
  border-color: var(--gate-primary);
  background: var(--gate-primary);
  color: #fff;
}

.gate-type-group input:focus + span {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.gate-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.gate-field-wide {
  grid-column: 1 / -1;
}

.gate-field textarea {
  resize: vertical;
}

.gate-form-error {
  margin-top: 13px;
  border-radius: 9px;
  padding: 9px 11px;
  background: #fff1f0;
  color: var(--gate-danger);
  font-size: 12px;
  font-weight: 700;
}

.gate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 16px;
}

.gate-button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.gate-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.gate-button-primary {
  background: var(--gate-primary);
  color: #fff;
}

.gate-button-primary:hover {
  background: var(--gate-primary-dark);
}

.gate-button-secondary {
  border: 1px solid var(--gate-line);
  background: #f7fafc;
  color: var(--gate-ink);
}

.gate-recent-list {
  display: grid;
  gap: 8px;
}

.gate-recent-empty {
  border: 1px dashed #c7d6df;
  border-radius: 10px;
  padding: 16px;
  color: var(--gate-muted);
  font-size: 12px;
  text-align: center;
}

.gate-recent-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  border: 1px solid var(--gate-line);
  border-radius: 11px;
  padding: 11px 12px;
  background: #fbfdfe;
}

.gate-recent-entry strong {
  color: var(--gate-ink);
  font-size: 13px;
}

.gate-recent-entry p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--gate-muted);
  font-size: 11px;
}

.gate-entry-times {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--gate-muted);
  font-size: 11px;
}

.gate-entry-times b {
  color: var(--gate-ink);
}

.gate-entry-footer {
  display: flex;
  grid-column: 1 / -1;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
}

.gate-presence-pill {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.gate-presence-inside {
  background: #fff1d6;
  color: #8a4b08;
}

.gate-presence-exited {
  background: #dff7f1;
  color: var(--gate-primary-dark);
}

.gate-exit-button {
  border: 1px solid #e7a449;
  border-radius: 9px;
  padding: 8px 11px;
  background: #fff8e7;
  color: #7a4300;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.gate-exit-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.gate-status-pill {
  align-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  background: #dff7f1;
  color: var(--gate-primary-dark);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

@media (max-width: 520px) {
  .gate-presence-summary {
    grid-template-columns: 1fr;
  }

  .gate-summary-card {
    min-height: 88px;
  }

  .gate-field-grid {
    grid-template-columns: 1fr;
  }

  .gate-field-wide {
    grid-column: auto;
  }

  .gate-actions {
    flex-direction: column-reverse;
  }

  .gate-button {
    width: 100%;
  }
}
