:root{
  --bg:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --card:rgba(255,255,255,.96);
  --line:rgba(15,23,42,.08);

  --acc1:#2563eb;
  --acc2:#22c55e;

  --danger:#dc2626;
  --ok:#16a34a;
}

*{box-sizing:border-box;}

html,body{
  margin:0;
  padding:0;
}

body{
  min-height:100svh;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Ubuntu,Arial,sans-serif;
  font-size:13px;
  line-height:1.3;
  color:var(--text);
  background:
    radial-gradient(900px 600px at 25% 20%, rgba(37,99,235,.10), transparent 60%),
    radial-gradient(900px 600px at 80% 30%, rgba(34,197,94,.10), transparent 60%),
    var(--bg);
}

/* LOGIN */

.auth-shell{
  min-height:100svh;
  display:grid;
  place-items:center;
  padding:14px;
}

.auth-wrap{
  width:100%;
  max-width:360px;
}

.auth-card{
  position:relative;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  padding:16px;
  box-shadow:
    0 8px 24px rgba(2,6,23,.07),
    0 1px 4px rgba(2,6,23,.03);
  backdrop-filter:blur(8px);
  overflow:hidden;
}

.auth-card::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  width:100%;
  height:3px;
  background:linear-gradient(90deg,var(--acc1),var(--acc2));
  opacity:.9;
}

.brand{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:10px;
}

.brand-mark{
  width:30px;
  height:30px;
  border-radius:9px;
  border:1px solid rgba(15,23,42,.08);
  background:linear-gradient(135deg, rgba(37,99,235,.10), rgba(34,197,94,.10));
  display:grid;
  place-items:center;
  font-size:10px;
  font-weight:800;
  letter-spacing:.08em;
}

.brand-copy h1{
  margin:0;
  font-size:15px;
  font-weight:800;
  letter-spacing:-.02em;
}

.brand-copy p{
  margin:1px 0 0;
  color:var(--muted);
  font-size:10px;
}

.auth-foot{
  margin-top:8px;
  text-align:center;
  font-size:10px;
  color:var(--muted);
}

/* TOPBAR */

.topbar{
  position:sticky;
  top:0;
  z-index:20;
  height:42px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 12px;
  border-bottom:1px solid var(--line);
  background:rgba(255,255,255,.9);
  backdrop-filter:blur(8px);
}

.topbar-left{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.topbar-logo{
  font-size:11px;
  font-weight:800;
  letter-spacing:.08em;
  white-space:nowrap;
}

.topbar-sub{
  font-size:10px;
  color:var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
}

.user-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  height:24px;
  padding:0 8px;
  border:1px solid var(--line);
  border-radius:999px;
  background:rgba(255,255,255,.75);
  font-size:10px;
  min-width:0;
}

/* LAYOUT */

.shell{
  display:grid;
  grid-template-columns:180px minmax(0,1fr);
  min-height:calc(100svh - 42px);
}

.sidebar{
  border-right:1px solid var(--line);
  padding:8px;
  min-width:0;
}

.nav{
  display:grid;
  gap:3px;
}

.nav a{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  text-decoration:none;
  color:var(--text);
  border:1px solid transparent;
  border-radius:9px;
  padding:7px 9px;
  font-size:10px;
  font-weight:700;
  line-height:1.15;
  min-width:0;
}

.nav a:hover{
  background:rgba(15,23,42,.04);
}

.nav a.active{
  color:#fff;
  background:linear-gradient(90deg,var(--acc1),var(--acc2));
}

.content{
  padding:10px;
  max-width:1380px;
  width:100%;
  min-width:0;
}

/* PAGE */

.page-head{
  margin-bottom:8px;
}

.page-head h2{
  margin:0 0 1px;
  font-size:15px;
  letter-spacing:-.02em;
}

.page-head p{
  margin:0;
  color:var(--muted);
  font-size:10px;
}

/* GRID */

.grid{
  display:grid;
  gap:8px;
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
}

.section{
  margin-top:8px;
}

/* CARD / PANEL */

.card,
.panel{
  position:relative;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:12px;
  padding:9px;
  box-shadow:
    0 5px 14px rgba(2,6,23,.04),
    0 1px 3px rgba(2,6,23,.02);
  backdrop-filter:blur(6px);
  overflow:hidden;
  min-width:0;
}

.card::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  width:100%;
  height:2px;
  background:linear-gradient(90deg,var(--acc1),var(--acc2));
  opacity:.85;
}

.card-title{
  font-size:9px;
  font-weight:800;
  color:#334155;
  margin-bottom:4px;
  text-transform:uppercase;
  letter-spacing:.05em;
}

.card-value{
  font-size:18px;
  font-weight:800;
  letter-spacing:-.03em;
  line-height:1;
}

.card-sub{
  margin-top:3px;
  font-size:9px;
  color:var(--muted);
}

.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:6px;
  min-width:0;
}

.panel-title{
  font-size:11px;
  font-weight:800;
  min-width:0;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:4px;
  border-radius:999px;
  padding:3px 7px;
  font-size:9px;
  font-weight:700;
  border:1px solid rgba(22,163,74,.15);
  background:rgba(22,163,74,.07);
  color:#166534;
  white-space:nowrap;
  flex-shrink:0;
}

.panel.compact{
  padding:8px;
}

/* FORM */

