:root {
  --bg-main: #fbf5ea;
  --bg-alt: #efe2cc;
  --panel: rgba(255, 253, 247, 0.92);
  --line: rgba(25, 19, 11, 0.14);
  --text-main: #1f1a13;
  --text-soft: #5f5648;
  --accent: #cc4f13;
  --accent-2: #0e8a75;
  --danger: #9f1f1f;
  --ok: #1d7b52;
  --warning: #8a6507;
  --shadow-soft: 0 14px 34px rgba(29, 17, 5, 0.12);
  --shadow-deep: 0 24px 60px rgba(29, 17, 5, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 9%, rgba(14, 138, 117, 0.15), transparent 34%),
    radial-gradient(circle at 92% 6%, rgba(204, 79, 19, 0.17), transparent 30%),
    linear-gradient(150deg, var(--bg-main), var(--bg-alt));
  position: relative;
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: "Syne", "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 0.5rem;
}

h2 {
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  margin-bottom: 0.9rem;
}

.subtitle {
  color: var(--text-soft);
  margin-top: 0;
}

.eyebrow {
  margin: 0 0 0.45rem;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.admin-body {
  overflow-x: hidden;
}

.admin-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(125deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%),
    linear-gradient(305deg, rgba(0, 0, 0, 0.03) 25%, transparent 25%);
  background-size: 22px 22px, 26px 26px;
  opacity: 0.35;
  z-index: 0;
}

.admin-shell {
  width: min(1260px, calc(100% - 2rem));
  margin: 1.6rem auto 2.2rem;
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.admin-header {
  padding: 1.2rem 1.3rem;
  display: flex;
  gap: 1rem;
  align-items: start;
  justify-content: space-between;
}

.shop-chip {
  background: linear-gradient(130deg, rgba(204, 79, 19, 0.14), rgba(14, 138, 117, 0.14));
  border: 1px solid rgba(25, 19, 11, 0.17);
  border-radius: 16px;
  padding: 0.8rem 0.95rem;
  min-width: 210px;
}

.shop-chip span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.shop-chip strong {
  font-size: 0.95rem;
}

.alert {
  margin: 0.9rem 0;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 600;
}

.alert-success {
  color: #124834;
  background: rgba(61, 187, 141, 0.22);
  border-color: rgba(29, 123, 82, 0.36);
}

.alert-error {
  color: #5f1717;
  background: rgba(196, 70, 70, 0.19);
  border-color: rgba(159, 31, 31, 0.35);
}

.kpi-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card {
  padding: 0.9rem 0.95rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.85), rgba(247, 235, 219, 0.95));
  border: 1px solid rgba(25, 19, 11, 0.14);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.kpi-card .k {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-card .v {
  margin: 0.4rem 0 0;
  font-size: 1.5rem;
  font-family: "Syne", "Segoe UI", sans-serif;
  font-weight: 800;
}

.setup-banner {
  margin-top: 0.9rem;
  padding: 1rem;
}

.setup-title {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}

.setup-text {
  margin: 0.5rem 0 0;
  font-size: 1.02rem;
  font-weight: 600;
}

.setup-ok {
  border-left: 7px solid rgba(29, 123, 82, 0.8);
}

.setup-blocked {
  border-left: 7px solid rgba(159, 31, 31, 0.78);
}

.issue-list {
  margin: 0.8rem 0 0;
  padding-left: 1.2rem;
  color: #6e2317;
}

.issue-list li {
  margin-bottom: 0.28rem;
}

.workspace-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.95rem;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.config-panel {
  grid-column: span 8;
  padding: 1rem;
}

.actions-panel {
  grid-column: span 4;
  padding: 1rem;
}

.logs-panel {
  grid-column: span 12;
  padding: 1rem;
}

.toggle-row {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0.6rem;
}

.toggle-row label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 0.74rem;
  border: 1px solid rgba(25, 19, 11, 0.15);
  border-radius: 12px;
  margin: 0;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.93rem;
}

label {
  display: block;
  font-weight: 600;
  margin: 0.62rem 0 0.28rem;
}

.toggle-row input {
  width: auto;
  margin: 0;
}

.form-grid {
  display: grid;
  gap: 0.62rem 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

input,
select,
button,
textarea {
  width: 100%;
  border: 1px solid rgba(25, 19, 11, 0.2);
  border-radius: 12px;
  padding: 0.62rem 0.72rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(14, 138, 117, 0.3);
  border-color: rgba(14, 138, 117, 0.7);
}

button {
  margin-top: 0.9rem;
  border: none;
  cursor: pointer;
  font-weight: 700;
  color: #fff9f2;
  background: linear-gradient(125deg, #bd3f16, #de6b24);
  box-shadow: 0 10px 22px rgba(180, 72, 18, 0.26);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(180, 72, 18, 0.32);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: linear-gradient(120deg, #155d74, #0f8376);
  box-shadow: 0 10px 22px rgba(14, 118, 112, 0.25);
}

.webhook-box {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px dashed rgba(25, 19, 11, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.62rem;
  border-bottom: 1px solid rgba(25, 19, 11, 0.14);
}

th {
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.55);
}

.status-pill {
  display: inline-block;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-ok {
  color: #0a4b2f;
  background: rgba(76, 200, 132, 0.24);
}

.status-warning {
  color: #5a4607;
  background: rgba(238, 202, 83, 0.28);
}

.status-error {
  color: #6f1616;
  background: rgba(231, 102, 102, 0.24);
}

/* Legacy layout helpers kept for the home screen */
.wrap {
  width: min(1100px, calc(100% - 2rem));
  margin: 2rem auto;
}

.hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.4rem;
  box-shadow: var(--shadow-soft);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow-soft);
}

.col-4 {
  grid-column: span 4;
}

.col-6 {
  grid-column: span 6;
}

.col-8 {
  grid-column: span 8;
}

.col-12 {
  grid-column: span 12;
}

/* Entry motion for dashboard sections */
[class^="reveal-"] {
  opacity: 0;
  transform: translateY(16px) scale(0.99);
  animation: rise 0.7s cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}

.reveal-1 {
  animation-delay: 0.05s;
}

.reveal-2 {
  animation-delay: 0.12s;
}

.reveal-3 {
  animation-delay: 0.18s;
}

.reveal-4 {
  animation-delay: 0.26s;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .config-panel,
  .actions-panel {
    grid-column: span 12;
  }
}

@media (max-width: 760px) {
  .admin-shell {
    width: min(100%, calc(100% - 1rem));
  }

  .admin-header {
    flex-direction: column;
  }

  .shop-chip {
    width: 100%;
    min-width: 0;
  }

  .kpi-grid,
  .form-grid,
  .toggle-row {
    grid-template-columns: 1fr;
  }

  .col-4,
  .col-6,
  .col-8 {
    grid-column: span 12;
  }
}
