:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --sidebar: #edf1f5;
  --ink: #101828;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #e4e7ec;
  --line-soft: #eef2f6;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fff6df;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, 0.12);
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --font-sans: 'Noto Sans', 'Sarabun', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-thai: 'Sarabun', 'Noto Sans', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.07), transparent 28rem),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.glass-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

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

.login-card {
  width: min(100%, 460px);
  border-radius: 28px;
  padding: 34px;
  box-shadow: var(--shadow-lg);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, #101828, #344054);
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.08em;
  box-shadow: 0 16px 34px rgba(16, 24, 40, 0.18);
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 0.86rem;
}

.eyebrow {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-sans);
  color: var(--ink);
}

h1 {
  margin: 14px 0 12px;
  font-size: clamp(2rem, 5vw, 3.05rem);
  line-height: 1.08;
  letter-spacing: -0.06em;
}

h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  letter-spacing: -0.04em;
}

h3 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -0.025em;
}

.muted,
.hint,
small {
  color: var(--muted);
}

.hint {
  margin: 16px 0 0;
  font-family: var(--font-thai);
  font-size: 0.92rem;
  line-height: 1.55;
}

code {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--primary-dark);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--sidebar);
  border-right: 1px solid #dbe3ec;
}

.sidebar::before {
  content: '';
  width: 76px;
  height: 18px;
  border-radius: 999px;
  margin: 2px 0 2px 0;
  background: #d8e0eb;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 8px 12px;
  border-bottom: 1px solid #dbe3ec;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  font-size: 0.96rem;
  letter-spacing: -0.02em;
}

