/* ==========================================================================
   Mobile Admin Console — read-only / restricted; admin tier only.
   ========================================================================== */

@media (max-width: 767px) {
  body.madm-no-scroll { overflow: hidden; }

  .madm-overlay {
    position: fixed;
    inset: 0;
    background: #0a2e2e;
    color: #e0e0e8;
    z-index: 11500;
    display: flex;
    flex-direction: column;
  }

  .madm-shell { display: flex; flex-direction: column; height: 100%; }

  .madm-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px;
    background: #0f3636;
    border-bottom: 1px solid #1a5252;
  }

  .madm-close,
  .madm-refresh {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    color: #e0e0e8;
    border-radius: 22px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    font-size: 20px;
  }

  .madm-close:active,
  .madm-refresh:active { background: rgba(255, 255, 255, 0.08); }

  .madm-title {
    flex: 1;
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 18px;
    font-weight: 700;
  }

  .madm-tabs {
    display: flex;
    gap: 0;
    background: #0f3636;
    border-bottom: 1px solid #1a5252;
    padding: 0 8px;
  }

  .madm-tab {
    flex: 1;
    appearance: none;
    background: transparent;
    border: 0;
    color: #a8b0b8;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 8px;
    min-height: 44px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-bottom: 2px solid transparent;
  }

  .madm-tab-active {
    color: #6DD4D4;
    border-bottom-color: #6DD4D4;
  }

  .madm-body {
    flex: 1;
    overflow-y: auto;
    /* binary-hatching-pearl D2 (2026-05-09): L/R floor removed — env safe-area
       only — per Iron-Law class fix. Top/bottom paddings preserved. */
    padding: 12px env(safe-area-inset-right, 0px) calc(80px + env(safe-area-inset-bottom, 0px))
             env(safe-area-inset-left, 0px);
  }

  .madm-loading,
  .madm-empty,
  .madm-error {
    padding: 32px 16px;
    text-align: center;
    color: #a8b0b8;
    font-size: 14px;
  }
  .madm-error { color: #ff8a80; }

  /* ── Notify Joe rows ── */
  .madm-notify-list { display: flex; flex-direction: column; gap: 8px; }

  .madm-notify-row {
    background: #0f3636;
    border: 1px solid #1a5252;
    border-left: 3px solid #6DD4D4;
    border-radius: 10px;
    padding: 10px 12px;
  }
  .madm-notify-row.madm-pri-high { border-left-color: #ff8a80; }
  .madm-notify-row.madm-pri-low { border-left-color: #6f7d85; }

  .madm-notify-row-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
  }

  .madm-notify-source {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #f0c270;
    font-weight: 700;
  }

  .madm-notify-age {
    font-size: 11px;
    color: #7d8a92;
  }

  .madm-notify-subj {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e8;
    line-height: 1.3;
    margin-bottom: 4px;
  }

  .madm-notify-body {
    font-size: 13px;
    color: #a8b0b8;
    line-height: 1.5;
  }

  /* ── Train Station ── */
  .madm-trains-list { display: flex; flex-direction: column; gap: 14px; }

  .madm-trains-section {
    background: #0f3636;
    border: 1px solid #1a5252;
    border-radius: 10px;
    padding: 10px 12px;
  }

  .madm-trains-section-title {
    margin: 0 0 8px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 14px;
    font-weight: 700;
    color: #6DD4D4;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .madm-count {
    background: rgba(109, 212, 212, 0.18);
    color: #6DD4D4;
    font-family: "Source Sans 3", sans-serif;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
  }

  .madm-train-row {
    border-top: 1px solid rgba(26, 82, 82, 0.6);
    padding: 8px 0;
  }
  .madm-train-row:first-child { border-top: 0; }

  .madm-train-name {
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e8;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    word-break: break-word;
  }

  .madm-train-status {
    font-size: 11px;
    color: #f0c270;
    margin: 2px 0 4px;
  }

  .madm-train-desc {
    font-size: 12px;
    color: #a8b0b8;
    line-height: 1.45;
  }

  .madm-train-more {
    margin-top: 6px;
    font-size: 11px;
    color: #7d8a92;
    font-style: italic;
  }

  /* ── Watcher ── */
  .madm-watch-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
    background: rgba(109, 212, 212, 0.18);
    color: #6DD4D4;
  }

  .madm-watch-status.madm-watch-warning {
    background: rgba(232, 160, 64, 0.18);
    color: #f0c270;
  }
  .madm-watch-status.madm-watch-error {
    background: rgba(239, 68, 68, 0.18);
    color: #ff8a80;
  }

  .madm-watch-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
  }

  .madm-watch-metric {
    background: #0f3636;
    border: 1px solid #1a5252;
    border-radius: 10px;
    padding: 8px 10px;
  }

  .madm-watch-metric-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #7d8a92;
  }

  .madm-watch-metric-value {
    font-size: 16px;
    font-weight: 700;
    color: #e0e0e8;
    margin-top: 2px;
    word-break: break-word;
  }

  .madm-watch-insights h4 {
    margin: 0 0 6px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 14px;
    color: #e0e0e8;
  }

  .madm-watch-insight {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    font-size: 12px;
    color: #c8cdd2;
    margin-bottom: 6px;
  }

  .madm-watch-sev {
    background: rgba(255, 255, 255, 0.06);
    color: #a8b0b8;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border-radius: 999px;
    flex-shrink: 0;
  }
  .madm-watch-sev.madm-sev-high,
  .madm-watch-sev.madm-sev-error { background: rgba(239, 68, 68, 0.2); color: #ff8a80; }
  .madm-watch-sev.madm-sev-medium,
  .madm-watch-sev.madm-sev-warning { background: rgba(232, 160, 64, 0.2); color: #f0c270; }
}
