:root {
  --bg: #f3eee5;
  --bg-deep: #e7dcca;
  --surface: rgba(255, 252, 246, 0.94);
  --surface-2: #f6efe4;
  --surface-3: #efe5d6;
  --line: #d5c8b6;
  --line-strong: #bead95;
  --text: #241d16;
  --muted: #6d6457;
  --accent: #a64e32;
  --accent-strong: #874028;
  --accent-soft: rgba(166, 78, 50, 0.12);
  --teal: #1f6d68;
  --teal-soft: rgba(31, 109, 104, 0.12);
  --warning: #9e6b14;
  --warning-soft: rgba(158, 107, 20, 0.13);
  --danger: #a6372b;
  --danger-soft: rgba(166, 55, 43, 0.12);
  --success: #3d7c43;
  --success-soft: rgba(61, 124, 67, 0.12);
  --shadow: 0 18px 44px rgba(48, 34, 17, 0.08);
  --shadow-soft: 0 8px 24px rgba(48, 34, 17, 0.05);
  --radius: 22px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font: 15px/1.6 "Aptos", "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(166, 78, 50, 0.16), transparent 24%),
    radial-gradient(circle at right top, rgba(31, 109, 104, 0.12), transparent 22%),
    linear-gradient(180deg, #f8f3eb 0%, var(--bg) 100%);
}

h1,
h2,
h3,
.brand-title,
.stat-card strong,
.kpi-card strong,
.info-card strong {
  font-family: "Bahnschrift", "Aptos Display", "Trebuchet MS", sans-serif;
}

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

a:hover {
  color: var(--accent-strong);
}

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

button {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  background: linear-gradient(135deg, var(--accent), #c76a48);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

button:hover {
  filter: brightness(1.03);
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: #fffdfa;
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(166, 78, 50, 0.08);
}

textarea {
  resize: vertical;
  min-height: 112px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

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

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.shell-public {
  grid-template-columns: 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 28px 22px;
  background:
    linear-gradient(180deg, rgba(32, 25, 19, 0.98), rgba(47, 36, 26, 0.98)),
    #241c15;
  color: #f8f4ee;
}

.sidebar-top {
  display: grid;
  gap: 16px;
}

.sidebar-note {
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 244, 238, 0.78);
  font-size: 13px;
  line-height: 1.5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #e3945f);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: var(--shadow-soft);
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.brand-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(248, 244, 238, 0.7);
}

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

.nav a {
  border-radius: 14px;
  padding: 12px 14px;
  color: rgba(248, 244, 238, 0.84);
  font-weight: 600;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(2px);
}

.nav a.active {
  background: linear-gradient(135deg, rgba(166, 78, 50, 0.92), rgba(225, 136, 89, 0.9));
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.user-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.09);
}

.user-name {
  font-weight: 700;
}

.user-role {
  margin-top: 3px;
  font-size: 13px;
  color: rgba(248, 244, 238, 0.72);
}

.content {
  min-width: 0;
  padding: 28px;
}

.content-public {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.content-inner {
  display: grid;
  gap: 22px;
}

.public-header {
  margin-bottom: 18px;
  padding: 10px 0 4px;
}

.public-brand .brand-subtitle {
  color: var(--muted);
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

.page-head h1,
.hero-card h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.02;
}

.page-lead {
  max-width: 840px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

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

.hero-surface,
.panel,
.stat-card,
.info-card,
.hero-card,
.form-card {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-surface {
  padding: 26px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 420px);
  gap: 18px;
}

.dashboard-highlight {
  padding: 28px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(166, 78, 50, 0.1), rgba(31, 109, 104, 0.12)),
    rgba(255, 252, 246, 0.92);
}

.dashboard-highlight h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
}

.dashboard-highlight p:last-child {
  margin-bottom: 0;
}

.kpi-stack {
  display: grid;
  gap: 12px;
}

.kpi-card {
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-2);
}

.kpi-card span,
.stat-card span,
.info-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 700;
}

.kpi-card strong,
.stat-card strong,
.info-card strong {
  display: block;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1;
}

.kpi-card p,
.stat-card p,
.info-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.stat-card {
  padding: 20px;
}

.stat-card.danger strong {
  color: var(--danger);
}

.stat-card.warning strong {
  color: var(--warning);
}

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

.info-card {
  padding: 18px 20px;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.grid-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.layout-split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.92fr);
  gap: 20px;
}

.single-panel-row {
  margin-top: 4px;
}

.sticky-panel {
  position: sticky;
  top: 28px;
  align-self: start;
}

.panel {
  padding: 22px;
}

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

.panel-head h2,
.subpanel h3 {
  margin: 0;
}

.panel-intro {
  margin: 0 0 16px;
  color: var(--muted);
}

.panel-note {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text);
}

.panel-note a {
  font-weight: 700;
}

.ghost-button,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 14px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  color: var(--text);
  font-weight: 700;
  box-shadow: none;
}