.sidebar-brand span {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-item,
.ghost-btn,
.primary-btn {
  border: 0;
  border-radius: var(--radius-sm);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.nav-item {
  position: relative;
  min-height: 42px;
  padding: 10px 12px 10px 38px;
  text-align: left;
  color: #475467;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 50%;
  width: 15px;
  height: 15px;
  border: 1.7px solid currentColor;
  border-radius: 4px;
  transform: translateY(-50%);
  opacity: 0.82;
}

.nav-item:nth-child(2)::before {
  border-radius: 50%;
}

.nav-item:nth-child(3)::before {
  border-radius: 3px;
  box-shadow: inset 0 -5px 0 currentColor;
}

.nav-item:nth-child(4)::before {
  border-radius: 50% 50% 4px 4px;
}

.nav-item:nth-child(5)::before {
  border-radius: 999px;
}

.nav-item:hover,
.nav-item.active {
  color: #1d4ed8;
  background: #e7eefb;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.logout-btn {
  margin-top: auto;
}

.content {
  min-width: 0;
  padding: 20px 22px 28px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 20;
  border-radius: 20px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

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

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: #344054;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-chip span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.tab-panel {
  display: none;
  animation: fadeUp 0.22s ease both;
}

.active-panel {
  display: grid;
  gap: 16px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card,
.panel-card {
  border-radius: 20px;
  padding: 18px;
}

.metric-card {
  min-height: 126px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.metric-card span {
  color: var(--muted);
  font-family: var(--font-thai);
  font-size: 0.86rem;
  font-weight: 700;
}

.metric-card strong {
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  letter-spacing: -0.05em;
}

.metric-card small {
  font-family: var(--font-thai);
  line-height: 1.45;
}

.warning-card {
  background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
}

.grid-two,
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.align-start {
  align-items: start;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

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

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

.span-2 {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 6px;
  color: #475467;
  font-family: var(--font-thai);
  font-size: 0.84rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.primary-btn {
  min-height: 42px;
  background: var(--primary);
  color: #fff;
  padding: 10px 15px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.primary-btn:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.26);
}

.primary-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

.ghost-btn {
  min-height: 36px;
  padding: 8px 12px;
  color: #344054;
  background: #ffffff;
  border: 1px solid var(--line);
  font-size: 0.84rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.ghost-btn:hover {
  color: var(--primary-dark);
  border-color: rgba(37, 99, 235, 0.25);
  background: var(--primary-soft);
}

.full-btn,
.full-input {
  width: 100%;
}

.barcode-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
  margin-bottom: 10px;
}

.search-row {
  margin-bottom: 12px;
}

.compact-product-list,
.list-stack,
.cart-items {
  display: grid;
  gap: 8px;
}

.compact-row,
.list-row,
.cart-row {
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

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

.compact-row:hover,
.list-row:hover,
.cart-row:hover {
  background: #ffffff;
  border-color: #dbe3ec;
}

.row-title {
  font-weight: 800;
  letter-spacing: -0.01em;
}

.row-meta {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-thai);
  font-size: 0.84rem;
  line-height: 1.45;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.product-cell-text {
  min-width: 0;
}

.product-cell-text strong,
.product-cell-text small {
  display: block;
}

.product-cell-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f2f4f7;
  box-shadow: var(--shadow-sm);
}

.product-thumb.sm {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
}

.product-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: -0.08em;
  background: linear-gradient(145deg, #f8fafc, #e9eef6);
}

.file-field input[type="file"] {
  padding: 9px;
  min-height: auto;
}

.file-field small {
  line-height: 1.45;
}

.image-preview {
  min-height: 118px;
  display: grid;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background: #fbfcfe;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-thai);
  font-weight: 700;
}

.image-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #ffffff;
}

.image-preview.empty {
  padding: 14px;
}

.cart-card {
  position: sticky;
  top: 106px;
}

.cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 38px;
  gap: 10px;
  align-items: center;
}

.qty-control {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  gap: 4px;
  align-items: center;
}

.qty-control button,
.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 800;
}

.qty-control button:hover,
.icon-btn:hover {
  border-color: rgba(37, 99, 235, 0.25);
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.qty-control input {
  min-height: 32px;
  padding: 6px;
  text-align: center;
}

.icon-btn.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(180, 35, 24, 0.12);
}

.cart-summary {
  margin-top: 14px;
  display: grid;
  gap: 11px;
}

.total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.total-line span {
  font-family: var(--font-thai);
  color: var(--muted);
  font-weight: 700;
}

.total-line strong {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
  font-size: 0.88rem;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #475467;
  background: #f8fafc;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 0.14s ease;
}

tbody tr:hover {
  background: #fbfdff;
}

td strong {
  letter-spacing: -0.015em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  color: #344054;
  background: #f2f4f7;
  border: 1px solid #eaecf0;
  white-space: nowrap;
}

.badge.warn {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #fedf89;
}

.empty-state {
  color: var(--muted);
  padding: 16px;
  border: 1px dashed #d0d5dd;
  border-radius: var(--radius-md);
  background: #fbfcfe;
  font-family: var(--font-thai);
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: grid;
  gap: 8px;
}

.toast-message {
  max-width: 380px;
  padding: 12px 15px;
  border-radius: 16px;
  color: #fff;
  background: #101828;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-thai);
  font-weight: 700;
}

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

.toast-message.success {
  background: var(--success);
}

@media (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-two,
  .pos-layout {
    grid-template-columns: 1fr;
  }

  .cart-card {
    position: static;
  }
}

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

  .sidebar {
    position: sticky;
    z-index: 30;
    top: 0;
    height: auto;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid #dbe3ec;
  }

  .sidebar::before {
    display: none;
  }

  .sidebar-brand {
    padding: 4px 2px 8px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .nav-item {
    min-width: max-content;
    white-space: nowrap;
  }

  .logout-btn {
    margin-top: 0;
    width: max-content;
  }

  .content {
    padding: 16px;
  }

  .topbar {
    top: 12px;
  }
}

@media (max-width: 680px) {
  .login-screen {
    padding: 16px;
  }

  .login-card {
    padding: 24px;
    border-radius: 24px;
  }

  h1 {
    font-size: 2rem;
  }

  .content {
    padding: 12px;
    gap: 12px;
  }

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

  .topbar-actions {
    justify-content: space-between;
  }

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

  .metric-card,
  .panel-card {
    padding: 15px;
    border-radius: 18px;
  }

  .span-2 {
    grid-column: span 1;
  }

  .compact-row,
  .cart-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .status-chip {
    display: none;
  }

  .toast {
    left: 12px;
    right: 12px;
  }

  .toast-message {
    max-width: none;
  }
}

/* Product edit modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(100%, 820px);
  max-height: min(92vh, 860px);
  overflow: auto;
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.compact-action {
  min-height: 32px;
  padding: 6px 10px;
  white-space: nowrap;
}

@media (max-width: 680px) {
  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
    padding: 16px;
  }

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

/* Compact modern minimal refresh */
:root {
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.12);
}

body {
  background: #f7f8fa;
  font-size: 14px;
}

.glass-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: #edf0f4;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.app-shell {
  grid-template-columns: 206px minmax(0, 1fr);
}