.form-grid{
  display:grid;
  gap:6px;
}

.field{
  display:grid;
  gap:3px;
  min-width:0;
}

.label{
  font-size:10px;
  font-weight:700;
  color:#334155;
}

.input{
  width:100%;
  min-height:28px;
  padding:5px 8px;
  border:1px solid rgba(15,23,42,.12);
  border-radius:8px;
  outline:none;
  background:#fff;
  color:var(--text);
  font-size:10px;
  transition:border-color .15s ease, box-shadow .15s ease;
  min-width:0;
}

.input:focus{
  border-color:rgba(37,99,235,.45);
  box-shadow:0 0 0 2px rgba(37,99,235,.08);
}

select.input{
  appearance:none;
}

.btn{
  appearance:none;
  border:0;
  width:100%;
  min-height:28px;
  border-radius:8px;
  cursor:pointer;
  font-size:10px;
  font-weight:700;
  letter-spacing:.01em;
  color:#fff;
  background:linear-gradient(90deg,var(--acc1),var(--acc2));
  box-shadow:0 5px 12px rgba(37,99,235,.12);
}

.btn:hover{
  filter:brightness(.98);
}

.form-row{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
}

.form-row-3{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:6px;
}

.form-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  align-items:center;
}

.form-actions .btn{
  width:auto;
  min-width:90px;
  padding:0 12px;
}

/* ALERTS */

.alert{
  border-radius:8px;
  padding:7px 8px;
  font-size:10px;
  border:1px solid transparent;
  margin-bottom:8px;
}

.alert-error{
  background:rgba(220,38,38,.06);
  color:#991b1b;
  border-color:rgba(220,38,38,.14);
}

.alert-success{
  background:rgba(22,163,74,.07);
  color:#166534;
  border-color:rgba(22,163,74,.16);
}

/* BUTTON-LINKS */

.logout-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  color:var(--text);
  font-size:10px;
  font-weight:700;
  border:1px solid var(--line);
  border-radius:8px;
  padding:5px 8px;
  background:#fff;
  cursor:pointer;
  line-height:1.1;
  white-space:nowrap;
}

.logout-link:hover{
  background:rgba(15,23,42,.03);
}

/* TABLE */

.table-wrap{
  overflow-x:auto;
  max-width:100%;
  min-width:0;
}

.table{
  width:100%;
  border-collapse:collapse;
  font-size:10px;
  table-layout:auto;
}

.table th,
.table td{
  text-align:left;
  padding:5px 5px;
  vertical-align:top;
  min-width:0;
}

.table th{
  color:var(--muted);
  font-size:9px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
  border-bottom:1px solid var(--line);
  white-space:nowrap;
}

.table td{
  border-bottom:1px solid rgba(15,23,42,.06);
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:break-word;
  line-height:1.25;
}

.table td[colspan]{
  color:var(--muted);
}

.table form{
  margin:0;
}

.table .input{
  min-height:26px;
  padding:4px 7px;
  font-size:10px;
}

/* TOOL AREA */

.tools-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:8px;
  align-items:start;
  min-width:0;
}

/* QUICK LINKS */

.quick-links{
  display:grid;
  gap:6px;
}

.quick-link{
  display:block;
  text-decoration:none;
  color:var(--text);
  font-size:10px;
  font-weight:600;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:8px;
  background:rgba(255,255,255,.72);
  transition:all .15s ease;
}

.quick-link:hover{
  background:rgba(15,23,42,.04);
  border-color:rgba(37,99,235,.18);
}

.dot{
  display:inline-block;
  width:6px;
  height:6px;
  border-radius:50%;
  background:#16a34a;
}

/* SPECIAL CONTENT */

input[type="range"].input{
  padding:0;
  min-height:auto;
  height:22px;
  border:0;
  background:transparent;
  box-shadow:none;
}

pre{
  margin:0;
  white-space:pre-wrap;
  word-break:break-word;
  overflow-wrap:anywhere;
  font:inherit;
  max-width:100%;
  line-height:1.25;
}

.dns-grid-table th{
  width:145px;
}

.dns-value{
  white-space:pre-wrap;
  word-break:break-word;
  overflow-wrap:anywhere;
  max-width:100%;
}

.code-soft{
  display:block;
  white-space:pre-wrap;
  word-break:break-word;
  overflow-wrap:anywhere;
  font:inherit;
  max-width:100%;
  line-height:1.25;
}

/* MOBILE / RESPONSIVE */

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

@media (max-width:980px){
  .form-row,
  .form-row-3{
    grid-template-columns:1fr;
  }
}

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

  .sidebar{
    border-right:0;
    border-bottom:1px solid var(--line);
  }

  .nav{
    grid-template-columns:repeat(auto-fit,minmax(110px,1fr));
  }
}

@media (max-width:640px){
  .topbar-sub{
    display:none;
  }

  .content{
    padding:8px;
  }

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

  .auth-card{
    padding:14px;
    border-radius:14px;
  }

  .dns-grid-table th{
    width:auto;
  }
}

.status-dot{
  display:inline-block;
  width:7px;
  height:7px;
  border-radius:50%;
  margin-right:4px;
  vertical-align:middle;
}

.status-dot.ok{
  background:#16a34a;
}

.status-dot.warn{
  background:#f59e0b;
}

.status-dot.missing{
  background:#dc2626;
}