/* ============================================================
   RULI — Mobile-first Admin UI
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&display=swap');

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

:root {
  --bg:        #F0F2F5;
  --surface:   #FFFFFF;
  --border:    #E4E7EC;
  --primary:   #2563EB;
  --primary-d: #1D4ED8;
  --primary-bg:#EFF6FF;
  --danger:    #DC2626;
  --danger-bg: #FEF2F2;
  --success:   #16A34A;
  --success-bg:#F0FDF4;
  --warning:   #D97706;
  --warning-bg:#FFFBEB;
  --purple:    #7C3AED;
  --purple-bg: #F5F3FF;
  --text:      #111827;
  --text-2:    #374151;
  --muted:     #6B7280;
  --muted-2:   #9CA3AF;
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --font: 'Golos Text', -apple-system, sans-serif;
  --navbar-h: 56px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── NAVBAR ─────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
}
.navbar::-webkit-scrollbar { display: none; }

.nav-hamburger { display: none; }

.nav-brand {
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  margin-right: 8px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.nav-links a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  transition: .15s;
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active { background: var(--primary-bg); color: var(--primary); }

/* Hide navbar on login page */
.login-page .navbar {
  display: none !important;
}

/* ── CONTAINER ───────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  transition: .15s;
  white-space: nowrap;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 40px;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); }

.btn-danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger:hover { background: var(--danger-bg); }

.btn-success { color: var(--success); border-color: transparent; background: transparent; }
.btn-success:hover { background: var(--success-bg); }

.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 34px; }
.btn-icon { padding: 8px; min-height: 36px; min-width: 36px; border-radius: var(--radius-sm); }

/* ── FILTERS ─────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: .15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}
.filter-btn:active { transform: scale(.96); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── MOBILE FILTER ROW ───────────────────────────────────── */
.mobile-filter-row {
  display: none;
  gap: 8px;
  margin-bottom: 14px;
}
.mobile-filter-select {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  appearance: auto;
}
.th-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sortable:hover { color: var(--primary); }
.sort-icon { font-size: 11px; opacity: .5; margin-left: 3px; }
.th-sortable:hover .sort-icon { opacity: 1; }

/* ── SEARCH ──────────────────────────────────────────────── */
.search-bar { margin-bottom: 14px; }
.search-bar input {
  width: 100%;
  max-width: 400px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
.search-bar input:focus { outline: none; border-color: var(--primary); }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.free                { background: var(--success-bg); color: var(--success); }
.badge.rented              { background: var(--primary-bg); color: var(--primary); }
.badge.repair              { background: var(--warning-bg); color: var(--warning); }
.badge.awaiting_replacement{ background: var(--purple-bg);  color: var(--purple); }
.badge.rental-active       { background: var(--primary-bg); color: var(--primary); }
.badge.rental-completed    { background: var(--success-bg); color: var(--success); }
.badge.rental-overdue      { background: var(--danger-bg);  color: var(--danger); }
.badge.contract-active     { background: var(--primary-bg); color: var(--primary); }
.badge.contract-completed  { background: var(--success-bg); color: var(--success); }
.badge.contract-overdue    { background: var(--danger-bg);  color: var(--danger); }

/* ── DESKTOP TABLE ───────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: auto;
  box-shadow: var(--shadow-sm);
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  padding: 8px 12px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg);
}
.table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: center;
  font-size: 14px;
}
.col-left { text-align: left !important; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted-2); padding: 36px !important; font-size: 14px; }

/* Строки аренд */
.row-overdue td { background: #FFF8F8; }
.row-completed td { color: var(--muted); }

/* ── MOBILE CARDS (вместо таблиц) ───────────────────────── */
.card-list { display: none; flex-direction: column; gap: 10px; }

.item-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.item-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.item-card-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  line-height: 1.3;
}
.item-card-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 1px;
}
.item-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--muted);
}
.item-card-meta span strong {
  color: var(--text-2);
  font-weight: 500;
}
.item-card-actions {
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  justify-content: space-between;
}
.item-card-actions .btn { flex: 1; justify-content: center; }

