/* Ashford State Patrol MDT
   V2 Operational Workstation UI
   Layered over styles.css so the redesign is reversible and backend-safe.
*/

:root{
  --v2-bg:#050b10;
  --v2-bg-2:#08121a;
  --v2-panel:#0a151e;
  --v2-panel-2:#0d1b26;
  --v2-panel-3:#10212e;
  --v2-line:#1b3140;
  --v2-line-strong:#29495d;
  --v2-text:#ecf2f5;
  --v2-muted:#8ca1ad;
  --v2-dim:#5f7582;
  --v2-gold:#c8a454;
  --v2-gold-soft:#ead39a;
  --v2-green:#63b985;
  --v2-amber:#d7a44f;
  --v2-red:#d9606b;
  --v2-blue:#6d9fc2;
  --v2-radius:5px;
  --v2-shadow:0 18px 44px rgba(0,0,0,.26);
  --v2-mono:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;
}

html{background:var(--v2-bg)}
body{
  background:var(--v2-bg);
  color:var(--v2-text);
  letter-spacing:.005em;
}

button,input,select,textarea{
  border-radius:var(--v2-radius)!important;
}

button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{
  outline:2px solid var(--v2-gold);
  outline-offset:2px;
}

/* ---- Primary shell ---- */
#app{
  grid-template-columns:78px minmax(0,1fr);
  background:var(--v2-bg);
}

.shell-rail{
  width:78px;
  padding:12px 7px;
  background:#030a0f;
  border-right:1px solid var(--v2-line);
  box-shadow:8px 0 28px rgba(0,0,0,.12);
}

.agency-badge-wrap{
  width:54px;
  height:54px;
}

.product-label{
  margin:9px 0 13px;
  font-size:7px;
  letter-spacing:.12em;
  color:#617580;
}

.rail-nav{
  gap:5px;
}

.rail-tab{
  height:52px;
  border-radius:5px!important;
}

.rail-tab:hover,.rail-tab.active{
  background:#0b1821;
  border-color:#223b4b;
  box-shadow:inset 2px 0 0 var(--v2-gold);
}

.rail-tab.active b{color:var(--v2-gold-soft)}

.rail-status{
  border-top:1px solid #13242f;
  padding-top:10px;
}

/* ---- Main surfaces ---- */
.surface{
  background:
    linear-gradient(rgba(255,255,255,.012),rgba(255,255,255,0)),
    var(--v2-bg-2);
}

.command-bar{
  min-height:64px;
  grid-template-columns:minmax(220px,1fr) minmax(280px,.8fr) minmax(300px,1fr);
  gap:12px;
  padding:8px 16px;
  background:rgba(5,13,19,.97);
  border-bottom:1px solid var(--v2-line);
  box-shadow:0 8px 28px rgba(0,0,0,.16);
}

.screen-kicker,.eyebrow,.module-label,.pane-title span,.civilian-eyebrow{
  color:var(--v2-gold);
  letter-spacing:.13em;
}

.unit-heading{
  gap:8px;
  margin-top:2px;
}

.unit-heading h1,
.page-head h2,
.module-head h3,
.pane-title h3,
.civ-card-head h3{
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-weight:720;
  letter-spacing:-.02em;
}

.unit-heading h1{
  font-size:20px;
}

.unit-chip{
  padding:3px 6px;
  border-radius:4px;
  background:#132838;
  border-color:#2d4d61;
  font-family:var(--v2-mono);
}

.command-center{
  min-height:38px;
  border-left:1px solid var(--v2-line);
  border-right:1px solid var(--v2-line);
}

.current-call-chip b,
.dispatch-clock strong,
.call-status,
.priority-code,
.pane-count,
.large-call-row>div:first-child,
.record-result-type,
.asset-badge,
.overview-strip strong{
  font-family:var(--v2-mono);
}

.command-right{
  gap:6px;
}

.status-select,.signal-button,.primary,.secondary{
  padding:8px 10px;
  border-radius:4px!important;
}

