:root {
  --bg: #f6f1e8;
  --panel: rgba(255, 252, 247, 0.94);
  --panel-strong: #fffdf9;
  --ink: #1a2428;
  --muted: #647177;
  --line: rgba(26, 36, 40, 0.12);
  --accent: #0d6b5f;
  --accent-deep: #08453f;
  --accent-soft: rgba(13, 107, 95, 0.12);
  --gold: #ca7e2f;
  --gold-soft: rgba(202, 126, 47, 0.12);
  --danger: #b24a3a;
  --warning: #9a6414;
  --shadow: 0 20px 50px rgba(26, 36, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(202, 126, 47, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(13, 107, 95, 0.15), transparent 34%),
    linear-gradient(135deg, #f7f2e9 0%, #ece4d7 100%);
  font-family: "Segoe UI", "Noto Sans TC", sans-serif;
}

.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 30px 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 248, 238, 0.84);
  backdrop-filter: blur(18px);
}

.brand-kicker,
.eyebrow,
.section-kicker,
.metric-label {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 700;
}

.brand h1 {
  margin: 10px 0 8px;
}

.brand-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.nav {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.nav a {
  display: block;
  padding: 13px 15px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.56);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.nav a:hover,
.nav a.active {
  transform: translateY(-1px);
  border-color: rgba(13, 107, 95, 0.3);
  background: linear-gradient(135deg, rgba(13, 107, 95, 0.12), rgba(202, 126, 47, 0.12));
}

.content {
  padding: 30px;
}

.flash {
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(13, 107, 95, 0.22);
  border-radius: 18px;
  background: rgba(13, 107, 95, 0.1);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(13, 107, 95, 0.14), rgba(202, 126, 47, 0.16));
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.hero h2 {
  margin: 8px 0 10px;
  font-size: 34px;
}

.lede {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions,
.inline-actions {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card,
.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card,
.metric {
  padding: 22px;
}

.panel {
  padding: 22px;
  margin-bottom: 24px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h3,
.card h3,
.metric h3 {
  margin: 0;
}

.primary,
.secondary,
.ghost,
button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
}

.primary,
button.primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

.secondary {
  color: var(--ink);
  background: linear-gradient(135deg, rgba(202, 126, 47, 0.16), rgba(255, 255, 255, 0.85));
  border: 1px solid rgba(202, 126, 47, 0.25);
}

.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.button-form {
  display: inline;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: var(--panel-strong);
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(26, 36, 40, 0.03);
}

tbody tr:hover {
  background: rgba(13, 107, 95, 0.04);
}

.mono {
  font-family: "Cascadia Code", "Consolas", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ready,
.badge.sent,
.badge.none,
.badge.hold,
.badge.uptrend,
.badge.strong_uptrend {
  color: var(--accent-deep);
  background: rgba(13, 107, 95, 0.12);
}

.badge.filtered_out,
.badge.skipped,
.badge.weaking,
.badge.exit_watch,
.badge.reduce,
.badge.warning {
  color: var(--warning);
  background: rgba(154, 100, 20, 0.12);
}

.badge.failed,
.badge.active,
.badge.exit_now,
.badge.downtrend {
  color: var(--danger);
  background: rgba(178, 74, 58, 0.12);
}

.stack {
  display: grid;
  gap: 6px;
}

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

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

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

.field label {
  font-weight: 700;
}

.field small {
  color: var(--muted);
  line-height: 1.5;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.checkbox-row input {
  width: auto;
}

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

.note,
.empty-state {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(26, 36, 40, 0.04);
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.status-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

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

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

  .content {
    padding: 20px;
  }

  .hero {
    flex-direction: column;
  }

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