/* ==========================================================================
   Matix — Dark Neon Dashboard theme
   Fonts: Vazirmatn (Persian) + Sora (Latin) + JetBrains Mono (IPs/code)
   ========================================================================== */
:root{
  --bg:#08070f;
  --bg-app:#0b0a14;
  --bg-panel:#100e1b;
  --bg-panel-2:#141225;
  --bg-sunken:#0c0a16;
  --bg-hover:rgba(139,92,246,.10);
  --border:rgba(167,139,250,.12);
  --border-strong:rgba(167,139,250,.26);
  --text:#f4f2fb;
  --text-secondary:#a9a3c4;
  --text-tertiary:#6f6989;
  --accent:#8b5cf6;
  --accent-dark:#6d3be0;
  --accent-bright:#c084fc;
  --accent-soft:rgba(139,92,246,.16);
  --glow:rgba(139,92,246,.45);
  --on-accent:#ffffff;
  --success:#34d399;
  --success-soft:rgba(52,211,153,.14);
  --danger:#f87171;
  --danger-soft:rgba(248,113,113,.14);
  --warn:#fbbf24;
  --persistent:#ffd700;
  --radius-sm:10px;
  --radius-md:14px;
  --radius-lg:20px;
  --radius-xl:26px;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow-md:0 18px 50px rgba(0,0,0,.55);
  --font-ui:'Sora','Vazirmatn',system-ui,sans-serif;
  --font-body:'Vazirmatn','Sora',system-ui,sans-serif;
  --font-mono:'JetBrains Mono','Sora',ui-monospace,monospace;
  --header-h:64px;
  --sidebar-w:264px;
}

*,*::before,*::after{ box-sizing:border-box; }
[hidden]{ display:none !important; }

html,body{
  margin:0; padding:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  min-height:100%;
}
body{
  overflow-x:hidden;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(124,58,237,.22), transparent 60%),
    radial-gradient(700px 480px at -5% 105%, rgba(168,85,247,.14), transparent 60%),
    var(--bg);
  background-attachment:fixed;
}
h1,h2,h3{ font-family:var(--font-body); margin:0; }
a{ color:inherit; }
button,select,textarea,input{ font-family:inherit; }
::selection{ background:var(--accent); color:#fff; }
:focus-visible{ outline:2px solid var(--accent-bright); outline-offset:2px; }

/* scrollbar */
*{ scrollbar-width:thin; scrollbar-color:rgba(139,92,246,.4) transparent; }
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-thumb{ background:rgba(139,92,246,.35); border-radius:8px; }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.001ms !important; transition-duration:.001ms !important; }
}

/* ==========================================================================
   Loading screen
   ========================================================================== */
