:root {
  --bg: #f2ede3;
  --panel: rgba(255, 250, 242, 0.78);
  --panel-strong: #fff9f0;
  --sidebar: #16231f;
  --sidebar-soft: #22352f;
  --text: #1d1b18;
  --muted: #5f584f;
  --accent: #db6b2f;
  --accent-dark: #a74816;
  --line: rgba(29, 27, 24, 0.12);
  --success: #28745d;
  --shadow: 0 20px 50px rgba(38, 27, 14, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(219, 107, 47, 0.22), transparent 25%),
    radial-gradient(circle at bottom right, rgba(22, 35, 31, 0.18), transparent 22%),
    var(--bg);
}

body.auth-required .app-shell {
  display: none;
}

body.auth-required .auth-shell {
  display: grid;
}

button,
input {
  font: inherit;
}

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

.page {
  display: none;
}

.page-active {
  display: block;
}

.auth-shell {
  display: none;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.auth-card {
  width: min(460px, 100%);
  padding: 1.75rem;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 28px;
  background: rgba(255, 249, 240, 0.9);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.auth-copy {
  color: var(--muted);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem;
  color: #eff6f0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    var(--sidebar);
}

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

.sidebar .eyebrow {
  color: #f2b088;
}

.sidebar h1,
.topbar h2,
.hero-card h3,
.panel h3,
.modal h3 {
  margin: 0;
  line-height: 1.05;
}

.sidebar-copy,
.sidebar-note-copy,
.hero-copy,
.form-note,
.panel-copy {
  color: var(--muted);
  line-height: 1.5;
}

.sidebar-copy,
.sidebar-note-copy {
  color: rgba(239, 246, 240, 0.72);
}

.nav {
  display: grid;
  gap: 0.75rem;
}

.nav-item {
  padding: 0.95rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  color: inherit;
  text-align: left;
  background: var(--sidebar-soft);
}

.nav-item-active {
  border-color: rgba(242, 176, 136, 0.4);
  background: rgba(242, 176, 136, 0.1);
}

.sidebar-note {
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-note-label {
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.main-content {
  padding: 2rem;
}

.topbar,
.hero-card,
.stats-grid,
.panel-grid {
  margin-bottom: 1.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hero-card,
.stat-card,
.panel,
.modal-card {
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem;
}

.hero-card h3 {
  max-width: 14ch;
  font-size: clamp(1.9rem, 4vw, 3.3rem);
}

.hero-copy {
  max-width: 520px;
  margin: 0;
}

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

.stat-card {
  padding: 1.25rem;
}

.stat-label {
  margin: 0 0 0.6rem;
  color: var(--muted);
}

.stat-value {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  font-weight: 700;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  gap: 1rem;
}

.panel-grid-single {
  grid-template-columns: 1fr;
}

.panel {
  padding: 1.25rem;
}

.panel-large {
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.95rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
}

.next-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.8;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.action-panel {
  display: grid;
  gap: 0.9rem;
}

.hero-card-tight h3 {
  max-width: 18ch;
}

.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  padding: 0.95rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 12px 28px rgba(167, 72, 22, 0.28);
}

.secondary-button {
  color: var(--text);
  background: rgba(29, 27, 24, 0.08);
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(29, 27, 24, 0.08);
}

.modal {
  width: min(560px, calc(100vw - 2rem));
  padding: 0;
  border: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(12, 12, 12, 0.45);
  backdrop-filter: blur(5px);
}

.modal-card {
  width: 100%;
  padding: 1.5rem;
  background: var(--panel-strong);
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0 1rem;
}

label {
  display: grid;
  gap: 0.5rem;
  font-weight: 500;
}

input {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

input:focus {
  outline: 2px solid rgba(219, 107, 47, 0.35);
  border-color: rgba(219, 107, 47, 0.55);
}

.form-note {
  margin: 0 0 1.25rem;
}

.status-good {
  color: var(--success);
}

.status-bad {
  color: #9c341c;
}

@media (max-width: 1080px) {
  .stats-grid,
  .panel-grid,
  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-large {
    grid-column: 1 / -1;
  }
}

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

  .sidebar,
  .main-content {
    padding: 1.25rem;
  }

  .topbar,
  .hero-card,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid,
  .panel-grid,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .hero-card h3 {
    max-width: none;
  }
}
