/* styles.css — AVL Equipment Dashboard */

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

:root {
  /* Sidebar keeps the deep navy ink even in light mode */
  --sidebar-bg: #081A26;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active: rgba(135,206,242,0.18);
  --sidebar-text: rgba(255,255,255,0.55);
  --sidebar-text-active: #ffffff;
  --sidebar-width: 244px;

  /* Map the app's tokens onto the TipBros brand tokens */
  --accent: var(--ink);
  --accent-hover: var(--ink);
  --accent-blue: var(--sky);
  --accent-blue-hover: var(--skydk);
  --accent-light: rgba(135,206,242,0.22);
  --accent-border: rgba(93,144,171,0.45);

  --bg: var(--cream);
  --surface: var(--paper);
  --surface-alt: color-mix(in srgb, var(--paper) 60%, var(--cream));
  --border: var(--line);
  --border-strong: var(--line);

  --text-primary: var(--ink);
  --text-secondary: var(--ink2);
  --text-muted: var(--ink3);

  --status-active: var(--ok);
  --status-active-bg: rgba(95,168,108,0.16);
  --status-active-border: rgba(95,168,108,0.35);
  --status-service: var(--warn);
  --status-service-bg: rgba(224,164,88,0.20);
  --status-service-border: rgba(224,164,88,0.40);
  --status-retired: var(--ink3);
  --status-retired-bg: rgba(108,122,130,0.14);
  --status-retired-border: rgba(108,122,130,0.28);
  --status-overdue: var(--danger);
  --status-overdue-bg: rgba(209,73,91,0.16);
  --status-overdue-border: rgba(209,73,91,0.35);

  --eol-green: var(--ok);
  --eol-yellow: var(--warn);
  --eol-red: var(--danger);
  --eol-gray: var(--ink3);

  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(8,26,38,0.05);
  --shadow-md: 0 10px 26px rgba(8,26,38,0.12);
}

html, body {
  height: 100%;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg);
}

/* Sit the whole app above the brand film-grain layer */
.app-shell { position: relative; z-index: 1; }

.page-title, .card-title, .modal-title, .year-band-title, .stat-value,
.mobile-header-title, .modal-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ---- Layout ---- */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
}

.sidebar-logo-icon {
  width: 160px;
  height: 90px;
  overflow: hidden;
  border-radius: 6px;
  flex-shrink: 0;
}

.sidebar-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.sidebar-logo-text {
  display: none;
}

.sidebar-logo-sub {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 12px 16px;
}

.nav-section-label {
  color: var(--sidebar-text);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px 8px;
  margin-top: 12px;
}

.nav-group {
  margin-bottom: 4px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
  margin-top: 8px;
}

.nav-group-header:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.75);
}

.nav-group-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
  opacity: 0.5;
}

.nav-group.collapsed .nav-group-arrow {
  transform: rotate(-90deg);
}

.nav-group-body {
  padding-left: 8px;
  overflow: hidden;
}

.nav-group.collapsed .nav-group-body {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 500;
}

.nav-item .nav-icon {
  font-size: 17px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--status-overdue);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* ---- Main content area ---- */

.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.page-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.page-body {
  padding: 24px 28px;
  flex: 1;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s, box-shadow 0.12s, border-color 0.12s;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink); }

/* Sky highlighted action */
.btn-sky {
  background: var(--sky);
  color: var(--ink);
  border-color: var(--sky);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { background: var(--surface); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(209,73,91,0.5);
}
.btn-danger:hover { background: var(--status-overdue-bg); }

.btn-sm {
  padding: 8px 13px;
  font-size: 12.5px;
}

.btn-maint {
  background: transparent;
  color: var(--warn);
  border-color: rgba(224,164,88,0.55);
  font-size: 12.5px;
  padding: 8px 13px;
  white-space: nowrap;
}
.btn-maint:hover { background: var(--status-service-bg); }

.btn-icon {
  padding: 7px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 16px;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--bg); color: var(--text-primary); }

/* ---- Stat cards ---- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}

.stat-value.accent { color: var(--accent); }
.stat-value.warning { color: var(--status-service); }
.stat-value.danger { color: var(--status-overdue); }

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ---- Cards ---- */

