:root {
  --red-700: #a51d27;
  --red-600: #bd2732;
  --red-100: #fce8e9;
  --ink: #17202a;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --canvas: #f4f6f8;
  --green: #147a55;
  --green-soft: #e7f5ee;
  --amber: #a45e08;
  --amber-soft: #fff2d8;
  --blue: #2463a8;
  --blue-soft: #e8f1fb;
  --shadow: 0 18px 50px rgba(23, 32, 42, 0.14);
  --sidebar-width: 248px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body,
button,
input,
select,
textarea {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

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

button,
input,
select,
textarea {
  font-size: 14px;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke-width: 2;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 6px;
  color: #ffffff;
  background: var(--red-600);
  font-size: 20px;
  font-weight: 800;
}

.login-page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #d8dde1 url("../img/login-warehouse.e40e0de3aa7b.png") center / cover no-repeat;
}

.login-shade {
  position: fixed;
  inset: 0;
  background: rgba(18, 24, 33, 0.24);
}

.login-brand {
  position: fixed;
  z-index: 2;
  top: 28px;
  left: 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
}

.login-brand-name {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 800;
}

.login-brand-company {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
}

.login-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 88px 20px 40px;
}

.login-panel {
  width: min(100%, 420px);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-panel-head {
  margin-bottom: 26px;
}

.login-kicker,
.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--red-700);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.login-panel-head h1,
.page-heading h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.login-panel-head p,
.page-heading p,
.section-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-form,
.standard-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.field input:not([type="checkbox"]),
.field select,
.field textarea,
.search-box,
.filter-bar > select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfd5dd;
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:not([type="checkbox"]),
.field select,
.field textarea,
.filter-bar > select {
  padding: 10px 12px;
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-box:focus-within,
.filter-bar > select:focus {
  border-color: var(--red-600);
  box-shadow: 0 0 0 3px rgba(189, 39, 50, 0.12);
}

.input-with-icon {
  position: relative;
}

.input-with-icon > svg {
  position: absolute;
  z-index: 1;
  top: 13px;
  left: 13px;
  color: #7b8493;
}

.input-with-icon input {
  padding-left: 42px !important;
}

.password-field input {
  padding-right: 44px !important;
}

.password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: #667085;
  background: transparent;
}

.password-toggle:hover {
  background: #f0f2f5;
}

.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  font-weight: 750;
  white-space: nowrap;
}

.primary-button {
  padding: 10px 16px;
  border: 1px solid var(--red-600);
  color: #ffffff;
  background: var(--red-600);
}

.primary-button:hover {
  border-color: var(--red-700);
  background: var(--red-700);
}

.secondary-button {
  padding: 9px 14px;
  border: 1px solid #cfd5dd;
  color: #344054;
  background: #ffffff;
}

.secondary-button:hover {
  background: #f7f8fa;
}

.text-button {
  min-height: 32px;
  color: var(--red-700);
  font-size: 13px;
}

.login-button {
  width: 100%;
  min-height: 46px;
  margin-top: 2px;
}

.login-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(207, 213, 221, 0.8);
  color: #667085;
  font-size: 11px;
  font-weight: 650;
}

.form-alert,
.message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid #f0b7bb;
  border-radius: 6px;
  color: #8e1d26;
  background: #fff1f2;
  font-size: 13px;
  line-height: 1.5;
}

.form-alert {
  margin-bottom: 18px;
  padding: 11px 12px;
}

.field-error,
.field-help {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.45;
}

.field-error {
  color: #b4232c;
}

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

.password-page {
  min-height: 100vh;
  background: #eef1f4;
}

.password-wrap {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px 18px;
}

.password-panel {
  width: min(100%, 470px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 40px rgba(23, 32, 42, 0.1);
}

.password-panel > .brand-mark {
  margin-bottom: 22px;
}

.app-body {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid #dfe3e8;
  background: #ffffff;
}

.brand-block {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 11px;
  padding: 16px 19px;
  border-bottom: 1px solid #edf0f2;
}

.brand-name {
  font-size: 17px;
  font-weight: 850;
  line-height: 1.15;
}

.brand-company {
  overflow: hidden;
  max-width: 155px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  padding: 18px 12px;
}

.nav-item {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 6px;
  color: #4c5563;
  font-size: 13px;
  font-weight: 700;
}

.nav-item:hover {
  color: var(--ink);
  background: #f4f6f8;
}

.nav-item.active {
  color: var(--red-700);
  background: var(--red-100);
}

.sidebar-footer {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid #edf0f2;
}

.user-chip {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 9px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #344054;
  font-size: 13px;
  font-weight: 800;
}

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

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

.user-copy strong {
  font-size: 12px;
}

.user-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #667085;
  background: transparent;
}

.icon-button:hover {
  border-color: #d9dde3;
  color: var(--ink);
  background: #f7f8fa;
}

