:root{
  --bg:#070A10;
  --panel:#0B1220;
  --panel2:#0A162B;
  --border:rgba(255,255,255,.08);
  --muted:rgba(255,255,255,.62);
  --text:rgba(255,255,255,.92);
  --accent:#7C3AED;
  --accent2:#22C55E;
  --warn:#F59E0B;
  --danger:#EF4444;
  --shadow:0 10px 30px rgba(0,0,0,.45);
  --transition:.18s ease;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family:ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 800px at 10% 10%, rgba(124,58,237,.20), transparent 60%),
    radial-gradient(1000px 700px at 90% 0%, rgba(34,197,94,.12), transparent 55%),
    var(--bg);
  background-attachment: scroll;
  color:var(--text);
}

body.drawer-open{
  overflow:hidden;
}

a{
  color:inherit;
  text-decoration:none;
}

small{
  color:var(--muted);
}

.container{
  max-width:1100px;
  margin:0 auto;
  padding:22px;
}

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

.brand{
  display:flex;
  gap:10px;
  align-items:center;
  cursor:pointer;
  transition:var(--transition);
}

.brand:hover{
  opacity:.95;
}

.logo{
  width:34px;
  height:34px;
  border-radius:12px;
  box-shadow:var(--shadow);
  object-fit:cover;
}

.hgroup h1{
  font-size:18px;
  margin:0;
}

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

.nav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.pill{
  padding:8px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--border);
  transition:var(--transition);
  font-size:13px;
  cursor:pointer;
  user-select:none;
}

.pill:hover{
  transform:translateY(-1px);
  background:rgba(255,255,255,.07);
}

.pill.active{
  border-color:rgba(124,58,237,.55);
  background:rgba(124,58,237,.15);
}

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

@media(min-width:960px){
  .grid.two{grid-template-columns:1.1fr .9fr}
  .grid.three{grid-template-columns:1fr 1fr 1fr}
}

.card{
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow:var(--shadow);
  min-width:0;
}

.card .card-h{
  padding:14px 14px 10px;
  border-bottom:1px solid rgba(255,255,255,.06);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.card .card-h h2{
  font-size:14px;
  margin:0;
}

.card .card-b{
  padding:14px;
  min-width:0;
}

.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.col{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.spacer{
  flex:1;
}

.input,
.textarea,
.select{
  width:100%;
  background:rgba(10,18,32,.65);
  border:1px solid rgba(255,255,255,.10);
  color:var(--text);
  border-radius:12px;
  padding:10px 12px;
  outline:none;
  transition:var(--transition);
}

.input::placeholder,
.textarea::placeholder{
  color:rgba(255,255,255,.38);
}

.textarea{
  min-height:110px;
  resize:vertical;
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
  line-height:1.45;
}

.input:focus,
.textarea:focus,
.select:focus{
  border-color:rgba(124,58,237,.6);
  box-shadow:0 0 0 4px rgba(124,58,237,.12);
}

.btn{
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.06);
  color:var(--text);
  border-radius:14px;
  padding:10px 14px;
  cursor:pointer;
  transition:var(--transition);
  display:inline-flex;
  gap:8px;
  align-items:center;
  justify-content:center;
  font-size:13px;
  line-height:1.2;
  min-height:40px;
}

.btn:hover{
  transform:translateY(-1px);
  background:rgba(255,255,255,.09);
}

.btn:focus{
  outline:none;
  box-shadow:0 0 0 3px rgba(124,58,237,.25);
}

.btn.primary{
  background:rgba(124,58,237,.25);
  border-color:rgba(124,58,237,.55);
}

.btn.good{
  background:rgba(34,197,94,.20);
  border-color:rgba(34,197,94,.45);
}

.btn.danger{
  background:rgba(239,68,68,.20);
  border-color:rgba(239,68,68,.45);
}

.btn:disabled{
  opacity:.5;
  cursor:not-allowed;
  transform:none;
}

.badge{
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.05);
  display:inline-flex;
  align-items:center;
  gap:6px;
}

.badge.green{
  border-color:rgba(34,197,94,.5);
  background:rgba(34,197,94,.15);
}

.badge.violet{
  border-color:rgba(124,58,237,.55);
  background:rgba(124,58,237,.18);
}

.badge.amber{
  border-color:rgba(245,158,11,.55);
  background:rgba(245,158,11,.15);
}

.badge.red{
  border-color:rgba(239,68,68,.55);
  background:rgba(239,68,68,.18);
}