.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
}

.card-body {
  padding: 20px;
}

/* ---- Dashboard grid ---- */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dashboard-grid .card-full {
  grid-column: 1 / -1;
}

/* ---- Alert items ---- */

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.alert-item.danger {
  background: var(--status-overdue-bg);
  border-color: var(--status-overdue-border);
}
.alert-item.warning {
  background: var(--status-service-bg);
  border-color: var(--status-service-border);
}
.alert-item.info {
  background: var(--accent-light);
  border-color: var(--accent-border);
}

.alert-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-text strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.alert-text span {
  font-size: 12px;
  color: var(--text-secondary);
}

.alert-action {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.alert-action:hover { text-decoration: underline; }

/* ---- Tables ---- */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

thead {
  background: var(--surface-alt);
}

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text-primary); }

td {
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--line2);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--bg); cursor: pointer; }
tbody tr.no-hover:hover { background: transparent; cursor: default; }

.table-name {
  font-weight: 500;
}
.table-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Status badges ---- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-dot, .cat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-active {
  background: var(--status-active-bg);
  color: #2e7d52;
  border-color: var(--status-active-border);
}
.badge-active .badge-dot { background: var(--status-active); }

.badge-service {
  background: var(--status-service-bg);
  color: #b9770e;
  border-color: var(--status-service-border);
}
.badge-service .badge-dot { background: var(--status-service); }

.badge-retired {
  background: var(--status-retired-bg);
  color: var(--ink3);
  border-color: var(--status-retired-border);
}
.badge-retired .badge-dot { background: var(--status-retired); }

.badge-overdue {
  background: var(--status-overdue-bg);
  color: #c0392b;
  border-color: var(--status-overdue-border);
}
.badge-overdue .badge-dot { background: var(--status-overdue); }

/* category = its own hue (bg/border inline), ink label + solid color dot */
.badge-category {
  color: var(--ink);
  font-size: 11px;
}

.badge-type {
  background: var(--bg);
  color: var(--text-secondary);
  border-color: var(--border);
  font-size: 11px;
}

/* ---- Filters bar ---- */

.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.input-search {
  width: 100%;
  padding: 10px 12px 10px 34px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(135,206,242,0.30);
}

.select-filter {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding: 10px 34px 10px 13px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235D90AB' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  outline: none;
  width: auto;
  min-width: 140px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.select-filter:hover { border-color: var(--skydk); }
.select-filter:focus {
  border-color: var(--skydk);
  box-shadow: 0 0 0 3px rgba(135,206,242,0.30);
}

/* ---- Forms ---- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  width: 100%;
}
.form-select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235D90AB' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(135,206,242,0.30);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
}

/* ---- Equipment Detail ---- */

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
}

.detail-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

.detail-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  display: block;
}

.detail-field .value {
  font-size: 14px;
  color: var(--text-primary);
}

.detail-field .value.mono {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 13px;
}

/* ---- EOL Progress bar ---- */

.eol-bar-wrap {
  margin: 16px 0;
}

.eol-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.eol-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.eol-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.eol-green { background: var(--eol-green); }
.eol-yellow { background: var(--eol-yellow); }
.eol-red { background: var(--eol-red); }
.eol-gray { background: var(--eol-gray); }

.eol-bar-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
}

/* ---- QR Code section ---- */

.qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.qr-section svg {
  display: block;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.qr-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Schedule / EOL page ---- */

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.year-band {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.year-band-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.year-band-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.year-band-cost {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.year-band-header.green { border-left: 4px solid var(--eol-green); }
.year-band-header.yellow { border-left: 4px solid var(--eol-yellow); }
.year-band-header.red { border-left: 4px solid var(--eol-red); }
.year-band-header.gray { border-left: 4px solid var(--eol-gray); }

.year-band-items {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 13px;
}

.schedule-item-name {
  flex: 1;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-item-cost {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.eol-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 44px 24px;
  color: var(--text-muted);
  border: 1.5px dashed var(--line);
  border-radius: 16px;
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

/* Brand mascot on empty states */
.empty-state::before {
  content: "";
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  background: url("../assets/mascot.png") center/contain no-repeat;
  opacity: 0.92;
}

.empty-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ---- Modals ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
}

.modal-body {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- Breadcrumbs ---- */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb-sep { color: var(--text-muted); }

/* ---- Upcoming service list ---- */

.service-upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.service-upcoming-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.service-upcoming-item:last-child { border-bottom: none; }

.service-date-badge {
  width: 48px;
  flex-shrink: 0;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 0;
}

.service-date-month {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

.service-date-day {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.service-upcoming-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.service-upcoming-type {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Mobile top bar ---- */

.page-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.table-container {
  border-color: var(--border);
}

thead {
  background: var(--surface-alt);
}

tbody tr:hover { background: var(--surface-alt); }

.schedule-item { background: var(--surface-alt); }
.service-date-badge { background: var(--surface-alt); }
.qr-section { background: var(--surface-alt); }

.input-search:focus,
.select-filter:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--skydk);
  box-shadow: 0 0 0 3px rgba(135,206,242,0.30);
}

.badge-category { color: var(--ink); }

.breadcrumb a { color: var(--accent-blue); }
.alert-action { color: var(--accent-blue); }

.mobile-header {
  display: none;
}

/* ---- Sidebar overlay (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 49;
}
.sidebar-overlay.active { display: block; }

/* ---- Responsive ---- */

@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full-width { grid-column: 1; }
}

@media (max-width: 700px) {
  /* Mobile top bar */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: var(--sidebar-bg);
    z-index: 50;
    padding: 0 16px;
    flex-shrink: 0;
  }

  .hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
  }
  .hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.2s;
  }

  .mobile-header-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-scan-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  /* Push content below fixed header */
  .app-shell {
    padding-top: 54px;
    height: 100dvh;
  }

  /* Sidebar becomes a drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* Main content */
  .main-content {
    width: 100%;
  }

  .page-header {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .page-title { font-size: 17px; }

  .page-body {
    padding: 14px 16px;
  }

  /* Stats row */
  .stats-row .stat-card {
    padding: 14px 16px;
  }
  .stat-value { font-size: 26px; }

  /* Dashboard grid */
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* Detail */
  .detail-grid { grid-template-columns: 1fr; }
  .detail-fields { grid-template-columns: 1fr 1fr; }

  /* Form */
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full-width { grid-column: 1; }

  /* Tables — make them scrollable */
  .table-container { border-radius: var(--radius); }
  table { min-width: 500px; }
  td, th { padding: 10px 12px; font-size: 13px; }

  /* Cards */
  .card-header { padding: 12px 14px; flex-wrap: wrap; }
  .card-body { padding: 14px; }

  /* Filters bar */
  .filters-bar { flex-direction: column; align-items: stretch; }
  .search-input-wrap { min-width: unset; }
  .select-filter { min-width: unset; width: 100%; }

  /* Modals */
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal {
    max-height: 92dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  /* Buttons in page header — wrap on small screens */
  .page-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Auth card */
  .auth-card { padding: 28px 20px; }
  .auth-logo-icon img { width: 180px; height: 100px; }

  /* Breadcrumbs */
  .breadcrumb { font-size: 12px; }
}

/* ---- Misc ---- */

.section-spacer { margin-bottom: 24px; }

.text-muted { color: var(--text-muted); font-size: 13px; }
.text-danger { color: var(--status-overdue); }
.text-warning { color: var(--status-service); }
.text-success { color: var(--status-active); }
.text-right { text-align: right; }
.font-mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 13px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ---- Print styles ---- */

@media print {
  .app-shell { display: block; }
  .sidebar, .page-header { display: none; }
  .main-content { overflow: visible; }
  .page-body { padding: 0; }
  body { background: white; }
}

.print-label-page {
  display: none;
}

@media print {
  .print-label-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 2in;
    height: 3in;
    padding: 0.15in;
    border: 1px solid #000;
    font-family: sans-serif;
    page-break-after: always;
  }
  .print-label-qr { margin-bottom: 8px; }
  .print-label-name { font-size: 11pt; font-weight: 700; text-align: center; margin-bottom: 4px; }
  .print-label-serial { font-size: 9pt; font-family: monospace; color: #333; margin-bottom: 2px; }
  .print-label-cat { font-size: 8pt; color: #555; margin-bottom: 2px; }
  .print-label-loc { font-size: 8pt; color: #333; }
}

/* ---- Auth overlay ---- */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--cream);
  background-image: var(--grain);
  background-size: 300px;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(8,26,38,.18);
  padding: 36px;
  width: 100%;
  max-width: 400px;
  color: var(--ink);
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.auth-logo-icon img {
  width: 200px;
  height: auto;
  max-height: 120px;
  object-fit: contain;
}

.auth-logo-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -.01em;
  color: var(--ink);
}

.auth-logo-sub {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--skydk);
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ink3);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.auth-tab:hover {
  color: var(--ink);
}

.auth-tab.auth-tab-active {
  color: var(--ink);
  border-bottom-color: var(--skydk);
}

.auth-card label {
  color: var(--ink2);
}

.auth-card .form-input {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.auth-card .form-input::placeholder {
  color: var(--ink3);
}

.auth-card .form-input:focus {
  border-color: var(--skydk);
  box-shadow: 0 0 0 3px rgba(135,206,242,.3);
}

.auth-card .btn-primary {
  background: var(--ink);
  color: var(--cream);
  border: 1.5px solid var(--ink);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 800;
}

.auth-card .btn-primary:hover {
  transform: translateY(-1px);
}

.auth-error {
  font-size: 13px;
  color: var(--status-overdue);
  margin-bottom: 12px;
  min-height: 18px;
  text-align: center;
}

/* ---- User menu in sidebar ---- */

.user-menu {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-menu-email {
  font-size: 11px;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* loading shimmer */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 8px;
}

/* =========================================================
   TipBros top-bar layout (replaces the sidebar) — 2026-07-01
   ========================================================= */
.tb-topbar{position:sticky;top:0;z-index:30;background:color-mix(in srgb,var(--cream) 90%,transparent);backdrop-filter:blur(8px);border-bottom:1px solid var(--line2);}
.tb-row{max-width:1180px;margin:0 auto;padding:12px 22px;display:flex;align-items:center;gap:16px;}
.tb-logo{display:flex;align-items:center;gap:10px;font-family:'Playfair Display', Georgia, serif;font-weight:800;font-size:18px;color:var(--ink);white-space:nowrap;}
.tb-logo img{width:34px;height:34px;object-fit:contain;}
.tb-nav{display:flex;gap:4px;flex-wrap:wrap;}
.tb-tab{position:relative;font-family:inherit;font-weight:700;font-size:13.5px;color:var(--ink2);background:none;border:none;padding:9px 14px;border-radius:24px;cursor:pointer;transition:.12s;}
.tb-tab:hover{background:rgba(135,206,242,.2);color:var(--ink);}
.tb-tab.active{background:var(--ink);color:var(--cream);}
.tb-badge{position:absolute;top:-3px;right:-3px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#D1495B;color:#fff;font-size:11px;font-weight:800;line-height:18px;text-align:center;box-shadow:0 0 0 2px var(--cream);}

/* ---- Rental Calendar ---- */
.rc-month{font-family:'Playfair Display', Georgia, serif;font-weight:800;font-size:20px;margin-bottom:14px;color:var(--ink);}
.rc-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:6px;}
.rc-head{margin-bottom:6px;}
.rc-dow{font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--ink3);text-align:center;padding:2px 0;}
.rc-cell{min-height:98px;background:var(--paper);border:1.5px solid var(--line);border-radius:10px;padding:6px;overflow:hidden;}
.rc-cell.rc-empty{background:transparent;border:none;}
.rc-cell.rc-today{border-color:var(--skydk);box-shadow:0 0 0 2px rgba(135,206,242,.35);}
.rc-daynum{font-size:12px;font-weight:700;color:var(--ink2);margin-bottom:4px;}
.rc-ev{font-size:10.5px;font-weight:700;color:#fff;border-radius:5px;padding:2px 6px;margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;transition:filter .12s;}
.rc-ev:hover{filter:brightness(1.08);}
@media (max-width:700px){ .rc-grid{gap:3px;} .rc-cell{min-height:64px;padding:4px;border-radius:7px;} .rc-ev{font-size:8.5px;padding:1px 3px;} .rc-daynum{font-size:11px;} .rc-dow{font-size:9px;} }
.tb-right{margin-left:auto;display:flex;align-items:center;gap:12px;}
.tb-actions{display:flex;gap:6px;flex-wrap:wrap;}
.tb-action{font-family:inherit;font-weight:700;font-size:12px;color:var(--ink);background:var(--surface);border:1.5px solid var(--line);border-radius:22px;padding:7px 12px;cursor:pointer;white-space:nowrap;transition:.12s;}
.tb-action:hover{border-color:var(--skydk);color:var(--skydk);}
.tb-subrow{max-width:1180px;margin:0 auto;padding:0 22px 11px;}
.tb-subnav{display:flex;gap:5px;flex-wrap:wrap;}
.tb-subtab{font-family:inherit;font-weight:700;font-size:12.5px;color:var(--ink2);background:var(--surface);border:1.5px solid var(--line);border-radius:22px;padding:6px 13px;cursor:pointer;transition:.12s;}
.tb-subtab:hover{border-color:var(--skydk);}
.tb-subtab.active{background:var(--sky);color:var(--ink);border-color:var(--sky);}
.tb-subbadge{display:inline-flex;align-items:center;justify-content:center;min-width:17px;height:17px;padding:0 5px;margin-left:6px;border-radius:9px;background:#D1495B;color:#fff;font-size:10.5px;font-weight:800;line-height:1;vertical-align:middle;}
/* compact account menu in the top bar */
.tb-right .user-menu{margin:0;padding:0;border:none;display:flex;align-items:center;gap:8px;}
.tb-right .user-menu-email{max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--ink3);}
.tb-right .user-menu .btn{width:auto!important;margin:0!important;padding:7px 12px;}
/* content is full-width now (no sidebar) */
.main-content{display:block;max-width:1320px;margin:0 auto;padding:22px 22px 60px;overflow:visible;min-height:60vh;}
/* Tighter cell padding on data tables so wide equipment lists fit without side-scroll */
.table-container th, .table-container td { padding-left: 10px; padding-right: 10px; }
.page-header{background:transparent!important;position:static!important;border:none!important;padding:0 0 14px 0!important;}
@media(max-width:640px){
  .tb-row{flex-wrap:wrap;gap:10px;}
  .tb-right{margin-left:0;width:100%;justify-content:space-between;}
}

/* =========================================================
   Improvements Pass 1 — 2026-07-01
   ========================================================= */
/* mascot-only empty states (drop the emoji icon) */
.empty-icon { display: none; }

/* sticky table header + scroll-in-place for long lists */
.table-container { overflow: auto; max-height: calc(100vh - 240px); }
thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-alt); }

/* sortable headers */
th.sortable .sort-arrow { color: var(--skydk); font-size: 9px; margin-left: 3px; }

/* clickable dashboard stat cards */
.stat-card.clickable { cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.stat-card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--skydk); }

/* dark-mode toggle button in the top bar */
.tb-themebtn { font-family: inherit; font-weight: 700; font-size: 15px; line-height: 1; color: var(--ink2);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 22px; padding: 7px 11px; cursor: pointer; }
.tb-themebtn:hover { border-color: var(--skydk); }

/* Improvements Pass 2 — bulk actions */
.bulkbar { display: none; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--ink); color: var(--cream); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.bulkbar .bulk-count { font-weight: 800; font-size: 13px; margin-right: 4px; }
.bulkbar .chip { background: transparent; border: 1.5px solid rgba(255,255,255,0.5); color: var(--cream); font-weight: 700; font-size: 12px; padding: 6px 12px; border-radius: 22px; cursor: pointer; font-family: inherit; }
.bulkbar .chip:hover { background: rgba(255,255,255,0.15); }
.bulkbar .chip.danger { border-color: rgba(209,73,91,0.7); color: #f3b4bd; }
.eq-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--skydk); }

/* ---- Pass 3: QR card on detail page ---- */
.qr-card .qr-body { display: flex; align-items: center; gap: 16px; }
.qr-card .qr-svg { flex: none; width: 128px; height: 128px; background: #fff; border: 1px solid var(--line, rgba(8,26,38,.16)); border-radius: 10px; padding: 6px; }
.qr-card .qr-svg svg { width: 100%; height: 100%; display: block; }
.qr-card .qr-cap { font-size: 13px; color: var(--ink2, #3c4d57); margin-bottom: 10px; max-width: 220px; line-height: 1.4; }

/* ---- Pass 4: header action group ---- */
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- Pass 5: checkout log + attachments ---- */
.checkout-status { font-size: 14px; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; border: 1px solid var(--line, rgba(8,26,38,.14)); }
.checkout-status.out { background: rgba(224,164,88,0.12); border-color: rgba(224,164,88,0.4); }
.checkout-status.in { background: rgba(95,168,108,0.12); border-color: rgba(95,168,108,0.4); }
.log-list, .file-list { display: flex; flex-direction: column; }
.log-row, .file-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line2, rgba(8,26,38,.08)); }
.log-row:last-child, .file-row:last-child { border-bottom: none; }
.log-tag { flex: none; font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 3px 7px; border-radius: 6px; }
.log-tag.out { background: rgba(224,164,88,0.18); color: #b9770e; }
.log-tag.in { background: rgba(95,168,108,0.18); color: #2e7d52; }
.log-main { flex: 1; min-width: 0; }
.log-date, .file-size { flex: none; font-size: 12px; color: var(--ink3, #6c7a82); }
.icon-btn { flex: none; background: none; border: none; color: var(--ink3, #6c7a82); font-size: 14px; cursor: pointer; padding: 4px 6px; border-radius: 6px; line-height: 1; }
.icon-btn:hover { background: rgba(209,73,91,0.12); color: var(--danger, #D1495B); }
.file-ic { flex: none; }
.file-name { flex: 1; min-width: 0; color: var(--skydk, #5D90AB); font-weight: 600; cursor: pointer; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name:hover { text-decoration: underline; }

/* ---- Loading skeletons ---- */
@keyframes sk-shimmer { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
.sk-head, .sk-line { background: linear-gradient(90deg, rgba(8,26,38,.06) 25%, rgba(8,26,38,.12) 37%, rgba(8,26,38,.06) 63%); background-size: 600px 100%; animation: sk-shimmer 1.2s infinite linear; border-radius: 8px; }
.sk-head { height: 30px; width: 240px; margin-bottom: 20px; }
.sk-card { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 8px 16px; }
.sk-row { display: flex; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line2); }
.sk-row:last-child { border-bottom: none; }
.sk-line { height: 13px; }

/* ---- Mobile: turn wide data tables into stacked cards ---- */
@media (max-width: 640px) {
  .table-container table.responsive-cards { min-width: 0; }
  .table-container table.responsive-cards thead { display: none; }
  .table-container table.responsive-cards, 
  .table-container table.responsive-cards tbody,
  .table-container table.responsive-cards tr,
  .table-container table.responsive-cards td { display: block; width: 100%; }
  .table-container table.responsive-cards tr {
    border: 1.5px solid var(--line); border-radius: 12px; margin: 10px; padding: 6px 12px; background: var(--paper);
  }
  .table-container table.responsive-cards td {
    border: none; padding: 6px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right;
  }
  .table-container table.responsive-cards td::before {
    content: attr(data-label); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ink3); text-align: left;
  }
  .table-container table.responsive-cards td:empty { display: none; }
  .table-container table.responsive-cards td .table-name { white-space: normal !important; }
  .table-container table.responsive-cards td.cell-check { display: none; }
  .table-container table.responsive-cards td.cell-name { justify-content: flex-start; padding-top: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line2); margin-bottom: 4px; }
  .table-container table.responsive-cards td.cell-name::before { display: none; }
  .table-container table.responsive-cards td.cell-name .table-name { font-size: 16px; font-weight: 800; }
}
