:root {
  --background: #f7f9fb;
  --foreground: #111827;
  --card: #ffffff;
  --muted: #667085;
  --border: #dde3ea;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --secondary: #f59e0b;
  --accent: #0ea5e9;
  --danger: #dc2626;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.error-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #f7faf9 0%, #edf6f4 52%, #fff7ed 100%);
}

.error-page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  width: min(620px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.error-page-card {
  width: 100%;
  padding: 42px;
  text-align: center;
}

.error-page-code {
  display: block;
  color: var(--primary);
  font-size: clamp(64px, 15vw, 112px);
  font-weight: 900;
  line-height: 0.9;
}

.error-page-card h1 {
  margin: 22px 0 10px;
  font-size: 30px;
}

.error-page-card p {
  margin: 0 0 26px;
  color: var(--muted);
  line-height: 1.6;
}

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

button,
input,
select {
  font: inherit;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #f7faf9 0%, #edf6f4 48%, #fff7ed 100%);
}

.login-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 56px;
  padding: 32px 0;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  font-size: 14px;
  font-weight: 700;
}

.brand-icon {
  color: var(--primary);
}

.login-hero h1 {
  max-width: 660px;
  margin: 28px 0 0;
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: 0;
}

.login-hero p {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 620px;
  margin-top: 32px;
}

.mini-stats div,
.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.mini-stats div {
  padding: 18px;
}

.mini-stats strong {
  display: block;
  font-size: 28px;
}

.mini-stats span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.login-card {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  padding: 28px;
}

.login-card h2,
.card-header h2 {
  margin: 0;
  font-size: 22px;
}

.muted {
  color: var(--muted);
}

.form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--foreground);
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.16);
  border-color: var(--primary);
}

.error {
  color: var(--danger);
  font-size: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
  gap: 8px;
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

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

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

.button.danger:hover {
  background: #b91c1c;
}

.button.outline {
  border-color: var(--border);
  background: #fff;
}

.button.small {
  min-height: 34px;
  font-size: 14px;
}

.button.full {
  width: 100%;
  margin-top: 8px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  min-height: 92px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 10px 92px 10px 0;
}

.main-nav {
  display: grid;
  grid-template-columns: minmax(230px, 280px) 150px minmax(220px, 320px) 88px;
  grid-template-rows: repeat(2, 36px);
  gap: 8px;
  align-items: stretch;
  justify-content: center;
}

.main-nav a {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0 12px;
  color: var(--foreground);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
}

.main-nav a.active {
  border-color: var(--primary);
  background: #e6f4f1;
  color: var(--primary-dark);
}

.main-nav .brand-nav {
  grid-row: 1 / span 2;
  justify-content: flex-start;
  gap: 12px;
  height: 80px;
  padding: 0 14px;
  color: var(--foreground);
}

.brand-nav .brand-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #fff;
}

.brand-nav span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.brand-nav strong,
.brand-nav small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-nav small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-tile {
  grid-row: 1 / span 2;
  aspect-ratio: 1;
  height: 80px;
  padding: 0 12px;
  align-self: center;
}

.main-nav .nav-stock {
  grid-column: 2;
  width: 150px;
  aspect-ratio: auto;
  white-space: normal;
}

.main-nav .nav-sale {
  grid-column: 4;
  border-color: rgba(14, 165, 233, 0.24);
  background: #f0f9ff;
  color: #075985;
  white-space: normal;
}

.main-nav .nav-sale.active {
  border-color: rgba(14, 165, 233, 0.42);
  background: #e0f2fe;
  color: #075985;
}

.nav-stack {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  min-height: 80px;
}

.nav-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.account-menu {
  position: absolute;
  top: 10px;
  right: 0;
}

.account-menu-toggle {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--foreground);
  cursor: pointer;
}

.account-menu-toggle:hover,
.account-menu-toggle[aria-expanded="true"] {
  border-color: rgba(15, 118, 110, 0.35);
  background: #e6f4f1;
  color: var(--primary-dark);
}

.account-menu-toggle svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  transition: transform 160ms ease;
}

