:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --surface-soft: #f3f4f6;
  --border: #e5e7eb;
  --border-soft: #f3f4f6;
  --text: #111827;
  --muted: #6b7280;
  --muted-strong: #4b5563;
  --primary: #16a34a;
  --primary-700: #15803d;
  --primary-50: #f0fdf4;
  --primary-100: #dcfce7;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-600: #2563eb;
  --yellow-50: #fefce8;
  --yellow-100: #fef9c3;
  --yellow-700: #a16207;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-700: #15803d;
  --purple-50: #faf5ff;
  --purple-100: #f3e8ff;
  --purple-700: #7e22ce;
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-700: #b91c1c;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --sidebar: 256px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

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

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

button {
  cursor: pointer;
}

svg {
  display: inline-block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vertical-align: middle;
}

code {
  color: #374151;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  word-break: break-word;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar);
  min-height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(0);
  transition: transform 180ms ease;
}

.brand-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 64px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.brand-bar > span {
  flex: 1;
  font-weight: 600;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
}

.brand-mark.small {
  width: 28px;
  height: 28px;
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

.nav-list {
  max-height: calc(100vh - 160px);
  padding: 16px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 8px 12px;
  margin-top: 4px;
  color: var(--muted-strong);
  border-radius: 8px;
}

.nav-item:hover {
  background: var(--surface-soft);
}

.nav-item.active {
  color: var(--primary-700);
  background: var(--primary-50);
}

.nav-item span {
  flex: 1;
  min-width: 0;
}

.nav-item .external-icon {
  width: 16px;
  height: 16px;
  color: #9ca3af;
}

.nav-heading {
  padding: 16px 12px 8px;
  margin: 4px 0 0;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.user-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.user-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--muted);
  background: #e5e7eb;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

.user-copy p,
.user-copy span {
  display: block;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy p {
  font-size: 14px;
  font-weight: 600;
}

.user-copy span,
small {
  color: var(--muted);
  font-size: 12px;
}

.content-shell {
  min-height: 100vh;
  padding-left: var(--sidebar);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.topbar-spacer {
  flex: 1;
}

.topbar-link,
.brand-inline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted-strong);
  font-size: 14px;
  font-weight: 600;
}

.language-switcher {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 2px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.language-switcher button {
  min-width: 42px;
  min-height: 28px;
  padding: 4px 8px;
  color: var(--muted-strong);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.language-switcher button.active {
  color: var(--primary-700);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.public-actions {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.main-content {
  max-width: 1280px;
  padding: 32px;
}

.main-content > *,
.dashboard-stack > *,
.form-stack > *,
.detail-main > *,
.detail-side > * {
  min-width: 0;
  max-width: 100%;
}

.dashboard-stack,
.form-stack {
  display: grid;
  gap: 24px;
}

.page-heading {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.page-heading h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 36px;
}

.page-heading p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

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

.metric-card {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 20px;
}

.metric-label,
.metric-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.metric-value {
  margin: 6px 0 4px;
  font-size: 30px;
  font-weight: 700;
  line-height: 36px;
}

.metric-icon,
.summary-icon,
.category-icon {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
}

.metric-icon.blue,
.summary-icon.blue {
  color: var(--blue-600);
  background: var(--blue-100);
}

.metric-icon.yellow,
.summary-icon.yellow {
  color: var(--yellow-700);
  background: var(--yellow-100);
}

.metric-icon.green,
.summary-icon.green,
.metric-icon.emerald {
  color: var(--green-700);
  background: var(--green-100);
}

.metric-icon.purple,
.summary-icon.purple {
  color: var(--purple-700);
  background: var(--purple-100);
}

.status-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
}

.status-banner p {
  margin: 0;
  font-weight: 600;
}

.status-banner span {
  color: #047857;
  font-size: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.section-heading h2,
.form-section h2,
.compact-card h2,
.permissions-card h2,
.compare-picker h2,
.public-section h3,
.passport-score h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.subtle-link,
.strong-link {
  color: var(--primary-700);
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
}

.table-card-bare {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  font-size: 14px;
}

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

.entity-cell {
  min-width: 230px;
}

.entity-cell a {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.entity-cell span {
  display: -webkit-box;
  max-width: 520px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.summary-grid,
.category-grid,
.permissions-grid,
.public-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.summary-card,
.category-card,
.permissions-card article {
  padding: 20px;
}

.summary-title {
  display: flex;
  gap: 12px;
  align-items: center;
}

.summary-title h3,
.category-card h2,
.permissions-card h3 {
  margin: 0;
  font-size: 16px;
}

.summary-count {
  margin-top: 18px;
}

.summary-count strong {
  margin-right: 8px;
  font-size: 28px;
}

.summary-card p,
.category-card p,
.permissions-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

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

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

.badge-yellow {
  color: var(--yellow-700);
  background: var(--yellow-100);
}

.badge-purple {
  color: var(--purple-700);
  background: var(--purple-100);
}

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

.badge-gray {
  color: #374151;
  background: #f3f4f6;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.primary-button {
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
}

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

.secondary-button {
  color: var(--muted-strong);
  background: #fff;
  border: 1px solid var(--border);
}

.secondary-button:hover,
.ghost-button:hover {
  background: var(--surface-soft);
}

.ghost-button {
  color: var(--muted-strong);
  background: transparent;
  border: 1px solid transparent;
}

.full-width {
  width: 100%;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.topbar .icon-button,
.brand-bar .icon-button {
  display: none;
}

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.row-actions .secondary-button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

.filter-card {
  display: flex;
  gap: 16px;
  align-items: end;
  padding: 16px;
  flex-wrap: wrap;
}

.filter-field,
.form-field {
  display: grid;
  gap: 6px;
  min-width: 170px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 600;
}

.filter-field input,
.filter-field select,
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  outline: none;
}

.filter-field input:focus,
.filter-field select:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(22 163 74 / 0.12);
}

.search-field {
  position: relative;
  min-width: min(360px, 100%);
}

.search-field span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  color: #9ca3af;
}

.search-field input {
  padding-left: 38px;
}

.tabs,
.passport-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.tabs button,
.passport-tabs button {
  padding: 10px 16px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.tabs button.active,
.passport-tabs button.active {
  color: var(--primary-700);
  border-bottom-color: var(--primary);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.detail-main {
  display: grid;
  gap: 20px;
}

.detail-side {
  display: grid;
  gap: 16px;
}

.form-section {
  padding: 20px;
}

.form-section-head {
  margin-bottom: 18px;
}

.form-section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.form-field.wide,
.form-grid .wide {
  grid-column: 1 / -1;
}

.form-field textarea {
  resize: vertical;
}

.input-wrap {
  position: relative;
}

.field-suffix {
  position: absolute;
  right: 10px;
  top: 50%;
  color: var(--muted);
  font-size: 12px;
  transform: translateY(-50%);
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 8px 0 24px;
}

.compact-card {
  padding: 16px;
}

.compact-card p {
  margin: 10px 0;
}

.compact-card small {
  display: block;
  word-break: break-word;
}

.compact-card dl,
.category-card dl {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}

dl div,
.info-grid div {
  display: grid;
  gap: 2px;
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
}

.qr-box,
.wallet-qr {
  display: grid;
  place-items: center;
  color: var(--primary-700);
  background:
    linear-gradient(90deg, rgb(0 0 0 / 0.04) 1px, transparent 1px),
    linear-gradient(rgb(0 0 0 / 0.04) 1px, transparent 1px),
    var(--primary-50);
  background-size: 12px 12px;
  border: 1px solid var(--primary-100);
  border-radius: 8px;
}

.qr-box {
  height: 180px;
}

.qr-box svg,
.wallet-qr svg {
  width: 96px;
  height: 96px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  grid-column: 1 / -1;
}

.check-field {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted-strong);
  font-size: 14px;
}

.permissions-card {
  padding: 20px;
}

.permissions-grid {
  margin-top: 16px;
}

.permissions-grid article {
  background: var(--surface-soft);
  border-radius: 8px;
}

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

.category-icon {
  margin-bottom: 14px;
  color: var(--primary-700);
  background: var(--primary-50);
}

.key-line {
  color: var(--green-700);
  font-size: 12px;
  font-weight: 700;
}

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

.public-body {
  background: #f8fafc;
}

.login-page {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 12%, rgb(22 163 74 / 0.16), transparent 28%),
    linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%);
}

.login-language {
  position: absolute;
  top: 24px;
  right: 24px;
}

.login-card {
  width: min(460px, 100%);
}

.login-brand {
  display: grid;
  gap: 12px;
  justify-items: center;
  margin-bottom: 24px;
}

.login-brand h1 {
  margin: 0;
  font-size: 30px;
}

.login-panel {
  padding: 28px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-panel h2 {
  margin: 0;
}

.login-panel p {
  color: var(--muted);
}

.wallet-qr {
  width: 220px;
  height: 220px;
  margin: 22px auto;
}

.compare-page,
.passport-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.public-topbar,
.passport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.compare-hero,
.passport-hero {
  padding: 28px;
  margin-bottom: 20px;
  color: #064e3b;
  background: linear-gradient(135deg, #ecfdf5, #eff6ff);
  border: 1px solid #d1fae5;
  border-radius: 8px;
}

.compare-hero h1,
.passport-hero h1,
.passport-hero h2 {
  margin: 0;
  color: #0f172a;
  font-size: 36px;
  line-height: 1.15;
}

.compare-hero p,
.passport-hero h1 {
  margin: 8px 0 0;
  color: #047857;
  font-size: 16px;
  font-weight: 500;
}

.passport-hero h2 {
  margin-top: 4px;
}

.compare-picker {
  display: grid;
  gap: 14px;
  padding: 20px;
  margin-bottom: 20px;
}

.result-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.result-list button {
  display: grid;
  gap: 4px;
  padding: 12px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.result-list button.selected {
  border-color: var(--primary);
  background: var(--primary-50);
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 40px;
  background: #fff;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
}

.empty-state h1,
.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  color: var(--muted);
}

.passport-header {
  margin-bottom: 18px;
}

.passport-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.passport-hero > div > span {
  display: inline-block;
  margin-top: 12px;
  color: #334155;
  font-weight: 600;
}

.passport-id {
  display: grid;
  gap: 8px;
  justify-items: center;
  max-width: 220px;
  color: #064e3b;
  font-size: 12px;
  font-weight: 700;
  word-break: break-word;
}

.passport-id svg {
  width: 96px;
  height: 96px;
}

.passport-tabs {
  padding: 6px;
  margin-bottom: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.passport-tabs button {
  border: 0;
  border-radius: 8px;
}

.passport-tabs button.active {
  background: var(--primary-100);
}

.passport-content {
  display: grid;
  gap: 20px;
}

.product-overview,
.public-section,
.passport-score {
  padding: 20px;
}

.product-overview h2 {
  margin: 0 0 8px;
}

.product-overview p {
  margin: 0 0 18px;
  color: var(--muted-strong);
}

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

.passport-score strong {
  display: block;
  margin-top: 10px;
  font-size: 44px;
  line-height: 1;
}

.passport-score span {
  color: var(--green-700);
  font-weight: 700;
}

.verification-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding-left: 20px;
}

.timeline.compact {
  font-size: 13px;
}

.accordion-list {
  display: grid;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.accordion-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.accordion-list button:last-child {
  border-bottom: 0;
}

@media (max-width: 1100px) {
  .metric-grid,
  .summary-grid,
  .permissions-grid,
  .public-grid,
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    background: rgb(0 0 0 / 0.4);
  }

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

  .content-shell {
    padding-left: 0;
  }

  .topbar .icon-button,
  .brand-bar .icon-button {
    display: grid;
  }

  .main-content {
    padding: 24px 16px;
  }

  .page-heading,
  .passport-hero {
    flex-direction: column;
  }

  .form-grid,
  .checkbox-grid,
  .category-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .metric-grid,
  .summary-grid,
  .permissions-grid,
  .public-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .page-heading h1,
  .compare-hero h1,
  .passport-hero h2 {
    font-size: 28px;
    line-height: 34px;
  }

  .topbar-link span {
    display: none;
  }

  .language-switcher button {
    min-width: 36px;
    padding-inline: 6px;
  }

  .public-actions {
    gap: 8px;
  }

  th,
  td {
    padding: 12px;
  }

  .compare-page,
  .passport-page {
    padding: 16px;
  }
}
