:root {
  --bg: #eee6d8;
  --paper: #fffaf1;
  --ink: #1d1a16;
  --muted: #5d5347;
  --line: #d1beaa;
  --accent: #0f493f;
  --accent-hover: #0b352e;
  --accent-2: #b85f23;
  --warning: #88400e;
  --danger: #783030;
  --shadow: 0 14px 34px rgba(37, 29, 21, 0.1);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(184, 95, 35, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(15, 73, 63, 0.12), transparent 28%),
    linear-gradient(180deg, #f1e8d9 0%, #ece4d7 100%);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

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

.shell {
  max-width: 1680px;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 440px);
  background: var(--paper);
  border: 1px solid rgba(143, 118, 91, 0.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-title {
  margin-top: 18px;
  font-size: 42px;
  line-height: 1;
}

.login-copy {
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
  margin-bottom: 18px;
}

.hero-card,
.metrics,
.panel,
.tool-card,
.alert {
  background: var(--paper);
  border: 1px solid rgba(143, 118, 91, 0.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -70px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(20, 99, 86, 0.14), transparent 65%);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(20, 99, 86, 0.1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

.hero-title {
  margin-top: 14px;
  font-size: clamp(30px, 3.2vw, 42px);
  line-height: 1.04;
  max-width: 16ch;
}

.hero-copy {
  max-width: 64ch;
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.metrics {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.metric {
  padding: 11px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(248, 239, 226, 0.92));
  border: 1px solid rgba(103, 82, 60, 0.18);
}

.metric-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.metric-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
}

.metric-subtext {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.search input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  outline: none;
}

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

.chip {
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(143, 118, 91, 0.18);
  background: rgba(255, 250, 242, 0.95);
  color: #493f36;
}

.chip strong {
  color: var(--ink);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.tool-card {
  padding: 14px;
  display: grid;
  gap: 12px;
  border-radius: 14px;
}

.tool-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.tool-name {
  font-size: 22px;
  line-height: 1;
}

.tool-domain {
  color: var(--muted);
  margin-top: 8px;
  font-size: 14px;
}

.runtime {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(20, 99, 86, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.ready {
  background: rgba(20, 99, 86, 0.12);
  color: var(--accent);
}

.status.partial {
  background: rgba(213, 122, 54, 0.13);
  color: var(--warning);
}

.status.needs_discovery {
  background: rgba(141, 47, 47, 0.11);
  color: var(--danger);
}

.panel-status-stack {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.process-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(143, 118, 91, 0.18);
}

.process-badge small {
  color: var(--muted);
  font-weight: 700;
}

.process-badge.running {
  background: rgba(15, 73, 63, 0.1);
  color: var(--accent);
}

.process-badge.down {
  background: rgba(141, 47, 47, 0.1);
  color: var(--danger);
}

.process-badge.blocked {
  background: rgba(184, 95, 35, 0.12);
  color: var(--warning);
}

.tool-meta {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.tool-meta div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #f8f4ea;
  box-shadow: 0 12px 24px rgba(15, 73, 63, 0.22);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #fff8ed;
  border-color: #c9b49e;
  color: #171410;
}

.btn-danger {
  background: rgba(141, 47, 47, 0.08);
  border-color: rgba(141, 47, 47, 0.2);
  color: var(--danger);
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.panel {
  padding: 22px;
}

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

.panel-subtitle {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.section {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(249, 245, 237, 0.8), rgba(255, 253, 248, 0.95));
  border: 1px solid rgba(143, 118, 91, 0.12);
}

.section h3 {
  font-size: 18px;
}

.section-copy {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.95);
  color: var(--ink);
  padding: 14px 15px;
  font-size: 15px;
  outline: none;
}

.field textarea {
  min-height: 220px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.field small {
  color: var(--muted);
  font-size: 12px;
}

.cookie-guide {
  display: grid;
  gap: 9px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(143, 118, 91, 0.16);
  background: rgba(255, 250, 242, 0.86);
}

.cookie-guide-title,
.cookie-row-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cookie-guide p,
.detected-cookies {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.cookie-pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cookie-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(143, 118, 91, 0.18);
}

.cookie-pill.present {
  color: var(--accent);
  background: rgba(15, 73, 63, 0.1);
}

.cookie-pill.missing {
  color: var(--danger);
  background: rgba(120, 48, 48, 0.1);
}

.alert {
  padding: 14px 16px;
  margin-bottom: 18px;
  color: var(--ink);
}

.alert.success {
  border-left: 4px solid var(--accent);
}

.alert.error {
  border-left: 4px solid var(--danger);
}

.inline-list {
  display: grid;
  gap: 10px;
}

.file-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.file-pill {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(143, 118, 91, 0.12);
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.helper {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.process-details {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.process-details div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.process-details strong {
  color: var(--ink);
  text-align: right;
}

.process-form {
  margin-top: 16px;
}

.iframe-shell {
  margin-top: 18px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(143, 118, 91, 0.18);
  background: rgba(255, 250, 242, 0.8);
}

.iframe-shell iframe {
  width: 100%;
  min-height: 720px;
  border: 0;
}

.top-actions {
  margin-bottom: 14px;
}

.monitor-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 560px;
  gap: 16px;
  margin-bottom: 16px;
}

.compact-hero {
  padding: 18px;
}

.monitor-title {
  margin-top: 12px;
  font-size: clamp(30px, 3vw, 46px);
  line-height: 1.02;
}

.compact-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.monitor-panel {
  padding: 0;
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

.monitor-table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
}

.monitor-table th,
.monitor-table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(143, 118, 91, 0.16);
  text-align: left;
  vertical-align: top;
}

.monitor-table th {
  color: #3d342b;
  background: rgba(241, 230, 216, 0.8);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.monitor-table td strong {
  display: block;
  font-size: 15px;
}

.monitor-table td span,
.muted {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.monitor-table small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.probe {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 66px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px !important;
  font-weight: 800;
}

.probe.good {
  color: #f8f4ea !important;
  background: var(--accent);
}

.probe.warn {
  color: #fff7ec !important;
  background: var(--warning);
}

.probe.bad {
  color: #fff4f2 !important;
  background: var(--danger);
}

.probe.unknown {
  color: #2b241d !important;
  background: #e2d6c8;
}

.target-cell {
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

.btn-small {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12px;
}

.empty-state {
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.75);
  border: 1px dashed rgba(143, 118, 91, 0.35);
}

@media (max-width: 1080px) {
  .hero,
  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1240px) {
  .hero,
  .monitor-hero {
    grid-template-columns: 1fr;
  }

  .tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 20px 14px 48px;
  }

  .toolbar,
  .metrics,
  .compact-metrics,
  .tools-grid {
    grid-template-columns: 1fr;
  }

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

  .panel-header,
  .tool-top {
    flex-direction: column;
    align-items: start;
  }

  .panel-status-stack {
    justify-items: start;
  }

  .hero-title {
    max-width: none;
  }
}
