/* ============================================================
   FuckFile Admin — operations console
   design language: ported from admin.veilwatch.net
   ============================================================ */

:root {
  /* primary palette */
  --vw-blue:         #023047;
  --vw-blue-light:   #034166;
  --vw-blue-dark:    #011a2d;
  --vw-blue-deep:    #000d17;
  --vw-orange:       #f79520;
  --vw-orange-light: #ffa940;
  --vw-green:        #10b981;
  --vw-red:          #ef4444;
  --vw-yellow:       #f59e0b;

  /* grayscale (Tailwind-like) */
  --vw-gray-50:      #f8fafc;
  --vw-gray-100:     #f1f5f9;
  --vw-gray-200:     #e2e8f0;
  --vw-gray-300:     #cbd5e1;
  --vw-gray-400:     #94a3b8;
  --vw-gray-500:     #64748b;
  --vw-gray-600:     #475569;
  --vw-gray-700:     #334155;
  --vw-gray-800:     #1e293b;
  --vw-gray-900:     #0f172a;

  --vw-radius:       8px;
  --vw-shadow:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --vw-shadow-md:    0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --vw-shadow-lg:    0 10px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.06);
  --vw-card-glow:    inset 0 1px 0 0 rgba(255,255,255,.8), inset 1px 0 0 0 rgba(255,255,255,.4);

  --header-height:   56px;
  --nav-height:      42px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', ui-monospace, Menlo, monospace;
}

/* -------- reset & base -------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: #eef2f7;
  background-image:
    linear-gradient(rgba(2,48,71,.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(2,48,71,.015) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--vw-gray-800);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: calc(3px + var(--header-height) + var(--nav-height));
}

a { color: var(--vw-blue); text-decoration: none; }
a:hover { color: var(--vw-orange); }
pre, code, .mono { font-family: var(--font-mono); }

/* -------- animations -------- */
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
  50%      { box-shadow: 0 0 0 6px rgba(16,185,129,.15), 0 0 12px rgba(16,185,129,.1); }
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
  50%      { box-shadow: 0 0 0 6px rgba(239,68,68,.15), 0 0 12px rgba(239,68,68,.1); }
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------- scrollbar -------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--vw-gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--vw-gray-400); }
::-webkit-scrollbar-track { background: transparent; }

/* -------- top accent + header + nav -------- */
.top-accent {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1200;
  height: 3px;
  background: linear-gradient(90deg, var(--vw-orange), var(--vw-orange-light), var(--vw-orange));
}

.top-header {
  position: fixed; top: 3px; left: 0; right: 0; z-index: 1100;
  height: var(--header-height);
  background: linear-gradient(180deg, var(--vw-blue-dark), var(--vw-blue-deep));
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.2);
}
.top-header-left  { display: flex; align-items: center; gap: 1rem; }
.top-header-right { display: flex; align-items: center; gap: .85rem; }

.brand {
  display: flex; align-items: center; gap: .85rem;
  text-decoration: none;
}
.brand-logo {
  height: 34px; width: auto; display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
}
.brand-sub {
  font-weight: 500; letter-spacing: .18em; font-size: .68rem;
  color: rgba(255,255,255,.55); text-transform: uppercase;
  padding-left: .85rem; border-left: 1px solid rgba(255,255,255,.15);
  font-family: var(--font-sans);
}

.header-clock {
  font-family: var(--font-mono); font-size: .78rem;
  color: var(--vw-gray-300); letter-spacing: .03em; white-space: nowrap;
  padding: .35rem .7rem; border-radius: 6px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.05);
}
.header-user {
  color: var(--vw-gray-400); font-size: .82rem; font-weight: 500;
}
.live-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .65rem; border-radius: 999px;
  background: rgba(16,185,129,.14); border: 1px solid rgba(16,185,129,.28);
  color: #4ade80; font-weight: 700; font-size: .72rem; letter-spacing: .08em;
}
.live-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--vw-green); box-shadow: 0 0 8px var(--vw-green);
  animation: pulse-green 2.5s ease-in-out infinite;
}