.ghost-button:hover,
.ghost-link:hover {
  background: #fff;
}

.sidebar .ghost-button,
.sidebar .ghost-link,
.sidebar-logout {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.sidebar .ghost-button:hover,
.sidebar .ghost-link:hover,
.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.auth-panel {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(420px, 520px);
  gap: 32px;
  align-items: stretch;
}

.hero-card {
  padding: 44px;
  background:
    linear-gradient(135deg, rgba(166, 78, 50, 0.1), rgba(31, 109, 104, 0.12)),
    rgba(255, 252, 246, 0.94);
}

.form-card {
  padding: 32px;
  display: grid;
  gap: 16px;
}

.auth-hero {
  display: grid;
  align-content: center;
  gap: 18px;
}

.auth-form {
  width: 100%;
  max-width: 520px;
  justify-self: end;
  align-content: start;
}

.auth-form-head h2 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.08;
}

.auth-form-head p {
  margin: 0;
}

.auth-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.auth-steps {
  list-style: decimal;
}

.auth-actions {
  display: grid;
  gap: 12px;
}

.auth-actions.stacked {
  align-content: start;
}

.auth-link {
  min-height: 50px;
}

.form-note {
  margin: 0;
}

.status-card {
  align-content: center;
}

.request-stack,
.entity-list,
.part-list,
.subpanel,
.media-group {
  display: grid;
  gap: 12px;
}

.subpanel + .subpanel {
  margin-top: 18px;
}

.request-card,
.list-row,
.part-card,
.code-block,
.media-card,
.empty-state {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-2);
}

.request-card {
  display: grid;
  gap: 12px;
}

.request-head,
.list-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 13px;
}

.list-row-link {
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.list-row-link:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.list-row-wrap {
  flex-wrap: wrap;
}

.list-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.step-editor {
  align-items: stretch;
}

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

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

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-2);
}

.summary-row span {
  color: var(--muted);
}

.summary-row strong {
  text-align: right;
  font-size: 14px;
}

.action-stack {
  display: grid;
  gap: 10px;
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td strong {
  display: inline-block;
  margin-bottom: 2px;
}

.stack-form,
.compact-form {
  display: grid;
  gap: 14px;
}

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

.inline-form,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-bar {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-2);
}

.filter-bar > * {
  flex: 1 1 180px;
}

.filter-bar > button,
.filter-bar > .ghost-link,
.filter-bar > .ghost-button {
  flex: 0 0 auto;
}

.filter-bar-soft {
  background: rgba(31, 109, 104, 0.08);
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.flex-grow {
  flex: 1 1 320px;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
}

.code-block pre {
  margin: 0;
  white-space: pre-wrap;
  font: 13px/1.5 Consolas, "Cascadia Code", monospace;
}

.row-actions,
.inline-danger {
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: var(--teal-soft);
  color: var(--teal);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.flash {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
}

.flash-info {
  background: var(--teal-soft);
  border-color: rgba(31, 109, 104, 0.22);
}

.flash-success {
  background: var(--success-soft);
  border-color: rgba(61, 124, 67, 0.24);
}

.flash-error {
  background: var(--danger-soft);
  border-color: rgba(166, 55, 43, 0.24);
}

@media (max-width: 1260px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid-three,
  .dashboard-hero {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    gap: 18px;
    padding-bottom: 22px;
  }

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

  .nav a:hover {
    transform: none;
  }

  .sidebar-footer {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .auth-panel,
  .grid-two,
  .layout-split {
    grid-template-columns: 1fr;
  }

  .sticky-panel {
    position: static;
  }

  .hero-card,
  .form-card {
    padding: 30px;
  }

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

@media (max-width: 780px) {
  .content,
  .content-public {
    padding: 18px;
  }

  .content-inner {
    gap: 18px;
  }

  .public-header {
    margin-bottom: 6px;
  }

  .page-head {
    align-items: start;
    flex-direction: column;
  }

  .page-actions {
    justify-content: flex-start;
  }

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

  .sidebar-footer {
    grid-template-columns: 1fr;
  }

  .request-head,
  .summary-row,
  .list-row,
  .reject-form {
    flex-direction: column;
    align-items: start;
  }

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

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    margin-bottom: 12px;
    padding: 14px;
    border-radius: 16px;
    background: var(--surface-2);
  }

  .responsive-table td {
    padding: 8px 0;
    border-bottom: 1px dashed rgba(109, 100, 87, 0.22);
  }

  .responsive-table td:last-child {
    border-bottom: 0;
  }

  .responsive-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
}

@media (max-width: 560px) {
  .sidebar,
  .panel,
  .hero-card,
  .form-card,
  .hero-surface,
  .stat-card,
  .info-card {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .auth-panel {
    gap: 18px;
  }

  .brand-title {
    font-size: 20px;
  }

  .auth-form-head h2 {
    font-size: 26px;
  }

  .summary-row strong,
  .list-meta {
    text-align: left;
  }
}