/* ── DASHBOARD CARDS ─────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 90px;
}
.card-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card-value { font-size: 20px; font-weight: 700; line-height: 1; align-self: flex-end; }
.card-value.free    { color: var(--success); }
.card-value.rented  { color: var(--primary); }
.card-value.repair  { color: var(--warning); }
.card-value.waiting { color: var(--purple); }
.card-value.warning { color: var(--warning); }
.card-value.muted   { color: var(--muted); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 0;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 8px 20px 32px;
  box-shadow: var(--shadow-lg);
  overscroll-behavior: contain;
}
/* Ручка */
.modal::before {
  content: '';
  display: block;
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 18px;
}
.modal h2 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.modal h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

.modal label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
}
.modal input,
.modal select,
.modal textarea {
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  width: 100%;
  min-height: 44px;
}
.modal input:focus,
.modal select:focus,
.modal textarea:focus { outline: none; border-color: var(--primary); }
.modal input:disabled  { background: var(--bg); color: var(--muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--danger); font-size: 13px; margin-bottom: 10px; padding: 10px 12px; background: var(--danger-bg); border-radius: var(--radius-sm); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; justify-content: center; min-height: 48px; font-size: 15px; }

[x-cloak] { display: none !important; }

/* ── DETAIL MODAL ────────────────────────────────────────── */
.modal-wide { max-width: 100%; }
.detail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-header h2 { margin: 0; font-size: 18px; }
.detail-grid {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  background: var(--surface);
}
.detail-grid > div {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
.detail-grid > div:last-child { border-bottom: none; }
.detail-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  min-width: 140px;
  flex-shrink: 0;
  padding-top: 2px;
}

.extend-block {
  margin: 12px 0;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.extend-row { display: flex; gap: 10px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.extend-row input { flex: 1; min-width: 130px; }

.add-payment {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ── CLIENT DETAIL ───────────────────────────────────────── */
.back-link { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.back-link:hover { color: var(--primary); }
.client-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.client-meta a { color: var(--primary); text-decoration: none; }

/* ── PHOTO / UPLOAD ──────────────────────────────────────── */
.photo-link { font-size: 13px; color: var(--primary); text-decoration: none; }
.photo-link:hover { text-decoration: underline; }
.upload-btn { cursor: pointer; font-size: 12px; }

/* ── PASSPORT CELL ───────────────────────────────────────── */
.passport-cell { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--muted); }

/* ── ACTIONS CELL ────────────────────────────────────────── */
.actions-cell { white-space: nowrap; text-align: right; }

/* ── DESKTOP (≥ 768px) ───────────────────────────────────── */
@media (min-width: 768px) {
  .container { padding: 28px 24px 48px; }
  .navbar { padding: 0 24px; gap: 8px; }
  .nav-links a { padding: 6px 14px; }
  .modal-overlay { align-items: center; padding: 20px; }
  .modal {
    border-radius: var(--radius-lg);
    max-width: 520px;
    padding: 28px;
  }
  .modal::before { display: none; }
  .modal-wide { max-width: 680px; }
  .table-wrap { display: block; }
  .card-list { display: none !important; }
}

/* ── MOBILE ONLY (< 768px) ───────────────────────────────── */
@media (max-width: 767px) {
  /* ── MOBILE NAV ─────────────────── */
  .navbar { overflow-x: visible; }
  .nav-links { display: none; }
  .nav-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
  }
  .nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
  }
  .nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-hamburger.open span:nth-child(2) { opacity: 0; }
  .nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav-mobile-dropdown {
    display: flex;
    position: absolute;
    top: var(--navbar-h);
    right: 0;
    left: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 200;
    flex-direction: column;
  }
  .nav-mobile-dropdown a {
    padding: 13px 20px;
    text-decoration: none;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid var(--border-light);
    display: block;
  }
  .nav-mobile-dropdown a:last-child { border-bottom: none; }
  .nav-mobile-dropdown a:active { background: var(--primary-bg); color: var(--primary); }


  .page-header h1 { font-size: 20px; }
  .table-wrap { display: none; }
  .filters { display: none; }
  .col-event-details { display: none; }
  .mobile-filter-row { display: flex; }
  .table-wrap.detail-table { display: block; overflow-x: auto; }
  .card-list { display: flex; }
  .form-row { grid-template-columns: 1fr; gap: 0; }

  .cards { grid-template-columns: repeat(2, 1fr); }
  .card-value { font-size: 18px; }
  .dashboard h1 { font-size: 20px; margin-bottom: 14px; }
}

/* ── DEV RESET BUTTON ────────────────────────────────────── */
#dev-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
}
.dev-btn {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(220,38,38,.4);
  transition: .15s;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: .85;
}
.dev-btn:hover { opacity: 1; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(220,38,38,.5); }
.dev-btn:active { transform: scale(.96); }

