/* =========================================================
   Employee & Truck Control — Minimal CSS
   ========================================================= */

/* ----- Reset & Base ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-primary:    #147cc2;
  --color-primary-dk: #155a87;
  --color-success:    #198754;
  --color-warning:    #ffc107;
  --color-error:      #dc3545;
  --color-info:       #0dcaf0;
  --color-bg:         #f4f6f9;
  --color-surface:    #ffffff;
  --color-text:       #212529;
  --color-muted:      #6c757d;
  --color-border:     #dee2e6;
  --radius:           10px;
  --radius-sm:        6px;
  --shadow:           0 2px 8px rgba(0,0,0,.08);
  --nav-height:       80px;
  --font-sans:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                      "Helvetica Neue", Arial, sans-serif;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ----- Navbar ----- */
.navbar {
  height: var(--nav-height);
  background: linear-gradient(to bottom, var(--color-primary), var(--color-primary-dk));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-brand a {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-logo {
  height: 90px;
  width: auto;
  display: block;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.navbar-menu a {
  color: #ffffffcc;
  font-size: .95rem;
  text-decoration: none;
  transition: color .15s, font-size .5s;
}

.navbar-menu a:hover {
  color: #fff;
  text-decoration: none;
  font-size: 1.2rem;
}

.navbar-user {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #ffffffaa;
  font-size: .9rem;
  white-space: nowrap;
}

/* ----- Navbar "Sistema" dropdown ----- */
.navbar-dropdown {
  position: relative;
}

.navbar-dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: #ffffffcc;
  font-size: .95rem;
  font-family: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: color .15s;
}

.navbar-dropdown-toggle:hover {
  color: #fff;
}

.navbar-dropdown-caret {
  font-size: .75rem;
  transition: transform .15s;
}

.navbar-dropdown.open .navbar-dropdown-caret {
  transform: rotate(180deg);
}

/* Same gradient/colors as .navbar, stacked in equal-size boxes below the toggle */
.navbar-dropdown-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  min-width: 200px;
  background: linear-gradient(to bottom, var(--color-primary), var(--color-primary-dk));
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 200;
}

.navbar-dropdown.open .navbar-dropdown-menu {
  display: flex;
}

.navbar-dropdown-menu a,
.navbar-dropdown-item {
  color: #ffffffcc;
  font-size: .95rem;
  text-decoration: none;
  padding: .85rem 1.1rem;
  text-align: left;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
  transition: background .15s, color .15s;
}

.navbar-dropdown-menu a:last-child,
.navbar-dropdown-form:last-child .navbar-dropdown-item {
  border-bottom: none;
}

.navbar-dropdown-menu a:hover,
.navbar-dropdown-item:hover {
  background: rgba(255, 255, 255, .15);
  text-decoration: none;
  color: #fff;
}

.navbar-dropdown-form {
  width: 100%;
}

@media (max-width: 768px) {
  .navbar-dropdown-menu {
    position: static;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
    gap: 15px;
  }
}

/* btn-link — looks like a link, behaves like a button */
.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  color: #ffffffcc;
  font-size: .95rem;
  padding: 0;
  transition: color .15s, font-size .5s;
}

.btn-link:hover {
  color: #ff1717;
  text-decoration: underline;
}

/* ----- Container ----- */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex: 1;
}

.container--wide {
  max-width: 1400px;
}

/* ----- Messages / Alerts ----- */
.messages {
  margin-bottom: 1.25rem;
}

.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: .5rem;
  font-size: .95rem;
  border-left: 4px solid transparent;
}

.alert--success,
.alert--messages-success {
  background: #d1e7dd;
  border-color: var(--color-success);
  color: #0a3622;
}

.alert--warning,
.alert--messages-warning {
  background: #fff3cd;
  border-color: var(--color-warning);
  color: #664d03;
}

.alert--error,
.alert--messages-error,
.alert--danger,
.alert--messages-danger {
  background: #f8d7da;
  border-color: var(--color-error);
  color: #58151c;
}

.alert--info,
.alert--messages-info {
  background: #cff4fc;
  border-color: var(--color-info);
  color: #055160;
}

