:root {
  --ink: #172026;
  --muted: #63717a;
  --line: #d8e0e5;
  --paper: #f6f8f9;
  --white: #ffffff;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --focus: #e0f2f1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--white);
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

.button-link {
  display: inline-grid;
  min-height: 34px;
  align-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: var(--white);
  padding: 0 12px;
  text-decoration: none;
  font-weight: 800;
}

.danger-button {
  min-height: 34px;
  background: #b42318;
  padding: 0 12px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--white);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(23, 32, 38, 0.08);
}

.login-panel h1,
.sidebar h1,
.topbar h1,
.topbar h2 {
  margin: 0;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.sidebar {
  background: #1f2a30;
  color: var(--white);
  padding: 24px 18px;
}

.sidebar h1 {
  margin-bottom: 28px;
}

.nav {
  width: 100%;
  margin-bottom: 10px;
  text-align: left;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.nav.active {
  background: var(--accent);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.topbar-brand {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 72px;
  height: 56px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--accent-dark);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  text-decoration: none;
  font-weight: 800;
}

.brand-logo img {
  max-width: 100%;
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-logo span {
  line-height: 1;
}

.brand-copy {
  min-width: 0;
}

.topbar h1 {
  font-size: 24px;
  line-height: 1.1;
}

.topbar h2 {
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.topbar-actions {
  width: min(900px, 66vw);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: end;
}

.template-download {
  min-height: 40px;
  white-space: nowrap;
}

.searchbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metrics article {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metrics span {
  display: block;
  font-size: 30px;
  font-weight: 800;
}

.metrics small {
  color: var(--muted);
  font-weight: 700;
}

.import-form {
  display: grid;
  grid-template-columns: 1.2fr 180px 1fr 1.2fr auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 18px 0 10px;
}

.section-head h3 {
  margin: 0;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 310px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-wrap.compact {
  max-height: calc(100vh - 260px);
}

table {
  width: 100%;
  min-width: 2020px;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #edf3f5;
  color: #31424b;
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
}

th:first-child {
  z-index: 3;
  background: #edf3f5;
}

td input {
  min-width: 90px;
  min-height: 34px;
  border-color: transparent;
  background: transparent;
}

td input:focus {
  border-color: var(--accent);
  background: var(--focus);
  outline: 0;
}

.choice-cell {
  min-width: 112px;
}

.radio-choice {
  display: inline-flex;
  min-width: 78px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfc;
  color: var(--ink);
  font-size: 13px;
}

.radio-choice input {
  width: auto;
  min-width: 0;
  min-height: 0;
}

.forced-price-input {
  min-width: 130px;
}

.pos-category-select {
  min-width: 150px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}

.row-error {
  background: #fff4f2;
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 700;
}

.status-message {
  min-height: 24px;
  margin-bottom: 10px;
  font-weight: 700;
}

.success-message {
  color: var(--accent-dark);
}

.error-message {
  color: var(--danger);
}

.actions {
  display: flex;
  gap: 8px;
}

.secondary {
  color: var(--accent-dark);
  background: #dff4f1;
}

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

  .sidebar {
    display: flex;
    gap: 10px;
    align-items: center;
    overflow-x: auto;
  }

  .nav {
    width: auto;
    white-space: nowrap;
    margin-bottom: 0;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-brand {
    min-width: 0;
  }

  .brand-logo {
    width: 64px;
    height: 52px;
  }

  .brand-logo img {
    height: 44px;
  }

  .topbar-actions,
  .searchbar,
  .import-form {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr;
  }
}