/* ── TRACKER STATUS ──────────────────────────────────────── */
.tracker-battery {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}
.bat-ok  { background: var(--success-bg); color: var(--success); }
.bat-mid { background: var(--warning-bg); color: var(--warning); }
.bat-low { background: var(--danger-bg);  color: var(--danger);  }
.bat-unknown { background: var(--surface); color: var(--muted); }

.tracker-online { font-size: 13px; font-weight: 500; }
.online-yes  { color: var(--success); }
.online-warn { color: var(--warning); }
.online-no   { color: var(--danger);  }
.online-unknown { color: var(--muted); }

.tracker-na      { color: var(--muted-2); font-size: 13px; }
.tracker-loading { font-size: 13px; color: var(--muted); }

.coords-link {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  font-family: 'SF Mono', monospace;
  white-space: nowrap;
}
.coords-link:hover { text-decoration: underline; }

/* Мобильная строка трекера */
.tracker-card-row {
  padding: 8px 0 4px;
  border-top: 1px solid var(--border);
}
.tracker-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── IMPORT MODAL ────────────────────────────────────────── */
.import-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.import-stat {
  padding: 16px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.import-stat-ok   { background: var(--success-bg); }
.import-stat-skip { background: var(--bg); border: 1px solid var(--border); }
.import-stat-num  { font-size: 32px; font-weight: 700; line-height: 1; }
.import-stat-ok .import-stat-num   { color: var(--success); }
.import-stat-skip .import-stat-num { color: var(--muted); }
.import-stat-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }

.import-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}
.import-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.import-item .muted { color: var(--muted-2); font-size: 11px; }

/* ── PAGE HEADER ACTIONS ─────────────────────────────────── */
.mobile-status-badge { display: none; }
.page-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .page-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .page-header-actions {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  .page-header-actions .dropdown > button { min-height: 40px; font-size: 14px; }
  .page-header-actions .dropdown-menu { right: 0; left: auto !important; min-width: 220px; }
  .desktop-only { display: none; }
  .mobile-status-badge { display: inline-flex !important; padding: 9px 14px; font-size: 14px; border-radius: var(--radius-sm); }
  /* Карточки — убираем обрезание */
  .card-list {
    margin: 0;
  }
  .item-card {
    border-radius: var(--radius-sm);
  }
  /* Трекер инфо в карточке */
  .tracker-info-row {
    gap: 8px;
  }
  /* Кнопки действий в карточке — крупнее */
  .item-card-actions .btn {
    min-height: 40px;
    font-size: 13px;
  }
}


/* ── BIKES TABLE COMPACT ─────────────────────────────────── */
.bikes-table td,
.bikes-table th {
  padding: 8px 10px;
  white-space: nowrap;
  width: 1%;  /* все колонки по содержимому */
}

.bikes-table .col-actions {
  width: 1%;
}
.bikes-table .col-actions .btn-icon {
  padding: 5px 7px;
  min-height: 30px;
  min-width: 30px;
  font-size: 14px;
}

/* SVG иконки кнопок */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: .15s;
  color: var(--muted);
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.icon-btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.icon-btn.danger:hover { background: var(--danger-bg); }
.icon-btn svg { width: 15px; height: 15px; }

/* ── TRACKER INFO ROW (mobile) ───────────────────────────── */
.tracker-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.ymaps-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  transition: .15s;
}
.ymaps-link:hover { background: var(--bg); }
.ymaps-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 4px;
}

