:root {
  --bg: #f4f1ea;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #fffdf9;
  --line: #d5cec1;
  --line-strong: #c4b7a0;
  --text: #1f1b16;
  --muted: #675d52;
  --accent: #0d5c63;
  --accent-soft: #dcefee;
  --success-bg: #e8f3e8;
  --success-text: #2e5f32;
  --shadow: 0 20px 50px rgba(31, 27, 22, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(13, 92, 99, 0.14), transparent 28%),
    linear-gradient(180deg, #f8f4ec 0%, #efe7da 100%);
}

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

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 28px;
  padding: 32px 24px;
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  background: rgba(29, 33, 37, 0.92);
  color: #f7f2ea;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar h1 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1.05;
}

.sidebar-copy {
  color: rgba(247, 242, 234, 0.78);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar .eyebrow {
  color: rgba(255, 255, 255, 0.56);
}

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

.nav a {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.content {
  padding: 40px;
}

.hero,
.panel,
.card,
.page-header,
.metric-card,
.notice {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  margin-bottom: 24px;
}

.hero h2,
.page-header h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.95;
}

.hero p,
.page-header p,
.card p,
.panel li,
.helper-copy {
  color: var(--muted);
  font-size: 1.02rem;
}

.hero-panel {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  min-width: 220px;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.pill {
  background: var(--accent-soft);
  color: var(--accent);
}

.status {
  background: #edf3e8;
  color: #365b32;
}

.status-muted {
  background: #efebe2;
  color: #6b604d;
}

.metric-grid,
.section-grid,
.detail-grid {
  display: grid;
  gap: 18px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
}

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

.metric-grid.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  padding: 20px 22px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 1.9rem;
  line-height: 1;
}

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

.card,
.panel,
.page-header,
.notice {
  padding: 24px;
}

.compact-header h2 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}

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

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

.card-link {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
}

.filter-panel {
  margin-bottom: 24px;
}

.filter-form {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.filter-form-wide {
  flex-wrap: wrap;
}

.filter-form label,
.edit-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  min-width: 0;
}

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

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

.form-grid.four-cols {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-entry-form {
  gap: 18px;
}

.subpanel {
  padding: 18px;
  border: 1px solid #ebe3d5;
  border-radius: 18px;
  background: rgba(244, 241, 234, 0.45);
}

.filter-form label {
  flex: 1;
}

input,
select {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fffefb;
  color: var(--text);
}

button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #f9f8f5;
  cursor: pointer;
}

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

.data-table,
.subtable {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td,
.subtable th,
.subtable td {
  padding: 12px 10px;
  border-bottom: 1px solid #ebe3d5;
  text-align: left;
  vertical-align: top;
}

.data-table th,
.subtable th {
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.data-table tbody tr:hover {
  background: rgba(220, 239, 238, 0.25);
}

.compact-table th,
.compact-table td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.edit-form {
  display: grid;
  gap: 14px;
}

.notice.success {
  margin-bottom: 24px;
  background: var(--success-bg);
  color: var(--success-text);
}

.subrow td {
  padding: 0;
  border-bottom: 1px solid #ebe3d5;
}

.subtable-wrap {
  padding: 12px 14px 18px;
  background: rgba(244, 241, 234, 0.5);
}

.helper-copy {
  margin-top: 14px;
}

.table-action,
.table-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.table-action {
  border: 1px solid var(--line-strong);
  background: #fffefb;
  color: var(--accent);
}

.table-button {
  min-height: 40px;
}

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

.summary-item {
  padding: 14px 16px;
  border: 1px solid #ebe3d5;
  border-radius: 16px;
  background: rgba(244, 241, 234, 0.45);
}

.summary-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

.summary-item strong {
  font-size: 1.3rem;
}

.form-table td {
  vertical-align: middle;
}

.inline-edit-form {
  display: contents;
}

.form-table input {
  width: 100%;
  min-width: 0;
}

@media (max-width: 1100px) {
  .metric-grid,
  .metric-grid.two-up,
  .metric-grid.three-up,
  .section-grid,
  .detail-grid,
  .form-grid.two-cols,
  .form-grid.four-cols {
    grid-template-columns: 1fr;
  }
}

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

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

  .content {
    padding: 20px;
  }

  .hero,
  .filter-form {
    flex-direction: column;
  }
}
