:root {
  color-scheme: light;
  --bg: #f3f1eb;
  --surface: #ffffff;
  --ink: #17120b;
  --muted: #6c675d;
  --line: #ddd6c9;
  --brand: #8d640f;
  --brand-strong: #5c3a02;
  --gold: #d7a32f;
  --gold-soft: #fff3c5;
  --dark: #17120b;
  --danger: #b42318;
  --danger-bg: #fff0ed;
  --warning: #a15c07;
  --warning-bg: #fff6df;
  --ok: #18794e;
  --ok-bg: #eaf8ef;
  --shadow: 0 18px 45px rgba(23, 33, 31, 0.09);
  font-family: Inter, Segoe UI, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% -10%, rgba(215, 163, 47, 0.2), transparent 32%),
    linear-gradient(180deg, #faf8f1 0, var(--bg) 340px);
  color: var(--ink);
}

.site-page {
  background: #f8f8f4;
}

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

button {
  cursor: pointer;
}

.topbar {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(255, 236, 168, 0.16), transparent 32%),
    linear-gradient(120deg, #120d07, #2d2110 52%, #0d0b08);
  border-bottom: 3px solid var(--gold);
  color: #fff8df;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 124px;
  padding: 14px clamp(16px, 4vw, 40px);
  position: relative;
  overflow: hidden;
}

.topbar h1,
.product-form h2,
.empty-state h3 {
  margin: 0;
}

.brand-tagline {
  color: var(--gold-soft);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 5px 0 0;
  opacity: 0.86;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 16px;
  min-width: 0;
}

.brand-logo {
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55));
  height: clamp(70px, 9vw, 104px);
  object-fit: contain;
  width: clamp(92px, 13vw, 148px);
}

.jamon-logo {
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.55));
  height: clamp(78px, 10vw, 118px);
  margin-left: auto;
  object-fit: contain;
  width: clamp(120px, 18vw, 210px);
}

.eyebrow {
  color: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  opacity: 0.72;
  text-transform: uppercase;
}

.top-actions,
.row-actions,
.tools-row,
.panel-toolbar,
.field-grid,
.summary {
  display: flex;
  gap: 10px;
}

.icon-button {
  align-items: center;
  background: rgba(255, 227, 145, 0.13);
  border: 1px solid rgba(255, 227, 145, 0.34);
  border-radius: 8px;
  color: white;
  display: inline-flex;
  font-weight: 900;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.link-icon {
  text-decoration: none;
}

.app-shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 22px clamp(14px, 3vw, 28px) 34px;
}

.brand-hero {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(255, 245, 204, 0.94), rgba(255, 255, 255, 0.88)),
    linear-gradient(90deg, rgba(215, 163, 47, 0.28), transparent);
  border: 1px solid #e6d4a1;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(45, 33, 16, 0.08);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 16px 18px;
}

.brand-hero h2 {
  font-size: clamp(1.25rem, 2.8vw, 2rem);
  margin: 0;
}

.hero-badge {
  background: var(--dark);
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: var(--gold-soft);
  min-width: 220px;
  padding: 12px 14px;
}

