:root {
  --bg: #f4efe6;
  --panel: #fffaf2;
  --panel-strong: #f8e6c5;
  --border: #d4c3a8;
  --text: #2f261c;
  --muted: #766754;
  --accent: #0f766e;
  --accent-strong: #0a5c56;
  --warning: #c67b17;
  --success: #2f855a;
  --shadow: 0 18px 40px rgba(63, 43, 14, 0.09);
  --radius: 24px;
}

:root[data-theme="dark"] {
  --bg: #1d1b17;
  --panel: #26231d;
  --panel-strong: #3c3529;
  --border: #4c4335;
  --text: #f5ecdb;
  --muted: #c0b39e;
  --accent: #4ec0b7;
  --accent-strong: #7fe0d7;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.density-compact .panel,
.density-compact .hero,
.density-compact .request-card {
  padding: 14px;
}

.density-compact .request-grid {
  gap: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 28%),
    linear-gradient(180deg, #f7f2ea 0%, #efe6d8 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.narrow-shell {
  max-width: 520px;
}

.hero,
.panel,
.stat-card,
.request-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  background: linear-gradient(135deg, #fefaf1 0%, #f7e4bc 100%);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.hero h1,
.panel h2,
.panel h3 {
  margin: 0;
}

.hero-text {
  margin: 10px 0 0;
  max-width: 720px;
  color: var(--muted);
}

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

.layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  background: var(--panel);
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-grid,
.form-grid,
.mini-form,
.directories-grid {
  display: grid;
  gap: 12px;
}

.filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

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

.mini-form {
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

.directories-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
}

.directories-stack {
  display: grid;
  gap: 14px;
}

.tabs-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab-button {
  border: 1px solid var(--border);
  background: #fff7ea;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.tab-button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tab-panel.active {
  display: block;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  font-size: 13px;
  color: var(--muted);
}

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

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.compact-select {
  width: auto;
  min-width: 120px;
  padding: 10px 12px;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff7ea;
}

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

.primary-button {
  background: var(--accent);
  color: white;
}

.secondary-button {
  background: var(--panel-strong);
  color: var(--text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}

.stats-grid-extended {
  margin-top: 12px;
}

.stat-card {
  background: rgba(255, 250, 242, 0.88);
  padding: 12px 14px;
  border-radius: 18px;
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.stat-value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

.request-list,
.sites-list {
  display: grid;
  gap: 14px;
}

.request-card {
  background: #fff;
  padding: 16px;
}

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

.request-title {
  margin: 0;
  font-size: 20px;
}

.request-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.request-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.request-metric {
  background: #faf4ea;
  border-radius: 14px;
  padding: 10px 12px;
}

.request-metric strong {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.request-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.status-select {
  border-radius: 999px;
  background: #fff7ea;
  border: 1px solid var(--border);
  padding: 12px 16px;
}

.status-select-card {
  min-width: 0;
  width: auto;
  max-width: 132px;
  padding: 8px 28px 8px 12px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.status-select-planned {
  background: #f3e8d0;
  color: #714b14;
}

.status-select-completed {
  background: #dcefdc;
  color: #1f6b42;
}

.status-select-false {
  background: #f0e1e1;
  color: #8a3a3a;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}

.status-planned,
.badge {
  background: #f3e8d0;
  color: #714b14;
}

.status-active {
  background: #d7f3ef;
  color: var(--accent-strong);
}

.status-done {
  background: #dcefdc;
  color: #1f6b42;
}

.site-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
}

.site-card h3 {
  margin: 0 0 6px;
}

.site-card p {
  margin: 0;
  color: var(--muted);
}

.mobile-summary {
  padding: 12px 14px;
  border-radius: 14px;
  background: #faf4ea;
  color: var(--muted);
  font-size: 14px;
}

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

.directories-panel section {
  min-width: 0;
}

.full-width {
  grid-column: 1 / -1;
}

.hidden {
  display: none;
}

.compact-details {
  padding: 14px 18px;
}

.compact-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 720px) {
  .hero {
    flex-direction: column;
  }

  .hero-actions,
  .request-actions {
    width: 100%;
  }

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

  .hero-actions button,
  .status-select,
  .request-actions button,
  .tab-button,
  .primary-button.full-width {
    flex: 1 1 100%;
  }
}
