/* Amber Sight responsive layer.
   Loaded after style.css. Desktop layout is unchanged above 960px.
   ≤960px  navigation collapses into a right-side drawer opened from the top-right menu button;
           workspace scope selectors fold behind a "change scope" button.
   ≤760px  phone: secondary copy and low-priority data are dropped, tables become label/value cards. */

/* ---------- desktop additions (sidebar account block) ---------- */
.mobile-topbar,.nav-backdrop,.drawer-close,.scope-toggle{display:none}
.side-account .user-line{display:grid;grid-template-columns:28px minmax(0,1fr);align-items:center;gap:9px;margin-top:12px;padding:6px;border-radius:9px;color:inherit;text-decoration:none}
.side-account .user-line:hover{background:rgba(255,255,255,.05)}
.user-avatar{width:28px;height:28px;display:grid;place-items:center;border-radius:50%;background:var(--amber);color:#141a22;font-size:12px;font-weight:900}
.user-ident{min-width:0;display:grid;gap:2px}
.user-ident b{font-size:11px;font-weight:700;color:#d6e1ea;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-ident small{font-size:9px;letter-spacing:.06em;color:var(--muted)}
.user-mypage{display:none}

/* ---------- ≤960px: top bar + drawer navigation ---------- */
@media(max-width:960px){
  .workspace-shell,.shell.workspace-shell{display:block}
  .mobile-topbar{position:sticky;top:0;z-index:1050;display:flex;align-items:center;justify-content:space-between;gap:12px;height:56px;padding:0 10px 0 16px;background:rgba(8,17,27,.96);backdrop-filter:blur(14px);border-bottom:1px solid var(--line)}
  .mobile-brand{display:flex;align-items:center;gap:10px;min-width:0;color:var(--text);text-decoration:none}
  .mobile-brand .brand-logo-tile{width:38px;height:30px;flex:0 0 38px;padding:4px;border-radius:8px}
  .mobile-brand strong{font-size:16px;white-space:nowrap}
  .mobile-menu-btn{position:relative;display:grid;align-content:center;justify-items:center;gap:4px;width:44px;height:44px;margin:0;padding:0;border:1px solid var(--line);border-radius:11px;background:transparent;color:var(--text)}
  .mobile-menu-btn i{display:block;width:18px;height:2px;border-radius:2px;background:currentColor}
  .mobile-menu-btn:hover,.mobile-menu-btn:focus,.scope-toggle:hover,.scope-toggle:focus,.drawer-close:hover,.drawer-close:focus{background:rgba(255,255,255,.06);box-shadow:none}
  .mobile-menu-dot{position:absolute;top:8px;right:8px;width:8px;height:8px;border-radius:50%;background:var(--amber)}

  .sidebar{position:fixed;top:0;right:0;left:auto;z-index:1100;width:min(86vw,340px);height:100vh;height:100dvh;padding:18px 16px calc(18px + env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain;border-right:0;border-left:1px solid var(--line);box-shadow:-24px 0 60px rgba(0,0,0,.4);transform:translateX(105%);visibility:hidden;transition:transform .22s ease,visibility 0s linear .22s}
  .nav-open .sidebar{transform:none;visibility:visible;transition:transform .22s ease}
  .nav-backdrop{display:block;position:fixed;inset:0;z-index:1090;background:rgba(1,6,11,.6);backdrop-filter:blur(2px)}
  .nav-backdrop[hidden]{display:none}
  .nav-open body{overflow:hidden}
  .drawer-close{display:grid;place-items:center;position:absolute;top:12px;right:12px;width:40px;height:40px;margin:0;padding:0;border:1px solid var(--line);border-radius:10px;background:transparent;color:var(--text);font-size:22px;line-height:1}

  /* Drawer order: account card (my page + logout) → navigation → theme/language. */
  .sidebar .brand{display:none}
  .sidebar .side-foot{display:contents}
  .side-account{order:1;margin:44px 0 6px;padding:12px;border:1px solid var(--line);border-radius:14px;background:rgba(255,255,255,.03)}
  .side-account .user-line{grid-template-columns:40px minmax(0,1fr) auto;margin:0;padding:0}
  .side-account .user-line:hover{background:transparent}
  .side-account .user-avatar{width:40px;height:40px;font-size:16px}
  .side-account .user-ident b{font-size:13px}
  .side-account .user-ident small{font-size:10px}
  .user-mypage{display:block;padding:7px 10px;border:1px solid var(--line);border-radius:999px;font-size:11px;font-weight:800;color:var(--text);white-space:nowrap}
  .side-account .ghost{margin-top:12px}
  .sidebar .nav-groups{order:2;margin-top:14px!important;gap:14px!important}
  .sidebar .nav-group a{padding:12px!important;font-size:15px}
  .side-prefs{order:3;margin-top:auto;padding-top:16px;border-top:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
  .side-prefs .theme-switch{margin:0}

  .workspace-bar{position:relative;top:auto;z-index:auto;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px 10px;min-height:0;padding:10px 16px}
  .workspace-crumb{min-width:0;overflow:hidden;white-space:nowrap}
  .workspace-crumb span{overflow:hidden;text-overflow:ellipsis;max-width:30vw}
  .scope-toggle{display:block;margin:0;padding:7px 11px;border:1px solid var(--line);border-radius:999px;background:transparent;color:var(--text);font-size:11px;font-weight:800;white-space:nowrap}
  .scope-toggle[aria-expanded="true"]{border-color:var(--amber);color:var(--amber)}
  .workspace-bar .workspace-scope-form{display:none;grid-column:1/-1}
  .workspace-bar.scope-open .workspace-scope-form{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .workspace-bar.scope-open .workspace-scope-form .workspace-timezone{grid-column:1/-1}
  .workspace-bar.scope-open .workspace-scope-form select{width:100%;min-width:0;max-width:none}
  .workspace-bar.scope-open .workspace-scope-form button{grid-column:1/-1}

  .content{padding:22px 20px 40px}
  .sight-alert-dock{z-index:1040}
}

/* ---------- ≤760px: phone ---------- */
@media(max-width:760px){
  body{-webkit-text-size-adjust:100%}
  .content{padding:16px 14px 36px}
  .m-hide{display:none!important}

  /* Page chrome: keep the title, drop breadcrumbs and descriptive subtitles. */
  .page-head,.workspace-page-head{flex-direction:column;align-items:stretch;gap:10px;margin-bottom:14px}
  .page-head h1{font-size:22px;line-height:1.25;overflow-wrap:anywhere}
  .page-head .breadcrumb,.page-head>div>p:not(.eyebrow),.workspace-page-head .freshness{display:none}
  .page-head>.small-btn,.page-head>a.small-btn,.page-head>button{align-self:flex-start}
  .eyebrow,.section-kicker{font-size:9px}
  .panel,.card{padding:14px;border-radius:12px}
  .panel h2{font-size:16px;margin-bottom:12px}
  .section-head{flex-wrap:wrap;gap:8px}
  .section-head p{display:none}
  .two-col,.report-two-col{grid-template-columns:1fr!important}
  .tabs{flex-wrap:nowrap;margin-bottom:12px;scrollbar-width:none}
  .tabs::-webkit-scrollbar{display:none}
  .metric-grid{grid-template-columns:1fr 1fr!important;gap:8px}
  .metric-card{padding:12px}
  .metric-card b{font-size:18px}
  .notice p,.console-policy-note{display:none}
  .time-context code{display:none}
  input,select,textarea{font-size:16px}  /* stops iOS zoom on focus */
  .workspace-dialog{width:100%;max-width:100%;max-height:92dvh;margin:auto 0 0;border-radius:16px 16px 0 0}

  /* Tables → label/value cards (labels set by responsive.js). */
  .table-wrap{overflow:visible}
  .table-wrap.panel{padding:8px}
  table.m-cards{min-width:0!important;width:100%;border-collapse:separate}
  table.m-cards thead{display:none}
  table.m-cards,table.m-cards tbody,table.m-cards tr{display:block;width:100%}
  table.m-cards tr{margin:0 0 8px;padding:6px 12px;border:1px solid var(--line);border-radius:10px;background:rgba(255,255,255,.02)}
  table.m-cards td{display:grid;grid-template-columns:minmax(78px,32%) minmax(0,1fr);gap:10px;align-items:baseline;width:auto;max-width:none!important;padding:6px 0;border:0;text-align:left;white-space:normal;overflow-wrap:anywhere}
  table.m-cards td+td{border-top:1px solid var(--line-soft,rgba(255,255,255,.06))}
  table.m-cards td::before{content:attr(data-label);color:var(--muted);font-size:11px;font-weight:700}
  table.m-cards td:not([data-label])::before,table.m-cards td[data-label=""]::before{content:none}
  table.m-cards td:not([data-label]),table.m-cards td[data-label=""]{grid-template-columns:1fr}
  table.m-cards td[hidden],table.m-cards th[hidden]{display:none!important}
  table.m-cards tr.m-row-note td{display:block;color:var(--muted)}
  table.m-cards .action-row{flex-wrap:wrap}
  .data-grid-toolbar{display:none}

  /* Dashboard */
  .ops-overview{grid-template-columns:1fr 1fr!important}
  .ops-overview .ops-status{grid-column:1/-1}
  .attention-row{grid-template-columns:auto minmax(0,1fr)}
  .attention-row time{grid-column:2}
  .report-row{grid-template-columns:auto minmax(0,1fr)}
  .report-row .muted{grid-column:2}

  /* Findings */
  .finding-main{grid-template-columns:auto minmax(0,1fr);gap:10px;padding:13px}
  .finding-meta{grid-column:2;display:flex;gap:8px;align-items:baseline}
  .suppress-form{flex-wrap:wrap}

  /* Logs / summaries: filters keep search + range only */
  .log-workspace-filter,.telemetry-workspace-filter,.filter-grid,.status-data-filter{grid-template-columns:1fr!important}

  /* Sites: list view collapses to cards */
  .view-switch{display:none}
  .site-view-list{display:none!important}
  .site-view-card{display:grid!important;grid-template-columns:1fr}
  .asset-summary{flex-wrap:wrap;gap:12px}
  .site-card-stats,.console-card-metrics{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .site-card-stats b,.console-card-metrics b{font-size:16px}
  .site-card-stats .small-value,.console-card-metrics .small-value{font-size:11px}

  /* Consoles */
  .console-workspace-grid{grid-template-columns:1fr}
  .plane-status{flex-wrap:wrap;gap:6px 12px}
  .console-ops-identity{flex-wrap:wrap}
  .console-ops-tabs{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
  .console-ops-tabs a{flex:0 0 auto;white-space:nowrap}
  .console-authority-note{display:none}
  .console-health-grid{grid-template-columns:1fr 1fr!important}
  .console-health-wide{grid-column:1/-1}
  .console-health-source small{display:none}
  .console-maintenance-grid>section:first-child{display:none}

  /* Status data */
  .status-data-filter{display:none!important}  /* the workspace scope bar covers account/site/console */
  .status-data-summary-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px}
  .status-data-summary-grid article{padding:10px}
  .status-console-grid{grid-template-columns:1fr!important}

  /* Metric data dashboard: single column, live panels only (overlay/wall tools stay on desktop). */
  .telemetry-content-wide{padding-left:14px!important;padding-right:14px!important}
  .telemetry-toolbar{justify-content:flex-start}
  #telemetry-open-overlay,#telemetry-open-wall,#telemetry-clear,#telemetry-overlay-visible-toggle,.telemetry-overlay-card,.telemetry-presentation-strip,.telemetry-semantic-strip,.telemetry-presentation-note{display:none!important}
  .telemetry-stat-grid{grid-template-columns:1fr 1fr!important}
  .telemetry-stat:nth-child(n+4):not(:last-child){display:none}
  .telemetry-workspace{grid-template-columns:1fr!important}
  .telemetry-explorer{max-height:55vh;overflow:auto}
  .telemetry-panel-grid{grid-template-columns:1fr!important}

  /* Video */
  .video-management-shell{grid-template-columns:1fr!important}
  .video-range-toolbar>.muted{display:none}
  .video-range-toolbar{flex-wrap:wrap}
  .video-thumbnail-grid{grid-template-columns:1fr 1fr!important}
  .video-list-query>label{white-space:nowrap}
  .video-list-query>label>input,.video-list-query>label>select{flex:1 1 auto;min-width:0}

  /* Reports */
  .report-card-kpis{display:grid;grid-template-columns:1fr 1fr;gap:6px}
  .report-summary-card .status{white-space:nowrap}
  .report-kpi-grid{grid-template-columns:1fr 1fr!important}
  .report-hero{flex-direction:column;align-items:stretch;gap:12px}
  .snapshot-footer span{overflow-wrap:anywhere}

  /* Alert detail: video evidence first, raw evidence capped */
  .alert-detail-grid{display:flex!important;flex-direction:column;gap:14px}
  .alert-media-column{order:-1}
  .alert-detail-hero{flex-direction:column;align-items:stretch;gap:12px}
  .alert-detail-hero h2,.finding-main h2{overflow-wrap:anywhere}
  .evidence-box,.alert-log-list pre{max-height:220px;overflow:auto}

  /* My page (account security) */
  .security-summary{grid-template-columns:1fr!important}
  .session-row>div{flex-wrap:wrap}
  .kv{grid-template-columns:1fr;gap:2px 0}
  .kv b{margin-bottom:8px}

  /* System */
  .health-grid{grid-template-columns:1fr 1fr!important;gap:8px}
  .health-item small{display:none}
}

@media(max-width:380px){
  .metric-grid,.health-grid,.ops-overview,.console-health-grid{grid-template-columns:1fr!important}
  .video-thumbnail-grid{grid-template-columns:1fr!important}
}

/* ---------- sign-in / sign-up / recovery cards ---------- */
@media(max-width:520px){
  .login-body{place-items:start center;padding:16px 12px}
  .login-card{padding:22px 18px;border-radius:16px}
  .login-card .auth-lang{justify-content:flex-start;margin-bottom:10px}
  .login-card .theme-switch.compact{position:absolute;top:22px;right:18px;margin:0}
  .login-card{position:relative}
  .login-card .brand.big{margin:6px 0 22px}
  .login-card h1{font-size:22px}
  .login-card input,.login-card select{font-size:16px}
}

/* ---------- bright theme ---------- */
html[data-theme="bright"] .side-account .user-line:hover{background:rgba(255,255,255,.06)}
@media(max-width:960px){
  html[data-theme="bright"] .mobile-topbar{background:rgba(255,255,255,.96);border-color:#d7dee7}
  html[data-theme="bright"] .mobile-menu-btn,html[data-theme="bright"] .mobile-menu-btn:hover,html[data-theme="bright"] .mobile-menu-btn:focus,
  html[data-theme="bright"] .scope-toggle,html[data-theme="bright"] .scope-toggle:hover,html[data-theme="bright"] .scope-toggle:focus{background:#ffffff;border-color:#d5dce5;color:#18212f;box-shadow:none}
  html[data-theme="bright"] .scope-toggle[aria-expanded="true"]{border-color:#b95714;color:#b95714}
  html[data-theme="bright"] .drawer-close,html[data-theme="bright"] .drawer-close:hover,html[data-theme="bright"] .drawer-close:focus{background:transparent;border-color:rgba(255,255,255,.14);color:#ffffff;box-shadow:none}
  html[data-theme="bright"] .side-account{border-color:rgba(255,255,255,.1);background:rgba(255,255,255,.04)}
  html[data-theme="bright"] .user-mypage{border-color:rgba(255,255,255,.18);color:#ffffff}
}
@media(max-width:760px){
  html[data-theme="bright"] table.m-cards tr{background:#ffffff;border-color:#d7dee7}
}
