/* HeavyHub – Professional UI */
:root {
    --tm-primary: #0b3d5c;
    --tm-primary-dark: #072a40;
    --tm-primary-light: #1a5a82;
    --tm-accent: #e8a838;
    --tm-success: #1a9b7a;
    --tm-danger: #d64545;
    --tm-warning: #e9a825;
    --tm-info: #2b7bb9;
    --tm-bg: #eef2f6;
    --tm-card: #ffffff;
    --tm-border: #d8e0e8;
    --tm-text: #1a2332;
    --tm-muted: #6b7c8f;
    --tm-radius: 10px;
    --tm-shadow: 0 2px 8px rgba(11, 61, 92, 0.08);
    --tm-shadow-lg: 0 8px 24px rgba(11, 61, 92, 0.12);
}
* { box-sizing: border-box; }
body {
    background: var(--tm-bg);
    color: var(--tm-text);
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.95rem;
    margin: 0;
    padding-top: 58px;
    min-height: 100vh;
}
.bg-tm, .navbar.bg-tm {
    background: linear-gradient(135deg, #0b3d5c 0%, #072a40 100%) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,.2);
    padding: 0.35rem 0;
}
.navbar-brand { font-weight: 800; letter-spacing: -0.02em; font-size: 1.25rem !important; }
.navbar-brand i { color: #e8a838; margin-right: 0.35rem; }
.navbar .nav-link {
    color: rgba(255,255,255,.9) !important;
    font-weight: 500;
    padding: 0.5rem 0.8rem !important;
    border-radius: 6px;
    transition: background .15s;
}
.navbar .nav-link:hover { color: #fff !important; background: rgba(255,255,255,.12); }
.navbar .dropdown-menu {
    border: none; box-shadow: var(--tm-shadow-lg); border-radius: 8px; padding: 0.4rem; min-width: 210px;
}
.navbar .dropdown-item { border-radius: 6px; padding: 0.5rem 0.85rem; font-weight: 500; }
.navbar .dropdown-item:hover { background: #eef5fa; color: #0b3d5c; }
.navbar .dropdown-item i { width: 1.2rem; margin-right: 0.3rem; color: #1a5a82; }
.main-content {
    min-height: calc(100vh - 130px);
    padding: 1.5rem 1.75rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem;
}
.page-header h1 {
    font-size: 1.55rem; font-weight: 800; margin: 0;
    color: #0b3d5c; letter-spacing: -0.02em;
}
.page-header h1 i { margin-right: 0.4rem; opacity: 0.9; }
.card {
    background: #fff; border: 1px solid #d8e0e8;
    border-radius: 10px; box-shadow: var(--tm-shadow); overflow: hidden;
}
.card-header {
    background: #f7fafc; border-bottom: 1px solid #d8e0e8;
    font-weight: 700; color: #0b3d5c; padding: 0.85rem 1.15rem; font-size: 0.95rem;
}
.card-body { padding: 1.15rem; }
.stat-card {
    border: 1px solid #d8e0e8; border-left: 5px solid #0b3d5c;
    border-radius: 10px; transition: transform .15s, box-shadow .15s; background: #fff;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--tm-shadow-lg); }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: #0b3d5c; line-height: 1.1; }
.stat-card .stat-label {
    font-size: 0.78rem; color: #6b7c8f; text-transform: uppercase;
    letter-spacing: 0.05em; font-weight: 600; margin-top: 0.25rem;
}
.btn-tm {
    background: linear-gradient(135deg, #0b3d5c 0%, #1a5a82 100%);
    border: none; color: #fff !important; font-weight: 600;
    border-radius: 8px; padding: 0.5rem 1.15rem;
    box-shadow: 0 2px 6px rgba(11, 61, 92, 0.25);
    transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn-tm:hover, .btn-tm:focus {
    filter: brightness(1.08); color: #fff !important;
    transform: translateY(-1px); box-shadow: 0 4px 12px rgba(11, 61, 92, 0.3);
}
.btn-success { background: #1a9b7a !important; border-color: #1a9b7a !important; }
.btn-outline-primary { border-color: #0b3d5c; color: #0b3d5c; font-weight: 600; }
.btn-outline-primary:hover { background: #0b3d5c; border-color: #0b3d5c; color: #fff; }
.btn-sm { border-radius: 6px; font-weight: 600; }
.table { margin-bottom: 0; font-size: 0.9rem; }
.table thead.table-light th, .table thead th {
    background: #f0f5f9 !important; color: #0b3d5c; font-weight: 700;
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em;
    border-bottom: 2px solid #d8e0e8; white-space: nowrap; padding: 0.75rem 1rem;
}
.table td { padding: 0.7rem 1rem; vertical-align: middle; border-color: #eef2f6; }
.table-hover tbody tr:hover { background: #f5f9fc; }
.table-checklist td { vertical-align: middle; }
.table-checklist .form-select-sm { min-width: 140px; }
.badge { font-weight: 600; font-size: 0.75rem; padding: 0.35em 0.65em; border-radius: 6px; }
.bg-primary { background: #0b3d5c !important; }
.bg-success { background: #1a9b7a !important; }
.bg-danger { background: #d64545 !important; }
.bg-warning { background: #e9a825 !important; color: #333 !important; }
.bg-info { background: #2b7bb9 !important; }
.bg-secondary { background: #7a8b9c !important; }
.form-label { font-weight: 600; font-size: 0.85rem; color: #072a40; margin-bottom: 0.3rem; }
.form-control, .form-select {
    border: 1.5px solid #d8e0e8; border-radius: 8px; padding: 0.5rem 0.85rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: #1a5a82; box-shadow: 0 0 0 3px rgba(26, 90, 130, 0.15);
}
.result-sat { color: #1a9b7a; font-size: 1.15rem; }
.result-att { color: #d64545; font-size: 1.15rem; }
.result-mon { color: #e9a825; font-size: 1.15rem; }
.result-na  { color: #adb5bd; font-size: 1.15rem; }
.signature-pad {
    border: 2px dashed #d8e0e8; border-radius: 8px; background: #fafbfc; touch-action: none;
}
.empty-state { text-align: center; padding: 3rem 1.5rem; color: #6b7c8f; }
.empty-state i { font-size: 3rem; color: #d8e0e8; display: block; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.15rem; color: #0b3d5c; font-weight: 700; margin-bottom: 0.5rem; }
.empty-state p { margin-bottom: 1.25rem; max-width: 360px; margin-left: auto; margin-right: auto; }
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, #0b3d5c 0%, #1a5a82 40%, #0b3d5c 100%);
    padding: 1.5rem; padding-top: 0 !important;
}
.login-card {
    width: 100%; max-width: 420px; border-radius: 16px; overflow: hidden;
    border: none; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.login-card .card-body { padding: 2.25rem; }
.login-card .display-4 { color: #0b3d5c; }
.alert { border-radius: 8px; border: none; font-weight: 500; }
.alert-success { background: #e6f7f2; color: #0d6b54; }
.alert-danger { background: #fdeaea; color: #9b2c2c; }
.alert-info { background: #e8f2fa; color: #1a5270; }
.alert-warning { background: #fef6e6; color: #8a6d1a; }
.modal-content { border: none; border-radius: 12px; box-shadow: var(--tm-shadow-lg); }
.modal-header {
    background: #f7fafc; border-bottom: 1px solid #d8e0e8;
    border-radius: 12px 12px 0 0; font-weight: 700;
}
.modal-title { color: #0b3d5c; font-weight: 700; }
footer { background: transparent; color: #6b7c8f; font-size: 0.8rem; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.quick-actions .btn { border-radius: 8px; font-weight: 600; font-size: 0.85rem; }
.filter-bar {
    background: #fff; border: 1px solid #d8e0e8; border-radius: 10px;
    padding: 1rem 1.15rem; margin-bottom: 1.15rem; box-shadow: var(--tm-shadow);
}
.list-group-item { border-color: #eef2f6; padding: 0.85rem 1.15rem; }
@media (max-width: 768px) {
    .main-content { padding: 1rem; }
    .page-header h1 { font-size: 1.25rem; }
    .stat-card .stat-value { font-size: 1.5rem; }
}

/* ===== Mobile-first improvements ===== */
@media (max-width: 992px) {
    .main-content { padding: 0.85rem; }
    .page-header { flex-direction: column; align-items: flex-start !important; gap: 0.75rem; }
    .page-header .btn, .page-header .d-flex { width: 100%; }
    .page-header .btn { display: block; text-align: center; }
    .table-responsive { font-size: 0.82rem; }
    .navbar-nav .nav-link { padding: 0.65rem 1rem !important; }
    .stat-card .stat-value { font-size: 1.4rem; }
    .quick-actions { flex-direction: column; }
    .quick-actions .btn { width: 100%; text-align: center; }
    .card-body { padding: 0.9rem; }
    /* PMI form on tablet */
    .table-checklist .form-select-sm { min-width: 110px; font-size: 0.85rem; }
    .signature-pad { height: 140px !important; }
}
@media (max-width: 576px) {
    body { padding-top: 52px; font-size: 0.9rem; }
    .page-header h1 { font-size: 1.15rem; }
    .btn-lg { padding: 0.65rem 1rem; font-size: 1rem; width: 100%; }
    .d-flex.gap-2.mb-5 { flex-direction: column; }
    .d-flex.gap-2.mb-5 .btn { width: 100%; }
}
/* Touch-friendly status selects */
.status-select { min-height: 38px; }
/* Sticky action bar for mobile PMI */
@media (max-width: 768px) {
    .pmi-actions-sticky {
        position: sticky; bottom: 0; left: 0; right: 0;
        background: #fff; border-top: 1px solid #d8e0e8;
        padding: 0.75rem; z-index: 100;
        box-shadow: 0 -4px 12px rgba(0,0,0,.08);
        display: flex; gap: 0.5rem;
    }
    .pmi-actions-sticky .btn { flex: 1; }
}



/* PMI result buttons – polished segmented control */
.table-checklist .result-btns {
    display: inline-flex;
    align-items: center;
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid #d0d7de;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.table-checklist .result-btns .result-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 38px;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    border-right: 1.5px solid #d0d7de !important;
    background: #ffffff !important;
    color: #c0c8d0 !important;
    font-size: 1.2rem !important;
    line-height: 1 !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.table-checklist .result-btns .result-btn:last-child { border-right: none !important; }
.table-checklist .result-btns .result-btn i { pointer-events: none; font-size: 1.15rem; }

.table-checklist .result-btns .result-btn[data-val="satisfactory"] { color: #86efac !important; }
.table-checklist .result-btns .result-btn[data-val="requires_attention"] { color: #fca5a5 !important; }
.table-checklist .result-btns .result-btn[data-val="monitor"] { color: #fdba74 !important; }
.table-checklist .result-btns .result-btn[data-val="not_applicable"] { color: #cbd5e1 !important; }

.table-checklist .result-btns .result-btn:hover { background: #f8fafc !important; }

.table-checklist .result-btns .result-btn.active-sat {
    background: #ecfdf5 !important;
    color: #16a34a !important;
}
.table-checklist .result-btns .result-btn.active-sat i { color: #16a34a !important; }

.table-checklist .result-btns .result-btn.active-att {
    background: #fef2f2 !important;
    color: #dc2626 !important;
}
.table-checklist .result-btns .result-btn.active-att i { color: #dc2626 !important; }

.table-checklist .result-btns .result-btn.active-mon {
    background: #fff7ed !important;
    color: #ea580c !important;
}
.table-checklist .result-btns .result-btn.active-mon i { color: #ea580c !important; }

.table-checklist .result-btns .result-btn.active-na {
    background: #f1f5f9 !important;
    color: #64748b !important;
}
.table-checklist .result-btns .result-btn.active-na i { color: #64748b !important; }


/* Mobile technician PMI mode */
@media (max-width: 768px) {
  .table-checklist td, .table-checklist th { padding: 0.65rem 0.4rem; vertical-align: middle; }
  .table-checklist .result-btns .result-btn { width: 48px; height: 44px; font-size: 1.25rem !important; }
  .page-header h1 { font-size: 1.15rem; }
  .sticky-actions {
    position: sticky; bottom: 0; z-index: 20;
    background: #fff; border-top: 1px solid #dee2e6;
    padding: 0.75rem; margin: 0 -0.75rem; box-shadow: 0 -4px 12px rgba(0,0,0,.08);
  }
  .defect-detail-row textarea { font-size: 16px; } /* prevent iOS zoom */
}


/* Brand logo */
.navbar-brand .hh-logo,
.navbar-brand img {
  height: 36px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 2px 6px;
}


/* More menu – multi-column panel */
.hh-mega-menu {
  max-width: min(760px, 96vw);
  max-height: min(70vh, 520px);
  overflow-y: auto;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  margin-top: .35rem !important;
}
.hh-mega-menu .hh-mega-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #6c757d;
  padding: .15rem .75rem .35rem;
  margin-bottom: .15rem;
  border-bottom: 1px solid #eee;
}
.hh-mega-menu .dropdown-item {
  border-radius: 6px;
  padding: .4rem .75rem;
  font-size: .9rem;
  white-space: normal;
}
.hh-mega-menu .dropdown-item i {
  width: 1.25rem;
  display: inline-block;
  text-align: center;
  margin-right: .35rem;
  opacity: .85;
}
.hh-mega-menu .dropdown-item:hover,
.hh-mega-menu .dropdown-item:focus {
  background: rgba(11, 61, 92, 0.08);
  color: #0b3d5c;
}
@media (max-width: 575.98px) {
  .hh-mega-menu {
    max-width: 100%;
    min-width: 280px !important;
  }
  .hh-mega-menu .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
}
