:root {
  /* Brand inks derived from the provided CMYK swatches */
  --brand-dark: #263038;
  --brand-dark-rgb: 38, 48, 56;
  --brand-dark-soft: #33414b;
  --accent: #a38220;
  --accent-rgb: 163, 130, 32;
  --accent-dark: #7f6317;
  --canvas: #f5f1e8;
  --canvas-deep: #ece5d8;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-muted: rgba(248, 244, 237, 0.95);
  --line: rgba(38, 48, 56, 0.12);
  --line-strong: rgba(163, 130, 32, 0.28);
  --text: #263038;
  --muted: #61707a;
  --shadow: 0 24px 48px rgba(38, 48, 56, 0.08);
  --shadow-soft: 0 14px 28px rgba(38, 48, 56, 0.05);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(var(--brand-dark-rgb), 0.1), transparent 20%),
    linear-gradient(180deg, var(--canvas) 0%, var(--canvas-deep) 100%);
}

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

img {
  display: block;
  max-width: 100%;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 28px 22px;
  display: grid;
  gap: 22px;
  color: #f8f4ed;
  background:
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.18), transparent 26%),
    linear-gradient(180deg, #243038 0%, #2d3942 52%, #34424d 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 4px solid rgba(var(--accent-rgb), 0.9);
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.16), transparent 38%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 28px rgba(15, 19, 22, 0.22);
}

.brand small,
.hint {
  color: rgba(248, 244, 237, 0.68);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 700;
}

.brand h2,
.page-head h1,
.panel h2,
.hero-card h2 {
  font-family: "Iowan Old Style", Georgia, serif;
  font-weight: 700;
}

.brand h2 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.02;
}

.brand-note {
  margin: 0;
  color: rgba(248, 244, 237, 0.84);
  font-size: 0.95rem;
  line-height: 1.5;
}

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

.nav a {
  padding: 14px 15px;
  border-radius: 16px;
  border: 1px solid transparent;
  color: rgba(248, 244, 237, 0.88);
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.nav a:hover,
.nav a.active {
  color: #fff;
  border-color: rgba(var(--accent-rgb), 0.32);
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.28), rgba(255, 255, 255, 0.1));
  box-shadow: inset 3px 0 0 rgba(var(--accent-rgb), 1);
}

.nav a:hover {
  transform: translateX(2px);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-foot a {
  color: rgba(248, 244, 237, 0.84);
}

.sidebar-foot a:hover {
  color: #fff;
}

.main-shell {
  display: grid;
  gap: 22px;
  align-content: start;
  padding: 32px clamp(18px, 3vw, 40px) 42px;
}

.page-head,
.notice,
.page-stack {
  width: min(100%, 1320px);
  margin-inline: auto;
}

.page-stack {
  display: grid;
  gap: 24px;
}

.page-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  padding: 30px 32px;
  border-radius: 30px;
  border: 1px solid rgba(var(--accent-rgb), 0.26);
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.22), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.99), rgba(246, 241, 232, 0.98));
  box-shadow: 0 28px 52px rgba(38, 48, 56, 0.1);
}

.page-head::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(var(--accent-rgb), 0.7) 34%, rgba(var(--accent-rgb), 0) 76%);
}

.page-head-main {
  display: grid;
  gap: 10px;
  max-width: 780px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.03;
}

.page-subtitle {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

.actions {
  align-content: flex-start;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 17px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 241, 234, 0.98));
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(38, 48, 56, 0.07);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 12px 24px rgba(38, 48, 56, 0.1);
}

.btn.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #1f2b33 0%, #32404a 52%, var(--accent) 100%);
  box-shadow: 0 18px 34px rgba(38, 48, 56, 0.24);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.96);
}

.btn.danger {
  color: var(--brand-dark);
  border-color: rgba(var(--accent-rgb), 0.42);
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(249, 240, 218, 0.98));
  box-shadow: none;
}

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), 0.24);
  outline-offset: 2px;
}

.metrics,
.grid-2,
.grid-3,
.cards,
.filters,
.gallery,
.sheet-grid,
.stack,
.history-list,
.meta-list {
  display: grid;
  gap: 20px;
}

.metrics {
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 18px;
}

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

.grid-3,
.cards {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.filters {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  align-items: end;
}

.sheet-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.95fr);
}

