  :root {
    /* brand */
    --navy: #1A3A6B; --navyLight: #2A4E82; --navyBright: #2F5FA8;
    --gold: #C9A84C; --goldBright: #DABE72;
    /* main content surfaces */
    --page: #EEF1F5; --surface: #FFFFFF; --surfaceAlt: #F5F6F9; --border: #E1E4EA;
    /* main content text */
    --ink: #1C2333; --inkDim: #5C6472; --inkMuted: #8991A0;
    /* sidebar (navy chrome) text */
    --onNavy: #F2F4F8; --onNavyDim: #A6B6CC; --navyBorder: #2E4E7C;
    /* status */
    --success: #2E7D32; --warning: #D98620; --danger: #D03B3B;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; background: var(--page); overflow-x: hidden; }
  body { font-family: 'IBM Plex Sans', system-ui, sans-serif; color: var(--ink); padding: 20px; display: flex; justify-content: center; }
  h1, h2, h3, h4 { font-family: 'Fraunces', Georgia, serif; margin: 0; font-weight: 600; }
  :focus-visible { outline: 2px solid var(--navyBright); outline-offset: 2px; }
  .mt-mono { font-family: 'IBM Plex Mono', monospace; }
  .mt-dim { color: var(--inkDim); font-size: 13px; margin: 2px 0 0; }
  .mt-positive { color: var(--success); }
  .mt-negative { color: var(--danger); }

  .mt-app { max-width: 1200px; width: 100%; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: 0 20px 50px rgba(26,58,107,0.12); }
  .mt-layout { display: flex; align-items: flex-start; }
  .mt-sidebar { width: 250px; flex-shrink: 0; background: var(--navy); color: var(--onNavy); padding: 20px 14px; display: flex; flex-direction: column; gap: 16px; border-right: 1px solid var(--navyBorder); position: sticky; top: 0; max-height: 100vh; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
  .mt-sidebar::-webkit-scrollbar { display: none; }
  .mt-brand { display: flex; align-items: center; gap: 9px; padding: 0 6px; }
  .mt-brand-mark { width: 22px; height: 22px; flex-shrink: 0; }
  .mt-brand h1 { font-size: 17px; letter-spacing: 0.4px; color: var(--onNavy); }
  .mt-brand-sub { font-size: 11px; color: var(--onNavyDim); padding: 0 6px; margin-top: -10px; }

  .mt-nav { display: flex; flex-direction: column; gap: 3px; }
  .mt-nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; background: transparent; border: none; color: var(--onNavyDim); cursor: pointer; font-size: 13.5px; text-align: left; font-family: inherit; width: 100%; }
  .mt-nav-item:hover { background: var(--navyLight); color: var(--onNavy); }
  .mt-nav-item.active { background: var(--gold); color: var(--ink); font-weight: 600; }
  .mt-nav-section-label { display: flex; align-items: center; justify-content: space-between; width: 100%; font-family: inherit; border: none; border-top: 1px solid var(--navyBorder); background: transparent; cursor: pointer; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--goldBright); padding: 16px 10px 6px; margin-top: 4px; font-weight: 700; }
  .mt-nav-section-label:first-child { padding-top: 6px; margin-top: 0; border-top: none; }
  .mt-nav-section-label:hover { color: var(--gold); }
  .mt-nav-section-chevron { font-size: 9px; color: var(--onNavyDim); transition: transform 0.15s ease; }
  .mt-nav-section-label.collapsed .mt-nav-section-chevron { transform: rotate(-90deg); }

  .mt-profile-bar { display: flex; align-items: center; justify-content: space-between; background: var(--navyLight); border: 1px solid var(--navyBorder); border-radius: 8px; padding: 6px 10px; margin: -4px 0 2px; }
  .mt-profile-badge { font-size: 12px; font-weight: 600; color: var(--goldBright); }

  .mt-profile-screen { display: flex; align-items: center; justify-content: center; min-height: 480px; padding: 40px 20px; }
  .mt-profile-box { max-width: 460px; width: 100%; }
  .mt-profile-box .mt-brand-mark { color: var(--navy); }
  .mt-profile-box .mt-brand h1 { color: var(--gold); font-size: 28px; font-weight: 700; }
  .mt-profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .mt-profile-card { background: var(--surfaceAlt); border: 1px solid var(--border); border-radius: 10px; padding: 18px 12px; cursor: pointer; font-family: inherit; color: var(--ink); text-align: center; }
  .mt-profile-card:hover { background: var(--surface); border-color: var(--navyBright); }
  .mt-profile-name { font-family: 'Fraunces', serif; font-size: 15px; font-weight: 600; }
  .mt-profile-disclaimer { font-size: 11px; color: var(--inkMuted); text-align: center; margin-top: 20px; line-height: 1.5; }
  .mt-login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
  .mt-login-error { background: rgba(208,59,59,0.10); border: 1px solid var(--danger); color: var(--ink); font-size: 12.5px; padding: 8px 12px; border-radius: 6px; }
  .mt-user-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .mt-user-info { display: flex; flex-direction: column; line-height: 1.3; }
  .mt-user-name { font-size: 12.5px; font-weight: 600; color: var(--onNavy); }
  .mt-user-role { font-size: 10.5px; color: var(--goldBright); }

  .mt-sidebar-filter { padding-top: 12px; border-top: 1px solid var(--navyBorder); }
  .mt-sidebar-filter label { font-size: 11px; color: var(--onNavyDim); display: block; margin-bottom: 6px; }
  .mt-sidebar-tools { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--navyBorder); }
  .mt-sidebar-tools .mt-btn { justify-content: center; font-size: 12px; padding: 6px 10px; }
  .mt-storage-note { font-size: 10.5px; color: var(--onNavyDim); line-height: 1.4; padding: 0 2px; }

  .mt-main { flex: 1; padding: 26px 30px; min-width: 0; background: var(--surface); }
  .mt-view { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
  .mt-view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  .mt-view-head h2 { font-size: 21px; color: var(--ink); }
  .mt-view-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

  .mt-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--border); background: var(--surfaceAlt); color: var(--ink); cursor: pointer; font-size: 13.5px; font-family: inherit; }
  .mt-btn:hover { background: var(--border); }
  .mt-btn-primary { background: var(--navy); border-color: var(--navy); color: var(--onNavy); font-weight: 600; }
  .mt-btn-primary:hover { background: var(--navyLight); border-color: var(--navyLight); }
  .mt-icon-btn { background: transparent; border: none; color: var(--inkMuted); cursor: pointer; padding: 4px; border-radius: 5px; display: inline-flex; }
  .mt-icon-btn:hover { color: var(--danger); background: var(--surfaceAlt); }

  .mt-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
  .mt-kpi { background: var(--surfaceAlt); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
  .mt-kpi-label { font-size: 11.5px; color: var(--inkDim); }
  .mt-kpi-value { font-size: 21px; font-weight: 600; color: var(--ink); }

  .mt-chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; min-width: 0; }
  .mt-panel { background: var(--surfaceAlt); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; min-width: 0; }
  .mt-panel h4 { font-size: 14px; margin-bottom: 10px; color: var(--ink); }
  .mt-chart-svg { width: 100%; height: 200px; display: block; }

  .mt-table-wrap { overflow-x: auto; max-width: 100%; }
  .mt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .mt-table th { text-align: left; color: var(--inkDim); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
  .mt-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--ink); }

  .mt-site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
  .mt-site-card { background: var(--surfaceAlt); border: 1px solid var(--border); border-radius: 10px; padding: 15px 17px; display: flex; flex-direction: column; gap: 6px; }
  .mt-site-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
  .mt-site-card-head h3 { font-size: 16px; color: var(--ink); }
  .mt-site-detail { font-size: 12.5px; color: var(--inkDim); }
  .mt-site-stats { display: flex; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
  .mt-site-stats > div { display: flex; flex-direction: column; }
  .mt-site-stats span { font-size: 15px; font-weight: 600; color: var(--ink); }
  .mt-site-stats small { font-size: 10.5px; color: var(--inkMuted); }
  .mt-site-created { font-size: 11px; color: var(--inkMuted); margin-top: 6px; }

  .mt-status-pill { border: none; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600; cursor: pointer; width: fit-content; margin-top: 2px; }
  .mt-status-on { background: var(--success); color: #FFFFFF; }
  .mt-status-off { background: var(--border); color: var(--inkDim); }
  .mt-zone-tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }

  .mt-threshold-bar { display: flex; align-items: center; gap: 8px; background: var(--surfaceAlt); border: 1px solid var(--border); border-radius: 8px; padding: 9px 14px; font-size: 13px; color: var(--inkDim); width: fit-content; flex-wrap: wrap; }
  .mt-threshold-input { width: 64px; text-align: center; padding: 5px 6px; }

  .mt-pointage-list { display: flex; flex-direction: column; gap: 8px; }
  .mt-pointage-row { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; flex-wrap: wrap; }
  .mt-pointage-name { flex: 1 1 160px; font-weight: 600; color: var(--ink); font-size: 13.5px; min-width: 140px; }
  .mt-pointage-time { display: flex !important; flex-direction: row !important; align-items: center; gap: 6px; font-size: 12px; color: var(--inkDim); }
  .mt-pointage-time .mt-input { width: 110px; }
  .mt-pointage-hours { font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; color: var(--ink); min-width: 48px; text-align: right; }

  .mt-zone-filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
  .mt-zone-pill { border: 1px solid var(--border); background: var(--surfaceAlt); color: var(--inkDim); padding: 6px 14px; border-radius: 999px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
  .mt-zone-pill.active { color: var(--ink); font-weight: 600; }

  .mt-passport-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
  .mt-passport-card { background: var(--surfaceAlt); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
  .mt-passport-head { display: flex; justify-content: space-between; align-items: center; padding: 7px 14px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
  .mt-passport-body { padding: 18px 16px 14px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
  .mt-passport-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; color: var(--inkMuted); margin-bottom: 8px; overflow: hidden; }
  .mt-passport-photo { width: 100%; height: 100%; object-fit: cover; }
  .mt-photo-preview-img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
  .mt-passport-name { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 600; color: var(--ink); }
  .mt-passport-detail { font-size: 12px; color: var(--inkDim); margin-bottom: 8px; }
  .mt-passport-row { display: flex; justify-content: space-between; width: 100%; font-size: 12px; color: var(--inkDim); padding: 4px 0; border-top: 1px dashed var(--border); }
  .mt-passport-row span:last-child { color: var(--ink); font-family: 'IBM Plex Mono', monospace; }
  .mt-passport-number { background: var(--navy); color: var(--goldBright); font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; text-align: center; padding: 8px; letter-spacing: 1.2px; }

  .mt-ticket-list { display: flex; flex-direction: column; gap: 9px; }
  .mt-ticket { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--surfaceAlt); border: 1px solid var(--border); border-radius: 4px 10px 10px 4px; padding: 12px 16px 12px 26px; }
  .mt-ticket::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 14px; background-image: radial-gradient(circle at 7px 11px, var(--surface) 4px, transparent 4.4px); background-size: 14px 22px; background-repeat: repeat-y; }
  .mt-ticket::after { content: ''; position: absolute; left: 14px; top: 0; bottom: 0; width: 1px; background: repeating-linear-gradient(to bottom, var(--border) 0 5px, transparent 5px 10px); }
  .mt-ticket-eyebrow { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent, var(--navy)); font-weight: 600; }
  .mt-ticket-title { font-size: 14px; margin-top: 2px; color: var(--ink); }
  .mt-ticket-meta { font-size: 12px; color: var(--inkDim); margin-top: 3px; }
  .mt-ticket-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
  .mt-ticket-value { font-size: 15px; font-weight: 600; white-space: nowrap; color: var(--ink); }
  .mt-ticket-values { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
  .mt-ticket-value-sub { font-size: 11.5px; font-family: 'IBM Plex Mono', monospace; color: var(--inkDim); }
  .mt-badge-absent { background: var(--danger); color: #FFFFFF; font-size: 10px; padding: 1px 7px; border-radius: 999px; margin-left: 8px; vertical-align: middle; }

  .mt-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; background: var(--surfaceAlt); border: 1px dashed var(--border); border-radius: 10px; padding: 34px 30px; color: var(--inkDim); max-width: 460px; }
  .mt-empty h3 { color: var(--ink); font-size: 16px; margin-top: 4px; }
  .mt-empty p { font-size: 13px; margin: 0; }
  .mt-empty .mt-btn { margin-top: 6px; }

  .mt-overlay { position: fixed; inset: 0; background: rgba(20,26,38,0.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
  .mt-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(26,58,107,0.20); }
  .mt-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
  .mt-modal-head h3 { font-size: 16px; color: var(--ink); }
  .mt-modal-body { padding: 18px; }

  .mt-form { display: flex; flex-direction: column; gap: 13px; }
  .mt-form label { font-size: 12.5px; color: var(--inkDim); display: flex; flex-direction: column; gap: 5px; }
  .mt-check-label { display: flex; flex-direction: row !important; align-items: center; gap: 8px !important; font-size: 13px !important; color: var(--ink) !important; }
  .mt-input { font-family: inherit; font-size: 13.5px; background: var(--surfaceAlt); border: 1px solid var(--border); color: var(--ink); border-radius: 6px; padding: 8px 10px; width: 100%; }
  .mt-input:focus { background: var(--surface); }
  .mt-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
  .mt-hidden-input { display: none; }
  .mt-form-note { font-size: 11.5px; color: var(--inkDim); background: var(--surfaceAlt); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }

  @media (max-width: 900px) {
    .mt-chart-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 720px) {
    .mt-layout { flex-direction: column; align-items: stretch; }
    .mt-sidebar { width: 100%; position: static; max-height: none; }
    .mt-main { min-width: 0; }
    body { padding: 8px; }
  }
