:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2f5db6;
  --primary-strong: #1f4da3;
  --sidebar: #f3f4f6;
  --sidebar-text: #111827;
  --success: #22c55e;
  --warning: #f97316;
  --purple: #a855f7;
  --blue: #3b82f6;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.sidebar {
  width: 254px;
  background: var(--sidebar);
  padding: 14px 14px 16px;
  border-right: 1px solid #d7dce6;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  padding: 2px 0 6px;
}

.logo-badge {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: transparent;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-title {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: #4b5563;
  margin: 2px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 400;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-item.active,
.nav-item:hover {
  background: #dfe5f3;
  color: #111827;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 11px;
  color: var(--muted);
  padding: 10px 8px 4px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid var(--border);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.user-role {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}


.sidebar,
.main {
  transition: all 0.2s ease;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.icon-button:hover {
  background: #f8fafc;
  color: var(--primary);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.topbar {
  gap: 12px;
}

.topbar .page-title {
  margin-right: auto;
}

.nav-item svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logo-badge img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

body.sidebar-collapsed .sidebar {
  width: 0;
  padding: 0;
  overflow: hidden;
  border-right: 0;
}

.sidebar-overlay {
  display: none;
}


.topbar {
  min-height: 52px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.page {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-title h1 {
  font-size: 26px;
}

.page-title p {
  color: var(--muted);
  font-size: 14px;
}


.page-title strong,
.page-title h1 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.page-title .title-icon {
  width: 16px;
  height: 16px;
  color: #374151;
}
.button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(47, 93, 182, 0.2);
}

.button:hover {
  background: var(--primary-strong);
}

.button:disabled {
  background: #94a3b8;
  color: #e2e8f0;
  cursor: not-allowed;
  box-shadow: none;
}

.button:disabled:hover {
  background: #94a3b8;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.cards {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--card);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-link {
  display: block;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
}

.card h3 {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
  margin-bottom: 4px;
}

.card small {
  color: var(--muted);
  font-size: 12px;
}

.metric {
  font-size: 32px;
  line-height: 1.1;
  font-weight: 700;
  margin: 10px 0 4px;
}

.badge {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-left: auto;
}

.badge.blue {
  background: rgba(59, 130, 246, 0.12);
  color: var(--blue);
}

.badge.green {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
}

.badge.purple {
  background: rgba(168, 85, 247, 0.12);
  color: var(--purple);
}

.badge.orange {
  background: rgba(249, 115, 22, 0.12);
  color: var(--warning);
}

.widget {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.widget h4 {
  font-size: 15px;
}

.widget p {
  color: var(--muted);
  font-size: 13px;
}


.page-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
}

.badge svg {
  width: 20px;
  height: 20px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row-subtext {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.status {
  display: inline-flex;
  align-items: center;
  align-self: center;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #dbe4ff;
  background: #eef2ff;
  color: #1e40af;
  font-size: 12px;
  font-weight: 600;
}

.status.done {
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #166534;
}

.table {
  display: grid;
  gap: 12px;
}

.table-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fdfdff;
  font-size: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}


.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.table-actions form {
  margin: 0;
  display: inline-flex;
}

.table-action {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.table-action svg {
  width: 16px;
  height: 16px;
}

.table-action-edit {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.table-action-edit:hover {
  color: #1e3a8a;
  background: #dbeafe;
}

.table-action-delete {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.table-action-delete:hover {
  color: #991b1b;
  background: #fee2e2;
}
.permission-matrix th.permission-matrix-level {
  text-align: center;
  width: 82px;
}

.permission-matrix-cell {
  text-align: center !important;
}

.permission-matrix-input {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.permission-matrix-input input[type='radio'] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.tag--default {
  background: #eef2ff;
  color: var(--primary);
}

.tag--registered {
  background: #fee2e2;
  color: #991b1b;
}

.tag--receiving {
  background: #ffedd5;
  color: #9a3412;
}

.tag--accepted {
  background: #dcfce7;
  color: #166534;
}

.tag--incomplete {
  background: #fee2e2;
  color: #991b1b;
}

.tag--reserved-production {
  background: #dcfce7;
  color: #166534;
}


.warehouse-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.warehouse-stat-card {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.warehouse-stat-card strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  margin-bottom: 4px;
}

.warehouse-stat-card span {
  color: #374151;
}

.warehouse-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.warehouse-stat-icon svg {
  width: 20px;
  height: 20px;
}

.warehouse-stat-icon.blue {
  background: rgba(6, 182, 212, 0.15);
  color: #0891b2;
}

.warehouse-stat-icon.green {
  background: rgba(34, 197, 94, 0.14);
  color: #16a34a;
}

.warehouse-stat-icon.purple {
  background: rgba(168, 85, 247, 0.16);
  color: #9333ea;
}

.warehouse-search {
  max-width: 384px;
  border: 1px solid #9ca3af;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
}

.warehouse-search svg {
  width: 18px;
  height: 18px;
  color: #4b5563;
  flex-shrink: 0;
}

.warehouse-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  color: #374151;
}

.warehouse-search input::placeholder {
  color: #6b7280;
}

.warehouse-empty {
  min-height: 280px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fcfcfd;
}

.warehouse-empty h3 {
  font-size: 32px;
  margin-bottom: 6px;
  color: #0f172a;
}

.warehouse-empty p {
  font-size: 14px;
  color: #4b5563;
}

.incoming-empty-card {
  min-height: 350px;
  display: flex;
}

.incoming-empty-card .empty {
  width: 100%;
}

.incoming-empty-card .empty .icon svg {
  width: 22px;
  height: 22px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  margin-right: 6px;
}

.status-dot.warning {
  background: var(--warning);
}

.status-dot.muted {
  background: var(--muted);
}

.auth-page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f6f7fb 0%, #eef2ff 100%);
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.auth-card h1 {
  font-size: 22px;
  margin-bottom: 6px;
}

.auth-card p {
  color: var(--muted);
  margin-bottom: 20px;
}

.alert {
  padding: 10px 14px;
  border-radius: 10px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 13px;
  margin-bottom: 16px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  color: var(--muted);
  padding: 40px 20px;
}

.empty .icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #f0f2f7;
  display: grid;
  place-items: center;
  color: var(--muted);
  margin-bottom: 8px;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.input {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  min-width: 0;
  width: 100%;
}

.input input,
.input select {
  border: none;
  outline: none;
  width: 100%;
  font-size: 14px;
  background: transparent;
}

.packlist-hint-input::placeholder {
  color: #cbd5e1;
}

.panel-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.toggle span {
  font-size: 13px;
  color: var(--muted);
}

.switch {
  width: 46px;
  height: 24px;
  border-radius: 24px;
  background: #d1d5db;
  position: relative;
}

.switch::after {
  content: "";
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 4px;
  transition: transform 0.2s ease;
}

.switch.active {
  background: var(--primary);
}

.switch.active::after {
  transform: translateX(20px);
}

.button.button-muted {
  background: #f3f4f6;
  color: #374151;
  box-shadow: none;
  border: 1px solid var(--border);
}

.button.button-muted:hover {
  background: #e5e7eb;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.28);
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 34px;
  line-height: 1.2;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #4b5563;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.modal-close:hover {
  background: #f3f4f6;
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: #374151;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: #111827;
  background: #fff;
}

.modal-form textarea {
  resize: vertical;
  min-height: 94px;
}

.modal-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }

  .page {
    padding: 20px;
  }
}

@media (max-width: 860px) {
  body {
    flex-direction: row;
  }

  .topbar {
    min-height: 56px;
    padding: 8px 12px;
    align-items: center;
    gap: 8px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(320px, 88vw);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-mobile-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
    display: block;
  }

  body.sidebar-mobile-open {
    overflow: hidden;
  }

  body.sidebar-collapsed .sidebar {
    width: min(320px, 88vw);
    padding: 14px 14px 16px;
    border-right: 1px solid #d7dce6;
    overflow-y: auto;
  }

  .main {
    width: 100%;
  }

  .topbar .page-title {
    min-width: 0;
  }

  .topbar .page-title p,
  .topbar .page-title span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .modal {
    padding: 18px;
  }

  .modal-form-row {
    grid-template-columns: 1fr;
  }
}