.panel,
.metric-card,
.hero-card {
  position: relative;
  overflow: hidden;
  padding: 24px 24px 22px;
  border-radius: var(--radius);
  border: 1px solid rgba(38, 48, 56, 0.08);
  background:
    linear-gradient(180deg, var(--panel) 0%, var(--panel-muted) 100%);
  box-shadow: 0 18px 34px rgba(38, 48, 56, 0.06);
}

.panel::before,
.metric-card::before,
.hero-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 124px;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), rgba(var(--accent-rgb), 0));
}

.metric-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 136px;
}

.metric-card::after {
  content: "";
  position: absolute;
  top: -18px;
  right: -18px;
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.28), rgba(var(--accent-rgb), 0));
}

.metric-card strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(2.1rem, 4vw, 2.85rem);
  line-height: 1;
  font-family: "Iowan Old Style", Georgia, serif;
  color: var(--brand-dark);
}

.hero-card {
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.22), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(247, 241, 231, 0.98));
}

.panel h2,
.hero-card h2,
.auth-card h1 {
  margin: 10px 0 14px;
  font-size: clamp(1.55rem, 2vw, 2.1rem);
  line-height: 1.12;
}

.panel h3,
.hero-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.subtitle,
.field-help,
.empty {
  color: var(--muted);
}

.subtitle,
.field-help {
  line-height: 1.55;
}

.empty {
  font-size: 0.96rem;
}

.cards > a.panel {
  display: grid;
  gap: 10px;
  min-height: 100%;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.cards > a.panel:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-rgb), 0.32);
  box-shadow: var(--shadow);
}

form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

input::placeholder,
textarea::placeholder {
  color: #8c979f;
}

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

select[multiple] {
  min-height: 160px;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(38, 48, 56, 0.08);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(38, 48, 56, 0.08);
}

th {
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

tbody tr:nth-child(even) td {
  background: rgba(var(--accent-rgb), 0.035);
}

tbody tr:hover td {
  background: rgba(var(--accent-rgb), 0.09);
}

td div + div {
  margin-top: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 800;
}

.badge.success,
.badge.danger {
  border-color: rgba(var(--brand-dark-rgb), 0.16);
  background: rgba(var(--brand-dark-rgb), 0.08);
  color: var(--brand-dark);
}

.badge.warn {
  border-color: rgba(var(--accent-rgb), 0.22);
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent-dark);
}

.badge.muted {
  border-color: rgba(var(--brand-dark-rgb), 0.1);
  background: rgba(var(--brand-dark-rgb), 0.05);
  color: var(--muted);
}

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

.thumb {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(38, 48, 56, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

.thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.thumb-body {
  padding: 12px 14px;
}

.history-item,
.stack > div {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(38, 48, 56, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.page-stack > .panel,
.page-stack > .grid-2,
.page-stack > .metrics {
  animation: rise-in 240ms ease-out both;
}

.notice {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  background: linear-gradient(180deg, rgba(255, 248, 235, 0.98), rgba(249, 240, 216, 0.96));
  color: var(--brand-dark);
  box-shadow: var(--shadow-soft);
}

.meta-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(var(--accent-rgb), 0.28);
}

.meta-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.sheet-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(18, 24, 28, 0.86);
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: min(1120px, 92vw);
  max-height: 86vh;
  border-radius: 18px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px;
  background:
    radial-gradient(circle at top, rgba(var(--accent-rgb), 0.18), transparent 34%),
    linear-gradient(180deg, var(--canvas) 0%, var(--canvas-deep) 100%);
}

.auth-card {
  width: min(560px, 100%);
}

@media (max-width: 1280px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow: auto;
    padding-bottom: 4px;
  }

  .nav a {
    white-space: nowrap;
  }

  .sidebar-foot {
    margin-top: 0;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .grid-3,
  .cards {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 860px) {
  .main-shell {
    padding: 18px 16px 32px;
  }

  .page-head {
    padding: 22px;
    flex-direction: column;
  }

  .metrics,
  .grid-2,
  .grid-3,
  .cards,
  .filters,
  .sheet-grid {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 640px;
  }
}

@media (max-width: 640px) {
  .sidebar {
    padding: 18px 16px;
  }

  .page-head,
  .panel,
  .metric-card,
  .hero-card {
    border-radius: 20px;
  }

  .panel,
  .metric-card,
  .hero-card {
    padding: 20px;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