.table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}

.table th,
.table td{
  padding:10px 8px;
  border-bottom:1px solid rgba(255,255,255,.06);
  text-align:left;
  vertical-align:top;
}

.table tbody tr:hover{
  background:rgba(255,255,255,.03);
}

.table tr.selected-row{
  background:rgba(124,58,237,.09);
}

.table th{
  color:var(--muted);
  font-weight:600;
  font-size:12px;
}

.mono{
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
  word-break:break-all;
}

.kv{
  display:grid;
  gap:10px;
  grid-template-columns:160px minmax(0,1fr);
}

.kv div:nth-child(odd){
  color:var(--muted);
  font-size:12px;
}

.kv.deploy-kv{
  grid-template-columns:160px minmax(0,1fr);
}

.hr{
  height:1px;
  background:rgba(255,255,255,.06);
  margin:10px 0;
}

.toast{
  margin-top:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(10,18,32,.7);
  font-size:13px;
  color:var(--muted);
}

.toast.ok{border-color:rgba(34,197,94,.5)}
.toast.err{border-color:rgba(239,68,68,.5)}
.toast.warn{border-color:rgba(245,158,11,.5)}

.toggle-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:8px 2px;
  font-size:13px;
}

.switch{
  position:relative;
  display:inline-block;
  width:46px;
  height:24px;
  flex:0 0 auto;
}

.switch input{
  opacity:0;
  width:0;
  height:0;
}

.slider{
  position:absolute;
  cursor:pointer;
  inset:0;
  background-color:rgba(255,255,255,.15);
  transition:.25s;
  border-radius:34px;
}

.slider:before{
  position:absolute;
  content:"";
  height:18px;
  width:18px;
  left:3px;
  bottom:3px;
  background:white;
  transition:.25s;
  border-radius:50%;
}

.switch input:checked + .slider{
  background-color:var(--accent2);
}

.switch input:checked + .slider:before{
  transform:translateX(22px);
}

.codebox{
  width:100%;
  background:rgba(10,18,32,.72);
  border:1px solid rgba(255,255,255,.10);
  color:var(--text);
  border-radius:14px;
  padding:12px;
  outline:none;
  transition:var(--transition);
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
  line-height:1.5;
  tab-size:2;
  resize:none;
  overflow:auto;
  scrollbar-width:thin;
  white-space:pre;
  min-height:96px;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.04);
}

.codebox:hover{
  border-color:rgba(255,255,255,.16);
}

.codebox:focus{
  border-color:rgba(124,58,237,.6);
  box-shadow:0 0 0 4px rgba(124,58,237,.12), inset 0 0 0 1px rgba(255,255,255,.04);
}

.codebox::selection{
  background:rgba(124,58,237,.28);
}

/* =========================
   Deployment summary
   ========================= */

.deploy-summary{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.deploy-row{
  display:grid;
  grid-template-columns:160px minmax(0,1fr);
  align-items:start;
  gap:12px;
}

.deploy-label{
  color:var(--muted);
  font-size:12px;
  padding-top:10px;
}

.deploy-value{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  min-width:0;
}

.deploy-value > span,
.deploy-value > div,
.deploy-value .copy-value{
  min-width:0;
  overflow-wrap:anywhere;
}

.deploy-value button{
  min-width:96px;
  white-space:nowrap;
  word-break:normal;
  overflow-wrap:normal;
  flex-shrink:0;
}

.copy-inline{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  width:100%;
}

.copy-inline .mono,
.copy-inline .copy-value{
  flex:1;
  min-width:0;
}

.copy-btn{
  min-width:96px;
  white-space:nowrap;
  flex-shrink:0;
}

/* =========================
   Shared drawers
   ========================= */

.drawer-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.46);
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease;
  z-index:70;
}

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

.drawer{
  position:fixed;
  top:0;
  right:0;
  height:100vh;
  width:min(760px, 96vw);
  transform:translateX(104%);
  transition:transform .22s ease;
  z-index:80;
  pointer-events:none;
}

.drawer-wide{
  width:min(920px, 98vw);
}

.drawer.open{
  transform:translateX(0);
  pointer-events:auto;
}

.drawer-shell{
  height:100%;
  display:flex;
  flex-direction:column;
  background:linear-gradient(180deg, rgba(8,14,24,.98), rgba(8,14,24,.96));
  border-left:1px solid rgba(255,255,255,.08);
  box-shadow:-20px 0 40px rgba(0,0,0,.35);
  backdrop-filter:blur(8px);
}