.account-menu-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.account-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: 210px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0 14px;
  background: #fff;
  color: var(--foreground);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.account-menu-item:last-child {
  border-bottom: 0;
}

.account-menu-item:hover {
  background: #f8fafc;
}

.account-menu-item:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.account-menu-item svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.account-menu-logout {
  color: #991b1b;
}

.account-menu-logout:hover {
  background: #fef2f2;
}

.settings-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.settings-summary {
  display: grid;
  gap: 20px;
  padding: 24px;
  background: linear-gradient(145deg, #e6f4f1 0%, #ffffff 72%);
}

.settings-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

.settings-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.settings-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.settings-summary strong {
  display: block;
  font-size: 25px;
}

.settings-summary p {
  margin: 14px 0 0;
  color: #475467;
  font-size: 14px;
  line-height: 1.6;
}

.settings-password-card {
  overflow: hidden;
}

.settings-password-form {
  display: grid;
  gap: 20px;
  padding: 22px;
}

.settings-password-form label {
  display: grid;
  gap: 8px;
}

.settings-password-form label span {
  font-size: 14px;
  font-weight: 700;
}

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

.settings-password-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-submit {
  min-height: 48px;
  padding: 0 22px;
}

.dashboard {
  padding: 28px 0 48px;
}

.page-heading {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}

.page-heading h1 {
  margin: 14px 0 8px;
  font-size: 34px;
  letter-spacing: 0;
}

.page-heading p {
  max-width: 700px;
  margin: 0;
  line-height: 1.6;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.actions.single-action {
  grid-template-columns: minmax(0, 220px);
}

.quick-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.quick-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.action-in {
  border-color: rgba(15, 118, 110, 0.28);
  background: #e6f4f1;
  color: #0b5f59;
}

.action-out {
  border-color: rgba(245, 158, 11, 0.32);
  background: #fff4dd;
  color: #8a5200;
}

.action-sale {
  border-color: rgba(14, 165, 233, 0.28);
  background: #e7f6fd;
  color: #075985;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.outline {
  border: 1px solid var(--border);
  background: #fff;
}

.badge.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stock-stats-grid,
.product-stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  padding: 20px;
}

.stat-card p {
  margin: 0;
  font-size: 14px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 27px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  margin-top: 24px;
}

.stock-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.stock-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.stock-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.stock-primary-action {
  display: grid;
  gap: 8px;
  min-height: 118px;
  align-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 24px;
  color: var(--foreground);
  text-decoration: none;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.stock-primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.12);
}

.stock-primary-action strong {
  font-size: 22px;
  line-height: 1.15;
}

.stock-primary-action span {
  color: #374151;
  font-size: 14px;
  font-weight: 700;
}

.stock-primary-action-out {
  border-color: rgba(220, 38, 38, 0.22);
  background: #fef2f2;
}

.stock-primary-action-in {
  border-color: rgba(15, 118, 110, 0.22);
  background: #e6f4f1;
}

.card-header {
  padding: 22px 22px 0;
}

.card-header.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
}

.card-header p {
  margin: 6px 0 0;
  font-size: 14px;
}

.search {
  position: relative;
  width: 290px;
}

.search span {
  position: absolute;
  top: 9px;
  left: 12px;
  color: var(--muted);
}

.search input {
  padding-left: 36px;
}

.stock-card {
  margin-top: 24px;
  overflow: hidden;
}

.stock-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px 220px;
  gap: 14px;
  align-items: end;
  padding: 18px 22px;
}

.stock-toolbar .search {
  width: 100%;
}

.stock-inventory-toolbar {
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) 100px 120px;
  gap: 12px;
}

.stock-inventory-toolbar .search {
  width: 100%;
}

.stock-inventory-toolbar > * {
  min-width: 0;
}

.stock-toolbar label {
  display: grid;
  gap: 7px;
}

.stock-toolbar label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stock-table-wrap {
  padding-top: 0;
}

.stock-table-wrap .clickable-row {
  cursor: pointer;
  transition: background-color 140ms ease;
}

.stock-table-wrap .clickable-row[data-status="LOW"] {
  background: #fff7ed;
}

