:root {
  --primary: #5b45e0;
  --primary-dark: #4432bd;
  --success: #0d9f6e;
  --warning: #d97706;
  --info: #1474c4;
  --dark: #162033;
  --muted: #697386;
  --border: #e5e9f2;
  --bg: #f5f7fb;
  --white: #fff;
  --danger: #cf3c4f;
  --shadow: 0 14px 35px rgba(35, 45, 80, .08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--dark);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
}

.navbar {
  height: 72px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--dark);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), #8675ee);
  display: grid;
  place-items: center;
  color: white;
  font-size: 18px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.environment {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.environment span {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  margin-right: 6px;
}

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

.nav-actions form {
  margin: 0;
}

.login-page {
  min-height: 100vh;
  background: #fff;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(460px, 1.1fr);
}

.login-intro {
  color: #fff;
  padding: clamp(36px, 6vw, 80px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: radial-gradient(circle at 75% 20%, rgba(140, 119, 255, .38), transparent 30%), linear-gradient(145deg, #281d72, #4e38c6 55%, #6452dd);
}

.login-brand,
.login-brand small {
  color: #fff;
}

.login-brand .brand-mark {
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .18);
}

.login-intro .eyebrow {
  color: #cfc7ff;
}

.login-intro h1 {
  font-size: clamp(42px, 5vw, 68px);
  line-height: 1.02;
  letter-spacing: -.055em;
  margin: 0;
}

.login-intro>div>p:last-child {
  color: #dedaff;
  line-height: 1.75;
  max-width: 520px;
  font-size: 15px;
}

.secure-note {
  display: flex;
  align-items: center;
  gap: 13px;
}

.secure-note>i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .12);
}

.secure-note strong,
.secure-note small {
  display: block;
}

.secure-note small {
  color: #cfc9f5;
  margin-top: 4px;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 36px;
  background: #f8f9fd;
}

.login-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: clamp(28px, 4vw, 44px);
  box-shadow: 0 24px 70px rgba(37, 31, 78, .1);
}

.login-card h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -.035em;
}

.login-subtitle {
  color: var(--muted);
  line-height: 1.6;
  margin: 9px 0 28px;
}

.form-alert {
  display: flex;
  gap: 9px;
  align-items: center;
  color: #a82438;
  background: #fff0f2;
  border: 1px solid #ffd4da;
  border-radius: 10px;
  padding: 11px 12px;
  margin-bottom: 18px;
  font-size: 12px;
}

.form-alert[hidden] {
  display: none;
}

.form-field {
  display: block;
  margin: 0 0 18px;
}

.form-field>span {
  display: block;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 8px;
}

.form-field>div {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 11px;
  padding: 0 13px;
  color: #929bad;
}

.form-field>div:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 69, 224, .1);
}

.form-field input {
  border: 0;
  outline: 0;
  width: 100%;
  padding: 13px 0;
  background: transparent;
}

.password-toggle {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 7px 0 7px 7px;
}

.login-submit {
  width: 100%;
  justify-content: center;
  padding: 13px 16px;
  margin-top: 4px;
}

.login-help {
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  margin: 20px 0 0;
}

.dashboard-container {
  max-width: 1560px;
  margin: auto;
  padding: 42px clamp(18px, 4vw, 58px) 60px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  margin: 0 0 8px;
}

.dashboard-header h1 {
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -.04em;
  margin: 0;
}

.dashboard-header p:not(.eyebrow) {
  color: var(--muted);
  margin: 10px 0 0;
  max-width: 680px;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: 600 13px Inter;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(91, 69, 224, .24);
}

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

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

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

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 15px;
  align-items: center;
  box-shadow: 0 4px 15px rgba(35, 45, 80, .03);
}