.primary{
  background:var(--v2-gold);
  border-color:#9f7e35;
  color:#071017;
}

.primary:hover{
  background:#d5b467;
}

.secondary{
  background:#10202b;
  border-color:#294658;
}

.signal-button{
  background:#34151a;
  border-color:#6f3037;
}

/* ---- Trooper workspace ---- */
.trooper-layout{
  grid-template-columns:158px minmax(0,1fr);
  min-height:calc(100vh - 64px);
}

.section-nav{
  padding:12px 7px;
  background:#071019;
  border-right:1px solid var(--v2-line);
}

.section-nav button{
  min-height:36px;
  padding:8px 9px;
  gap:8px;
  border-radius:4px!important;
  font-size:9px;
  color:#8195a0;
}

.section-nav button span{
  width:20px;
  font-family:var(--v2-mono);
  color:#536b79;
}

.section-nav button:hover,
.section-nav button.active{
  background:#0d1b25;
}

.section-nav button.active{
  box-shadow:inset 2px 0 0 var(--v2-gold);
}

.page-area{
  padding:14px 16px 18px;
  max-width:1900px;
  width:100%;
  margin:0 auto;
}

.page-head{
  min-height:42px;
  margin-bottom:10px;
  align-items:center;
  border-bottom:1px solid var(--v2-line);
  padding-bottom:9px;
}

.page-head h2{
  margin:2px 0 0;
  font-size:21px;
}

.head-actions{
  gap:6px;
}

/* Compact shift strip, more terminal and less dashboard-card */
.overview-strip{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:0;
  background:#071018;
  border:1px solid var(--v2-line);
  border-radius:var(--v2-radius);
  overflow:hidden;
  margin-bottom:10px;
  box-shadow:none;
}

.overview-strip article{
  min-height:68px;
  padding:10px 12px;
  background:transparent;
  border:0;
  border-right:1px solid var(--v2-line);
  border-radius:0;
}

.overview-strip article:last-child{
  border-right:0;
}

.overview-strip article>span{
  display:block;
  color:var(--v2-dim);
  font-size:8px;
  font-weight:850;
  letter-spacing:.12em;
}

.overview-strip strong{
  display:block;
  margin-top:5px;
  font-size:15px;
  letter-spacing:-.02em;
}

.overview-strip small{
  display:block;
  margin-top:3px;
  color:var(--v2-muted);
  font-size:8px;
}

/* Operations-first dashboard */
.dashboard-grid{
  grid-template-columns:minmax(280px,.8fr) minmax(520px,1.65fr) minmax(300px,.9fr);
  grid-template-areas:
    "crew calls alerts"
    "search calls alerts";
  gap:10px;
  align-items:stretch;
}

.crew-module{grid-area:crew}
.calls-module{grid-area:calls}
.search-module{grid-area:search}
.alerts-module{grid-area:alerts}

.module,
.admin-card,
.civ-card{
  background:var(--v2-panel);
  border:1px solid var(--v2-line);
  border-radius:var(--v2-radius);
  box-shadow:none;
}

.module{
  padding:12px;
}

.module:hover,
.admin-card:hover{
  border-color:#254254;
}

.module-head{
  padding-bottom:8px;
  margin-bottom:8px;
  border-bottom:1px solid var(--v2-line);
}

.module-head h3{
  font-size:14px;
  margin:2px 0 0;
}

.pill{
  border-radius:999px!important;
  padding:4px 7px;
  font-family:var(--v2-mono);
  font-size:8px;
}

.lookup-box,
.big-search{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:6px;
}

.lookup-box input,
.big-search input,
.unit-filter input,
input,select,textarea{
  background:#061018;
  color:var(--v2-text);
  border:1px solid #244050;
}

.lookup-box input:focus,
.big-search input:focus,
.unit-filter input:focus,
input:focus,select:focus,textarea:focus{
  border-color:#6f653f;
  box-shadow:0 0 0 2px rgba(200,164,84,.11);
}

.lookup-box button,
.big-search button{
  min-width:72px;
}

