:root {
  --bg: #f5f3ee;
  --bg-accent: radial-gradient(circle at top right, #ffd089 0%, #f5f3ee 43%),
    linear-gradient(135deg, #f0e7d8 0%, #f8f5ef 45%, #eee7da 100%);
  --panel: #fffefb;
  --ink: #1f1d1a;
  --ink-soft: #6c6559;
  --line: #d8cebd;
  --primary: #0a7a69;
  --primary-ink: #ecfffc;
  --warn: #d97706;
  --error: #b91c1c;
  --ok: #166534;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Manrope, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg-accent);
}

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

.wrap {
  width: min(1320px, 96vw);
  margin: 0 auto;
}

.topbar {
  background: rgba(255, 254, 251, 0.94);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 60px;
  gap: 12px;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.top-logo {
  max-height: 34px;
  max-width: 120px;
  object-fit: contain;
}

.org-logo {
  max-width: 280px;
  max-height: 90px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.mini-logo {
  max-width: 70px;
  max-height: 28px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 14px;
  font-weight: 600;
}

.main-wrap { padding: 18px 0 26px; }
.main-wrap.full-width { width: min(1720px, 98vw); }

.grid { display: grid; gap: 16px; }
.grid.two-col { grid-template-columns: 1fr 1fr; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(96, 75, 36, 0.09);
}

h1, h2 { margin: 0 0 10px 0; }

.muted { color: var(--ink-soft); }
.small { font-size: 12px; }
.mt { margin-top: 18px; }

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

label { font-size: 14px; font-weight: 600; }

input, select, textarea {
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  background: #fffcf8;
}

.inline { display: flex; align-items: center; gap: 8px; }
.inline input { width: auto; margin: 0; }

.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 9px 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

.alerts { margin-bottom: 12px; display: grid; gap: 8px; }
.alert { padding: 10px 12px; border-radius: 10px; font-weight: 600; border: 1px solid; }
.alert.success { background: #ecfdf5; border-color: #86efac; }
.alert.error { background: #fef2f2; border-color: #fca5a5; }

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

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.table th, .table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  background: #fff;
}

.table.compact th, .table.compact td { font-size: 13px; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.pill.draft { background: #fff7ed; color: var(--warn); }
.pill.complete { background: #ecfdf5; color: var(--ok); }
.pill.error { background: #fef2f2; color: var(--error); }

.session-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.session-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-label {
  display: block;
  max-width: 360px;
  margin-top: 12px;
}

.table-shell { padding: 0; overflow: hidden; }
.table-wrap {
  max-height: calc(100vh - 210px);
  overflow: auto;
}

.inventory-table {
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
}

.inventory-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f5ecdc;
  text-align: center;
}

.inventory-table th,
.inventory-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px;
}

.inventory-table .sticky-col {
  position: sticky;
  left: 0;
  background: #fffdf8;
  z-index: 3;
  min-width: 180px;
}

.inventory-table .sticky-col.second {
  left: 180px;
  min-width: 90px;
}

.category-row td {
  background: #efe5d3;
  font-weight: 800;
  padding: 0;
}

.category-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px;
  font-weight: 800;
  cursor: pointer;
}

.qty-input {
  min-width: 84px;
  text-align: center;
  font-size: 16px;
  min-height: 44px;
}

.auth-panel {
  max-width: 480px;
  margin: 24px auto;
}

.actions-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.no-print {}

@media (max-width: 980px) {
  .grid.two-col { grid-template-columns: 1fr; }
  .table-wrap { max-height: calc(100vh - 245px); }
  .inventory-table .sticky-col { min-width: 150px; }
  .inventory-table .sticky-col.second { left: 150px; min-width: 72px; }
  .qty-input { min-width: 74px; }
}

@media print {
  .no-print,
  .topbar,
  .alerts { display: none !important; }

  body,
  .wrap,
  .main-wrap,
  .panel,
  .table-shell,
  .table-wrap {
    width: 100% !important;
    margin: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    border: 0 !important;
    background: #fff !important;
    padding: 0 !important;
    overflow: visible !important;
    max-height: none !important;
  }
}