/* ----- Cards ----- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

.card--accent-success { border-left: 4px solid var(--color-success); }
.card--accent-danger  { border-left: 4px solid var(--color-error); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85em;
  background: var(--color-bg);
  padding: .2em .5em;
  border-radius: var(--radius-sm);
}

/* ----- Tables ----- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table-responsive table {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}

thead th {
  background: var(--color-primary);
  color: #fff;
  padding: .6rem 1rem;
  text-align: left;
  font-weight: 600;
}

tbody tr:nth-child(even) {
  background: #f8f9fa;
}

tbody td {
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

tbody tr:hover {
  background: #e9f0f7;
}

tr.row-inactive {
  color: var(--color-muted);
  opacity: .65;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}

.col-visitor-name {
  width: 24%;
}

.col-visit-actions {
  width: 30%;
}

.col-visit-actions.table-actions {
  flex-wrap: nowrap;
}

.table-empty-cell {
  text-align: center;
  padding: 2rem;
  color: var(--color-muted);
}

/* ----- Badges ----- */
.badge {
  display: inline-block;
  padding: .25em .55em;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1;
}

.badge--success  { background: #d1e7dd; color: #0a3622; }
.badge--danger   { background: #f8d7da; color: #58151c; }
.badge--warning  { background: #fff3cd; color: #664d03; }
.badge--info     { background: #cff4fc; color: #055160; }
.badge--secondary{ background: #e2e3e5; color: #41464b; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .45rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  line-height: 1.4;
}

.btn:hover {
  text-decoration: none;
  opacity: .9;
}

.btn--primary   { background: var(--color-primary);    color: #fff; }
.btn--success   { background: var(--color-success);    color: #fff; }
.btn--danger    { background: var(--color-error);      color: #fff; }
.btn--warning   { background: var(--color-warning);    color: #212529; }
.btn--secondary { background: var(--color-muted);      color: #fff; }
.btn--outline   {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.btn--outline:hover { background: var(--color-primary); color: #fff; }

.btn--sm  { padding: .3rem .7rem; font-size: .82rem; }
.btn--full { width: 100%; }

/* ----- Forms ----- */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: .35rem;
  font-size: .9rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: .45rem .75rem;
  font-size: .95rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}

.form-control--sm {
  padding: .3rem .6rem;
  font-size: .85rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(29,111,165,.18);
}

.form-control--error {
  border-color: var(--color-error);
}

.form-error {
  display: block;
  color: var(--color-error);
  font-size: .82rem;
  margin-top: .25rem;
}

.form-help {
  display: block;
  color: var(--color-muted);
  font-size: .82rem;
  margin-top: .25rem;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: .35rem;
  font-size: .9rem;
}

.form-text {
  display: block;
  color: var(--color-muted);
  font-size: .82rem;
  margin-top: .25rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: 1.5rem;
}

/* ----- Camera capture (photo/document fields) ----- */
.camera-capture {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.camera-viewport {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-placeholder {
  color: #ffffffaa;
  font-size: .85rem;
  text-align: center;
  padding: 1rem;
}

.camera-video,
.camera-snapshot {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.camera-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.camera-error {
  display: none;
}

.camera-file-input {
  display: none;
}

.form-group--check {
  display: flex;
  align-items: center;
}

.form-check-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 500;
  font-size: .9rem;
  cursor: pointer;
}

.form-checkboxes {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.filter-form {
  width: 100%;
}

.search-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.6rem;
}

.search-bar input[type="search"] {
  min-width: 0;
}

.search-bar .btn {
  white-space: nowrap;
}

/* ----- Login page ----- */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 4rem;
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.25rem;
  width: 100%;
  max-width: 400px;
}

.login-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--color-primary);
}

/* ----- Page headers ----- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .5rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ----- Footer ----- */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: .85rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  margin-top: auto;
}

/* ----- Utilities ----- */
.text-muted    { color: var(--color-muted); }
.text-center   { text-align: center; }
.text-sm       { font-size: .85rem; }
.text-nowrap   { white-space: nowrap; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: 1.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.ml-2 { margin-left: .5rem; }
.d-flex         { display: flex; }
.d-inline       { display: inline; }
.d-none         { display: none; }
.align-center   { align-items: center; }
.align-self-end   { align-self: flex-end; }
.align-self-start { align-self: start; }
.flex-wrap      { flex-wrap: wrap; }
.w-auto         { width: auto; }
.gap-2          { gap: .5rem; }
.gap-3          { gap: 1rem; }
.cursor-zoom    { cursor: zoom-in; }

/* ----- Photos ----- */
.photo-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  display: block;
}

.photo-thumb--sm {
  width: 36px;
  height: 36px;

}

.photo-thumb--100 { max-width: 100px; width: auto; height: auto; }
.photo-thumb--150 { max-width: 150px; width: auto; height: auto; }
.photo-thumb--200 { max-width: 200px; width: auto; height: auto; }

.photo-thumb--list {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  display: block;
}

/* Photo cell fills the entire row height */
.photo-cell {
  padding: 0 !important;
  width: 80px;
  vertical-align: middle;
  text-align: center;
}
.photo-cell img,
.photo-cell .photo-placeholder--list {
  display: block;
}

.photo-thumb--lg {
  width: 120px;
  height: 120px;
  border-radius: var(--radius);
}

.photo-placeholder {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
}

.photo-placeholder--sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: .95rem;
}

.photo-placeholder--list {
  width: 78px;
  height: 78px;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.photo-header {
  margin-bottom: 1rem;
}

.photo-preview {
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}


/* ----- Truck slideshow (detail) ----- */
.truck-slideshow {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-bg);
}

.truck-slide {
  display: none;
  width: 100%;
  height: 100%;
}

.truck-slide.active {
  display: block;
}

.truck-slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.truck-slide-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, .45);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.truck-slide-nav:hover {
  background: rgba(0, 0, 0, .7);
}

.truck-slide-nav--prev { left: .6rem; }
.truck-slide-nav--next { right: .6rem; }

.truck-slide-dots {
  position: absolute;
  bottom: .6rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: .4rem;
}

.truck-slide-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .6);
  border: 1px solid rgba(0, 0, 0, .15);
  cursor: pointer;
  transition: background .15s, transform .15s;
}

.truck-slide-dot.active {
  background: #fff;
  transform: scale(1.25);
}

/* ----- Truck photo management (create/edit form) ----- */
.truck-photo-manage-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.truck-photo-manage-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
}

.truck-photo-manage-thumb {
  width: 110px;
  height: 85px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.truck-photo-manage-remove {
  font-size: .8rem;
  color: var(--color-error);
  display: flex;
  align-items: center;
  gap: .3rem;
  cursor: pointer;
}

/* ----- Employees page ----- */
.employees-page-layout {
  display: grid;
  grid-template-columns: 1fr 529px;
  gap: 1.5rem;
  align-items: start;
}

.employees-side-col .card {
  position: sticky;
  top: calc(var(--nav-height) + 1rem);
}

.employees-side-col .table td,
.employees-side-col .table th {
  font-size: .9rem;
}

/* Fixed-height scroll box for the "Histórico de Entradas" widget — the
   thead stays put while the tbody scrolls, and this bounded height is what
   makes "infinite scroll" (load more near the bottom) meaningful for a
   short sidebar list instead of eagerly loading everything at once. */
.history-scroll-box {
  max-height: 588px;
  overflow-y: auto;
}

.history-scroll-box thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .5rem;
}

.side-panel-header .card-title {
  margin-bottom: 0;
}

.col-employee-name {
  width: 22%;
  font-size: 1.05rem;
}

@media (max-width: 992px) {
  .employees-page-layout { grid-template-columns: 1fr; }
  .employees-side-col .card { position: static; }
}

/* ----- Brands & Models page ----- */
.brands-page-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .brands-page-layout { grid-template-columns: 1fr; }
}

.brands-forms {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: calc(var(--nav-height) + 1rem);
}

.brands-scroll-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.25rem;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
}

.brands-scroll-box {
  max-height: 420px;
  overflow-y: auto;
}

.brands-table {
  width: 100%;
  border-collapse: collapse;
}

.brands-table .col-brand  { width: 160px; }
.brands-table .col-action { width: 90px; text-align: center; }

.brands-table thead th {
  position: sticky;
  top: 0;
  background: #f0f4f8;
  color: var(--color-text);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .5rem 1rem;
  border-bottom: 2px solid var(--color-border);
  z-index: 1;
}

.brands-table tbody td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.brands-table tbody tr:last-child td {
  border-bottom: none;
}

.brands-table tbody tr:hover {
  background: #f8fafc;
}

.model-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.model-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #eef4fb;
  border: 1px solid #c5d9ee;
  border-radius: 20px;
  padding: .2rem .6rem .2rem .75rem;
  font-size: .82rem;
  color: var(--color-primary-dk);
  font-weight: 500;
}