.return-empty{
  border:1px dashed #27404e;
  background:#071018;
  color:var(--v2-muted);
}

.mini-table{
  border-top:1px solid var(--v2-line);
}

/* Dense data rows */
.call-table,
.data-table,
.records-results{
  border:1px solid var(--v2-line);
  border-radius:4px;
  overflow:hidden;
  background:#071018;
}

.call-table-row,
.large-call-row,
.record-result,
.asset-card,
.alert-line{
  border-bottom:1px solid var(--v2-line);
  background:transparent;
}

.call-table-row:last-child,
.large-call-row:last-child,
.record-result:last-child,
.asset-card:last-child,
.alert-line:last-child{
  border-bottom:0;
}

.call-table-row:hover,
.large-call-row:hover,
.record-result:hover,
.asset-card:hover{
  background:#0c1a24;
}

.call-table-head,
.call-table-row,
.large-call-row{
  min-height:38px;
  padding:7px 9px;
}

.call-table-head{
  background:#0b1821;
  color:#728895;
  font-size:8px;
  letter-spacing:.1em;
}

.large-call-row{
  font-size:10px;
}

.database-tabs,
.filter-row,
.editor-tabs{
  gap:2px;
  border-bottom:1px solid var(--v2-line);
}

.database-tabs button,
.filter-row button,
.editor-tabs button{
  border-radius:3px 3px 0 0!important;
  background:transparent;
}

.database-tabs button.active,
.filter-row button.active,
.editor-tabs button.active{
  background:#142531;
  color:var(--v2-gold-soft);
  box-shadow:inset 0 -2px 0 var(--v2-gold);
}

/* ---- Dispatch/CAD ---- */
.dispatch-bar{
  grid-template-columns:minmax(250px,1fr) auto minmax(360px,1fr);
}

.dispatch-clock{
  padding:0 16px;
  border-left:1px solid var(--v2-line);
  border-right:1px solid var(--v2-line);
}

.dispatch-clock strong{
  font-size:17px;
  letter-spacing:.04em;
}

.dispatch-workspace{
  display:grid;
  grid-template-columns:330px minmax(520px,1fr) 300px;
  min-height:calc(100vh - 64px);
  gap:0;
  background:#050c12;
}

.cad-pane,
.cad-center{
  background:#071018;
  border-color:var(--v2-line);
}

.cad-pane{
  padding:0;
}

.calls-pane{
  border-right:1px solid var(--v2-line);
}

.units-pane{
  border-left:1px solid var(--v2-line);
}

.pane-title{
  min-height:58px;
  padding:10px 12px;
  border-bottom:1px solid var(--v2-line);
  background:#09151e;
}

.pane-title h3{
  font-size:14px;
}

.pane-count{
  min-width:28px;
  text-align:center;
  background:#132631;
  border:1px solid #294757;
  border-radius:4px;
  padding:5px 6px;
}

.filter-row,
.unit-filter{
  padding:7px 8px;
  background:#061018;
}

.dispatch-call-list,
.unit-board{
  padding:6px;
}

.dispatch-call-card,
.unit-board-card{
  margin-bottom:5px;
  padding:9px;
  border-radius:4px;
  background:#0a1720;
  border:1px solid #1c3442;
  box-shadow:none;
}

.dispatch-call-card:hover,
.unit-board-card:hover{
  background:#0e1e29;
  border-color:#315265;
}

.dispatch-call-card.active{
  border-color:#7b6736;
  box-shadow:inset 3px 0 0 var(--v2-gold);
}

.cad-center{
  padding:12px;
}

.call-editor{
  border:1px solid var(--v2-line);
  border-radius:4px;
  background:var(--v2-panel);
  box-shadow:none;
}

.call-editor-head{
  padding:10px 12px;
  border-bottom:1px solid var(--v2-line);
}

.call-data-grid{
  gap:6px;
}

.field-box,
.priority-box,
.call-narrative,
.timeline{
  background:#071018;
  border:1px solid var(--v2-line);
  border-radius:4px;
}

.timeline-entry{
  border-left-color:#34566a;
}