.stock-table-wrap .clickable-row[data-status="OUT"] {
  background: #fef2f2;
}

.stock-table-wrap .clickable-row:hover {
  background: #fffbeb;
}

.stock-table-wrap .clickable-row[data-status="LOW"]:hover {
  background: #ffedd5;
}

.stock-table-wrap .clickable-row[data-status="OUT"]:hover {
  background: #fee2e2;
}

.stock-critical-quantity {
  color: #b91c1c;
  font-weight: 800;
}

.inline-delete-form {
  display: inline-flex;
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
  padding: 0 22px 22px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-top: 1px solid var(--border);
  padding: 15px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
  text-transform: uppercase;
}

.table-sort-button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  line-height: inherit;
  text-align: left;
  text-transform: inherit;
}

.table-sort-button::after {
  content: "↕";
  display: inline-block;
  margin-left: 5px;
  color: #98a2b3;
  font-size: 10px;
}

.table-sort-button[data-direction="asc"]::after {
  content: "↑";
  color: var(--primary);
}

.table-sort-button[data-direction="desc"]::after {
  content: "↓";
  color: var(--primary);
}

.table-sort-button:hover {
  color: var(--foreground);
}

td span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.table-empty {
  padding: 24px 10px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.alert-table-wrap table {
  table-layout: fixed;
}

.alert-table-wrap th:first-child,
.alert-table-wrap td:first-child {
  width: auto;
}

.alert-table-wrap th:nth-child(2),
.alert-table-wrap td:nth-child(2) {
  width: 86px;
}

.alert-table-wrap th:nth-child(3),
.alert-table-wrap td:nth-child(3) {
  width: 108px;
}

.alert-table-wrap th:last-child,
.alert-table-wrap td:last-child {
  width: 168px;
  text-align: right;
}

.alert-product-cell {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.alert-product-image {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.alert-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.alert-product-image span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.alert-product-info {
  min-width: 0;
}

.alert-product-info strong {
  display: block;
  line-height: 1.25;
}

.alert-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.alert-action-button {
  padding: 7px 8px;
  font-size: 11px;
  line-height: 1;
}

.side-panel {
  display: grid;
  gap: 24px;
  align-content: start;
}

.priority-list,
.activity-list {
  display: grid;
  gap: 10px;
  padding: 18px 22px 22px;
}

.priority-list div {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.priority-list span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef2f6;
  color: var(--primary);
}

.priority-list p {
  margin: 0;
}

.priority-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.activity-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  padding: 10px;
  background: #fbfdff;
}

.activity-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef2f6;
  font-size: 20px;
}

.activity-main {
  min-width: 0;
}

.activity-product {
  display: block;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.activity-main span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.activity-meta {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 74px;
}

.activity-meta strong {
  border-radius: 999px;
  padding: 3px 8px;
  background: #e6f4f1;
  color: var(--primary-dark);
  font-size: 13px;
}

.activity-meta time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.empty-state {
  margin: 0;
  padding: 18px 22px 22px;
  color: var(--muted);
  font-size: 14px;
}

.form-layout {
  max-width: 860px;
}

.form-card {
  overflow: hidden;
}

.article-form {
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.form-grid label,
.form-grid .form-field {
  display: grid;
  gap: 8px;
}

.form-grid label span,
.form-grid .form-field > span {
  font-size: 14px;
  font-weight: 700;
}

.form-grid label.field-error span {
  color: var(--danger-text);
}

.form-grid label.field-error input,
.form-grid label.field-error select,
.form-grid label.field-error textarea {
  border-color: #fca5a5;
  background: #fff7f7;
}

.form-grid label.field-error input:focus,
.form-grid label.field-error select:focus,
.form-grid label.field-error textarea:focus {
  border-color: var(--danger);
  outline-color: rgba(220, 38, 38, 0.16);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.notice {
  border-radius: 8px;
  margin: 0 0 18px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
}

.notice.error {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.notice.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.error-box {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.info-box {
  background: #e0f2fe;
  color: #075985;
}

.success-box {
  background: var(--success-bg);
  color: var(--success-text);
}

.stock-warning {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(220, 38, 38, 0.28);
  border-radius: 10px;
  margin: 0 0 18px;
  padding: 16px 18px;
  background: #fef2f2;
  color: #991b1b;
}

.stock-warning strong {
  font-size: 18px;
}

.stock-warning span {
  line-height: 1.5;
}

.receive-layout {
  display: grid;
  gap: 24px;
}

.supplier-choice-card {
  overflow: hidden;
}

.supplier-choice-card-error {
  border-color: #fca5a5;
}

.supplier-choice-card-error .supplier-choice-header {
  background: #fff7f7;
}

.supplier-choice-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.supplier-choice-header h2 {
  margin: 12px 0 8px;
  font-size: 28px;
}

.supplier-choice-header p {
  max-width: 760px;
  margin: 0;
  line-height: 1.55;
}

.supplier-choice-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.supplier-validate-button {
  min-width: 130px;
}

.supplier-choice-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 18px 24px;
}

.supplier-search {
  width: 100%;
}

.supplier-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 0 24px 24px;
}

.supplier-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  gap: 6px 14px;
  align-items: start;
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  color: var(--foreground);
  cursor: pointer;
  text-align: left;
}

.supplier-card:hover {
  border-color: rgba(15, 118, 110, 0.35);
  background: #f8fafc;
}

.supplier-card.selected {
  border-color: rgba(15, 118, 110, 0.45);
  background: #e6f4f1;
  color: var(--primary-dark);
}

.supplier-card strong {
  grid-column: 1;
  font-size: 15px;
}

.supplier-card span {
  grid-column: 1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.supplier-card.selected span {
  color: var(--primary-dark);
}

.supplier-edit-link {
  grid-column: 2;
  grid-row: 3;
  align-self: end;
  justify-self: end;
  width: fit-content;
  color: #2563eb;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.supplier-edit-link:hover {
  color: #1d4ed8;
}

.supplier-create-form {
  margin: 0 24px 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.wide-field {
  grid-column: 1 / -1;
}

.selected-supplier-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 10px;
  padding: 14px 16px;
  background: #e6f4f1;
  color: var(--primary-dark);
}

.selected-supplier-banner span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.selected-supplier-banner strong {
  font-size: 18px;
}

.scan-card {
  overflow: hidden;
}

.scan-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(360px, 560px);
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
}

.scan-form h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.scan-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 132px;
  gap: 10px;
  align-items: stretch;
}

.scan-row input {
  height: 42px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.scan-row .button {
  min-height: 42px;
  align-self: stretch;
}

.receive-card {
  overflow: hidden;
}

.receive-card-existing {
  border-color: rgba(14, 165, 233, 0.32);
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 160px);
}

.receive-card-new {
  border-color: rgba(245, 158, 11, 0.48);
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 180px);
  box-shadow: 0 16px 38px rgba(245, 158, 11, 0.18);
}

.state-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 24px 0;
}

