:root {
  color-scheme: light;
  --ink: #0c0d11;
  --muted: #3d3a47;
  --surface: #efe6dd;
  --surface-2: #f1e7dc;
  --card: #f6eee4;
  --accent: #c45b25;
  --accent-2: #177a60;
  --accent-3: #2e4b9b;
  --danger: #b33d35;
  --line: #b8aa9b;
  --shadow: 0 18px 45px rgba(12, 13, 17, 0.2);
  --radius: 18px;
  --radius-lg: 26px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #e7d7c8 0%, #e5dccf 35%, #e1e5ea 100%);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: grid;
  gap: 28px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 36px;
  background: linear-gradient(135deg, #f0e2d5 0%, #e2e7ef 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: -40% 60% 20% -20%;
  background: radial-gradient(circle, rgba(196, 91, 37, 0.24), transparent 70%);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 8px;
}

h1 {
  font-family: "Fraunces", serif;
  font-size: 2.6rem;
  margin: 0 0 8px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 520px;
}

.stat {
  background: #f2e7db;
  padding: 20px 22px;
  border-radius: 16px;
  min-width: 160px;
  text-align: right;
  box-shadow: 0 8px 25px rgba(29, 28, 44, 0.15);
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent-3);
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 24px 26px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.panel-search input {
  min-width: 220px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.hint {
  color: var(--muted);
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

#stockTable {
  table-layout: fixed;
}

thead th {
  text-align: left;
  padding: 12px 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

.num {
  text-align: right;
}

tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e6d8c8;
  color: var(--muted);
  font-size: 0.75rem;
}

button {
  font-family: inherit;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

button.primary {
  background: var(--accent);
  color: white;
}

button.approve {
  background: var(--accent-2);
  color: white;
  padding: 4px 10px;
  font-size: 0.72rem;
}

button.delete {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(196, 70, 61, 0.45);
  padding: 4px 10px;
  font-size: 0.72rem;
}

button.revert {
  background: transparent;
  color: var(--accent-3);
  border: 1px solid rgba(63, 92, 170, 0.45);
  padding: 4px 10px;
  font-size: 0.72rem;
}

button.approve:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tabs {
  gap: 20px;
}

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.tab-buttons {
  display: inline-flex;
  background: #e5dacd;
  padding: 6px;
  border-radius: 999px;
  gap: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.tab-btn {
  background: transparent;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.tab-btn.is-active {
  background: #f7efe6;
  color: var(--ink);
  border-color: rgba(0, 0, 0, 0.05);
  box-shadow: 0 10px 20px rgba(16, 16, 24, 0.08);
}

.tab-panel {
  display: none;
  gap: 16px;
}

.tab-panel.is-active {
  display: grid;
}

.request-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.view-toggle {
  display: inline-flex;
  background: #e5dacd;
  padding: 4px;
  border-radius: 999px;
  gap: 4px;
}

.toggle-btn {
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1.5px solid transparent;
}

.toggle-btn[data-view="list"] {
  border-color: rgba(63, 92, 170, 0.55);
}

.toggle-btn[data-view="grouped"] {
  border-color: rgba(212, 107, 47, 0.55);
}

.toggle-btn.is-active {
  background: #f7efe6;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(16, 16, 24, 0.08);
}

.toggle-btn.is-active[data-view="list"] {
  border-color: var(--accent-3);
}

.toggle-btn.is-active[data-view="grouped"] {
  border-color: var(--accent);
}

.request-view {
  display: none;
}

.request-view.is-active {
  display: block;
}

.grouped {
  display: grid;
  gap: 20px;
}

.group-card {
  background: #f2e6da;
  border-radius: 20px;
  padding: 18px 18px 12px;
  border: 1px solid #d3c2b0;
  box-shadow: 0 12px 28px rgba(26, 24, 40, 0.08);
}

.group-card.is-warning {
  border-color: rgba(126, 28, 24, 0.9);
  box-shadow: 0 14px 30px rgba(126, 28, 24, 0.3);
  background: linear-gradient(180deg, #e6b8b4 0%, #e2c7c4 100%);
}

.group-header {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 12px;
}

.group-title h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.group-title-line {
  display: flex;
  gap: 12px;
  align-items: center;
}

.group-title span {
  font-size: 0.85rem;
  color: var(--muted);
}

.metric {
  background: #e9ddcf;
  padding: 12px;
  border-radius: 14px;
  text-align: right;
}

.metric strong {
  display: block;
  font-size: 1.2rem;
  color: var(--accent);
}

.metric.available strong {
  color: var(--accent-2);
}

.metric.available.is-warning strong {
  color: var(--danger);
}

.group-card.is-warning .metric.available {
  background: #ddaaa6;
  border: 1px solid rgba(126, 28, 24, 0.35);
}

.row-warning td {
  background: rgba(179, 61, 53, 0.12);
  border-bottom-color: rgba(179, 61, 53, 0.35);
}

.row-warning td:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.row-warning td:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.metric span {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.group-card table {
  font-size: 0.9rem;
  table-layout: fixed;
  width: 100%;
}

.group-card thead th {
  font-size: 0.7rem;
}

.inline-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid #b9ac9d;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fbf2e7;
}

.thumb-btn {
  background: transparent;
  border: 1px solid #b9ac9d;
  padding: 0;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.thumb-btn.small {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.thumb-actions {
  display: grid;
  gap: 6px;
}

.mini-btn {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #b9ac9d;
  background: #f7efe6;
  color: var(--muted);
}

.mini-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-modal {
  width: min(680px, 94vw);
  padding: 18px;
}

.image-modal-inner {
  display: grid;
  gap: 14px;
}

.image-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

#zoomImage {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid #b9ac9d;
}

.inline-input.num {
  text-align: right;
}

.row-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.modal::backdrop {
  background: rgba(18, 18, 22, 0.4);
}

.modal {
  border: none;
  border-radius: 20px;
  padding: 20px 22px;
  width: min(420px, 92vw);
  box-shadow: var(--shadow);
  background: #f6ede3;
}

.modal form {
  display: grid;
  gap: 14px;
}

.modal h3 {
  margin: 0 0 6px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #b9ac9d;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fbf2e7;
}

select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #b9ac9d;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fbf2e7;
}

.filter {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-card {
  width: min(420px, 92vw);
  background: var(--card);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1rem;
  margin: 0;
}

.is-hidden {
  display: none !important;
}
@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .tab-header {
    align-items: flex-start;
  }

  .group-header {
    grid-template-columns: 1fr;
  }

  .metric {
    text-align: left;
  }
}