.model-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-muted);
  font-size: .75rem;
  padding: 0 .1rem;
  line-height: 1;
  transition: color .15s;
}

.model-tag-remove:hover { color: var(--color-error); }

/* ----- Employee photo (detail) ----- */
.emp-photo {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  margin-bottom: 1rem;
  cursor: zoom-in;
  transition: transform .15s, border-color .15s;
}

.emp-photo:hover {
  transform: scale(1.04);
  border-color: var(--color-primary);
}

/* ----- Notes / Observations cell ----- */
.notes-cell {
  max-width: 280px;
  min-width: 120px;
}

.notes-textarea {
  width: 100%;
  min-height: 2.8em;
  max-height: 6em;
  padding: .25rem .35rem;
  font-size: .85rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  resize: none;
  overflow-y: auto;
  cursor: default;
  box-sizing: border-box;
}

/* ----- Form card ----- */
.form-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 2rem;
  max-width: 720px;
}

/* Wider variant — used by the employee form, which needs room for the
   photo + document-photo camera widgets to sit side by side. */
.form-card--wide {
  max-width: 980px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.required { color: var(--color-error); }

/* ----- Detail card ----- */
.detail-card,
.section-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-body {
  padding: 0;
}

.detail-list {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: .5rem 1rem;
}

/* Optional wrapper around each dt/dd pair — stays out of the grid flow
   so .detail-list keeps aligning labels and values in two columns. */
.detail-item {
  display: contents;
}

.detail-list dt {
  font-weight: 600;
  color: var(--color-muted);
  font-size: .9rem;
}

.detail-list dd {
  margin: 0;
}

/* ----- Detail table (label/value rows using <th>) ----- */
.detail-table th {
  width: 220px;
  text-align: left;
  font-weight: 600;
  color: var(--color-muted);
  font-size: .9rem;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

@media (max-width: 600px) {
  .detail-list { grid-template-columns: 1fr; gap: .15rem 0; }
  .detail-table th { width: auto; }
}

/* ----- Biometric status ----- */
.biometric-status {
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.biometric-status--enrolled {
  background: #d1e7dd33;
  border: 1px solid var(--color-success);
}

.biometric-status--missing {
  background: #fff3cd33;
  border: 1px solid var(--color-warning);
}

.biometric-status p {
  margin-top: .5rem;
  color: var(--color-muted);
  font-size: .9rem;
  line-height: 1.5;
}

/* ----- Enroll instructions ----- */
.enroll-instructions {
  margin-bottom: 1.5rem;
}

.enroll-instructions h3 {
  font-size: 1rem;
  margin-bottom: .5rem;
}

.enroll-instructions ol {
  padding-left: 1.25rem;
  margin-bottom: .75rem;
  line-height: 1.7;
}

.enroll-form {
  margin-top: .5rem;
}

/* ----- Confirmation dialogs ----- */
.confirm-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 2rem;
  max-width: 560px;
}

.confirm-card--danger {
  border-top: 4px solid var(--color-error);
}

.confirm-message {
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.confirm-warning {
  color: var(--color-error);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}

.confirm-actions {
  display: flex;
  gap: .6rem;
}

/* ----- Empty state ----- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-muted);
}

.empty-state p { margin-bottom: 1rem; }

/* ----- Presence status badge ----- */
.presence-badge {
  display: inline-block;
  padding: .4em 1em;
  border-radius: 20px;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .03em;
  margin-right: .5rem;
}

.presence-badge--in {
  background: #d1e7dd;
  color: #0a3622;
  border: 2px solid var(--color-success);
}

.presence-badge--out {
  background: #f8d7da;
  color: #58151c;
  border: 2px solid var(--color-error);
}

.presence-status {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .75rem 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1rem;
}

/* ----- Filter row ----- */
.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-row .form-group {
  margin-bottom: 0;
  min-width: 160px;
}

/* ----- Infinite scroll loader ----- */
.infinite-sentinel {
  height: 1px;
}

.infinite-loader {
  display: none;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 1.25rem;
  color: var(--color-muted);
  font-size: .9rem;
}

.infinite-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ----- Visit rows (active / completed) ----- */
.row-active {
  background-color: #e8f5e9 !important;
}

.row-completed {
  background-color: #f5f5f5 !important;
}

.row-active:hover {
  background-color: #c8e6c9 !important;
}

.row-completed:hover {
  background-color: #eeeeee !important;
}

/* ----- Photo lightbox (simple, single image) ----- */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox.active {
  display: flex;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-sm);
}

/* ----- Image modal (pan & zoom viewer) ----- */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, .9);
  overflow: hidden;
}

