:root {
  --ink: #10140f;
  --panel: #171d16;
  --panel-2: #1e261d;
  --line: #2d3a2b;
  --text: #e8efe4;
  --muted: #9aab95;
  --accent: #d6ff4b;
  --accent-2: #39c6a2;
  --warn: #ffb454;
  --danger: #ff6b6b;
  --ok: #6dffb0;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Manrope, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(214, 255, 75, 0.12), transparent 50%),
    radial-gradient(900px 500px at 100% 0%, rgba(57, 198, 162, 0.12), transparent 45%),
    linear-gradient(180deg, #0c100c, #121812 40%, #0b0f0b);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.7), transparent 85%);
  pointer-events: none;
  z-index: 0;
}

.topbar, main, dialog { position: relative; z-index: 1; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: max(0.85rem, env(safe-area-inset-top)) 1rem 0.9rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  background: rgba(12, 16, 12, 0.75);
  position: sticky;
  top: 0;
}

.brand { display: flex; gap: 0.9rem; align-items: center; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  font-family: Archivo, sans-serif; font-weight: 800;
  background: var(--accent); color: #111;
}
.brand h1 {
  margin: 0;
  font-family: Archivo, sans-serif;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.brand p { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.82rem; }

.top-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

.badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.badge.ok { color: var(--ok); border-color: rgba(109,255,176,.35); background: rgba(109,255,176,.08); }
.badge.bad { color: var(--warn); border-color: rgba(255,180,84,.35); background: rgba(255,180,84,.08); }

.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 12px;
  padding: 0.62rem 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); border-color: #4b5d47; }
.btn.primary { background: var(--accent); color: #13200f; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: 0.35rem 0.6rem; font-size: 0.8rem; }

.layout {
  width: min(1200px, calc(100% - 2rem));
  margin: 1rem auto 3rem;
  display: grid;
  gap: 1rem;
}

.hero-ops {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(214,255,75,0.08), transparent 40%),
    var(--panel);
  box-shadow: var(--shadow);
}
.eyebrow {
  margin: 0 0 0.4rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}
.hero-ops h2 {
  margin: 0;
  font-family: Archivo, sans-serif;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.lede { color: var(--muted); line-height: 1.55; max-width: 52ch; }

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.kpi {
  background: rgba(0,0,0,.25);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem;
}
.kpi strong {
  display: block;
  font-family: Archivo, sans-serif;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}
.kpi span { color: var(--muted); font-size: 0.8rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.panel-head { margin-bottom: 0.85rem; }
.panel-head.row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}
.panel-head.tight { margin-top: 1rem; margin-bottom: 0.5rem; }
.panel-head h3 {
  margin: 0;
  font-family: Archivo, sans-serif;
  letter-spacing: -0.02em;
}
.panel-head p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; }

.pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.55rem;
}
.kanban-wrap {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 300px);
  gap: 0.7rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}
.lane {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 14px;
  min-height: 170px;
  display: flex;
  flex-direction: column;
}
.lane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--line);
}
.lane-head strong { font-size: 0.82rem; }
.lane-list {
  list-style: none;
  margin: 0;
  padding: 0.55rem;
  display: grid;
  gap: 0.45rem;
}
.card-mini {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem;
  background: rgba(0,0,0,.18);
}
.card-mini .id {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--accent-2);
}
.card-mini .title {
  display: block;
  margin-top: 0.22rem;
  font-size: 0.8rem;
}
.card-mini .meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.dot {
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.64rem;
  padding: 0.08rem 0.35rem;
  font-family: "IBM Plex Mono", monospace;
}
.dot.green { border-color: rgba(109,255,176,.4); color: var(--ok); }
.dot.yellow { border-color: rgba(255,180,84,.4); color: var(--warn); }
.dot.red { border-color: rgba(255,107,107,.4); color: var(--danger); }
.stage {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 14px;
  padding: 0.75rem;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}
.stage:hover, .stage.active {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.stage .count {
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent);
  font-size: 0.78rem;
}
.stage .name { display: block; font-weight: 700; margin: 0.2rem 0; }
.stage .owner { color: var(--muted); font-size: 0.75rem; }