/* ---- Messaging/Admin ---- */
.messages-layout{
  grid-template-columns:260px minmax(0,1fr);
  gap:10px;
}

.thread-list,
.thread-view{
  background:var(--v2-panel);
  border:1px solid var(--v2-line);
  border-radius:4px;
}

.thread-item{
  border-bottom:1px solid var(--v2-line);
}

.thread-item.active{
  background:#10212c;
  box-shadow:inset 2px 0 0 var(--v2-gold);
}

.admin-grid{
  gap:10px;
}

.admin-card{
  padding:12px;
}

.admin-row{
  border-top:1px solid var(--v2-line);
}

/* ---- Civilian surface: same brand, intentionally friendlier ---- */
.civilian-surface{
  background:#e9edf0;
  color:#14222c;
}

.civilian-topbar{
  min-height:68px;
  background:#07131d;
  border-bottom:3px solid var(--v2-gold);
}

.civilian-container{
  max-width:1440px;
  padding:22px 24px 34px;
}

.civilian-welcome{
  margin-bottom:14px;
}

.civilian-summary{
  gap:8px;
}

.civilian-summary article,
.civ-card{
  border-radius:5px;
  box-shadow:0 8px 24px rgba(22,35,44,.07);
}

.civ-card{
  background:#fff;
  border-color:#cfd8dd;
}

.civilian-content-grid{
  gap:10px;
}

/* ---- Modal/auth surfaces ---- */
.modal-backdrop{
  background:rgba(0,5,9,.76);
  backdrop-filter:blur(7px);
}

.modal{
  border:1px solid #314c5e;
  border-radius:6px!important;
  box-shadow:0 30px 90px rgba(0,0,0,.45);
}

.modal-head{
  border-bottom:1px solid var(--v2-line);
}

.auth-card{
  border:1px solid var(--v2-line);
  border-radius:6px!important;
  box-shadow:var(--v2-shadow);
}

/* ---- Responsive ---- */
@media (max-width:1320px){
  .dashboard-grid{
    grid-template-columns:minmax(270px,.85fr) minmax(480px,1.55fr);
    grid-template-areas:
      "crew calls"
      "search calls"
      "alerts alerts";
  }

  .dispatch-workspace{
    grid-template-columns:300px minmax(460px,1fr) 260px;
  }

  .command-bar{
    grid-template-columns:minmax(210px,1fr) minmax(220px,.7fr) minmax(260px,1fr);
  }
}

@media (max-width:1050px){
  #app{grid-template-columns:64px minmax(0,1fr)}
  .shell-rail{width:64px}
  .agency-badge-wrap{width:46px;height:46px}
  .trooper-layout{grid-template-columns:134px minmax(0,1fr)}
  .command-bar{grid-template-columns:1fr auto}
  .command-center{display:none}
  .dashboard-grid{
    grid-template-columns:1fr;
    grid-template-areas:"crew" "calls" "search" "alerts";
  }
  .overview-strip{grid-template-columns:repeat(3,1fr)}
  .overview-strip article:nth-child(3){border-right:0}
  .overview-strip article:nth-child(n+4){border-top:1px solid var(--v2-line)}
  .dispatch-workspace{grid-template-columns:280px minmax(0,1fr)}
  .units-pane{display:none}
}