.modal-image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-content {
  display: block;
  max-width: 90%;
  max-height: 90%;
  transition: transform .1s ease;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
}

.modal-content:active {
  cursor: grabbing;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1002;
  line-height: 1;
}

.modal-close:hover {
  color: #ccc;
}

.modal-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(0, 0, 0, .6);
  padding: 8px 16px;
  border-radius: 30px;
  z-index: 1002;
}

.zoom-btn {
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, .3);
}

.zoom-btn--text {
  width: auto;
  border-radius: 20px;
  padding: 0 14px;
  font-size: 13px;
}

.zoom-level {
  color: #fff;
  font-size: 14px;
  min-width: 45px;
  text-align: center;
  font-family: sans-serif;
}

.modal-caption {
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  color: #aaa;
  font-size: 13px;
  text-align: center;
  z-index: 1002;
  background: rgba(0, 0, 0, .5);
  padding: 6px 14px;
  border-radius: 16px;
  font-family: sans-serif;
}

/* ----- Mobile navbar ----- */
.navbar-toggle {
  display: none;
}

@media (max-width: 768px) {
  html, body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .navbar {
    padding: 10px 15px;
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
  }

  .navbar-toggle {
    display: flex !important;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: var(--color-primary);
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid #fff;
    font-size: 2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .3);
  }

  .navbar-menu {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    left: 20px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, .2);
    z-index: 9998;
    padding: 20px;
    flex-direction: column;
    gap: 15px;
    border: 1px solid var(--color-border);
  }

  .navbar-menu.active {
    display: flex;
  }

  .navbar-menu a,
  .navbar-menu button {
    width: 100%;
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
    font-weight: bold;
    text-align: center;
    border: 1px solid var(--color-border);
  }

  .navbar-user {
    position: static;
    transform: none;
    margin-bottom: 10px;
    display: block;
    text-align: center;
    color: var(--color-muted);
    font-size: .9rem;
  }

  .form-row {
    flex-direction: column;
  }

  .card {
    min-width: 100% !important;
  }

  .page-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .navbar-title {
    display: none;
  }
}