.drawer-header{
  position:sticky;
  top:0;
  z-index:3;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:18px 18px 14px;
  border-bottom:1px solid rgba(255,255,255,.07);
  background:rgba(8,14,24,.92);
  backdrop-filter:blur(12px);
}

.drawer-body{
  padding:18px;
  overflow:auto;
  min-width:0;
}

.drawer-eyebrow{
  color:var(--muted);
  font-size:12px;
  margin-bottom:4px;
}

.drawer-title{
  margin:0;
  font-size:24px;
  line-height:1.1;
}

.drawer-subtitle{
  margin-top:6px;
  color:var(--muted);
}

.drawer-hero{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  padding:16px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  background:linear-gradient(180deg, rgba(124,58,237,.10), rgba(255,255,255,.03));
  box-shadow:var(--shadow);
}

.hero-main{
  min-width:0;
}

.hero-name{
  font-size:18px;
  font-weight:700;
  margin-bottom:6px;
}

.hero-meta{
  color:var(--muted);
}

.hero-side{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.drawer-tabs{
  margin-top:16px;
}

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

@media(min-width:720px){
  .form-grid-2{
    grid-template-columns:1fr 1fr;
  }
}

/* =========================
   Tenant deployment drawer
   ========================= */

.deploy-grid{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.deploy-item{
  display:grid;
  grid-template-columns:180px minmax(0,1fr);
  gap:14px;
  align-items:start;
}

.deploy-item-label{
  color:var(--muted);
  font-size:12px;
  padding-top:10px;
}

.deploy-item-value{
  min-width:0;
}

.wrap-row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.wrap-row > span{
  min-width:0;
  overflow-wrap:anywhere;
}

.deploy-code{
  min-height:150px;
  max-height:420px;
}

.guide-list{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.deploy-help{
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
}

/* =========================
   Generic modal / dialog
   ========================= */

.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.54);
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease;
  z-index:90;
}

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

.modal{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease;
  z-index:100;
}

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

.modal-panel{
  width:min(760px, 100%);
  max-height:calc(100vh - 48px);
  overflow:hidden;
  background:linear-gradient(180deg, rgba(11,18,32,.98), rgba(10,22,43,.96));
  border:1px solid rgba(255,255,255,.08);
  border-radius:20px;
  box-shadow:0 20px 60px rgba(0,0,0,.45);
  display:flex;
  flex-direction:column;
}

.modal-header{
  padding:18px 18px 14px;
  border-bottom:1px solid rgba(255,255,255,.07);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.modal-title{
  margin:0;
  font-size:20px;
  line-height:1.15;
}

.modal-subtitle{
  margin-top:6px;
  color:var(--muted);
  font-size:13px;
}

.modal-body{
  padding:18px;
  overflow:auto;
}

.modal-footer{
  padding:14px 18px 18px;
  border-top:1px solid rgba(255,255,255,.07);
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

/* =========================
   EULA / agreement helpers
   ========================= */

.agreement-box{
  min-height:260px;
  max-height:340px;
  white-space:pre-wrap;
  overflow:auto;
}

.agreement-note{
  font-size:13px;
  color:rgba(255,255,255,.78);
  line-height:1.5;
}

.agreement-check{
  display:flex;
  gap:10px;
  align-items:flex-start;
  line-height:1.45;
  font-size:13px;
}

.agreement-check input[type="checkbox"]{
  margin-top:3px;
  flex:0 0 auto;
}

.muted-text{
  color:var(--muted);
}

.hidden{
  display:none !important;
}

/* =========================
   Responsive
   ========================= */

@media(max-width:860px){
  .deploy-row,
  .deploy-item,
  .kv,
  .kv.deploy-kv{
    grid-template-columns:1fr;
  }

  .deploy-label,
  .deploy-item-label{
    padding-top:0;
  }

  .deploy-value{
    align-items:flex-start;
    flex-direction:column;
  }

  .drawer{
    width:100vw;
  }

  .drawer-wide{
    width:100vw;
  }

  .container{
    padding:16px;
  }
}

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

  .row{
    align-items:stretch;
  }

  .btn{
    width:100%;
  }

  .wrap-row{
    flex-direction:column;
    align-items:flex-start;
  }

  .modal{
    padding:12px;
  }

  .modal-panel{
    max-height:calc(100vh - 24px);
  }
}