.app-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 64px;
  align-items: center;
  gap: 13px;
  padding: 0 28px;
  border-bottom: 1px solid #dfe3e8;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

.topbar-company {
  font-size: 13px;
  font-weight: 800;
}

.topbar-role {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.topbar-actions {
  display: flex;
  margin-left: auto;
}

.live-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid #b7ddcd;
  border-radius: 999px;
  color: #116844;
  background: #f0faf5;
  font-size: 10px;
  font-weight: 800;
}

.live-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1e9d6a;
}

.mobile-menu {
  display: none;
}

.content {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 28px;
}

.messages {
  margin-bottom: 18px;
}

.message {
  padding: 11px 13px;
  border-color: #acd7c5;
  color: #126845;
  background: #edf9f3;
}

.page-heading {
  display: flex;
  min-height: 62px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}

.page-heading.compact {
  margin-bottom: 18px;
}

.page-heading .primary-button {
  flex: 0 0 auto;
}

.status-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  color: #3f4855;
  background: #edf0f3;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.active,
.status-badge.open {
  color: #126845;
  background: var(--green-soft);
}

.status-badge.pending,
.status-badge.on_hold {
  color: #8a5209;
  background: var(--amber-soft);
}

.status-badge.inactive,
.status-badge.closed {
  color: #7a2630;
  background: var(--red-100);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  min-height: 104px;
  align-items: center;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 7px;
}

.stat-card.red .stat-icon {
  color: var(--red-700);
  background: var(--red-100);
}

.stat-card.green .stat-icon {
  color: var(--green);
  background: var(--green-soft);
}

.stat-card.amber .stat-icon {
  color: var(--amber);
  background: var(--amber-soft);
}

.stat-card.blue .stat-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

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

.stat-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.stat-card strong {
  margin-top: 5px;
  font-size: 24px;
  line-height: 1.1;
}

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

.section-block,
.quick-panel,
.form-surface,
.detail-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.section-head {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid #edf0f2;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: #596273;
  background: #fafbfc;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

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

tbody tr:hover td {
  background: #fcfcfd;
}

.table-link {
  color: var(--red-700);
  font-weight: 800;
}

.empty-cell {
  height: 100px;
  color: var(--muted);
  text-align: center;
}

.quick-panel {
  align-self: start;
  overflow: hidden;
}

.quick-panel > a {
  display: grid;
  min-height: 53px;
  grid-template-columns: 20px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #edf0f2;
  color: #3b4554;
  font-size: 12px;
  font-weight: 750;
}

.quick-panel > a:last-child {
  border-bottom: 0;
}

.quick-panel > a:hover {
  color: var(--red-700);
  background: #fff8f8;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px auto;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  color: #7d8694;
}

.search-box input {
  width: 100%;
  height: 42px;
  padding: 9px 12px 9px 40px;
  border: 0;
  outline: 0;
  background: transparent;
}

.form-surface {
  padding: 22px;
}

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

.full-span {
  grid-column: 1 / -1;
}

.form-grid .form-alert {
  margin-bottom: 0;
}

.checkbox-field {
  display: flex;
  align-items: flex-end;
}

.checkbox-label {
  display: inline-flex !important;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  margin: 0 !important;
}

.checkbox-label input {
  width: 17px;
  height: 17px;
  accent-color: var(--red-600);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid #edf0f2;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 8px 18px 18px;
}

.detail-list > div {
  min-width: 0;
  padding: 14px 10px 14px 0;
  border-bottom: 1px solid #edf0f2;
}

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

.detail-list dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.sidebar-scrim {
  display: none;
}

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

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .quick-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quick-panel .section-head {
    grid-column: 1 / -1;
  }
}

@media (max-width: 800px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 25;
    inset: 0;
    background: rgba(23, 32, 42, 0.42);
  }

  .sidebar-scrim.show {
    display: block;
  }

  .app-shell {
    margin-left: 0;
  }

  .mobile-menu {
    display: grid;
  }

  .topbar {
    height: 60px;
    padding: 0 16px;
  }

  .content {
    padding: 20px 16px;
  }

  .filter-bar {
    grid-template-columns: minmax(0, 1fr) 180px auto;
  }
}

@media (max-width: 620px) {
  .login-brand {
    top: 18px;
    left: 18px;
  }

  .login-brand-name {
    font-size: 18px;
  }

  .login-wrap {
    align-items: end;
    padding: 84px 12px 12px;
  }

  .login-panel {
    padding: 26px 20px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .page-heading .primary-button {
    width: 100%;
  }

  .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-card {
    min-height: 88px;
  }

  .quick-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .quick-panel .section-head {
    grid-column: auto;
  }

  .filter-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid,
  .detail-layout,
  .detail-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-surface {
    padding: 16px;
  }

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

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

  .password-panel {
    padding: 26px 20px;
  }
}