.sidebar {
  padding: 14px 10px;
  gap: 12px;
  background: #f3f5f8;
  border-right: 1px solid #e8edf3;
}

.sidebar::before,
.sidebar-brand,
.brand-mark.small {
  display: none !important;
}

.sidebar-heading {
  padding: 6px 10px 4px;
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #94a3b8;
}

.nav-list {
  gap: 4px;
}

.nav-item {
  min-height: 36px;
  padding: 8px 10px 8px 32px;
  border-radius: 10px;
  font-size: 0.88rem;
}

.nav-item::before {
  left: 11px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #cbd5e1;
}

.nav-item.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.logout-btn {
  min-height: 34px;
  margin-top: auto;
}

.content {
  padding: 14px;
  gap: 12px;
}

.topbar {
  min-height: unset;
  padding: 13px 16px;
  border-radius: 18px;
}

.topbar .eyebrow,
.section-head .eyebrow {
  margin-bottom: 3px;
}

h2 {
  font-size: 1.38rem;
}

h3 {
  font-size: 1rem;
}

.eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.11em;
}

.status-chip,
.ghost-btn,
.primary-btn,
.danger-btn {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
}

.danger-btn {
  border: 1px solid #fee2e2;
  color: #b42318;
  background: #fff5f5;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.danger-btn:hover {
  background: #fee2e2;
  border-color: #fecaca;
  transform: translateY(-1px);
}

.metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  min-height: unset;
  padding: 14px;
  border-radius: 16px;
}

.metric-card span {
  font-size: 0.78rem;
}

.metric-card strong {
  margin-top: 6px;
  font-size: 1.45rem;
}

.metric-card small {
  margin-top: 4px;
  font-size: 0.76rem;
}

.grid-two,
.pos-layout {
  gap: 12px;
}

.panel-card {
  padding: 14px;
  border-radius: 18px;
}

.section-head {
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.form-grid {
  gap: 9px;
}

label span {
  margin-bottom: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

input,
select,
textarea {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.88rem;
}

textarea {
  min-height: 64px;
}

.image-preview {
  min-height: 96px;
  border-radius: 14px;
}

.image-preview img {
  max-height: 132px;
}

.table-wrap {
  border-radius: 14px;
  border-color: #edf0f4;
}

table {
  font-size: 0.84rem;
}

th,
td {
  padding: 9px 10px;
}

th {
  height: 34px;
  font-size: 0.68rem;
  color: #64748b;
  background: #f8fafc;
}

.product-thumb.sm,
.product-thumb {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.product-cell {
  gap: 9px;
}

.product-cell-text strong,
.row-title {
  font-size: 0.88rem;
}

.product-cell-text small,
.row-meta,
small {
  font-size: 0.74rem;
}

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
}

.compact-product-list,
.list-stack,
.cart-items {
  gap: 7px;
}

.compact-row,
.cart-row,
.list-row {
  padding: 8px;
  border-radius: 13px;
}

.cart-summary {
  gap: 8px;
}

.total-line {
  padding: 10px 0;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.compact-action {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 9px;
  font-size: 0.78rem;
}

.modal-card {
  width: min(100%, 760px);
  border-radius: 18px;
  padding: 16px;
}

.modal-head {
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: sticky;
    z-index: 20;
    height: auto;
    top: 0;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 8px;
  }

  .sidebar-heading {
    display: none;
  }

  .nav-list {
    display: flex;
    min-width: max-content;
  }

  .nav-item {
    min-height: 34px;
    padding: 8px 10px;
    white-space: nowrap;
  }

  .nav-item::before {
    display: none;
  }

  .logout-btn {
    margin-top: 0;
    min-width: 96px;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 13px;
  }

  .content {
    padding: 10px;
  }

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

  .topbar,
  .panel-card,
  .metric-card {
    border-radius: 16px;
  }

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

/* Add product modal + compact inventory toolbar */
.products-panel {
  display: grid;
  gap: 10px;
}

.compact-head {
  align-items: center;
}

.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

#addProductModal .modal-card,
#editProductModal .modal-card {
  width: min(100%, 760px);
}

#addProductModal .form-grid,
#editProductModal .form-grid {
  gap: 9px;
}

#addProductModal .image-preview,
#editProductModal .image-preview {
  min-height: 88px;
}

@media (max-width: 680px) {
  .compact-head {
    align-items: stretch;
  }

  .section-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .section-actions .primary-btn,
  .section-actions .ghost-btn {
    width: 100%;
  }
}