.nav-bar {
  position: fixed; top: calc(3px + var(--header-height)); left: 0; right: 0; z-index: 1050;
  height: var(--nav-height);
  background: var(--vw-blue);
  display: flex; align-items: stretch; padding: 0 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav-link {
  display: flex; align-items: center; gap: .4rem;
  padding: 0 1rem; height: 100%;
  color: rgba(255,255,255,.7); text-decoration: none;
  font-size: .82rem; font-weight: 600; letter-spacing: .02em;
  border-bottom: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.nav-link:hover    { color: #fff; background: rgba(255,255,255,.06); }
.nav-link.active   { color: var(--vw-orange); border-bottom-color: var(--vw-orange); background: rgba(247,149,32,.08); }
.nav-link.disabled { opacity: .35; pointer-events: none; }
.nav-link svg { width: 15px; height: 15px; opacity: .7; }
.nav-link.active svg { opacity: 1; }

/* -------- page layout -------- */
main.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
  animation: fade-in .3s ease;
}
.page-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem;
}
.page-header h1 {
  font-size: 1.5rem; font-weight: 800; color: var(--vw-gray-900);
  display: flex; align-items: center; gap: .6rem; letter-spacing: -.01em;
}
.page-header h1 .mark {
  display: inline-block; width: 4px; height: 22px; border-radius: 2px;
  background: var(--vw-orange);
}
.page-header .subtitle {
  font-size: .84rem; color: var(--vw-gray-500); font-weight: 400; margin-top: .15rem;
}
.page-actions { display: flex; align-items: center; gap: .6rem; }

/* -------- cards -------- */
.card {
  background: #fff;
  border: 1px solid var(--vw-gray-200);
  border-radius: var(--vw-radius);
  padding: 1.25rem;
  box-shadow: var(--vw-shadow), var(--vw-card-glow);
  transition: box-shadow .2s, border-color .2s, transform .15s;
  position: relative;
}
.card:hover {
  box-shadow: var(--vw-shadow-md), var(--vw-card-glow);
}
.card + .card { margin-top: 1rem; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; padding-bottom: .75rem;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--vw-blue), rgba(2,48,71,.08), transparent) 1;
}
.card-header h3 {
  font-size: 1rem; font-weight: 700; color: var(--vw-gray-800);
  display: flex; align-items: center; gap: .5rem;
}
.card-header .meta { font-size: .78rem; color: var(--vw-gray-500); }

/* dark hero card variant */
.card-dark {
  background: linear-gradient(135deg, var(--vw-blue-dark), var(--vw-blue-deep));
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
  box-shadow: var(--vw-shadow-lg), inset 0 1px 0 rgba(255,255,255,.05);
}
.card-dark .card-header h3 { color: rgba(255,255,255,.95); }