@media (max-width:760px){
  #app{display:block}
  .shell-rail{
    position:sticky;
    width:100%;
    height:auto;
    min-height:56px;
    flex-direction:row;
    align-items:center;
    padding:6px 8px;
    border-right:0;
    border-bottom:1px solid var(--v2-line);
  }
  .shell-rail .agency-lockup{width:48px}
  .agency-badge-wrap{width:42px;height:42px}
  .product-label,.rail-status{display:none}
  .rail-nav{display:flex;gap:4px;margin-left:6px}
  .rail-tab{width:64px;height:40px}
  .command-bar{
    position:static;
    min-height:auto;
    grid-template-columns:1fr;
    padding:9px 10px;
  }
  .command-right{justify-content:flex-start;flex-wrap:wrap}
  .trooper-layout{display:block}
  .section-nav{
    display:flex;
    gap:3px;
    overflow-x:auto;
    border-right:0;
    border-bottom:1px solid var(--v2-line);
    padding:6px;
  }
  .section-nav button{width:auto;min-width:max-content}
  .page-area{padding:10px}
  .page-head{align-items:flex-start}
  .overview-strip{grid-template-columns:1fr 1fr}
  .overview-strip article{border-bottom:1px solid var(--v2-line)}
  .overview-strip article:nth-child(odd){border-right:1px solid var(--v2-line)}
  .overview-strip article:nth-child(even){border-right:0}
  .dashboard-grid{display:block}
  .dashboard-grid>.module{margin-bottom:8px}
  .dispatch-workspace{display:block}
  .cad-pane,.cad-center{border:0;border-bottom:1px solid var(--v2-line)}
  .calls-pane{max-height:360px;overflow:auto}
  .units-pane{display:block}
  .messages-layout{grid-template-columns:1fr}
  .civilian-container{padding:14px}
}


/* ---- Secure portal launcher ---- */
body[data-portal="selector"] #app{
  filter:blur(5px);
  opacity:.18;
  pointer-events:none;
  user-select:none;
}