.state-header h2 {
  margin-top: 6px;
  font-size: 26px;
}

.state-header p {
  max-width: 360px;
  margin: 4px 0 0;
  line-height: 1.5;
  font-weight: 700;
}

.existing-state {
  color: #075985;
}

.new-state {
  color: #9a3412;
}

.state-kicker {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.existing-state .state-kicker {
  background: #e0f2fe;
  color: #075985;
}

.new-state .state-kicker {
  background: #ffedd5;
  color: #9a3412;
}

.product-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 22px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.product-summary div {
  min-width: 0;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.product-summary label {
  min-width: 0;
  display: grid;
  gap: 7px;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.product-summary span,
.product-summary label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.product-summary strong {
  display: block;
  margin-top: 7px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.product-summary input {
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 18px;
  font-weight: 800;
}

.product-summary input:focus {
  outline: 0;
  border-color: transparent;
  box-shadow: inset 0 -2px 0 var(--primary);
}

.compact-form {
  padding: 0 22px 22px;
}

.recognized-header {
  padding-bottom: 0;
}

.recognized-header h2 {
  margin-bottom: 12px;
}

.product-name-field {
  display: grid;
  gap: 8px;
}

.product-name-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.product-name-field input {
  height: auto;
  border: 0;
  border-radius: 0;
  padding: 0 0 8px;
  background: transparent;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
}

.product-name-field input:focus {
  outline: 0;
  border-color: transparent;
  box-shadow: inset 0 -2px 0 var(--primary);
}

.receive-quantity-grid {
  grid-template-columns: repeat(2, minmax(220px, 320px));
}

.receive-actions {
  align-items: center;
}

.receive-submit {
  min-height: 48px;
  padding: 0 24px;
  font-size: 16px;
}

.new-product-form .form-grid {
  grid-template-columns: 1.2fr repeat(3, minmax(160px, 0.75fr));
}

.new-product-form .new-product-identifier-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  margin-bottom: 18px;
}

.barcode-generator-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.barcode-generator-row .button {
  min-height: 42px;
  white-space: nowrap;
}

.barcode-download-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.barcode-download-box img {
  width: min(280px, 100%);
  height: auto;
  image-rendering: crisp-edges;
}

.new-product-form label {
  min-width: 0;
}

.new-product-photo-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

.new-product-photo-preview {
  min-height: 180px;
}

.create-product-submit {
  min-height: 54px;
  padding: 0 28px;
  background: #ea580c;
  box-shadow: 0 12px 24px rgba(234, 88, 12, 0.24);
}

.create-product-submit:hover {
  background: #c2410c;
}

.receive-empty {
  padding: 28px;
  min-height: 180px;
  display: grid;
  align-content: center;
}

.receive-empty h2 {
  margin: 0;
  font-size: 22px;
}

.receive-empty p {
  margin: 8px 0 0;
}

.product-form-card {
  margin-top: 24px;
  overflow: hidden;
}

.product-overview {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  margin-top: 24px;
}

.product-photo-card {
  padding: 18px;
}

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

.product-photo-editor {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 22px;
}

.product-photo-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px dashed rgba(15, 118, 110, 0.35);
  border-radius: 8px;
  background: #f8fafc;
}

.product-photo-preview-large {
  min-height: 320px;
}

.product-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-photo-placeholder {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.product-photo-controls {
  display: grid;
  gap: 10px;
  align-content: center;
}

.product-photo-controls h3 {
  margin: 0;
  font-size: 18px;
}

.product-photo-file-button {
  width: fit-content;
  cursor: pointer;
}

.product-photo-file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.product-photo-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-photo-toolbar .button {
  min-height: 40px;
  padding: 0 12px;
  font-size: 13px;
}

.product-photo-help {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.product-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.product-info-card {
  min-height: 116px;
}

.product-info-card strong {
  font-size: 24px;
  overflow-wrap: anywhere;
}

.product-info-card a {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.product-status-card {
  grid-column: 1 / -1;
}

.product-status-card strong {
  display: flex;
  align-items: center;
  min-height: 34px;
}

.danger-outline {
  border-color: rgba(185, 28, 28, 0.35);
  color: #991b1b;
}

.danger-outline:hover {
  border-color: rgba(185, 28, 28, 0.55);
  background: #fef2f2;
  color: #7f1d1d;
}

.supplier-info-card strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.supplier-detail-card {
  display: grid;
  gap: 22px;
  margin-top: 24px;
  padding: 24px;
}

.supplier-detail-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.supplier-detail-card p {
  margin: 0;
  color: #374151;
  line-height: 1.6;
}

.supplier-edit-form {
  max-width: 920px;
  margin: 24px auto 0;
  padding: 24px;
}

.supplier-edit-form .form-grid {
  gap: 22px 24px;
}

.supplier-edit-form input,
.supplier-edit-form textarea {
  width: 100%;
}

.supplier-missing-card {
  gap: 10px;
}

.sale-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.sale-main,
.sale-summary {
  overflow: hidden;
}

.sale-scan-form {
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.sale-table-wrap {
  padding-top: 18px;
}

.sale-table-wrap table {
  table-layout: fixed;
}

.sale-table-wrap th:first-child,
.sale-table-wrap td:first-child {
  width: 40%;
}

.sale-table-wrap th:nth-child(2),
.sale-table-wrap td:nth-child(2) {
  width: 108px;
}

.sale-table-wrap th:nth-child(3),
.sale-table-wrap td:nth-child(3) {
  width: 92px;
}

.sale-table-wrap th:nth-child(4),
.sale-table-wrap td:nth-child(4) {
  width: 124px;
  white-space: nowrap;
}

.sale-table-wrap th:last-child,
.sale-table-wrap td:last-child {
  width: 164px;
  text-align: right;
}

.sale-product-cell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.sale-product-image {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.sale-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sale-product-image span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.sale-product-info {
  min-width: 0;
}

.sale-product-info strong {
  display: block;
  line-height: 1.25;
}

.quantity-form input {
  width: 86px;
  height: 36px;
  font-weight: 800;
}

.sale-line-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.sale-line-price-input {
  width: 100px;
  height: 36px;
  font-weight: 800;
}

.sale-total {
  padding: 22px;
  color: var(--primary-dark);
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.sale-payment-form,
.sale-clear-form {
  display: grid;
  gap: 12px;
  padding: 0 22px 22px;
}

.sale-clear-form {
  padding-top: 0;
}

.sale-payment-form label {
  display: grid;
  gap: 7px;
}

.sale-payment-form .checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sale-payment-form .checkbox-field input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sale-payment-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.sale-validate-button {
  min-height: 52px;
  font-size: 16px;
}

.todo-card {
  margin-top: 24px;
  border-color: rgba(245, 158, 11, 0.35);
  background: #fffdf7;
}

.todo-card ul {
  margin: 0;
  padding: 18px 24px 24px 42px;
  color: #374151;
}

.todo-card li {
  margin: 0 0 10px;
  line-height: 1.5;
}

.todo-card li:last-child {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .login-shell,
  .content-grid,
  .sale-layout,
  .product-overview,
  .settings-layout,
  .stock-heading,
  .stock-toolbar,
  .supplier-choice-header,
  .supplier-choice-tools {
    grid-template-columns: 1fr;
  }

  .stock-inventory-toolbar {
    grid-template-columns: minmax(180px, 1fr) minmax(130px, 170px) 88px 108px;
    gap: 8px;
  }

  .stats-grid,
  .stock-stats-grid,
  .product-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-heading,
  .state-header,
  .card-header.split {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    min-width: 0;
  }

  .actions.single-action {
    grid-template-columns: 1fr;
  }

  .stock-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .supplier-choice-actions,
  .selected-supplier-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

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

  .settings-password-grid {
    grid-template-columns: 1fr;
  }

  .new-product-form .form-grid {
    grid-template-columns: 1fr;
  }

  .scan-form,
  .scan-row,
  .product-summary,
  .product-photo-editor,
  .new-product-photo-row {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    padding-right: 88px;
  }

  .main-nav {
    grid-template-columns: minmax(210px, 240px) 128px minmax(180px, 240px) 76px;
  }

  .nav-tile {
    height: 76px;
    font-size: 12px;
  }
}

@media (max-width: 620px) {
  .mini-stats,
  .stats-grid,
  .stock-stats-grid,
  .product-stats-grid,
  .product-info-grid {
    grid-template-columns: 1fr;
  }

  .product-photo-preview-large {
    min-height: 240px;
  }

  .product-info-card {
    min-height: 96px;
  }

  .login-hero h1 {
    font-size: 38px;
  }

  .topbar-inner {
    height: auto;
    min-height: 0;
    padding: 12px 0 52px;
  }

  .main-nav {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }

  .main-nav .brand-nav {
    grid-column: 1 / -1;
    grid-row: auto;
    width: 100%;
  }

  .nav-tile,
  .main-nav .nav-stock,
  .main-nav .nav-sale {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    height: 64px;
    aspect-ratio: auto;
  }

  .account-menu {
    top: auto;
    right: 0;
    bottom: 10px;
  }

  .account-menu-toggle {
    width: 64px;
    height: 44px;
  }

  .account-menu-toggle svg {
    width: 26px;
    height: 26px;
  }

  .account-menu-dropdown {
    top: auto;
    right: 0;
    bottom: calc(100% + 8px);
  }

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

}