/* -------- stats -------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--vw-gray-200);
  border-radius: var(--vw-radius);
  padding: 1.25rem;
  box-shadow: var(--vw-shadow), var(--vw-card-glow);
  position: relative; overflow: hidden;
  transition: box-shadow .2s, transform .15s;
}
.stat-card:hover {
  box-shadow: var(--vw-shadow-md), var(--vw-card-glow);
  transform: translateY(-2px);
}
.stat-card-accent {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--vw-blue);
}
.stat-card-accent.green  { background: var(--vw-green); }
.stat-card-accent.amber  { background: var(--vw-yellow); }
.stat-card-accent.red    { background: var(--vw-red); }
.stat-card-accent.orange { background: var(--vw-orange); }

.stat-card-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .75rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.06), inset 0 -1px 2px rgba(0,0,0,.04);
  color: #fff; font-weight: 700; font-size: 1.05rem;
  background: var(--vw-blue);
}
.stat-card-icon.blue   { background: linear-gradient(135deg, #2563eb, #1e40af); }
.stat-card-icon.green  { background: linear-gradient(135deg, #10b981, #059669); }
.stat-card-icon.amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card-icon.red    { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.stat-card-icon.orange { background: linear-gradient(135deg, #f79520, #d97706); }
.stat-card-icon.slate  { background: linear-gradient(135deg, #475569, #1e293b); }
.stat-card-icon svg { width: 20px; height: 20px; }

.stat-card-value {
  font-size: 2rem; font-weight: 800; color: var(--vw-gray-900);
  line-height: 1; letter-spacing: -.02em;
}
.stat-card-value.small { font-size: 1.1rem; font-weight: 700; padding-top: .25rem; }
.stat-card-label {
  font-size: .75rem; font-weight: 600; color: var(--vw-gray-500);
  margin-top: .4rem; text-transform: uppercase; letter-spacing: .05em;
}
.stat-card-sub { font-size: .75rem; color: var(--vw-gray-400); margin-top: .25rem; }

/* -------- badges & chips -------- */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .18rem .55rem; font-size: .72rem; font-weight: 700;
  border-radius: 999px; letter-spacing: .02em;
  text-transform: uppercase;
}
.badge-blue   { background: linear-gradient(180deg, #dbeafe, #c7d8f0); color: #1e40af; box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
.badge-green  { background: linear-gradient(180deg, #dcfce7, #c5f0d5); color: #166534; box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
.badge-red    { background: linear-gradient(180deg, #fee2e2, #f5cdcd); color: #991b1b; box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
.badge-yellow { background: linear-gradient(180deg, #fef3c7, #fbe8a8); color: #92400e; box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
.badge-orange { background: linear-gradient(180deg, #ffedd5, #fed7aa); color: #9a3412; box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
.badge-gray   { background: linear-gradient(180deg, var(--vw-gray-100), var(--vw-gray-200)); color: var(--vw-gray-600); box-shadow: inset 0 1px 0 rgba(255,255,255,.7); }
.badge-dark   { background: linear-gradient(180deg, var(--vw-blue), var(--vw-blue-dark)); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }

.status-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: .35rem; flex-shrink: 0; vertical-align: middle;
}
.status-dot.up      { background: var(--vw-green); box-shadow: 0 0 0 3px rgba(16,185,129,.2); animation: pulse-green 2.5s ease-in-out infinite; }
.status-dot.down    { background: var(--vw-red);   box-shadow: 0 0 0 3px rgba(239,68,68,.2);  animation: pulse-red 2s ease-in-out infinite; }
.status-dot.warn    { background: var(--vw-yellow); box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.status-dot.unknown { background: var(--vw-gray-400); }

/* -------- buttons -------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: 6px;
  border: 1px solid transparent;
  font-size: .82rem; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none;
  transition: all .15s; line-height: 1.4;
}
.btn-primary {
  background: linear-gradient(180deg, var(--vw-blue-light), var(--vw-blue));
  color: #fff; border-color: var(--vw-blue-dark);
  box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.1);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #04527a, var(--vw-blue-light));
  color: #fff;
}
.btn-secondary {
  background: linear-gradient(180deg, #fff, var(--vw-gray-50));
  color: var(--vw-gray-700); border-color: var(--vw-gray-300);
}
.btn-secondary:hover {
  background: linear-gradient(180deg, var(--vw-gray-50), var(--vw-gray-100));
  border-color: var(--vw-gray-400); color: var(--vw-gray-800);
}
.btn-ghost {
  background: transparent; color: var(--vw-gray-600);
  border-color: var(--vw-gray-200);
}
.btn-ghost:hover { background: var(--vw-gray-50); color: var(--vw-gray-800); }

/* -------- instance cards (dashboard grid) -------- */
.instance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
  align-items: start;
}
.instance-card {
  background: #fff;
  border: 1px solid var(--vw-gray-200);
  border-radius: var(--vw-radius);
  box-shadow: var(--vw-shadow), var(--vw-card-glow);
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
  transition: all .18s;
  position: relative;
  overflow: hidden;
}
.instance-card:hover {
  box-shadow: var(--vw-shadow-md), var(--vw-card-glow);
  transform: translateY(-2px);
  border-color: var(--vw-gray-300);
}
.instance-card-rail {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--vw-gray-300);
}
.instance-card.health-green .instance-card-rail { background: var(--vw-green); }
.instance-card.health-amber .instance-card-rail { background: var(--vw-yellow); }
.instance-card.health-red   .instance-card-rail { background: var(--vw-red); }

.instance-card-head {
  padding: 1rem 1.1rem .75rem 1.25rem;
  display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem;
}
.instance-card-title {
  display: flex; flex-direction: column; gap: .15rem; min-width: 0;
}
.instance-card-kicker {
  font-size: .7rem; color: var(--vw-gray-500); font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
}
.instance-card-name {
  font-size: 1.15rem; font-weight: 700; color: var(--vw-gray-900);
  letter-spacing: -.005em;
}
.instance-card-sub {
  font-family: var(--font-mono); font-size: .72rem; color: var(--vw-gray-500);
  margin-top: .15rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.status-stack { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; flex-shrink: 0; }

.instance-card-body {
  padding: .75rem 1.25rem 1rem;
  border-top: 1px solid var(--vw-gray-100);
  display: grid; grid-template-columns: 1fr 1fr;
  column-gap: 1rem; row-gap: .8rem;
}
.instance-card-body .kv { min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.instance-card-body .kv-wide { grid-column: span 2; }
.instance-card-body .kv-k {
  font-size: .68rem; font-weight: 600; color: var(--vw-gray-500);
  text-transform: uppercase; letter-spacing: .08em;
}
.instance-card-body .kv-v {
  font-size: .82rem; color: var(--vw-gray-800); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.instance-card-body .kv-v.mono { font-family: var(--font-mono); font-size: .78rem; color: var(--vw-gray-700); }
.instance-card-body .kv-v.muted { color: var(--vw-gray-400); }
.instance-card-body .kv-v.url { color: var(--vw-blue); font-weight: 600; }
.instance-card-body .kv-v.url:hover { color: var(--vw-orange); text-decoration: underline; }
.instance-card-body .kv-v.copyable { cursor: copy; }
.instance-card-body .kv-v.copyable:hover { color: var(--vw-blue); }
.instance-card-body .kv-v.copyable.copied { color: var(--vw-green); }
.instance-card-body .kv-v.copyable.copied::after { content: " ✓"; color: var(--vw-green); }

.instance-card-foot {
  padding: .85rem 1.25rem 1rem;
  border-top: 1px solid var(--vw-gray-100);
  background: linear-gradient(180deg, transparent, rgba(2,48,71,.015));
}
.chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: .5rem;
}
.chart-label {
  font-size: .68rem; color: var(--vw-gray-500);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
}
.chart-val {
  font-size: .9rem; font-weight: 700; color: var(--vw-blue);
  font-family: var(--font-mono);
}
.spark { width: 100%; height: 48px; display: block; overflow: visible; }

/* -------- tables -------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.data-table thead th {
  padding: .6rem .8rem;
  background: var(--vw-gray-700); color: rgba(255,255,255,.9);
  border-bottom: 2px solid var(--vw-gray-600);
  text-align: left; font-weight: 700; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .06em;
}
.data-table thead th:first-child { border-top-left-radius: 6px; }
.data-table thead th:last-child  { border-top-right-radius: 6px; }
.data-table tbody td {
  padding: .55rem .8rem;
  border-bottom: 1px solid var(--vw-gray-100);
  vertical-align: middle;
  color: var(--vw-gray-800);
}
.data-table tbody tr { transition: background .1s, border-color .1s; border-left: 2px solid transparent; }
.data-table tbody tr:nth-child(even) { background: rgba(248,250,252,.6); }
.data-table tbody tr:hover { background: rgba(2,48,71,.03); border-left-color: var(--vw-blue); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td.mono, .data-table td code {
  font-family: var(--font-mono); font-size: .75rem; color: var(--vw-gray-700);
}
.data-table td.right, .data-table th.right { text-align: right; }

/* -------- topology section -------- */
.topology-card {
  background: #fff;
  border: 1px solid var(--vw-gray-200);
  border-radius: var(--vw-radius);
  box-shadow: var(--vw-shadow), var(--vw-card-glow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.topology-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--vw-gray-100);
}
.topology-head h2 {
  font-size: 1rem; font-weight: 700; color: var(--vw-gray-800);
  display: flex; align-items: center; gap: .5rem;
}
.topology-head .legend {
  display: flex; gap: 1rem; font-size: .72rem; color: var(--vw-gray-500); font-weight: 500;
}
.topology-head .legend .lg { display: flex; align-items: center; gap: .35rem; }

.topo-svg {
  width: 100%; height: auto; display: block;
  background: linear-gradient(180deg, var(--vw-gray-50), #fff 70%);
  border: 1px solid var(--vw-gray-200);
  border-radius: 6px;
  padding: 12px;
}

/* -------- detail pages -------- */
.breadcrumb {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8rem; color: var(--vw-gray-500);
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--vw-blue); font-weight: 500; }
.breadcrumb .sep { color: var(--vw-gray-300); }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}
.detail-card {
  background: #fff;
  border: 1px solid var(--vw-gray-200);
  border-radius: var(--vw-radius);
  box-shadow: var(--vw-shadow), var(--vw-card-glow);
  padding: 1.25rem;
  min-width: 0;
  overflow: auto;
}
.detail-card h3 {
  font-size: .85rem; font-weight: 700; color: var(--vw-gray-800);
  margin-bottom: .85rem; padding-bottom: .6rem;
  border-bottom: 1px solid var(--vw-gray-100);
  text-transform: uppercase; letter-spacing: .06em;
}
.detail-card dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1rem; row-gap: .55rem;
  font-size: .85rem;
}
.detail-card dt {
  color: var(--vw-gray-500); font-weight: 600;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  padding-top: 2px;
}
.detail-card dd { color: var(--vw-gray-800); font-weight: 500; }
.detail-card dd.mono, .mono { font-family: var(--font-mono); }
.detail-card pre {
  background: var(--vw-gray-50); color: var(--vw-gray-800);
  padding: .75rem .85rem; border-radius: 6px;
  border: 1px solid var(--vw-gray-200);
  font-family: var(--font-mono); font-size: .75rem;
  line-height: 1.55; overflow: auto; white-space: pre-wrap;
}

/* large detail page header */
.detail-header {
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.detail-header .big-name {
  font-size: 1.75rem; font-weight: 800; color: var(--vw-gray-900); letter-spacing: -.01em;
}
.detail-header .detail-id {
  font-family: var(--font-mono); font-size: .82rem; color: var(--vw-gray-500);
}

.errbox {
  background: linear-gradient(180deg, #fee2e2, #fecaca);
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-left: 3px solid var(--vw-red);
  padding: .85rem 1rem; border-radius: 6px;
  font-size: .85rem;
  margin-bottom: 1rem;
}

.footer {
  margin-top: 2rem; padding-top: 1rem;
  border-top: 1px solid var(--vw-gray-200);
  color: var(--vw-gray-500);
  font-size: .78rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}

.muted { color: var(--vw-gray-500); }
.small { font-size: .78rem; }
.right { text-align: right; }

/* -------- responsive -------- */
@media (max-width: 900px) {
  .top-header { padding: 0 1rem; }
  .brand-sub { display: none; }
  .nav-bar { padding: 0 .5rem; }
  main.page { padding: 1.25rem 1rem 3rem; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .instance-grid { grid-template-columns: 1fr; }
  .instance-card-body { grid-template-columns: 1fr; }
  .detail-header .big-name { font-size: 1.4rem; }
}

/* ---- Logs page ---- */
.logs-toolbar {
  display: flex; flex-direction: column; gap: .75rem;
  margin-bottom: 1rem;
}
.tabstrip {
  display: flex; flex-wrap: wrap; gap: .35rem;
  background: #fff; border: 1px solid var(--vw-gray-200);
  border-radius: var(--vw-radius); padding: .35rem;
  box-shadow: var(--vw-shadow-sm);
}
.tabstrip-tab {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .55rem .85rem;
  border-radius: 6px;
  font-size: .82rem; font-weight: 600;
  color: var(--vw-gray-700);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.tabstrip-tab:hover { background: var(--vw-gray-50); }
.tabstrip-tab.active {
  background: var(--vw-blue);
  color: #fff;
  border-color: var(--vw-blue);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.tabstrip-tab.active .tabstrip-sub { color: rgba(255,255,255,.65); }
.tabstrip-sub {
  font-size: .65rem; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--vw-gray-400);
  padding-left: .35rem; border-left: 1px solid currentColor;
  opacity: .7;
}
.tabstrip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--vw-gray-300);
  display: inline-block;
}
.tabstrip-dot.pill-green { background: var(--vw-green); }
.tabstrip-dot.pill-amber { background: var(--vw-yellow); }
.tabstrip-dot.pill-red   { background: var(--vw-red); }
.tabstrip-dot.pill-gray  { background: var(--vw-gray-400); }

.chiprow { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  display: inline-flex; align-items: center;
  padding: .35rem .65rem;
  border-radius: 999px;
  font-size: .73rem; font-weight: 600;
  background: var(--vw-gray-100);
  color: var(--vw-gray-700);
  border: 1px solid var(--vw-gray-200);
  text-decoration: none;
  letter-spacing: .02em;
  transition: background .15s, color .15s;
}
.chip:hover { background: var(--vw-gray-200); }
.chip.chip-active {
  background: var(--vw-orange);
  color: #fff;
  border-color: var(--vw-orange);
}

.logs-section .section-head { margin-bottom: .65rem; }
.logs-pane {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: var(--vw-radius);
  overflow: hidden;
  box-shadow: var(--vw-shadow-sm);
}
.logs-pre {
  margin: 0; padding: .9rem 1rem;
  background: transparent;
  color: #e2e8f0;
  font-family: var(--font-mono, ui-monospace, "JetBrains Mono", Consolas, "Liberation Mono", monospace);
  font-size: .78rem; line-height: 1.5;
  white-space: pre;
  overflow: auto;
  max-height: 70vh;
}
.logs-foot {
  background: #0a1120;
  padding: .45rem .9rem;
  border-top: 1px solid #1e293b;
  color: #94a3b8;
}
.logs-foot .small, .logs-foot .muted { color: #94a3b8 !important; }

/* ---- Shell page (embedded ttyd) ---- */
.shell-frame {
  margin: 1rem 0 1.25rem;
  border-radius: var(--vw-radius);
  overflow: hidden;
  box-shadow: var(--vw-shadow-sm);
  border: 1px solid var(--vw-gray-300);
  background: #0f172a;
  height: calc(100vh - 280px);
  min-height: 460px;
}
.shell-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0f172a;
}

/* ---- Schema viewer ---- */
.cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .65rem;
}
.cluster-card {
  display: flex; flex-direction: column; gap: .4rem;
  padding: .9rem 1rem;
  background: #fff;
  border: 1px solid var(--vw-gray-200);
  border-radius: var(--vw-radius);
  box-shadow: var(--vw-shadow-sm);
  text-decoration: none;
  color: var(--vw-gray-800);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.cluster-card:hover {
  border-color: var(--vw-orange);
  box-shadow: 0 2px 8px rgba(247,149,32,.15);
  transform: translateY(-1px);
}
.cluster-card-active {
  border-color: var(--vw-orange);
  box-shadow: 0 0 0 2px rgba(247,149,32,.2);
}
.cluster-card-name {
  font-weight: 700;
  font-size: .92rem;
  color: var(--vw-gray-900);
  letter-spacing: .01em;
}
.cluster-card-stats {
  display: flex; flex-wrap: wrap; gap: .4rem .85rem;
  font-size: .73rem;
  color: var(--vw-gray-600);
}
.cluster-card-stats strong { color: var(--vw-gray-900); font-weight: 700; }
.cluster-card-stats .muted { color: var(--vw-gray-400); }

.schema-diagram-wrap {
  background: #fff;
  border: 1px solid var(--vw-gray-200);
  border-radius: var(--vw-radius);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--vw-shadow-sm);
  position: relative;
}
.schema-diagram-wrap .mermaid {
  font-family: var(--font-mono, ui-monospace, "JetBrains Mono", monospace);
  text-align: center;
  width: 100%;
  height: 70vh;
}
.schema-diagram-wrap .mermaid svg { width: 100%; height: 70vh; max-width: none; display: block; }

.schema-table-link { color: var(--vw-blue); text-decoration: none; }
.schema-table-link:hover { color: var(--vw-orange); text-decoration: underline; }


/* Levi's Laptop status pill (Tailscale presence indicator on dashboard) */
.laptop-pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .7rem;
  background: var(--vw-gray-100, #f3f4f6);
  border: 1px solid var(--vw-gray-200, #e5e7eb);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--vw-gray-700, #374151);
  white-space: nowrap;
}
.laptop-dot {
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: #9ca3af;
  display: inline-block;
}
.laptop-dot.up {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, .55);
  animation: laptop-pulse 1.8s ease-out infinite;
}
.laptop-dot.down {
  background: #9ca3af;
}
@keyframes laptop-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
  70%  { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ---- Upload section (shell page) ---- */
.upload-section {
  margin-top: 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
}

#drop-zone {
  border: 2px dashed var(--vw-gray-300);
  border-radius: var(--vw-radius);
  padding: 2rem 1.5rem;
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  cursor: pointer;
  transition: all .2s;
  background: linear-gradient(180deg, var(--vw-gray-50), #fff);
  outline: none;
}
#drop-zone:hover, #drop-zone:focus-visible {
  border-color: var(--vw-blue);
  background: rgba(2,48,71,.02);
}
#drop-zone.drag-over {
  border-color: var(--vw-orange);
  background: rgba(247,149,32,.04);
  box-shadow: 0 0 0 4px rgba(247,149,32,.1);
}
.drop-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--vw-blue-light), var(--vw-blue));
  color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(2,48,71,.2);
}
.drop-icon svg { width: 24px; height: 24px; }
.drop-text { display: flex; flex-direction: column; gap: .2rem; }
.drop-text strong { font-size: .92rem; color: var(--vw-gray-800); }
.drop-text span { font-size: .78rem; color: var(--vw-gray-500); }

.upload-options {
  display: flex; gap: .75rem; margin-top: .75rem;
}
.upload-opt { display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.upload-opt label {
  font-size: .68rem; font-weight: 600; color: var(--vw-gray-500);
  text-transform: uppercase; letter-spacing: .06em;
}
.upload-opt select, .upload-opt input {
  font-family: var(--font-sans); font-size: .82rem;
  padding: .45rem .65rem; border-radius: 6px;
  border: 1px solid var(--vw-gray-200);
  background: #fff; color: var(--vw-gray-800);
  outline: none; transition: border-color .15s;
}
.upload-opt select:focus, .upload-opt input:focus {
  border-color: var(--vw-blue);
  box-shadow: 0 0 0 3px rgba(2,48,71,.08);
}

#upload-queue {
  margin-top: .75rem;
  display: flex; flex-direction: column; gap: .5rem;
}
.queue-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .75rem;
  background: var(--vw-gray-50);
  border: 1px solid var(--vw-gray-100);
  border-radius: 6px;
}
.qi-info { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: .5rem; }
.qi-name {
  font-size: .82rem; font-weight: 600; color: var(--vw-gray-800);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qi-size { font-size: .72rem; color: var(--vw-gray-500); white-space: nowrap; }
.qi-url { display: block; margin-top: .15rem; }
.qi-url code {
  font-size: .68rem; background: var(--vw-gray-50); padding: .1rem .35rem;
  border-radius: 3px; color: var(--vw-gray-600); cursor: pointer;
  border: 1px solid var(--vw-gray-100); user-select: all;
  word-break: break-all; transition: all .15s;
}
.qi-url code:hover { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.qi-url code.copied { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.qi-bar {
  width: 100px; height: 4px; border-radius: 2px;
  background: var(--vw-gray-200); overflow: hidden; flex-shrink: 0;
}
.qi-progress {
  height: 100%; width: 0; border-radius: 2px;
  background: var(--vw-blue); transition: width .3s;
}
.qi-progress.ok { background: var(--vw-green); }
.qi-progress.fail { background: var(--vw-red); }
.qi-status {
  font-size: .72rem; font-weight: 700; white-space: nowrap;
  color: var(--vw-gray-500); text-transform: uppercase; letter-spacing: .04em;
}
.qi-ok { color: var(--vw-green); }
.qi-fail { color: var(--vw-red); }

.upload-alert {
  padding: .65rem 1rem; border-radius: 6px;
  font-size: .82rem; margin-top: .5rem;
}
.alert-ok {
  background: linear-gradient(180deg, #dcfce7, #c5f0d5);
  color: #166534; border: 1px solid #86efac;
}
.alert-warn {
  background: linear-gradient(180deg, #fef3c7, #fbe8a8);
  color: #92400e; border: 1px solid #fcd34d;
}

/* File list */
.file-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .65rem .85rem;
  border-bottom: 1px solid var(--vw-gray-100);
  transition: background .1s;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: rgba(2,48,71,.02); }
.file-row-info { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1; }
.file-row-name {
  font-size: .85rem; font-weight: 600; color: var(--vw-gray-800);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-row-meta { font-size: .72rem; color: var(--vw-gray-500); }
.file-row-url { font-size: .7rem; margin-top: .1rem; }
.file-row-url code {
  background: var(--vw-gray-50); padding: .1rem .35rem; border-radius: 3px;
  font-size: .68rem; color: var(--vw-gray-600); cursor: pointer;
  border: 1px solid var(--vw-gray-100); user-select: all;
  word-break: break-all; transition: all .15s;
}
.file-row-url code:hover { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.file-row-url code.copied { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.file-row-actions { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.btn-sm {
  display: inline-flex; align-items: center;
  padding: .25rem .55rem; border-radius: 4px;
  font-size: .72rem; font-weight: 600; font-family: inherit;
  border: 1px solid var(--vw-gray-200);
  background: #fff; color: var(--vw-gray-700);
  cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.btn-sm:hover { background: var(--vw-gray-50); border-color: var(--vw-gray-300); }
.btn-sm.btn-danger { color: var(--vw-red); }
.btn-sm.btn-danger:hover { background: #fee2e2; border-color: #fca5a5; }

@media (max-width: 640px) {
  .upload-options { flex-direction: column; }
  .file-row { flex-direction: column; align-items: flex-start; }
  .file-row-actions { width: 100%; justify-content: flex-end; }
  .qi-bar { width: 60px; }
}