.icon-btn.danger-bordered {
  color: var(--danger);
  border: 1px solid #fca5a5;
  background: #fff5f5;
}
.icon-btn.danger-bordered:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.icon-btn.btn-lock {
  color: #b45309;
  border-color: #fcd34d;
  background: #fffbeb;
}
.icon-btn.btn-lock:hover {
  background: #fef3c7;
  border-color: #b45309;
}

.icon-btn.btn-unlock {
  color: #15803d;
  border-color: #86efac;
  background: #f0fdf4;
}
.icon-btn.btn-unlock:hover {
  background: #dcfce7;
  border-color: #15803d;
}

.icon-btn.btn-danger {
  color: var(--danger);
  border: 1px solid #fca5a5;
  background: #fff5f5;
}
.icon-btn.btn-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.icon-btn.btn-maps {
  border-color: var(--border);
  background: #fff;
}
.icon-btn.btn-maps:hover {
  background: #ffe0de;
  border-color: #ff3d2e;
}

.btn.btn-lock-text {
  color: #b45309;
  border: 1px solid #fcd34d;
  background: #fffbeb;
}
.btn.btn-lock-text:hover {
  background: #fef3c7;
  border-color: #b45309;
}

.btn.btn-unlock-text {
  color: #15803d;
  border: 1px solid #86efac;
  background: #f0fdf4;
}
.btn.btn-unlock-text:hover {
  background: #dcfce7;
  border-color: #15803d;
}

.btn.btn-danger-bordered {
  color: var(--danger);
  border: 1px solid #fca5a5;
  background: #fff5f5;
}
.btn.btn-danger-bordered:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-wrapper {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 420px;
}
.login-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  text-align: center;
}
.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 24px;
  text-align: center;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.login-form label span {
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 11px;
}
.login-form input {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  min-height: 44px;
}
.login-form input:focus {
  outline: none;
  border-color: var(--primary);
}
.login-form .btn {
  margin-top: 8px;
  min-height: 48px;
  font-size: 15px;
}

@media (max-width: 767px) {
  .login-card {
    padding: 28px 20px;
    max-width: 100%;
  }
  .login-brand {
    font-size: 16px;
    margin-bottom: 20px;
  }
  .login-card h1 {
    font-size: 20px;
    margin-bottom: 20px;
  }
}

/* ── DROPDOWN ────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu.dropdown-menu-right { left: auto !important; right: 0; }
.dropdown-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
  min-width: 190px;
  z-index: 100;
  padding: 4px 0;
}
.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
  white-space: nowrap;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.btn-primary-item { color: var(--primary); font-weight: 600; }
.dropdown-menu-right .dropdown-item { text-align: right; }
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.detail-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

/* ── EQUIPMENT SELECT IN MODAL ───────────────────────────── */
.equipment-select-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0 10px;
}
.equipment-select-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
}
.equipment-select-row:last-child {
  border-bottom: none;
}
.equipment-check {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  cursor: pointer;
  font-weight: normal;
  font-size: 14px;
  color: var(--text);
  margin: 0;
}
.equipment-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}
.equipment-qty-input {
  width: 58px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
  flex-shrink: 0;
}

/* ── CONTRACT ACTION BUTTONS ─────────────────────────────── */
.contract-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.contract-actions-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.contract-actions-group + .contract-actions-group {
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

/* ── EVENT PAYLOAD ───────────────────────────────────────── */
.event-payload {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0 2px;
}
.event-payload-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
}
.event-payload-key {
  color: var(--muted);
  min-width: 120px;
  flex-shrink: 0;
}
.event-payload-val {
  color: var(--text);
  word-break: break-all;
}

.eq-dropdown {
  width: 100%;
  margin-bottom: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.eq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 4px;
}
.eq-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 4px 8px 4px 0;
  border-bottom: 1px solid var(--border);
}
.eq-table td {
  padding: 5px 8px 5px 0;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  text-align: left;
  font-size: 14px;
}
.eq-table td:first-child { width: 100%; }
.eq-table td:nth-child(2) { width: 70px; white-space: nowrap; }
.eq-table td:last-child { width: 32px; text-align: center; padding-right: 0; }
.eq-table .equipment-qty-input { width: 64px; }
.btn-xs { width: 28px; height: 28px; padding: 0; font-size: 16px; line-height: 1; }