.portal-gate{
  position:fixed;
  inset:0;
  z-index:200;
  overflow:auto;
  padding:clamp(18px,4vw,48px);
  background:
    radial-gradient(circle at 50% -20%,rgba(52,91,116,.34),transparent 38%),
    linear-gradient(180deg,#06111a,#03080d 72%);
  color:var(--v2-text);
}

.portal-shell{
  width:min(1180px,100%);
  min-height:calc(100vh - clamp(36px,8vw,96px));
  margin:0 auto;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.portal-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:24px;
  padding:0 2px 22px;
  border-bottom:1px solid var(--v2-line);
}

.portal-brand{
  display:flex;
  align-items:center;
  gap:16px;
}

.portal-badge{
  width:72px;
  height:72px;
  display:grid;
  place-items:center;
}

.portal-badge img{
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  filter:drop-shadow(0 8px 18px rgba(0,0,0,.32));
}

.portal-brand span{
  display:block;
  color:var(--v2-gold);
  font-size:9px;
  font-weight:900;
  letter-spacing:.16em;
}

.portal-brand h1{
  margin:4px 0 3px;
  font-size:27px;
  letter-spacing:-.035em;
}

.portal-brand p{
  margin:0;
  color:var(--v2-muted);
  font-size:11px;
}

.portal-header-actions{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.portal-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  padding:24px 0;
}

.portal-card{
  position:relative;
  min-height:292px;
  display:flex;
  flex-direction:column;
  padding:18px;
  border:1px solid var(--v2-line);
  border-radius:7px;
  background:linear-gradient(180deg,#0b1821,#071018);
  box-shadow:0 18px 46px rgba(0,0,0,.18);
}

.portal-card.unlocked{
  border-color:#315062;
}

.portal-card.locked{
  background:linear-gradient(180deg,#09131a,#060d12);
}

.portal-card-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.portal-abbr{
  color:var(--v2-gold-soft);
  font:800 12px/1 var(--v2-mono);
  letter-spacing:.12em;
}

.portal-state{
  border:1px solid #294454;
  border-radius:999px;
  padding:4px 7px;
  color:#91a7b3;
  font:700 8px/1 var(--v2-mono);
  letter-spacing:.07em;
}

.portal-card.unlocked .portal-state{
  color:#9bd6b2;
  border-color:#315b45;
  background:#10291c;
}

.portal-card h2{
  margin:30px 0 7px;
  font-size:22px;
  letter-spacing:-.025em;
}

.portal-card p{
  margin:0;
  color:#a5b4bd;
  font-size:11px;
  line-height:1.55;
}

.portal-card small{
  display:block;
  margin-top:8px;
  color:#607682;
  font-size:9px;
  line-height:1.45;
}

.portal-enter,
.portal-code-entry{
  margin-top:auto;
}

.portal-enter,
.portal-code-entry button{
  min-height:40px;
  border:1px solid #9f7e35;
  background:var(--v2-gold);
  color:#071017;
  font-size:9px;
  font-weight:900;
  letter-spacing:.07em;
}

.portal-enter{
  width:100%;
}

.portal-code-entry{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:6px;
}

.portal-code-entry input{
  min-width:0;
  text-transform:uppercase;
  font-family:var(--v2-mono);
  letter-spacing:.035em;
}

.portal-lock-state{
  margin-top:auto;
  min-height:40px;
  display:grid;
  place-items:center;
  border:1px solid #3b3430;
  border-radius:4px;
  background:#171410;
  color:#a89272;
  font:800 8px/1 var(--v2-mono);
  letter-spacing:.08em;
}

.portal-error{
  min-height:20px;
  padding-top:10px;
  color:#f1a6ad;
  font-size:10px;
  font-weight:700;
}

.portal-footer{
  display:flex;
  justify-content:space-between;
  gap:20px;
  padding-top:16px;
  border-top:1px solid var(--v2-line);
  color:#607480;
  font-size:8px;
  letter-spacing:.08em;
}

.portal-footer span:first-child{
  color:var(--v2-gold);
  font-weight:900;
}

.portal-session-controls{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:4px;
  margin-top:9px;
}

.portal-session-controls button{
  padding:5px 3px;
  border:1px solid #223845;
  background:#08151d;
  color:#718895;
  font-size:7px;
  font-weight:900;
  letter-spacing:.06em;
}

.portal-session-controls button:hover{
  border-color:#506371;
  color:#d5e0e5;
}

/* ---- Portal access administration ---- */
.portal-admin-body{
  max-height:68vh;
  overflow:auto;
}

.portal-admin-actions{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  margin-bottom:18px;
}

.portal-admin-body h3{
  margin:18px 0 8px;
  color:#b7c5cc;
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.1em;
}

.portal-admin-list{
  border:1px solid var(--v2-line);
  border-radius:4px;
  overflow:hidden;
}

.portal-admin-row{
  min-height:54px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  padding:9px 10px;
  border-bottom:1px solid var(--v2-line);
  background:#071018;
}

.portal-admin-row:last-child{
  border-bottom:0;
}

.portal-admin-row strong,
.portal-admin-row span{
  display:block;
}

.portal-admin-row strong{
  font-size:10px;
}

.portal-admin-row span{
  margin-top:3px;
  color:var(--v2-muted);
  font-size:8px;
}

.portal-admin-row button{
  border:1px solid #60323a;
  background:#261116;
  color:#e78f98;
  padding:6px 8px;
  font-size:8px;
  font-weight:850;
}

.portal-admin-row b{
  color:#718692;
  font:800 8px/1 var(--v2-mono);
}

/* ---- Dispatch history ---- */
.history-search{
  margin-bottom:10px;
}

.history-results{
  border:1px solid var(--v2-line);
  border-radius:4px;
  overflow:hidden;
  max-height:52vh;
  overflow-y:auto;
}

.history-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:18px;
  padding:10px 11px;
  border-bottom:1px solid var(--v2-line);
  background:#071018;
}

.history-row:last-child{
  border-bottom:0;
}

.history-row:hover{
  background:#0c1a24;
}

.history-row strong,
.history-row span{
  display:block;
}

.history-row strong{
  font:800 10px/1.2 var(--v2-mono);
  color:var(--v2-gold-soft);
}

.history-row span{
  margin-top:4px;
  color:#91a4ae;
  font-size:9px;
}

.history-row p{
  margin:5px 0 0;
  color:#c2cdd2;
  font-size:9px;
  line-height:1.45;
}

.history-meta{
  min-width:126px;
  text-align:right;
}

.history-meta span{
  font:800 8px/1 var(--v2-mono);
  color:#8aa0ac;
}

.history-meta small{
  display:block;
  margin:5px 0 7px;
  color:#566d79;
  font-size:8px;
}

.history-meta button{
  border:1px solid #385667;
  background:#10212c;
  color:#c5d4db;
  padding:5px 7px;
  font-size:8px;
  font-weight:850;
}

@media (max-width:900px){
  .portal-header{
    align-items:flex-start;
    flex-direction:column;
  }

  .portal-header-actions{
    justify-content:flex-start;
  }

  .portal-grid{
    grid-template-columns:1fr;
  }

  .portal-card{
    min-height:230px;
  }

  .portal-footer{
    flex-direction:column;
  }
}

@media (max-width:560px){
  .portal-gate{
    padding:14px;
  }

  .portal-brand{
    align-items:flex-start;
  }

  .portal-badge{
    width:54px;
    height:54px;
  }

  .portal-brand h1{
    font-size:22px;
  }

  .portal-code-entry{
    grid-template-columns:1fr;
  }

  .history-row{
    grid-template-columns:1fr;
  }

  .history-meta{
    text-align:left;
  }
}


/* Portal launcher must never cover application dialogs. */
.modal-backdrop{
  z-index:500;
}


/* ---- v1.2 usability pass ---- */
.trooper-layout{
  grid-template-columns:184px minmax(0,1fr);
}

.section-nav{
  padding:14px 9px;
}

.section-nav button{
  min-height:42px;
  padding:10px 11px;
  font-size:10px;
  letter-spacing:.015em;
}

.page-area{
  max-width:1680px;
  padding:18px 20px 24px;
}

.module{
  padding:14px;
}

.mdt-more-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.mdt-more-card{
  min-height:150px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-end;
  text-align:left;
  padding:16px;
  border:1px solid var(--v2-line);
  background:linear-gradient(180deg,#0c1922,#081119);
  color:var(--v2-text);
}

.mdt-more-card:hover{
  border-color:#3a596b;
  background:#10212c;
}

.mdt-more-card span{
  margin-bottom:auto;
  color:var(--v2-gold);
  font-size:8px;
  font-weight:900;
  letter-spacing:.13em;
}

.mdt-more-card strong{
  font-size:18px;
  letter-spacing:-.025em;
}

.mdt-more-card small{
  margin-top:5px;
  color:var(--v2-muted);
  font-size:9px;
  line-height:1.45;
}

/* Civilian tabs are real navigation now, not decorative optimism. */
.civilian-topbar nav button{
  cursor:pointer;
}

.civilian-topbar nav button.active{
  color:#fff;
  border-bottom-color:var(--v2-gold);
}

[data-civ-section][hidden],
.civilian-summary[hidden],
.civilian-content-grid[hidden]{
  display:none!important;
}

.civilian-content-grid{
  grid-template-columns:repeat(2,minmax(0,1fr));
}

.civ-card[data-civ-section="vehicles"],
.civ-card[data-civ-section="firearms"],
.civ-card[data-civ-section="history"]{
  grid-column:1 / -1;
}

.civilian-editable-asset{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
}

.asset-edit{
  align-self:center;
  border:1px solid #c5d0d6;
  background:#f4f6f7;
  color:#23323b;
  padding:7px 10px;
  font-size:8px;
  font-weight:850;
}

.asset-edit:hover{
  background:#e9eef1;
  border-color:#aebdc5;
}

#call911Btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}

.civilian-topbar nav{
  overflow-x:auto;
  scrollbar-width:none;
}

.civilian-topbar nav::-webkit-scrollbar{
  display:none;
}

@media (max-width:1050px){
  .trooper-layout{grid-template-columns:154px minmax(0,1fr)}
  .section-nav button{min-height:40px}
}

@media (max-width:760px){
  .mdt-more-grid{grid-template-columns:1fr}
  .civilian-content-grid{grid-template-columns:1fr}
  .civilian-topbar nav{max-width:100%;justify-content:flex-start}
  .civilian-editable-asset{grid-template-columns:auto minmax(0,1fr)}
  .asset-edit{grid-column:1 / -1;width:100%}
}
