:root {
  --brand: #0d5ec9;
  --brand-dark: #0a49a0;
  --text-dark: #1f2a37;
  --text-muted: #6b7280;
  --line: #e8edf3;
  --bg: #f5f7fb;
  --card: #ffffff;
  --soft-blue: #eef4ff;
  --soft-violet: #f2efff;
  --soft-gray: #eef3f7;
  --soft-green: #d9eef5;
  --soft-red: #ffe1dd;

  --ui-scale: 1;
  --sidebar-width: 16.25rem;
  --mobile-sidebar-width: min(82vw, 18rem);
}

* {
  box-sizing: border-box;
}

html {
  font-size: calc(16px * var(--ui-scale));
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  font-size: 1rem;
  line-height: 1.5;
  overflow-x: hidden;
}

body,
button,
input,
select,
textarea {
  font-size: 1rem;
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.75rem;
}
h4 {
  font-size: 1.5rem;
}
h5 {
  font-size: 1.25rem;
}
h6 {
  font-size: 1rem;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: #f3f6fa;
  border-right: 1px solid var(--line);
  min-height: 100vh;
  position: sticky;
  top: 0;
  transition:
    width 0.25s ease,
    flex-basis 0.25s ease,
    transform 0.25s ease,
    opacity 0.25s ease;
  overflow: hidden;
  z-index: 1045;
}

body.sidebar-collapsed .sidebar {
  width: 0;
  flex-basis: 0;
  border-right: 0;
  opacity: 0;
}

body.sidebar-collapsed .sidebar-inner,
body.sidebar-collapsed .brand-top {
  opacity: 0;
  pointer-events: none;
}

body.sidebar-collapsed .new-entry-btn {
  display: none;
}

.brand-top {
  height: 4.25rem;
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  font-weight: 800;
  font-size: 1.125rem;
  color: #1d4ed8;
  border-bottom: 1px solid var(--line);
  background: #fff;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.sidebar-inner {
  padding: 1.25rem 1.5rem 1.75rem;
  transition: opacity 0.2s ease;
}

.portal-title {
  color: #153ea7;
  font-weight: 700;
  font-size: 1.375rem;
  line-height: 1.1;
}

.portal-subtitle {
  font-size: 0.875rem;
  color: #2f3a4a;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.8;
}

.nav-ledger .nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  color: #334155;
  padding: 0.875rem;
  border-radius: 0.875rem;
  margin-bottom: 0.375rem;
  font-weight: 500;
  position: relative;
  white-space: nowrap;
  font-size: 0.95rem;
  text-decoration: none;
}

.nav-ledger .nav-link.active {
  background: #eaf2ff;
  color: #1d4ed8;
  font-weight: 700;
}

.nav-ledger .nav-link.active::after {
  content: "";
  position: absolute;
  right: -0.625rem;
  top: 0.75rem;
  width: 0.1875rem;
  height: calc(100% - 1.5rem);
  background: #245eff;
  border-radius: 0.1875rem;
}

.new-entry-btn {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.625rem;
  background: var(--brand);
  color: #fff;
  border-radius: 0.75rem;
  height: 3.5rem;
  border: 0;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 0.5rem 1.25rem rgba(13, 94, 201, 0.18);
}

.main-area {
  flex: 1;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  transition: width 0.25s ease;
}

body.sidebar-collapsed .main-area {
  width: 100%;
}

.topbar {
  height: 4.25rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.search-shell {
  width: 18.75rem;
  background: #f4f6fa;
  border-radius: 0.75rem;
  padding: 0 1rem;
  height: 2.625rem;
  display: flex;
  align-items: center;
}

.search-shell input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 0.9375rem;
}

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #475569;
  background: transparent;
  border: 0;
  font-size: 1rem;
  cursor: pointer;
}

.nav-toggle-btn {
  background: #f4f6fa;
  border: 1px solid #e5eaf1;
}

.nav-toggle-btn:hover {
  background: #eaf2ff;
  color: #1d4ed8;
}

.avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(180deg, #1f2937, #0f172a);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
}

.page-wrap {
  padding: 2.125rem 2.625rem 2.5rem;
}

.page-title {
  font-size: 1.5rem;
  line-height: 0.98;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
}

.page-subtitle {
  color: #4b5563;
  font-size: 1.125rem;
  margin-bottom: 1.75rem;
  max-width: 47.5rem;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1.375rem;
  box-shadow: 0 0.375rem 1.5rem rgba(15, 23, 42, 0.04);
}

.toolbar-soft {
  background: #f5f7fa;
  border-radius: 1.125rem;
  padding: 0.75rem 1.125rem;
  border: 1px solid #eef2f7;
}

.segmented {
  background: #f5f6f8;
  border-radius: 0.875rem;
  padding: 0.375rem;
  display: inline-flex;
  gap: 0.5rem;
}

.segmented .btn {
  border: 0;
  border-radius: 0.625rem;
  padding: 0.625rem 1.125rem;
  font-weight: 600;
  color: #4b5563;
  font-size: 0.95rem;
}

.segmented .btn.active {
  background: #fff;
  color: #0d5ec9;
  box-shadow: 0 0.125rem 0.625rem rgba(15, 23, 42, 0.08);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3125rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pill-violet {
  background: #e8e1ff;
  color: #6651b7;
}

.pill-blue {
  background: #d7edf8;
  color: #2d6d8d;
}

.pill-gray {
  background: #e8edf1;
  color: #6b7280;
}

.pill-red {
  background: #ffd6d1;
  color: #c43d32;
}

.pill-red-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 0.375rem;
  align-items: flex-start;
}

.record-avatar {
  width: 2.625rem;
  height: 2.625rem;
  border-radius: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.mini-card {
  border-radius: 1.25rem;
  padding: 1.75rem 1.5rem;
  min-height: 10.3125rem;
  border: 1px solid #e8edf4;
}

.mini-card h6 {
  color: #3157b7;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 0.625rem;
}

.mini-card .metric {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.875rem;
}

.form-card {
  padding: 2.125rem 2.375rem;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
}

.label-text {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #4b5563;
  margin-bottom: 0.5rem;
}

.input-material,
.select-material,
.textarea-material {
  border: 0;
  border-bottom: 2px solid #d8dee7;
  border-radius: 0;
  background: #f7fafc;
  padding: 1rem 0.875rem;
  font-size: 1rem;
}

.input-material,
.select-material {
  height: 3.625rem;
}

.textarea-material {
  min-height: 8.75rem;
  border: 1px solid #eef2f7;
  border-radius: 0.875rem;
  background: #f9fbfd;
}

.input-material:focus,
.select-material:focus,
.textarea-material:focus {
  box-shadow: none;
  border-color: var(--brand);
  background: #fff;
}

.error-input {
  border-color: #d2453d;
  background: #fff;
}

.helper-error {
  color: #b42318;
  font-size: 0.8125rem;
  margin-top: 0.5rem;
}

.asset-card,
.info-card {
  padding: 1.75rem;
  border-radius: 1.125rem;
  background: #f5f8fb;
  border: 1px solid #e6edf3;
}

.step-caption {
  color: #245eff;
  font-weight: 800;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.625rem;
}

.progress-thin {
  height: 0.3125rem;
  border-radius: 999px;
  background: #e9eef4;
  overflow: hidden;
}

.progress-thin .bar {
  height: 100%;
  width: 50%;
  background: #0d5ec9;
}

.check-tile {
  border: 1px solid #dbe4ee;
  border-radius: 0.75rem;
  padding: 1rem 1.125rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.625rem;
  background: #fff;
  font-size: 0.95rem;
}

.credential-card {
  padding: 1.875rem;
}

.compact-id-card--tight {
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  background: #fff;
  border: 1px solid #e6edf3;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.compact-label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  margin-bottom: 0.2rem !important;
}

.compact-customer-name {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.1;
  color: #1f2a37;
  margin-bottom: 0.1rem;
}

.compact-customer-role {
  color: #6b7280;
  font-size: 0.72rem;
  line-height: 1.2;
}

.compact-customer-id {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0d5ec9;
  line-height: 1.2;
  word-break: break-word;
}

.compact-status {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
}

.compact-meta-value {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  color: #1f2a37;
}

.compact-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0d5ec9;
  display: inline-block;
  flex: 0 0 7px;
}

