:root { --brand: #0f766e; --brand-dark: #115e59; --brand-soft: #e6f4f1; }
body { background: #f4f6f8; font-size: .95rem; }
.bg-brand { background: var(--brand) !important; }
.text-brand { color: var(--brand) !important; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-outline-brand { border-color: var(--brand); color: var(--brand); }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }
a { color: var(--brand); }
.card { border: 1px solid #e5e7eb; border-radius: .75rem; }
.card-header { background: #fff; font-weight: 600; border-bottom-color: #eef0f2; }
.table > :not(caption) > * > * { vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; color: #6b7280; font-weight: 600; white-space: nowrap; }
.form-label { font-weight: 500; font-size: .875rem; margin-bottom: .25rem; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: .8rem; color: #6b7280; }
.thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .5rem; background: #e5e7eb; }
.thumb-sm { width: 56px; height: 56px; object-fit: cover; border-radius: .5rem; }
.text-pre { white-space: pre-line; }
.min-w-0 { min-width: 0; }

/* Admin */
.sidebar { width: 236px; min-height: calc(100vh - 56px); }
@media (min-width: 992px) { .sidebar { flex: 0 0 236px; } }
@media (min-width: 992px) { .sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; } }
.sidebar .nav-link { color: #374151; padding: .5rem 1rem; border-left: 3px solid transparent; }
.sidebar .nav-link:hover { background: #f3f4f6; }
.sidebar .nav-link.active { color: var(--brand); background: var(--brand-soft); border-left-color: var(--brand); font-weight: 600; }
.admin-main { min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.35rem; margin: 0; font-weight: 600; }
.filters .form-control, .filters .form-select { min-width: 140px; }

/* Responsive tables -> stacked cards on small screens */
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack tr { display: block; background: #fff; border: 1px solid #e5e7eb; border-radius: .6rem; margin-bottom: .6rem; padding: .35rem .6rem; }
  .table-stack td { display: flex; justify-content: space-between; gap: 1rem; border: 0 !important; padding: .25rem 0 !important; text-align: right; }
  .table-stack td::before { content: attr(data-label); font-weight: 600; color: #6b7280; text-align: left; flex-shrink: 0; }
  .table-stack td[data-label=""]::before { content: none; }
  .table-stack td.actions { justify-content: flex-end; }
  .table-stack, .table-stack tbody { display: block; }
}

/* Mobile app shell (client + technician) */
.mobile-wrap { max-width: 760px; margin: 0 auto; }
.appbar { padding-top: env(safe-area-inset-top); }
.pb-nav { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { color: #6b7280; text-decoration: none; font-size: .72rem; }
.bottom-nav a.active { color: var(--brand); font-weight: 600; }
.bottom-nav a.active i { transform: scale(1.12); }
.mobile-body .card { border-radius: 1rem; }
.list-card { display: flex; gap: .75rem; align-items: center; padding: .8rem; background: #fff; border: 1px solid #e5e7eb; border-radius: .9rem; margin-bottom: .6rem; color: inherit; text-decoration: none; }
.list-card:hover { border-color: var(--brand); color: inherit; }
.list-card .icon { width: 44px; height: 44px; border-radius: .75rem; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; font-weight: 600; margin: 1rem 0 .5rem; }
.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 576px) { .tile-grid { grid-template-columns: repeat(4, 1fr); } }
.tile { background: #fff; border: 1px solid #e5e7eb; border-radius: .9rem; padding: .8rem; text-align: center; color: inherit; text-decoration: none; }
.tile i { font-size: 1.5rem; color: var(--brand); }
.tile .v { font-weight: 700; font-size: 1.15rem; }
.btn-lg-touch { padding: .8rem 1rem; font-size: 1.05rem; border-radius: .8rem; }
.check-row { display: flex; gap: .6rem; align-items: center; padding: .65rem .75rem; border: 1px solid #e5e7eb; border-radius: .6rem; margin-bottom: .4rem; background: #fff; }
.check-row input { width: 1.4rem; height: 1.4rem; }
.chat-box { display: flex; flex-direction: column; gap: .5rem; }
.bubble { max-width: 85%; padding: .6rem .8rem; border-radius: 1rem; background: #fff; border: 1px solid #e5e7eb; }
.bubble.me { align-self: flex-end; background: var(--brand); color: #fff; border-color: var(--brand); }
.bubble.me a { color: #fff; }
.chip { display: inline-block; padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--brand); color: var(--brand); background: #fff; font-size: .82rem; margin: 0 .3rem .4rem 0; }
.out-range { color: #dc2626 !important; font-weight: 700; }
.timeline { border-left: 2px solid #e5e7eb; padding-left: 1rem; }
.timeline .item { position: relative; margin-bottom: .8rem; }
.timeline .item::before { content: ""; position: absolute; left: -1.38rem; top: .35rem; width: .7rem; height: .7rem; background: var(--brand); border-radius: 50%; }
#reader { width: 100%; max-width: 420px; margin: auto; border-radius: 1rem; overflow: hidden; }

/* Plain (auth, QR landing) */
.auth-card { max-width: 420px; margin: 4vh auto; }
.plain-body { background: linear-gradient(160deg, #e6f4f1 0%, #f4f6f8 60%); min-height: 100vh; }

/* Print */
.print-body { background: #fff; }
.print-page { max-width: 820px; margin: 0 auto; padding: 24px; }
.qr-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.qr-card { border: 1px dashed #9ca3af; border-radius: 10px; padding: 10px; text-align: center; page-break-inside: avoid; }
.qr-card .qr { display: flex; justify-content: center; margin: 6px 0; }
@media print {
  .no-print { display: none !important; }
  .print-page { padding: 0; max-width: none; }
  @page { margin: 12mm; }
}