.loading-screen{
  position:fixed; inset:0; z-index:200;
  background:
    radial-gradient(600px 400px at 50% 38%, rgba(124,58,237,.30), transparent 70%),
    var(--bg);
  display:flex; align-items:center; justify-content:center;
  transition:opacity .6s ease;
  overflow:hidden;
}
.loading-screen::before{
  content:''; position:absolute; inset:0;
  background-image:
    linear-gradient(rgba(167,139,250,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167,139,250,.05) 1px, transparent 1px);
  background-size:44px 44px;
  mask-image:radial-gradient(circle at 50% 50%, #000 0%, transparent 70%);
  -webkit-mask-image:radial-gradient(circle at 50% 50%, #000 0%, transparent 70%);
}
.loading-screen.is-hidden{ opacity:0; pointer-events:none; }
.loading-inner{ position:relative; display:flex; flex-direction:column; align-items:center; gap:26px; padding:20px; }
.loading-bismillah{
  margin:0; font-family:var(--font-body); font-size:26px; font-weight:800; line-height:1.4;
  background:linear-gradient(180deg,#fff 0%, #d8c8ff 55%, #a78bfa 100%);
  -webkit-background-clip:text; background-clip:text; color:transparent;
  filter:drop-shadow(0 0 14px rgba(139,92,246,.7));
  opacity:0; animation:fade-in-up .8s ease forwards;
}
.loading-logo-wrap{
  position:relative; width:112px; height:112px;
  display:flex; align-items:center; justify-content:center;
  opacity:0; transform:scale(.8);
  animation:logo-in .8s cubic-bezier(.2,.9,.25,1) .15s forwards;
}
.loading-glow{
  position:absolute; inset:-30px; border-radius:50%;
  background:radial-gradient(circle, rgba(168,85,247,.65), rgba(124,58,237,0) 68%);
  animation:glow-pulse 2s ease-in-out infinite;
}
.loading-logo-wrap::before{
  content:''; position:absolute; inset:-10px; border-radius:50%;
  background:conic-gradient(from 0deg, transparent 0 55%, var(--accent-bright) 85%, transparent 100%);
  -webkit-mask:radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
          mask:radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation:spin 1.4s linear infinite;
}
.loading-logo{
  position:relative; display:block; width:100%; height:100%;
  border-radius:50%; object-fit:cover;
  box-shadow:0 0 0 2px rgba(192,132,252,.5), 0 0 40px rgba(139,92,246,.6);
}
.loading-word{ width:230px; height:auto; opacity:0; animation:fade-in-up .5s ease .35s forwards; }
#matix-clip-rect{ animation:matix-reveal 1.1s cubic-bezier(.16,.84,.44,1) .5s forwards; }
@keyframes matix-reveal{ from{ y:78px; height:0px; } to{ y:0px; height:78px; } }
.loading-bar{
  width:150px; height:4px; border-radius:4px;
  background:rgba(167,139,250,.14); overflow:hidden;
  opacity:0; animation:fade-in-up .5s ease .4s forwards;
}
.loading-bar-fill{
  display:block; height:100%; width:40%; border-radius:4px;
  background:linear-gradient(90deg, var(--accent), var(--accent-bright));
  box-shadow:0 0 12px var(--glow);
  animation:loading-sweep 1.1s ease-in-out infinite;
}
@keyframes spin{ to{ transform:rotate(360deg); } }
@keyframes glow-pulse{ 0%,100%{ opacity:.55; transform:scale(1); } 50%{ opacity:1; transform:scale(1.1); } }
@keyframes fade-in-up{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:translateY(0); } }
@keyframes logo-in{ from{ opacity:0; transform:scale(.8); } to{ opacity:1; transform:scale(1); } }
@keyframes loading-sweep{ 0%{ transform:translateX(-120%); } 100%{ transform:translateX(380%); } }

/* ==========================================================================
   App shell + header
   ========================================================================== */
.app{ min-height:100vh; display:flex; flex-direction:column; }
.topbar{
  direction:ltr; position:sticky; top:0; z-index:40;
  height:var(--header-h); display:flex; align-items:center; justify-content:space-between;
  padding:0 20px; background:rgba(11,10,20,.78);
  backdrop-filter:saturate(160%) blur(14px); -webkit-backdrop-filter:saturate(160%) blur(14px);
  border-bottom:1px solid var(--border);
}
.brand{ display:flex; align-items:center; gap:10px; }
.brand-mark{
  display:block; width:36px; height:36px; border-radius:50%; object-fit:cover;
  box-shadow:0 0 0 1.5px rgba(192,132,252,.5), 0 0 18px rgba(139,92,246,.5);
}
.brand-name{ font-family:var(--font-ui); font-weight:800; font-size:20px; letter-spacing:-.01em; color:var(--text); }
.hamburger{
  width:42px; height:42px; border-radius:12px;
  border:1px solid var(--border-strong); background:var(--bg-panel);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  cursor:pointer; transition:border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.hamburger:hover{ border-color:var(--accent); background:var(--bg-panel-2); box-shadow:0 0 16px rgba(139,92,246,.35); }
.hamburger span{ display:block; width:17px; height:2px; border-radius:2px; background:var(--text); transition:transform .25s ease, opacity .2s ease; }
.hamburger[aria-expanded="true"] span:nth-child(1){ transform:translateY(6px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2){ opacity:0; }
.hamburger[aria-expanded="true"] span:nth-child(3){ transform:translateY(-6px) rotate(-45deg); }

/* ==========================================================================
   Drawer / Sidebar
   ========================================================================== */
.drawer-overlay{
  position:fixed; inset:0; background:rgba(3,2,10,.65); backdrop-filter:blur(3px);
  opacity:0; pointer-events:none; transition:opacity .25s ease; z-index:49;
}
.drawer-overlay.is-visible{ opacity:1; pointer-events:auto; }
.drawer{
  position:fixed; top:0; right:0; height:100%; width:290px; max-width:84vw;
  background:linear-gradient(180deg,#0d0b18,#090811);
  border-left:1px solid var(--border);
  box-shadow:var(--shadow-md); z-index:50;
  transform:translateX(100%); transition:transform .3s cubic-bezier(.2,.9,.25,1);
  display:flex; flex-direction:column; padding:20px 16px;
}
.drawer.is-open{ transform:translateX(0); }
.drawer-head{
  direction:ltr; display:flex; align-items:center; gap:11px;
  padding:6px 8px 18px; margin-bottom:12px; border-bottom:1px solid var(--border);
}
.drawer-head img{
  width:38px; height:38px; border-radius:50%; object-fit:cover;
  box-shadow:0 0 0 1.5px rgba(192,132,252,.5), 0 0 16px rgba(139,92,246,.5);
}
.drawer-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; }
.drawer-link{
  width:100%; display:flex; align-items:center; gap:12px;
  padding:13px 14px; border-radius:14px;
  border:1px solid transparent; background:none; color:var(--text-secondary);
  font-family:var(--font-ui); font-size:14px; font-weight:600; cursor:pointer; text-align:right;
  direction:ltr; justify-content:flex-start;
  transition:background .18s ease, color .18s ease, box-shadow .18s ease;
}
.drawer-link:hover{ background:var(--bg-hover); color:var(--text); }
.drawer-link.is-active{
  color:#fff;
  background:linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow:0 8px 24px rgba(124,58,237,.45), inset 0 0 0 1px rgba(255,255,255,.14);
}
.drawer-icon{ flex-shrink:0; }
.drawer-foot{
  margin-top:auto; padding:18px 16px; border-radius:18px; text-align:center;
  font-family:var(--font-ui); font-size:12.5px; font-weight:700; color:#fff;
  background:linear-gradient(135deg, rgba(124,58,237,.55), rgba(236,121,170,.35));
  border:1px solid rgba(255,255,255,.12);
}

/* ==========================================================================
   Content
   ========================================================================== */
.content{ flex:1; width:100%; max-width:1040px; margin:0 auto; padding:34px 20px 60px; }
.page{ display:none; }
.page.is-active{ display:block; animation:page-in .35s ease; }
@keyframes page-in{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:translateY(0); } }
.page-head{ margin-bottom:24px; }
.page-head h1{ font-family:var(--font-ui); font-size:28px; font-weight:800; letter-spacing:-.02em; margin-bottom:8px; }
.page-head p{ margin:0; color:var(--text-secondary); font-size:15px; line-height:1.8; }

.panel{
  background:linear-gradient(160deg, rgba(20,18,37,.92), rgba(14,12,26,.92));
  border:1px solid var(--border);
  border-radius:var(--radius-xl); box-shadow:var(--shadow-sm); padding:22px;
}

/* Stat cards (like the reference dashboard) */
.stat-grid{ direction:ltr; display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
.stat-card{
  position:relative; overflow:hidden; border-radius:var(--radius-lg); padding:16px 18px;
  border:1px solid var(--border);
  background:linear-gradient(145deg, rgba(55,28,120,.55), rgba(18,14,36,.9));
  direction:ltr; text-align:left;
}
.stat-card:nth-child(2){ background:linear-gradient(145deg, rgba(120,30,90,.5), rgba(18,14,36,.9)); }
.stat-card:nth-child(3){ background:linear-gradient(145deg, rgba(40,35,120,.55), rgba(18,14,36,.9)); }
.stat-card:nth-child(4){ background:linear-gradient(145deg, rgba(130,35,60,.5), rgba(18,14,36,.9)); }
.stat-label{ display:flex; align-items:center; gap:8px; font-size:12.5px; font-weight:600; color:var(--text-secondary); font-family:var(--font-ui); }
.stat-label svg{ opacity:.9; }
.stat-value{ margin-top:12px; font-family:var(--font-ui); font-size:30px; font-weight:800; letter-spacing:-.02em; }
.stat-sub{ margin-top:4px; font-size:11.5px; color:var(--text-tertiary); font-family:var(--font-ui); }

/* last update badge */
.last-update-badge{
  display:inline-flex; align-items:center; gap:10px; margin-bottom:18px;
  padding:9px 16px; border-radius:99px; font-size:13px; color:var(--text-secondary);
  background:var(--success-soft); border:1px solid rgba(52,211,153,.28);
}
.last-update-badge strong{ color:var(--text); }
.last-update-badge .dot{
  width:8px; height:8px; border-radius:50%; background:var(--success);
  box-shadow:0 0 0 0 rgba(52,211,153,.6); animation:ping 1.8s ease-out infinite;
}
.last-update-badge.is-old{ background:rgba(251,191,36,.12); border-color:rgba(251,191,36,.3); }
.last-update-badge.is-old .dot{ background:var(--warn); box-shadow:0 0 0 0 rgba(251,191,36,.6); }
.last-update-badge.is-stale{ background:var(--danger-soft); border-color:rgba(248,113,113,.3); }
.last-update-badge.is-stale .dot{ background:var(--danger); box-shadow:0 0 0 0 rgba(248,113,113,.6); }
@keyframes ping{ 0%{ box-shadow:0 0 0 0 currentColor; opacity:1; } 70%{ box-shadow:0 0 0 8px rgba(0,0,0,0); } 100%{ box-shadow:0 0 0 0 rgba(0,0,0,0); } }

/* Scan controls */
.scan-controls{ display:flex; align-items:flex-end; gap:14px; flex-wrap:wrap; margin-bottom:20px; }
.field{ display:flex; flex-direction:column; gap:7px; }
.field label{ font-size:12.5px; font-weight:600; color:var(--text-secondary); }
.field select{
  appearance:none; -webkit-appearance:none;
  height:44px; padding:0 14px 0 36px; border-radius:var(--radius-sm);
  border:1px solid var(--border-strong);
  background:var(--bg-sunken) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a9a3c4' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat left 12px center;
  font-family:var(--font-ui); font-size:14.5px; font-weight:600; color:var(--text); min-width:130px; cursor:pointer;
}
.field select:hover,.field select:focus{ border-color:var(--accent); }
.field select option{ background:#120f20; color:var(--text); }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  height:44px; padding:0 20px; border-radius:var(--radius-sm);
  border:1px solid transparent; font-size:14.5px; font-weight:700; font-family:var(--font-ui);
  cursor:pointer; transition:filter .15s ease, background .15s ease, border-color .15s ease, box-shadow .2s ease, transform .1s ease;
  white-space:nowrap; color:var(--text);
}
.btn:active{ transform:translateY(1px); }
.btn-primary{
  background:linear-gradient(135deg, #7c3aed, #a855f7); color:#fff;
  box-shadow:0 8px 24px rgba(124,58,237,.5), inset 0 0 0 1px rgba(255,255,255,.14);
}
.btn-primary:hover{ filter:brightness(1.1); box-shadow:0 10px 30px rgba(139,92,246,.65), inset 0 0 0 1px rgba(255,255,255,.2); }
.btn-accent{ background:rgba(139,92,246,.22); color:#e9ddff; border-color:rgba(167,139,250,.5); }
.btn-accent:hover{ background:rgba(139,92,246,.38); box-shadow:0 0 22px rgba(139,92,246,.4); }
.btn-ghost{ background:transparent; color:var(--text); border-color:var(--border-strong); }
.btn-ghost:hover{ background:var(--bg-hover); border-color:var(--accent); }
.btn:disabled{ opacity:.5; cursor:not-allowed; box-shadow:none; }

/* ==========================================================================
   Earth loader
   ========================================================================== */
.earth-loader{ display:flex; flex-direction:column; align-items:center; gap:22px; padding:34px 10px 26px; margin-bottom:20px; }
.earth-loader[hidden]{ display:none; }
.earth-wrap{ position:relative; width:190px; height:190px; display:flex; align-items:center; justify-content:center; }
.earth-glow{
  position:absolute; inset:-26px; border-radius:50%;
  background:radial-gradient(circle, rgba(139,92,246,.55), transparent 68%);
  animation:glow-pulse 2.4s ease-in-out infinite;
}
.earth{ position:relative; width:130px; height:130px; border-radius:50%; overflow:hidden; box-shadow:0 0 40px rgba(139,92,246,.55); }
.earth-sphere{
  position:absolute; inset:0; border-radius:50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), transparent 40%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.0) 0 18px, rgba(216,196,255,.55) 18px 19px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.0) 0 18px, rgba(216,196,255,.4) 18px 19px),
    radial-gradient(circle at 50% 50%, #5b21b6, #2a0f63 70%);
  background-size:auto, 38px 100%, 100% 38px, auto;
  animation:earth-spin 6s linear infinite;
}
@keyframes earth-spin{ from{ background-position:0 0, 0 0, 0 0, 0 0; } to{ background-position:0 0, 38px 0, 0 38px, 0 0; } }
.earth-shadow{ position:absolute; inset:0; border-radius:50%; background:radial-gradient(circle at 70% 70%, transparent 30%, rgba(5,3,15,.75) 100%); }
.earth-ring{ position:absolute; border-radius:50%; border:1px solid rgba(192,132,252,.45); }
.earth-ring-1{ inset:14px; animation:ring-spin 5s linear infinite; border-top-color:var(--accent-bright); }
.earth-ring-2{ inset:2px;  animation:ring-spin 8s linear infinite reverse; border-right-color:var(--accent-bright); opacity:.7; }
.earth-ring-3{ inset:-12px; animation:ring-spin 12s linear infinite; border-bottom-color:var(--accent-bright); opacity:.45; }
@keyframes ring-spin{ to{ transform:rotate(360deg); } }
.earth-status{ text-align:center; }
.earth-status-title{ font-size:17px; font-weight:800; margin-bottom:6px; }
.earth-status-sub{ font-size:13.5px; color:var(--text-secondary); }

/* Progress */
.scan-progress-wrap{ margin-bottom:20px; }
.scan-progress-bar{ height:7px; border-radius:7px; background:rgba(167,139,250,.12); overflow:hidden; margin-bottom:8px; }
.scan-progress-fill{
  display:block; height:100%; width:0%;
  background:linear-gradient(90deg, var(--accent), var(--accent-bright));
  box-shadow:0 0 12px var(--glow); border-radius:7px; transition:width .25s ease;
}
.scan-progress-meta{ display:flex; justify-content:space-between; font-size:12.5px; color:var(--text-secondary); font-family:var(--font-ui); }

.status-msg{
  padding:14px 16px; border-radius:var(--radius-md);
  background:var(--bg-panel); border:1px solid var(--border);
  color:var(--text-secondary); font-size:14px; line-height:1.8; margin-bottom:20px;
}
.status-msg.is-error{ background:var(--danger-soft); border-color:rgba(248,113,113,.35); color:#fecaca; }
.status-msg.is-info{ background:var(--accent-soft); border-color:var(--border-strong); color:#e9ddff; }

/* ==========================================================================
   Results
   ========================================================================== */
.results-toolbar{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:14px; }
.results-summary{ direction:ltr; font-size:13.5px; color:var(--text-secondary); font-family:var(--font-ui); font-weight:600; }
.results-actions{ display:flex; gap:10px; flex-wrap:wrap; }
.table-scroll{
  overflow-x:auto; border:1px solid var(--border);
  border-radius:var(--radius-xl); background:linear-gradient(160deg, rgba(20,18,37,.92), rgba(12,10,22,.95)); box-shadow:var(--shadow-sm);
}
.results-table{ width:100%; border-collapse:collapse; min-width:540px; font-family:var(--font-ui); }
.results-table th{
  text-align:right; font-size:12px; font-weight:700; color:var(--text-tertiary);
  padding:14px 18px; border-bottom:1px solid var(--border); background:rgba(139,92,246,.05);
}
.results-table td{ padding:12px 18px; border-bottom:1px solid var(--border); font-size:14px; color:var(--text); }
.results-table tbody tr{ opacity:0; animation:row-in .35s ease forwards; transition:background .15s ease; }
.results-table tbody tr:hover{ background:var(--bg-hover); }
.results-table tbody tr:last-child td{ border-bottom:none; }
@keyframes row-in{ from{ opacity:0; transform:translateY(4px); } to{ opacity:1; transform:translateY(0); } }
.results-table tbody tr.is-best{ background:rgba(139,92,246,.08); }

.results-table tbody tr.is-persistent{
  background:linear-gradient(270deg, rgba(255,215,0,.09), transparent);
  box-shadow:inset -3px 0 0 var(--persistent);
}
.results-table tbody tr.is-persistent.is-best{ background:linear-gradient(270deg, rgba(255,215,0,.15), rgba(139,92,246,.1)); }
.results-table tbody tr.is-persistent td:first-child::before{ content:'💎 '; font-size:12px; }
.results-table tbody tr.is-long-term{
  background:linear-gradient(270deg, rgba(255,215,0,.16), rgba(139,92,246,.1));
  box-shadow:inset -4px 0 0 var(--persistent), inset 0 0 24px rgba(255,215,0,.08);
}
.results-table tbody tr.is-long-term td:first-child::before{ content:'👑 '; font-size:13px; }

.ip-cell{ font-family:var(--font-mono); font-size:13.5px; font-variant-numeric:tabular-nums; direction:ltr; text-align:right; }
.ping-cell{ font-variant-numeric:tabular-nums; direction:ltr; text-align:right; font-weight:700; color:var(--accent-bright); }
.status-pill{ display:inline-flex; align-items:center; gap:6px; padding:3px 11px; border-radius:99px; font-size:12px; font-weight:700; }
.status-pill.online{ background:var(--success-soft); color:var(--success); border:1px solid rgba(52,211,153,.3); }
.status-pill.online::before{ content:''; width:6px; height:6px; border-radius:50%; background:var(--success); box-shadow:0 0 8px var(--success); }
.status-pill.offline{ background:var(--danger-soft); color:var(--danger); border:1px solid rgba(248,113,113,.3); }
.copy-row-btn{
  border:1px solid var(--border-strong); background:rgba(139,92,246,.08); border-radius:8px;
  height:30px; padding:0 12px; font-size:12px; font-weight:700; font-family:var(--font-ui);
  cursor:pointer; color:var(--text-secondary); transition:all .15s ease;
}
.copy-row-btn:hover{ background:var(--accent); border-color:var(--accent); color:#fff; box-shadow:0 0 16px var(--glow); }

/* ==========================================================================
   Config builder
   ========================================================================== */
.builder-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:18px; }
.panel-label{ display:block; font-family:var(--font-ui); font-size:13px; font-weight:700; margin-bottom:12px; color:var(--text); }
.textarea{
  width:100%; resize:vertical; border:1px solid var(--border-strong);
  border-radius:var(--radius-md); padding:14px 16px; font-size:13px; line-height:1.7;
  color:var(--text); background:var(--bg-sunken); direction:ltr; text-align:left;
  font-family:var(--font-mono);
}
.textarea::placeholder{ color:var(--text-tertiary); }
.textarea:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(139,92,246,.2); }
.textarea-output{ background:#0a0814; }
.panel-foot{ margin-top:10px; font-size:12px; color:var(--text-tertiary); font-family:var(--font-ui); }
.builder-actions{ margin-bottom:22px; }

/* ==========================================================================
   Footer / toast
   ========================================================================== */
.footer{ text-align:center; padding:22px 20px 30px; font-size:12.5px; color:var(--text-tertiary); font-family:var(--font-ui); }
.toast{
  position:fixed; bottom:24px; left:50%;
  transform:translate(-50%, 12px);
  background:rgba(24,20,44,.95); color:#fff; border:1px solid var(--border-strong);
  padding:12px 22px; border-radius:99px; backdrop-filter:blur(10px);
  font-size:13.5px; font-weight:600; font-family:var(--font-body);
  box-shadow:var(--shadow-md), 0 0 24px rgba(139,92,246,.3);
  opacity:0; pointer-events:none; transition:opacity .25s ease, transform .25s ease; z-index:100;
}
.toast.is-visible{ opacity:1; transform:translate(-50%, 0); }
.toast.is-error{ background:rgba(127,29,29,.95); border-color:rgba(248,113,113,.5); }
.toast.is-success{ background:rgba(6,78,59,.95); border-color:rgba(52,211,153,.5); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (min-width:1024px){
  /* permanent sidebar like the reference dashboard */
  .drawer{ transform:none; width:var(--sidebar-w); box-shadow:none; z-index:45; }
  .drawer-overlay{ display:none; }
  .hamburger{ display:none; }
  .topbar{ display:none; }
  .app{ padding-right:var(--sidebar-w); }
  .content{ max-width:1080px; padding:44px 36px 60px; }
}
@media (max-width:860px){
  .stat-grid{ grid-template-columns:repeat(2,1fr); }
}
@media (max-width:720px){
  .builder-grid{ grid-template-columns:1fr; }
  .content{ padding:24px 14px 48px; }
  .page-head h1{ font-size:23px; }
  .scan-controls{ align-items:stretch; }
  .field select{ width:100%; }
  .scan-controls .btn{ flex:1; }
  .results-actions{ width:100%; }
  .results-actions .btn{ flex:1; }
}
@media (max-width:380px){
  .topbar{ padding:0 14px; }
  .brand-name{ font-size:17px; }
  .loading-word{ width:190px; }
  .loading-bismillah{ font-size:22px; }
  .btn{ font-size:13.5px; padding:0 14px; }
  .page-head h1{ font-size:21px; }
  .panel{ padding:16px; }
  .stat-value{ font-size:24px; }
}

/* Multi-source scanner */
.source-cell{
  white-space:nowrap;
  font-size:12px;
  font-weight:700;
  direction:rtl;
  text-align:right;
  color:var(--text-secondary);
}