.two-col {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.tools {
  display: grid;
  gap: 0.6rem;
}
.tool {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.8rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.tool h4 { margin: 0; font-size: 0.95rem; }
.tool p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.82rem; }
.tool .meta {
  margin-top: 0.35rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--accent-2);
}

.pending, .decisions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.pending li, .decisions li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: rgba(0,0,0,.18);
  font-size: 0.88rem;
}
.pending li.critical { border-color: rgba(255,107,107,.45); }
.pending li.warning { border-color: rgba(255,180,84,.45); }
.pending li.info { border-color: rgba(57,198,162,.35); }
.decisions li {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
}

.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
input, select, textarea {
  width: 100%;
  background: #0f140f;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.68rem 0.78rem;
  font: inherit;
}
.filters input, .filters select { width: auto; min-width: 180px; }

.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.88rem;
}
th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0,0,0,.25);
}
.mono { font-family: "IBM Plex Mono", monospace; }
.actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.pill {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  width: min(640px, calc(100% - 2rem));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.65); }
.dialog-card { margin: 0; }
.dialog-card header, .dialog-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}
.dialog-card footer { border-bottom: 0; border-top: 1px solid var(--line); }
.dialog-card h3 { margin: 0; font-family: Archivo, sans-serif; }
.dialog-body {
  padding: 1rem;
  display: grid;
  gap: 0.7rem;
}
.dialog-body label { display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.dialog-body .check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}
.dialog-body .check input { width: auto; }
.dialog-tools { display: grid; gap: 0.45rem; }
.dialog-msg {
  margin: 0;
  padding: 0 1rem 1rem;
  color: var(--accent-2);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  min-height: 1.2em;
}

@media (max-width: 900px) {
  .hero-ops, .two-col { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  .bg-grid { opacity: 0.6; }
  .topbar {
    gap: 0.7rem;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 0.9rem;
  }
  .brand h1 { font-size: 1.02rem; }
  .brand p { font-size: 0.74rem; }
  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .top-actions .badge { grid-column: 1 / -1; justify-self: start; }
  .top-actions .btn { justify-content: center; width: 100%; min-height: 42px; }
  .layout {
    width: calc(100% - 1rem);
    margin-top: 0.7rem;
    margin-bottom: calc(2.5rem + env(safe-area-inset-bottom));
    gap: 0.75rem;
  }
  .hero-ops, .panel {
    border-radius: 14px;
    padding: 0.85rem;
  }
  .hero-ops h2 { font-size: 1.25rem; }
  .lede { font-size: 0.9rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.55rem; }
  .kpi { padding: 0.7rem; border-radius: 10px; }
  .kpi strong { font-size: 1.25rem; }
  .pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
  .kanban-wrap {
    grid-auto-columns: minmax(220px, 84vw);
  }
  .stage {
    min-height: 84px;
    border-radius: 10px;
    padding: 0.62rem;
  }
  .stage .count { font-size: 0.7rem; }
  .stage .name { font-size: 0.85rem; }
  .tool {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    border-radius: 10px;
  }
  .tool .btn { width: 100%; justify-content: center; min-height: 40px; }
  .filters { width: 100%; }
  .filters input, .filters select { width: 100%; min-width: 0; }

  .table-wrap {
    border: 0;
    overflow: visible;
  }
  table, thead, tbody, tr, td {
    display: block;
    width: 100%;
  }
  thead { display: none; }
  tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.6rem;
    margin-bottom: 0.6rem;
    background: rgba(0, 0, 0, 0.18);
  }
  td {
    border-bottom: 0;
    padding: 0.34rem 0;
    font-size: 0.83rem;
  }
  td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.67rem;
    margin-bottom: 0.14rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
  .actions .btn {
    min-height: 38px;
    font-size: 0.78rem;
  }
  dialog {
    width: calc(100% - 0.8rem);
    border-radius: 14px;
    margin-bottom: env(safe-area-inset-bottom);
  }
  .dialog-card header, .dialog-card footer {
    padding: 0.7rem 0.8rem;
  }
  .dialog-body {
    padding: 0.8rem;
    gap: 0.55rem;
  }
}