.compact-hash-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px dashed #d7e0ea;
}

.compact-hash-value {
  font-size: 0.72rem;
  color: #475569;
  letter-spacing: 0.015em;
  word-break: break-word;
}

.qr-box {
  width: 17.5rem;
  height: 17.5rem;
  background:
    linear-gradient(90deg, rgba(31, 41, 55, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(31, 41, 55, 0.08) 1px, transparent 1px), #fff;
  background-size: 1.25rem 1.25rem;
  border: 3px solid #303942;
  position: relative;
  margin: 0 auto;
}

.qr-pixel {
  position: absolute;
  background: #26323a;
}

.barcode-lines {
  width: 9.375rem;
  height: 2.875rem;
  margin: 0 auto 1rem;
  background: repeating-linear-gradient(
    to right,
    #111 0,
    #111 3px,
    transparent 3px,
    transparent 6px,
    #111 6px,
    #111 8px,
    transparent 8px,
    transparent 11px
  );
}

.muted-small {
  color: #6b7280;
  font-size: 0.8125rem;
}

.footer-strip {
  color: #98a2b3;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.6875rem;
}

.table {
  font-size: 0.95rem;
}

.table thead th {
  font-size: 0.75rem;
}

.btn {
  font-size: 0.95rem;
}

.form-control,
.form-select {
  font-size: 1rem;
}

.mobile-nav-backdrop {
  display: none;
}

/* Mobile */
@media (max-width: 1199px) {
  .app-shell {
    display: block;
  }

  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.25s ease,
      visibility 0.25s ease;
  }

  body.mobile-nav-open .mobile-nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--mobile-sidebar-width);
    flex: none;
    min-height: 100vh;
    transform: translateX(-100%);
    opacity: 1;
    border-right: 1px solid var(--line);
    box-shadow: 0 0.625rem 1.875rem rgba(15, 23, 42, 0.18);
    background: #f3f6fa;
    overflow: hidden;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-collapsed .sidebar {
    width: var(--mobile-sidebar-width);
    flex-basis: auto;
    transform: translateX(-100%);
    opacity: 1;
    border-right: 1px solid var(--line);
  }

  body.sidebar-collapsed .sidebar-inner,
  body.sidebar-collapsed .brand-top {
    opacity: 1;
    pointer-events: auto;
  }

  .main-area {
    width: 100%;
    margin-left: 0;
  }

  body.sidebar-collapsed .main-area {
    width: 100%;
  }

  .sidebar-inner {
    padding: 1rem;
    overflow-y: auto;
    height: calc(100vh - 4.25rem);
  }

  .brand-top {
    padding: 0 1rem;
    font-size: 1rem;
  }

  .portal-title {
    font-size: 1.125rem;
  }

  .portal-subtitle {
    font-size: 0.75rem;
  }

  .nav-ledger .nav-link {
    padding: 0.875rem;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
  }

  .nav-ledger .nav-link.active::after {
    display: none;
  }

  .new-entry-btn {
    position: static;
    width: 100%;
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 3rem;
    font-size: 0.9375rem;
  }

  .topbar {
    padding: 0 1rem;
  }

  .search-shell {
    display: none;
  }

  .page-wrap {
    padding: 1.25rem 1rem 1.5rem;
  }

  .page-title {
    font-size: 2rem;
    line-height: 1.05;
  }

  .page-subtitle {
    font-size: 0.95rem;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
  }

  .segmented .btn {
    flex: 0 0 auto;
  }

  .table-responsive {
    border-radius: 1rem;
  }
}
