:root {
  color-scheme: light;
  --ink: #17231f;
  --muted: #64736e;
  --faint: #8c9995;
  --line: #d9e3de;
  --line-strong: #c3d4cc;
  --surface: #fbfcfb;
  --panel: #ffffff;
  --wash: #f2f6f4;
  --forest: #173d33;
  --forest-2: #24594a;
  --mint: #d8f1e4;
  --gold: #c89b3c;
  --gold-soft: #fff1ce;
  --blue: #2f6fbb;
  --blue-soft: #e7f0ff;
  --red: #ba3a3a;
  --red-soft: #ffe9e6;
  --green: #24845e;
  --green-soft: #e2f6ec;
  --shadow: 0 18px 50px rgba(28, 53, 44, 0.12);
  --radius: 8px;
  --sidebar: 276px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface);
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 10px;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
}

.brand strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.role-btn {
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.role-btn.active {
  background: var(--forest);
  color: #fff;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group.hidden {
  display: none;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

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

.nav-item.active {
  background: var(--mint);
  color: var(--forest);
  font-weight: 700;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(23, 61, 51, 0.08);
  font-size: 15px;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.workspace {
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(216, 241, 228, 0.42), rgba(251, 252, 251, 0) 260px),
    var(--surface);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 82px;
  padding: 18px 28px;
  background: rgba(251, 252, 251, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(217, 227, 222, 0.72);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.mobile-menu {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 16px;
  font-size: 20px;
  line-height: 1.3;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.3;
}

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

.search-box {
  width: min(360px, 30vw);
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.icon-button,
.profile-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

.icon-button {
  width: 42px;
}

.profile-button {
  padding: 4px 10px 4px 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--forest);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
}

.content {
  padding: 28px;
}

.view {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.panel,
.metric,
.table-wrap,
.form-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(23, 61, 51, 0.02);
}

.panel,
.form-panel {
  padding: 18px;
}

.metric {
  min-height: 116px;
  padding: 16px;
}

.metric-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.metric-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

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

.toolbar h2,
.toolbar p {
  margin-bottom: 0;
}

.toolbar-left,
.toolbar-right,
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 0 12px;
  color: var(--muted);
}

.segmented button.active {
  background: #fff;
  color: var(--forest);
  box-shadow: 0 1px 4px rgba(28, 53, 44, 0.09);
  font-weight: 700;
}

.btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  font-weight: 700;
}

.btn.primary {
  border-color: var(--forest);
  background: var(--forest);
  color: #fff;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: #f1b8b1;
  background: var(--red-soft);
  color: var(--red);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 16px;
}

.product-card {
  min-height: 240px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.product-head,
.asset-row,
.order-head,
.project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

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

.token-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--mint);
  color: var(--forest);
  font-weight: 800;
}

.token-title {
  font-weight: 800;
}

.token-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--wash);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.green {
  background: var(--green-soft);
  color: var(--green);
}

.badge.gold {
  background: var(--gold-soft);
  color: #8a6518;
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.red {
  background: var(--red-soft);
  color: var(--red);
}

.product-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-box {
  padding: 10px;
  background: var(--wash);
  border-radius: var(--radius);
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-box strong {
  display: block;
  margin-top: 4px;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--wash);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--forest);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #f7faf8;
}

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

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

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

.caption {
  color: var(--faint);
  font-size: 12px;
}

.asset-list {
  display: grid;
  gap: 10px;
}

.asset-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.asset-row.doc-row {
  display: block;
}

.asset-row.doc-row p {
  margin: 6px 0 0;
  white-space: normal;
  line-height: 1.6;
}

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

.quick-action {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
}

.quick-action span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--forest);
  box-shadow: 0 0 0 4px var(--mint);
}

.timeline-title {
  font-weight: 800;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.filters input,
.filters select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

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

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

.filters input,
.filters select {
  width: auto;
  min-width: 160px;
}

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

.check-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--forest);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
}

.narrow {
  max-width: 720px;
  margin: 0 auto;
}

.auth-layout {
  min-height: calc(100vh - 138px);
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.auth-card {
  width: min(100%, 520px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.brand.large {
  padding: 0 0 18px;
}

.brand.large img {
  width: 54px;
  height: 54px;
}

.brand.large strong {
  font-size: 24px;
}

.auth-actions {
  margin-top: 16px;
  margin-bottom: 0;
}

.link-btn {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--forest);
  padding: 0 4px;
  font-weight: 800;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  width: fit-content;
  max-width: 100%;
}

.subnav button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 700;
}

.subnav button.active {
  background: var(--forest);
  color: #fff;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.summary-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--wash);
}

.summary-list span {
  color: var(--muted);
}

.qr-panel {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.mock-qr {
  width: min(220px, 70vw);
  aspect-ratio: 1;
  border: 12px solid #fff;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, var(--ink) 10px, transparent 10px) 0 0 / 28px 28px,
    linear-gradient(var(--ink) 10px, transparent 10px) 0 0 / 28px 28px,
    var(--wash);
  box-shadow: inset 0 0 0 1px var(--line), 0 8px 24px rgba(28, 53, 44, 0.12);
  display: grid;
  place-items: center;
  color: var(--forest);
  font-size: 24px;
  font-weight: 900;
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stepper span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--wash);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stepper span.done {
  border-color: rgba(36, 132, 94, 0.25);
  background: var(--green-soft);
  color: var(--green);
}

.toast {
  max-width: 1440px;
  margin: 0 auto 14px;
  padding: 12px 14px;
  border: 1px solid rgba(47, 111, 187, 0.2);
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
}

.success-panel {
  text-align: center;
}

.success-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--green);
  font-size: 28px;
  font-weight: 900;
}

.success-panel .summary-list {
  margin-top: 18px;
  text-align: left;
}

.hero-panel {
  min-height: 240px;
  padding: 22px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(23, 61, 51, 0.92), rgba(36, 89, 74, 0.82)),
    url("../assets/images/logo_large.png") right 12px center / 260px auto no-repeat;
  color: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-panel h2 {
  max-width: 620px;
  margin-bottom: 10px;
  font-size: 28px;
}

.hero-panel p {
  max-width: 620px;
  color: rgba(255, 255, 255, 0.76);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-actions .btn {
  border-color: rgba(255, 255, 255, 0.34);
  background: #fff;
  color: var(--forest);
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
  max-width: 720px;
}

.kpi-strip div {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.09);
}

.kpi-strip span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.kpi-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.empty {
  min-height: 160px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--wash);
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.drawer-backdrop {
  display: none;
}

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

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

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

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

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    width: min(86vw, var(--sidebar));
    transition: transform 0.2s ease;
  }

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

  body.drawer-open .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(10, 20, 18, 0.28);
  }

  .mobile-menu {
    display: inline-grid;
    place-items: center;
  }

  .topbar {
    padding: 14px 16px;
    align-items: flex-start;
  }

  .top-actions {
    margin-left: auto;
  }

  .search-box,
  .profile-name {
    display: none;
  }

  .content {
    padding: 16px;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .product-grid,
  .form-grid,
  .kpi-strip {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    background:
      linear-gradient(135deg, rgba(23, 61, 51, 0.94), rgba(36, 89, 74, 0.88)),
      url("../assets/images/logo_large.png") right -60px bottom -80px / 220px auto no-repeat;
  }
}

@media (max-width: 520px) {
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .metric-value {
    font-size: 24px;
  }
}
