/*
 * This is a manifest file that'll be compiled into application.css.
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-50: #eff6ff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --red-600: #dc2626;
  --green-600: #16a34a;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  /* semantic tokens */
  --bg:         var(--gray-50);
  --bg-card:    #fff;
  --bg-sidebar: #fff;
  --border:     var(--gray-200);
  --text:       var(--gray-900);
  --text-muted: var(--gray-400);
}

[data-theme="dark"] {
  color-scheme: dark;
  --gray-50:   #0f172a;
  --gray-100:  #1e293b;
  --gray-200:  #334155;
  --gray-400:  #94a3b8;
  --gray-600:  #cbd5e1;
  --gray-700:  #e2e8f0;
  --gray-900:  #f1f5f9;
  --blue-50:   #1e3a5f;
  --blue-600:  #3b82f6;
  --blue-700:  #2563eb;
  --bg:        #0f172a;
  --bg-card:   #1e293b;
  --bg-sidebar:#1e293b;
  --border:    #334155;
  --text:      #f1f5f9;
  --text-muted:#94a3b8;
  --shadow:    0 1px 3px rgba(0,0,0,.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* Flash */
.flash {
  padding: 12px 16px;
  font-size: 14px;
  text-align: center;
}
.flash--notice { background: #dcfce7; color: #15803d; }
.flash--alert  { background: #fee2e2; color: #b91c1c; }
[data-theme="dark"] .flash--notice { background: #14532d; color: #86efac; }
[data-theme="dark"] .flash--alert  { background: #450a0a; color: #fca5a5; }

/* App layout */
.layout--app {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  transition: width .2s ease;
  overflow: hidden;
}

.sidebar--collapsed {
  width: 56px;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
}

.sidebar__nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item--active { background: var(--blue-50); color: var(--blue-600); }

.nav-section {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 10px 4px;
  white-space: nowrap;
}

.sidebar__footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar__user {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar__user-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.sidebar__user-email {
  display: block;
  font-size: 12px;
  color: var(--gray-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.sidebar__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar__icon-btns {
  display: flex;
  gap: 6px;
  align-items: center;
}

.sign-out-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-400);
  text-decoration: none;
  padding-left: 10px;
}
.sign-out-btn svg { display: none; }
.sign-out-btn:hover { color: var(--red-600); }
.sidebar--collapsed .sign-out-btn svg { display: block; }

/* Collapsed state */
.sidebar--collapsed .nav-label { display: none; }
.sidebar--collapsed .nav-item { justify-content: center; padding: 9px; gap: 0; }
.sidebar--collapsed .nav-section { padding: 8px 0; }
.sidebar--collapsed .sidebar__logo { justify-content: center; padding: 20px 10px; gap: 0; }
.sidebar--collapsed .sidebar__user { display: none; }
.sidebar--collapsed .sidebar__footer { align-items: center; padding: 12px 6px; gap: 8px; }
.sidebar--collapsed .sidebar__actions { flex-direction: column; gap: 6px; width: 100%; justify-content: center; }
.sidebar--collapsed .sidebar__icon-btns { flex-direction: column; gap: 6px; align-items: center; }
.sidebar--collapsed .lang-switcher { flex-direction: column; align-items: center; gap: 2px; }
.sidebar--collapsed .lang-btn { padding: 3px 6px; font-size: 11px; }
.sidebar--collapsed .sign-out-btn { justify-content: center; }

/* Sidebar collapse toggle */
.sidebar__collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: all .15s; flex-shrink: 0;
}
.sidebar__collapse-btn:hover { border-color: var(--text-muted); color: var(--text); background: var(--bg); }
.sidebar__collapse-btn svg { transition: transform .2s ease; }
.sidebar--collapsed .sidebar__collapse-btn svg { transform: rotate(180deg); }

/* Page layout */
.page {
  padding: 32px;
}

@media (max-width: 768px) {
  .page {
    padding: 20px 16px;
  }

  .sidebar {
    width: 200px;
  }

  .layout--app {
    flex-direction: row;
  }
}

@media (max-width: 600px) {
  .layout--app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-height: unset;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar__nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px;
  }

  .sidebar__footer {
    display: none;
  }
}

.page__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.page__subtitle {
  font-size: 14px;
  color: var(--gray-400);
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}

.card__body {
  padding: 20px;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }
.table__actions { text-align: right; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.table__actions form { display: contents; }

/* Pagination */
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; color: var(--text); text-decoration: none; background: var(--bg-card);
}
.page-btn:hover { border-color: var(--text-muted); color: var(--text); }
.page-btn--active { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.page-gap { border: none; color: var(--gray-400); cursor: default; }

/* Filter pills */
.filter-pills { display: flex; gap: 4px; }

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: all 0.1s;
  background: var(--bg-card);
}

.filter-pill input[type="radio"],
.filter-pill input[type="checkbox"] { display: none; }

.filter-pill:hover { border-color: var(--text-muted); color: var(--text); }

.filter-pill--active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.filter-pill--reg { font-family: monospace; font-size: 11px; font-weight: 600; letter-spacing: 0.5px; }

/* Hours cell */
.hours-cell { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.hours-hhmm { font-weight: 700; font-size: 12px; }
.hours-decimal { font-size: 10px; color: var(--gray-400); }

/* Logbook table */
.logbook-table th,
.logbook-table td { padding: 6px 10px; }

.logbook-table .border-left { border-left: 1px solid var(--border); }

.logbook-table .logbook-thead-group th {
  font-size: 10px;
  text-align: center;
  border-bottom: none;
  padding-bottom: 2px;
}

.logbook-table .logbook-thead-sub th {
  font-size: 10px;
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

.logbook-table .logbook-month-header td {
  padding: 5px 10px;
  background: var(--bg) !important;
}

.logbook-table .logbook-month-header:hover td { background: var(--bg) !important; }

.logbook-table .logbook-subtotal td {
  background: var(--bg) !important;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.logbook-table .logbook-subtotal:hover td { background: var(--bg) !important; }

.logbook-table .logbook-grandtotal td {
  background: var(--bg) !important;
}

.logbook-table .logbook-grandtotal:hover td { background: var(--bg) !important; }

.logbook-table .logbook-row:hover td { background: var(--bg); }

.logbook-table .text-center { text-align: center; }

.text-muted { color: var(--gray-400) !important; }

/* User avatar */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue-600); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.user-avatar--img { object-fit: cover; padding: 0; background: none; }

.avatar-upload-row { display: flex; align-items: center; gap: 16px; margin-bottom: 0; }
.avatar-upload-preview .user-avatar { font-size: 24px; font-weight: 700; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.badge--admin   { background: #fef3c7; color: #b45309; }
.badge--user    { background: var(--bg); color: var(--text-muted); }
.badge--danger  { background: #fee2e2; color: #b91c1c; }
.badge--warning { background: #fef9c3; color: #a16207; }

/* Buttons extra */
.btn--sm { padding: 5px 12px; font-size: 13px; white-space: nowrap; }
.btn--secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn--secondary:hover { background: var(--border); }
.btn--ghost { background: #e5e7eb; color: var(--text); border: none; font-size: inherit; font-family: inherit; -webkit-appearance: none; appearance: none; line-height: normal; }
.btn--ghost:hover { background: #d1d5db; }
[data-theme="dark"] .btn--ghost { background: #374151; color: var(--text); }
[data-theme="dark"] .btn--ghost:hover { background: #4b5563; }
.btn--danger { background: #fee2e2; color: var(--red-600); }
.btn--danger:hover { background: #fecaca; }

/* Form extras */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 8px; }

/* Empty state */
.expiry-warnings { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.expiry-warning {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius);
  border-left: 4px solid;
}
.expiry-warning--danger  { background: #fee2e2; border-color: #ef4444; color: #7f1d1d; }
.expiry-warning--warning { background: #fef9c3; border-color: #eab308; color: #713f12; }
[data-theme="dark"] .expiry-warning--danger  { background: #3b1212; color: #fca5a5; }
[data-theme="dark"] .expiry-warning--warning { background: #2d2505; color: #fde68a; }
.expiry-warning__icon { flex-shrink: 0; }
.expiry-warning__body { flex: 1; display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.expiry-warning__body span { font-size: 13px; opacity: .8; }
.btn--warning { background: #eab308; color: #fff; border: none; }
.btn--warning:hover { background: #ca8a04; }

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 80px 32px;
  color: var(--gray-400); text-align: center;
}

/* Auth layout */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  padding: 24px;
}

[data-theme="dark"] .auth-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-logo__text {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--gray-600);
  margin-bottom: 28px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color .15s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* Browser autofill — override the yellow/blue tint */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-card) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  /* delay the browser's own transition so our override stays visible */
  transition: background-color 5000s ease-in-out 0s;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--gray-600);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  line-height: normal;
  cursor: pointer;
  border: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background .15s;
  text-decoration: none;
}

.btn--primary {
  background: var(--blue-600);
  color: #fff;
}
.btn--primary:hover { background: var(--blue-700); }

.btn--full { width: 100%; }

/* Custom autocomplete dropdown (replaces native datalist) */
.cdd {
  display: none;
  position: absolute;
  top: calc(100% - 4px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
}
.cdd--open { display: block; }
.cdd__opt {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cdd__opt:hover,
.cdd__opt--focused { background: var(--bg); }

/* Dark mode toggle */
.theme-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: all .15s;
}
.theme-btn:hover { border-color: var(--text-muted); color: var(--text); background: var(--bg); }
.theme-btn .icon-sun  { display: none; }
.theme-btn .icon-moon { display: block; }
[data-theme="dark"] .theme-btn .icon-sun  { display: block; }
[data-theme="dark"] .theme-btn .icon-moon { display: none; }

/* Section title */
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

/* Auth header */
.auth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.auth-header .auth-logo {
  margin-bottom: 0;
}

/* Language switcher */
.lang-switcher {
  display: flex;
  gap: 4px;
}

.lang-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-400);
  text-decoration: none;
  transition: all .15s;
}

.lang-btn:hover { color: var(--blue-600); }

.lang-btn--active {
  background: var(--blue-50);
  color: var(--blue-600);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.stat-card--placeholder {
  opacity: 0.5;
}

.stat-card__value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
}

.stat-card__label {
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 500;
}

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.dashboard-section {}

.dashboard-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

/* Coming soon placeholder */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 12px;
  color: var(--gray-400);
  font-size: 13px;
}

/* Org switcher */
.org-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Info banner */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--blue-50);
  border: 1px solid var(--blue-600);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  max-width: 860px;
}

/* Permission matrix table */
.permission-table__role-col {
  text-align: center;
  min-width: 110px;
  font-size: 12px;
}

.permission-table__group-row td {
  background: var(--bg);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.permission-table__label {
  color: var(--gray-700);
  font-size: 13px;
}

.permission-table__check-cell {
  text-align: center;
  vertical-align: middle;
}

.permission-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.permission-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.permission-checkbox__box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.permission-checkbox input:checked + .permission-checkbox__box {
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.permission-checkbox input:checked + .permission-checkbox__box::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}

.permission-checkbox:hover .permission-checkbox__box {
  border-color: var(--blue-600);
}

/* Auth links */
.auth-links {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
}

.auth-links a {
  color: var(--blue-600);
  text-decoration: none;
}
.auth-links a:hover { text-decoration: underline; }

/* Brand credit — login + sidebar footer */
.brand-credit {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  user-select: none;
}
.brand-credit__wordmark {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text);
  line-height: 1;
}

/* Login header logo */
.auth-logo .brand-credit__wordmark { font-size: 20px; }
.auth-logo .brand-credit__by      { font-size: 9px; }

/* Sidebar header logo */
.sidebar__logo .brand-credit__wordmark { font-size: 15px; }
.sidebar__logo .brand-credit__by       { font-size: 8px; }
.sidebar--collapsed .sidebar__logo .brand-credit { display: none; }
.brand-credit__byline {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 3px 0 0;
}
.brand-credit__rule {
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.3;
}
.brand-credit__by {
  font-size: 7px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: lowercase;
}
.brand-credit__zoz {
  color: #2563eb;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.12em;
}
.brand-credit__copy {
  font-size: 7px;
  color: var(--text-muted);
  opacity: 0.55;
}

/* Login page wrapper */
.auth-credit { margin-top: 20px; text-align: center; }

/* Sidebar credit wrapper */
.sidebar__credit {
  padding: 6px 0 2px;
  overflow: hidden;
  text-align: center;
}
.sidebar--collapsed .sidebar__credit { display: none; }

/* Flight form */
.flight-form .form-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.flight-form .form-section:last-of-type {
  border-bottom: none;
}

.form-row--2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row--3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-row--4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }

@media (max-width: 700px) {
  .form-row--2,
  .form-row--3,
  .form-row--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .form-row--2,
  .form-row--3,
  .form-row--4 { grid-template-columns: 1fr; }
}

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  transition: border-color .15s;
  outline: none;
  background: var(--bg-card);
}

.form-group input[type="date"],
.form-group input[type="datetime-local"] {
  width: auto;
}

.form-group input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color .15s;
  outline: none;
}

.form-group select:focus,
.form-group textarea:focus,
.form-group input[type="date"]:focus,
.form-group input[type="datetime-local"]:focus,
.form-group input[type="number"]:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-static {
  font-size: 14px;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  margin: 0;
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attached-file {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
}

.link {
  color: var(--primary);
  text-decoration: none;
}
.link:hover { text-decoration: underline; }

.row-archived { display: none; opacity: .55; }
.show-archived .row-archived { display: table-row; }

.archive-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; user-select: none; }
.archive-toggle input { cursor: pointer; }

.doc-upload-section { margin-top: 8px; }
.doc-upload-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.doc-upload-row .form-control--file { flex: 1; min-width: 0; }

.qr-panel { margin-top: 12px; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; }
.qr-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.qr-expire { font-size: 11px; color: var(--text-muted); margin-top: 10px; }
.qr-code { display: inline-block; background: #fff; padding: 8px; border-radius: 8px; }
.qr-code svg { display: block; }

.text-right { text-align: right; }
.text-mono { font-family: ui-monospace, "SF Mono", monospace; font-size: 13px; }

.flight-reg {
  font-weight: 600;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 13px;
}

.se-me-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}

.se-me-option {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.se-me-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.se-me-option span {
  display: block;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-card);
  transition: all .15s;
  border-right: 1px solid var(--border);
  letter-spacing: 0.04em;
}

.se-me-option:last-child span {
  border-right: none;
}

.se-me-option input:checked + span {
  background: var(--blue-600);
  color: #fff;
}

.se-me-option:hover span {
  background: var(--bg);
  color: var(--text);
}

.se-me-option input:checked + span:hover {
  background: var(--blue-700);
  color: #fff;
}

.badge--engine-se { background: #dcfce7; color: #15803d; }
.badge--engine-me { background: #fef3c7; color: #b45309; }
.badge--pilot-single_pilot { background: var(--bg); color: var(--text-muted); }
.badge--pilot-multi_pilot  { background: #ede9fe; color: #6d28d9; }

.time-toggle-label {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 20px; /* match standard label height */
  margin-bottom: 6px;
}

.time-toggle {
  width: 15px;
  height: 15px;
  accent-color: var(--blue-600);
  cursor: pointer;
  flex-shrink: 0;
}

.time-toggle-text {
  font-weight: 500;
  color: var(--gray-700);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.time-toggle-field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: ui-monospace, "SF Mono", monospace;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color .15s;
  outline: none;
  -moz-appearance: textfield;
}
.time-toggle-field::-webkit-outer-spin-button,
.time-toggle-field::-webkit-inner-spin-button { -webkit-appearance: none; }
.time-toggle-field:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.time-toggle-field:disabled {
  background: var(--bg);
  color: var(--text-muted);
}

.time-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: ui-monospace, "SF Mono", monospace;
  letter-spacing: 0.05em;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color .15s;
  outline: none;
}
.time-input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.aircraft-engine-display {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  margin-top: 6px;
  cursor: default;
  outline: none;
}

.aircraft-engine-display:placeholder-shown {
  color: transparent;
  border-color: transparent;
  background: transparent;
}

.aircraft-search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color .15s;
  outline: none;
}
.aircraft-search-input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* User search autocomplete */
.user-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
}
.user-search-dropdown.hidden { display: none; }
.user-search-item {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.user-search-item:last-child { border-bottom: none; }
.user-search-item:hover { background: var(--bg-hover, var(--blue-50, #eff6ff)); }

/* Impersonation banner */
.impersonation-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #f59e0b;
  color: #1c1917;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
}
.impersonation-stop-btn {
  background: rgba(0,0,0,.15);
  border: none;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
}
.impersonation-stop-btn:hover { background: rgba(0,0,0,.25); }
body:has(.impersonation-banner) .sidebar,
body:has(.impersonation-banner) .app-main { margin-top: 34px; }

/* Date mask: native picker input, visually hidden but accessible for showPicker() */
/* Native date input overlaid on the calendar icon – transparent but clickable */
.date-mask-native {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 36px;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
  margin: 0;
  background: none;
}
.date-mask-native::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Visual-only calendar icon behind the native input */
.date-mask-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  line-height: 1;
}

/* ── Multi-page document upload ───────────────────────────────── */
.upload-page-queue {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  min-height: 0;
}

.upload-page-item {
  position: relative;
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.upload-page-thumb {
  width: 72px;
  height: 100px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text-muted);
}

.upload-page-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-page-label {
  font-size: 11px;
  color: var(--text-muted);
}

.upload-page-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red-600);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.upload-add-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* ── Light mode: darker sidebar text ──────────────────────────── */
:root:not([data-theme="dark"]) .nav-item {
  color: #4b5563;
}
:root:not([data-theme="dark"]) .nav-item:hover {
  color: #111827;
}
:root:not([data-theme="dark"]) .nav-section {
  color: #6b7280;
}