.stat-card>i {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.stat-card.primary>i {
  background: #eeeaff;
  color: var(--primary);
}

.stat-card.success>i {
  background: #e5f8f1;
  color: var(--success);
}

.stat-card.info>i {
  background: #e7f3fc;
  color: var(--info);
}

.stat-card.warning>i {
  background: #fff3dd;
  color: var(--warning);
}

.stat-card span,
.stat-card small {
  display: block;
}

.stat-card span {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.stat-card small {
  color: var(--muted);
  margin-top: 3px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
}

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  font-size: 16px;
  margin: 0;
}

.panel-header p {
  font-size: 12px;
  color: var(--muted);
  margin: 5px 0 0;
}

.filters {
  display: flex;
  gap: 9px;
}

.search-box {
  min-width: 330px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 69, 224, .1);
}

input,
select {
  font: inherit;
  color: var(--dark);
}

.search-box input {
  border: 0;
  outline: 0;
  padding: 10px 0;
  width: 100%;
  background: transparent;
}

.filters select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 30px 9px 10px;
  background: #fff;
}

.table-wrap {
  overflow: auto;
  min-height: 380px;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th {
  background: #fafbfe;
  text-align: left;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 15px;
  border-bottom: 1px solid #eff1f6;
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr:hover {
  background: #fbfaff;
}

.money {
  font-weight: 800;
  color: var(--success);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #424c5f;
}

.sku {
  background: #f0edff;
  color: var(--primary);
  border-radius: 6px;
  padding: 5px 7px;
  font-weight: 700;
  font-size: 10px;
}

.view-btn {
  width: 31px;
  height: 31px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  border-radius: 8px;
  cursor: pointer;
}

.table-state {
  text-align: center !important;
  color: var(--muted);
  padding: 70px !important;
}

.pagination {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  border-top: 1px solid var(--border);
}

.pagination span {
  color: var(--muted);
  font-size: 12px;
}

.product-list {
  padding: 8px 18px 18px;
}

.product-item {
  padding: 15px 2px;
  border-bottom: 1px solid var(--border);
}

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

.product-item>div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.product-item strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-item span {
  font-size: 11px;
  color: var(--muted);
}

.product-item small {
  display: block;
  color: var(--success);
  font-weight: 700;
  margin-top: 7px;
}

.empty-small {
  padding: 35px 5px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(12, 19, 34, .56);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  background: #fff;
  border-radius: 20px;
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 30px;
  position: relative;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .25);
}

.modal-card h2 {
  margin: 0 0 24px;
}

.modal-close {
  position: absolute;
  right: 20px;
  top: 18px;
  border: 0;
  background: #f2f4f8;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 23px;
  cursor: pointer;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-item {
  background: #f8f9fc;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 13px;
  min-width: 0;
}

.detail-item.wide {
  grid-column: 1 / -1;
}

.detail-item small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}

.detail-item div {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--dark);
  color: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s;
  z-index: 70;
}

.toast.show {
  opacity: 1;
  transform: none;
}

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

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

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

  .product-panel {
    order: -1;
  }

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

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters {
    width: 100%;
  }

  .search-box {
    min-width: 0;
    flex: 1;
  }
}

@media (max-width: 650px) {
  .navbar {
    height: 64px;
  }

  .environment {
    display: none;
  }

  .login-shell {
    display: block;
  }

  .login-intro {
    min-height: 220px;
    padding: 28px 24px;
  }

  .login-intro>div:not(.secure-note) {
    margin: 44px 0 10px;
  }

  .login-intro h1 {
    font-size: 37px;
  }

  .login-intro>div>p:last-child,
  .secure-note {
    display: none;
  }

  .login-panel {
    padding: 24px 18px 40px;
    margin-top: -1px;
  }

  .login-card {
    padding: 27px 23px;
  }

  .dashboard-container {
    padding-top: 28px;
  }

  .dashboard-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .filters {
    flex-direction: column;
  }

  .filters select {
    width: 100%;
  }

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

  .detail-item.wide {
    grid-column: auto;
  }

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

  .pagination {
    justify-content: space-between;
  }

  .dashboard-header .btn {
    width: 100%;
    justify-content: center;
  }
}