/* ----- Visitor picker (searchable, with inline quick-create) ----- */
.visitor-picker {
  position: relative;
}

.visitor-picker-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
  z-index: 20;
}

.visitor-picker-results.active {
  display: block;
}

.visitor-picker-item {
  padding: .55rem .75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  font-size: .9rem;
}

.visitor-picker-item:last-child {
  border-bottom: none;
}

.visitor-picker-item:hover {
  background: var(--color-bg);
}

.visitor-picker-item--create {
  color: var(--color-primary);
  font-weight: 600;
}

.visitor-picker-selected {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.visitor-quick-create {
  margin-top: .75rem;
  padding: 1rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

/* ----- Tab bar (segmented filter control, distinct from action buttons) ----- */
.tab-bar {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.25rem;
}

.tab-bar-item {
  padding: .6rem 1rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-bar-item:hover {
  color: var(--color-text);
  text-decoration: none;
}

.tab-bar-item.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* ----- Attendance calendar report ----- */
.calendar-month-title {
  margin: 0;
  min-width: 220px;
  text-align: center;
}

.calendar-grid {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calendar-grid-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-grid-header {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.calendar-grid-header div {
  padding: .6rem .5rem;
  text-align: center;
}

.calendar-day {
  min-height: 90px;
  padding: .4rem;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.calendar-grid-row .calendar-day:last-child {
  border-right: none;
}

.calendar-day--muted {
  background: var(--color-bg);
  color: var(--color-muted);
}

.calendar-day--today {
  background: #eef5fb;
}

.calendar-day-number {
  font-size: .82rem;
  font-weight: 600;
}

.calendar-record {
  font-size: .72rem;
  padding: .15rem .35rem;
  border-radius: 20px;
  background: #d1e7dd;
  color: #0a3622;
  line-height: 1.4;
}

.calendar-record--open {
  background: #cff4fc;
  color: #055160;
}

@media (max-width: 768px) {
  .calendar-day {
    min-height: 60px;
    font-size: .8rem;
  }

  .calendar-record {
    font-size: .65rem;
  }
}