.hero-badge span {
  color: var(--gold);
  display: block;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hero-badge strong {
  display: block;
  margin-top: 3px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric {
  background: linear-gradient(180deg, #fff, #fffaf0);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 96px;
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 2.2rem;
  line-height: 1;
  margin-top: 10px;
}

.metric-label {
  color: var(--muted);
  font-weight: 750;
}

.metric.urgent strong {
  color: var(--danger);
}

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

.metric.ok strong {
  color: var(--ok);
}

.workspace {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: 360px minmax(0, 1fr);
}

.product-form,
.inventory-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.product-form {
  border-top: 4px solid var(--gold);
  display: grid;
  gap: 14px;
  padding: 18px;
}

.form-header {
  align-items: start;
  display: flex;
  justify-content: space-between;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.9rem;
  font-weight: 750;
  gap: 7px;
}

input,
select,
textarea {
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  outline: 0;
  padding: 9px 11px;
  width: 100%;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 107, 93, 0.13);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.primary-button,
.text-button,
.file-button {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
}

.primary-button {
  background: linear-gradient(180deg, #176b5d, #0f574d);
  border: 1px solid #0f574d;
  color: white;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.text-button,
.file-button {
  background: linear-gradient(180deg, #fff, #fffaf0);
  border: 1px solid var(--line);
  color: var(--brand-strong);
}

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

.file-button input {
  display: none;
}

.inventory-panel {
  border-top: 4px solid var(--gold);
  min-width: 0;
  overflow: hidden;
}

.panel-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.search-box {
  align-items: center;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex: 1;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
}

.search-box input {
  border: 0;
  box-shadow: none;
  min-height: 38px;
  padding: 0;
}

.search-box input:focus {
  box-shadow: none;
}

.panel-toolbar select {
  max-width: 150px;
}

.tools-row {
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  padding: 12px 14px;
}

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

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 850;
  padding: 5px 9px;
  white-space: nowrap;
}

.status-expired {
  background: var(--danger-bg);
  color: var(--danger);
}

.status-warning {
  background: linear-gradient(180deg, #fff7df, #ffeab0);
  color: var(--warning);
}

.status-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.row-actions button {
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  min-height: 34px;
  padding: 6px 9px;
}

.row-actions button:last-child {
  color: var(--danger);
}

.empty-state {
  color: var(--muted);
  padding: 44px 18px;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.sync-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 800;
  margin: -8px 0 18px;
  padding: 10px 12px;
}

.sync-status[data-mode="ok"] {
  background: linear-gradient(90deg, var(--ok-bg), #fff8dc);
  border-color: #cfbd79;
  color: var(--ok);
}

.sync-status[data-mode="loading"] {
  background: #eef5ff;
  color: #205493;
}

.sync-status[data-mode="error"] {
  background: var(--danger-bg);
  color: var(--danger);
}

.version-badge {
  color: #7a5b13;
  font-size: 0.78rem;
  font-weight: 800;
  margin: -10px 0 18px;
  text-transform: uppercase;
}

.confirm-backdrop {
  align-items: center;
  background: rgba(10, 16, 14, 0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 30;
}

.confirm-backdrop[hidden] {
  display: none;
}

.confirm-box {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 420px;
  padding: 18px;
  width: min(420px, 100%);
}

.confirm-box h2 {
  margin: 0;
}

.confirm-box p {
  color: var(--muted);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.danger-button {
  background: var(--danger);
  border-color: var(--danger);
}

.install-shell {
  max-width: 920px;
}

.install-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.install-hero {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  padding-bottom: 18px;
}

.install-hero img {
  border-radius: 24px;
  flex: 0 0 auto;
}

.install-hero h2,
.install-card h3,
.install-hero p {
  margin: 0;
}

.install-slogan {
  color: var(--brand-strong);
  font-weight: 900;
  margin-top: 4px;
}

.install-hero p:last-child {
  color: var(--muted);
  margin-top: 6px;
}

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

.install-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.install-card ol {
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 0 0;
  padding-left: 22px;
}

.install-open-button {
  text-decoration: none;
  width: 100%;
}

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

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
  }

  .brand-logo {
    height: 70px;
    width: 96px;
  }

  .jamon-logo {
    height: 76px;
    margin-left: 0;
    width: 132px;
  }

  .brand-hero {
    align-items: stretch;
    display: grid;
  }

  .hero-badge {
    min-width: 0;
  }

  .summary,
  .field-grid,
  .panel-toolbar,
  .install-grid {
    grid-template-columns: 1fr;
  }

  .panel-toolbar {
    align-items: stretch;
    display: grid;
  }

  .panel-toolbar select {
    max-width: none;
  }
}
