:root{
  --bg:#020617;
  --surface:#0f172a;
  --surface-2:#111c33;
  --panel:#162036;
  --line:#26334d;
  --line-strong:#334155;
  --text:#f8fafc;
  --muted:#94a3b8;
  --soft:#cbd5e1;
  --primary:#38bdf8;
  --primary-strong:#0ea5e9;
  --positive:#22c55e;
  --warning:#f59e0b;
  --danger:#ef4444;
  --shadow:0 24px 70px rgba(0,0,0,.38);
}

*{box-sizing:border-box}

html,body{min-height:100%}

body{
  margin:0;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  background:
    radial-gradient(circle at 16% 0%, rgba(56,189,248,.16), transparent 34rem),
    linear-gradient(145deg, #020617 0%, #08111f 48%, #020617 100%);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

.app{
  width:min(1180px,100%);
  margin:0 auto;
  padding:28px;
}

.header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:18px;
  margin-bottom:24px;
}

.header-actions{
  display:flex;
  align-items:center;
  gap:12px;
}

.top-nav{
  display:flex;
  align-items:center;
  gap:14px;
}

.top-nav a,.site-footer a,.text-link{
  color:var(--soft);
  text-decoration:none;
  transition:color .2s;
}

.top-nav a:hover,.site-footer a:hover,.text-link:hover{
  color:#fff;
}

.brand{
  display:flex;
  gap:14px;
  align-items:center;
  min-width:0;
}

.logo{
  width:54px;
  height:54px;
  display:grid;
  place-items:center;
  flex:0 0 auto;
  border:1px solid rgba(245,200,75,.24);
  border-radius:16px;
  background:linear-gradient(145deg, rgba(15,23,42,.84), rgba(2,6,23,.72));
  box-shadow:0 16px 44px rgba(245,200,75,.16), 0 10px 34px rgba(56,189,248,.12);
}

.logo img{
  width:48px;
  height:48px;
  display:block;
}

.brand h1{
  margin:0;
  font-size:20px;
  line-height:1.2;
  letter-spacing:0;
}

.muted{
  color:var(--muted);
  font-size:13px;
  margin:4px 0 0;
}

.icon-btn{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  background:rgba(15,23,42,.74);
  border:1px solid var(--line);
  border-radius:10px;
  color:var(--soft);
  cursor:pointer;
  transition:background .2s,border-color .2s,color .2s;
}

.icon-btn:hover{
  background:#162036;
  border-color:#475569;
  color:#fff;
}

.panel{
  display:grid;
  grid-template-columns:minmax(280px,.92fr) minmax(360px,1.1fr) minmax(280px,.82fr);
  gap:18px;
  align-items:stretch;
}

.summary,.form,.card,.status-card,.spinner{
  border:1px solid rgba(148,163,184,.18);
  background:linear-gradient(180deg, rgba(15,23,42,.94), rgba(15,23,42,.78));
  box-shadow:var(--shadow);
}

.summary{
  min-height:360px;
  padding:24px;
  border-radius:14px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.summary-visual{
  width:100%;
  margin:0;
  aspect-ratio:1.62;
  display:grid;
  place-items:center;
  overflow:hidden;
  border-radius:12px;
  border:1px solid rgba(148,163,184,.16);
  background:radial-gradient(circle at 68% 72%, rgba(245,200,75,.2), transparent 12rem), rgba(2,6,23,.32);
}

.summary-visual svg{
  width:100%;
  height:100%;
  display:block;
}

.eyebrow{
  margin:0 0 18px;
  color:var(--primary);
  font-size:12px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.summary h2{
  margin:0;
  font-size:30px;
  line-height:1.05;
  letter-spacing:0;
}

.summary-copy{
  color:var(--soft);
  line-height:1.6;
  margin:18px 0 0;
  font-size:14px;
}

.metrics-strip{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:26px;
}

.metrics-strip div{
  min-height:72px;
  padding:12px;
  border-radius:10px;
  border:1px solid rgba(148,163,184,.16);
  background:rgba(2,6,23,.38);
}

.metrics-strip span{
  display:block;
  color:var(--muted);
  font-size:12px;
}

.metrics-strip strong{
  display:block;
  margin-top:8px;
  font-size:18px;
}

.form{
  padding:22px;
  border-radius:14px;
}

.form-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}

label{display:block}

label > span{
  display:block;
  color:var(--soft);
  font-size:13px;
  font-weight:650;
  margin-bottom:8px;
}

.input-wrap{position:relative}

input,select{
  width:100%;
  min-height:48px;
  padding:12px 14px;
  padding-right:74px;
  border-radius:10px;
  background:#07111f;
  border:1px solid var(--line);
  color:var(--text);
  font-size:15px;
  outline:none;
  transition:border-color .2s,box-shadow .2s,background .2s;
}

select{
  cursor:pointer;
  appearance:none;
  background-image:linear-gradient(45deg, transparent 50%, var(--muted) 50%),linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:calc(100% - 18px) 21px, calc(100% - 12px) 21px;
  background-size:6px 6px,6px 6px;
  background-repeat:no-repeat;
}

input::placeholder{color:#64748b}

input:focus,select:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 4px rgba(56,189,248,.14);
  background:#081423;
}

.unit{
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  font-size:12px;
  pointer-events:none;
}

.form-actions{margin-top:18px}

.btn{
  width:100%;
  min-height:50px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:12px 18px;
  border-radius:10px;
  border:0;
  cursor:pointer;
  font-weight:750;
  font-size:15px;
  transition:filter .2s,box-shadow .2s,opacity .2s;
}

.btn.primary{
  background:linear-gradient(135deg,var(--primary),var(--positive));
  color:#02111d;
  box-shadow:0 18px 38px rgba(34,197,94,.18);
}

.btn.primary:hover{
  filter:brightness(1.06);
  box-shadow:0 20px 44px rgba(56,189,248,.2);
}

.btn:disabled{
  cursor:not-allowed;
  opacity:.72;
}

.results{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.card{
  min-height:132px;
  padding:18px;
  border-radius:14px;
  display:flex;
  align-items:center;
  transition:border-color .2s,background .2s;
}

.card:hover{
  border-color:rgba(56,189,248,.4);
  background:linear-gradient(180deg, rgba(17,28,51,.96), rgba(15,23,42,.82));
}

.card-title{
  display:flex;
  gap:14px;
  align-items:center;
}

.card-icon{
  width:48px;
  height:48px;
  border-radius:12px;
  background:rgba(56,189,248,.1);
  color:var(--primary);
  display:grid;
  place-items:center;
  flex:0 0 auto;
}

.title{
  color:var(--muted);
  font-size:12px;
  font-weight:750;
  letter-spacing:.04em;
  text-transform:uppercase;
}

.value{
  min-height:34px;
  margin-top:6px;
  font-size:26px;
  line-height:1.15;
  font-weight:800;
  color:#fff;
}

.status-card{
  min-height:72px;
  padding:16px;
  border-radius:14px;
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--soft);
  font-size:14px;
}

.status-dot{
  width:10px;
  height:10px;
  border-radius:999px;
  flex:0 0 auto;
  background:var(--muted);
  box-shadow:0 0 0 4px rgba(148,163,184,.12);
}

.status-card.safe .status-dot{
  background:var(--positive);
  box-shadow:0 0 0 4px rgba(34,197,94,.14);
}

.status-card.watch .status-dot{
  background:var(--warning);
  box-shadow:0 0 0 4px rgba(245,158,11,.14);
}

.status-card.danger .status-dot{
  background:var(--danger);
  box-shadow:0 0 0 4px rgba(239,68,68,.14);
}

.loader{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(2,6,23,.62);
  backdrop-filter:blur(6px);
  opacity:0;
  pointer-events:none;
  transition:opacity .22s;
}

.loader.show{
  opacity:1;
  pointer-events:auto;
}

.spinner{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
  padding:20px;
  border-radius:14px;
}

.spinner svg{
  width:56px;
  height:56px;
  animation:spin 1.1s linear infinite;
}

.loader-text{
  color:var(--soft);
  font-size:13px;
}

.modal{
  position:fixed;
  inset:0;
  display:grid;
  place-items:center;
  padding:20px;
  background:rgba(2,6,23,.66);
  backdrop-filter:blur(8px);
  opacity:0;
  pointer-events:none;
  transition:opacity .2s;
  z-index:20;
}

.modal.show{
  opacity:1;
  pointer-events:auto;
}

.modal-dialog{
  position:relative;
  width:min(420px,100%);
  padding:28px;
  border-radius:14px;
  border:1px solid rgba(148,163,184,.22);
  background:linear-gradient(180deg, rgba(15,23,42,.98), rgba(15,23,42,.9));
  box-shadow:var(--shadow);
}

.modal-dialog h2{
  margin:0;
  font-size:28px;
  line-height:1.1;
}

.modal-role{
  margin:10px 0 0;
  color:var(--soft);
  font-size:16px;
}

.modal-close{
  position:absolute;
  top:14px;
  right:14px;
  width:36px;
  height:36px;
  display:grid;
  place-items:center;
  border:1px solid var(--line);
  border-radius:10px;
  background:#07111f;
  color:var(--soft);
  cursor:pointer;
  transition:background .2s,border-color .2s,color .2s;
}

.modal-close:hover{
  background:#162036;
  border-color:#475569;
  color:#fff;
}

.content-section{
  margin-top:22px;
  padding:26px;
  border:1px solid rgba(148,163,184,.18);
  border-radius:14px;
  background:linear-gradient(180deg, rgba(15,23,42,.82), rgba(15,23,42,.64));
  box-shadow:var(--shadow);
}

.content-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:24px;
}

.content-section h2,.page-hero h1,.page-card h2{
  margin:0;
  letter-spacing:0;
}

.content-section h2{
  font-size:24px;
  line-height:1.15;
}

.content-section p,.page-card p,.page-card li{
  color:var(--soft);
  line-height:1.7;
}

.site-footer{
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:center;
  padding:24px 0 0;
  color:var(--muted);
  font-size:13px;
}

.site-footer nav{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
}

.page-shell{
  width:min(900px,100%);
  margin:0 auto;
  padding:28px;
}

.page-hero{
  margin:34px 0 18px;
}

.page-hero h1{
  font-size:36px;
  line-height:1.08;
}

.page-hero p{
  color:var(--soft);
  line-height:1.7;
  max-width:720px;
}

.page-card{
  padding:24px;
  border:1px solid rgba(148,163,184,.18);
  border-radius:14px;
  background:linear-gradient(180deg, rgba(15,23,42,.9), rgba(15,23,42,.72));
  box-shadow:var(--shadow);
}

.page-card + .page-card{
  margin-top:16px;
}

.page-card h2{
  font-size:22px;
}

.page-card ul{
  margin:14px 0 0;
  padding-left:20px;
}

@keyframes spin{
  to{transform:rotate(360deg)}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    scroll-behavior:auto!important;
    transition-duration:.01ms!important;
  }
}

@media (max-width:980px){
  .panel{
    grid-template-columns:1fr;
  }

  .summary{
    min-height:auto;
  }

  .results{
    display:grid;
    grid-template-columns:1fr 1fr;
  }

  .status-card{
    grid-column:1 / -1;
  }

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

@media (max-width:640px){
  .app{
    padding:18px;
  }

  .header{
    align-items:flex-start;
  }

  .header-actions{
    align-items:flex-end;
    flex-direction:column-reverse;
  }

  .top-nav{
    gap:10px;
    font-size:13px;
  }

  .brand h1{
    font-size:18px;
  }

  .summary h2{
    font-size:25px;
  }

  .form-grid,.results,.metrics-strip{
    grid-template-columns:1fr;
  }

  .status-card{
    grid-column:auto;
  }

  input,select{
    padding-right:64px;
  }

  .site-footer{
    align-items:flex-start;
    flex-direction:column;
  }

  .page-shell{
    padding:18px;
  }

  .page-hero h1{
    font-size:30px;
  }
}
