:root {
  color-scheme: light;
  --sidebar: #172433;
  --sidebar-soft: #203247;
  --sidebar-text: #c5d0dc;
  --canvas: #f3f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #eef7f4;
  --ink: #182230;
  --muted: #66758a;
  --line: #dfe5ec;
  --line-strong: #cbd5e1;
  --brand: #0f9b7a;
  --brand-dark: #08715a;
  --brand-soft: #e1f6f0;
  --blue: #2878c8;
  --blue-soft: #e9f3ff;
  --yellow: #c98208;
  --yellow-soft: #fff5dd;
  --red: #c84a4a;
  --red-soft: #fff0f0;
  --gray-soft: #edf2f6;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 4%);
  --shadow: 0 10px 28px rgb(15 23 42 / 7%);
  --shadow-lg: 0 24px 70px rgb(15 23 42 / 18%);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

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

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

a {
  color: inherit;
}

.portal-page {
  overflow-x: hidden;
}

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

.sidebar {
  color: var(--sidebar-text);
  background:
    radial-gradient(circle at 10% 0%, rgb(31 199 158 / 13%), transparent 28%),
    var(--sidebar);
}

.brand-block {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  font-size: 19px;
  font-weight: 850;
  background: linear-gradient(145deg, #21c59a, #0d8f70);
  border-radius: 11px;
  box-shadow: 0 8px 22px rgb(9 143 111 / 28%);
}

.brand-copy {
  display: grid;
  min-width: 0;
}

.brand-copy strong {
  font-size: 17px;
  letter-spacing: 0.04em;
}

.brand-copy small {
  margin-top: 2px;
  color: #8fa2b7;
  font-size: 12px;
}

.sidebar-label {
  margin: 0;
  color: #72869c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.nav-link {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 9px 11px;
  color: #aebdcb;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #fff;
  background: rgb(255 255 255 / 6%);
  outline: none;
}

.nav-link.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgb(20 171 133 / 24%), rgb(20 171 133 / 10%));
  border-color: rgb(72 214 178 / 17%);
  box-shadow: inset 3px 0 #25c79d;
}

.nav-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #91a6ba;
  font-size: 13px;
  font-weight: 800;
  background: rgb(255 255 255 / 6%);
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 9px;
}

.nav-link.is-active .nav-icon {
  color: #a8f2df;
  background: rgb(28 191 150 / 15%);
  border-color: rgb(87 221 187 / 20%);
}

.nav-copy {
  display: grid;
  min-width: 0;
}

.nav-copy strong {
  color: inherit;
  font-size: 14px;
  font-weight: 730;
}

.nav-copy small {
  margin-top: 3px;
  color: #71859b;
  font-size: 11px;
}

.nav-link.is-active .nav-copy small {
  color: #9cb5ae;
}

.sidebar-tools {
  display: grid;
  gap: 7px;
}

.sidebar-action {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: #aebdcb;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 9px;
  cursor: pointer;
}

.sidebar-action span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #78d7bf;
  background: rgb(21 176 138 / 12%);
  border-radius: 7px;
}

.sidebar-action:hover,
.sidebar-action:focus-visible {
  color: #fff;
  background: rgb(255 255 255 / 5%);
  outline: none;
}

.sidebar-boundary {
  display: flex;
  gap: 10px;
  padding: 13px;
  background: rgb(255 255 255 / 4%);
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 11px;
}

.boundary-indicator {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  background: #28cda4;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(40 205 164 / 12%);
}

.sidebar-boundary strong {
  color: #d7e2ec;
  font-size: 12px;
}

.boundary-note {
  margin: 4px 0 0;
  color: #7f92a5;
  font-size: 11px;
  line-height: 1.65;
}

.app-main {
  min-width: 0;
}

.app-header {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  padding: 14px clamp(20px, 3vw, 42px);
  background: rgb(255 255 255 / 96%);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.header-title {
  min-width: 220px;
}

.header-title .eyebrow {
  margin-bottom: 4px;
  color: var(--brand-dark);
}

.app-header h1 {
  margin: 0;
  font-size: clamp(19px, 2vw, 24px);
  letter-spacing: -0.01em;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: flex-end;
}

.source-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.sync-summary {
  max-width: 330px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.session-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding-left: 16px;
  color: #4e5e71;
  font-size: 12px;
  border-left: 1px solid var(--line);
}

.session-avatar {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  background: var(--brand);
  border-radius: 50%;
}

.workspace {
  width: 100%;
  min-width: 0;
  padding: clamp(22px, 3vw, 38px);
  outline: none;
}

.workspace-view {
  width: min(1500px, 100%);
  margin: 0 auto;
}

.section-heading {
  display: flex;
  gap: 22px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.section-heading h2,
.dialog-heading h2,
.detail-panel h3 {
  margin: 0;
}

.section-heading h2 {
  font-size: clamp(27px, 3vw, 34px);
  letter-spacing: -0.035em;
}

.section-heading > div > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.section-actions,
.filter-actions,
.dialog-actions,
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.button,
.icon-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.button {
  padding: 9px 16px;
  font-weight: 700;
}

.button-compact {
  min-height: 34px;
  padding: 5px 10px;
  font-size: 12px;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(15 155 122 / 18%);
  outline-offset: 2px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.button-primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 7px 18px rgb(15 155 122 / 18%);
}

.button-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.button-secondary,
.button-quiet {
  color: #405064;
  background: #fff;
  border-color: var(--line-strong);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: #aeb9c7;
}

.button-link {
  min-height: 32px;
  padding: 4px 7px;
  color: var(--brand-dark);
  font-size: 12px;
  background: transparent;
  border-color: transparent;
}

.button-link:hover:not(:disabled) {
  background: var(--brand-soft);
  transform: none;
}

.status-pill {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  color: #536174;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
  background: var(--gray-soft);
  border: 1px solid #dce4eb;
  border-radius: 999px;
}

.status-pill i {
  width: 6px;
  height: 6px;
  background: currentcolor;
  border-radius: 50%;
}

.status-info {
  color: #2368a6;
  background: var(--blue-soft);
  border-color: #cce1f6;
}

.status-success {
  color: #08735a;
  background: var(--brand-soft);
  border-color: #b9eadc;
}

.status-warning {
  color: #8b5b00;
  background: var(--yellow-soft);
  border-color: #f1d79d;
}

.status-danger {
  color: #a33535;
  background: var(--red-soft);
  border-color: #efc4c4;
}

.status-muted {
  color: #5d6a78;
  background: var(--gray-soft);
  border-color: #dce4eb;
}

.sync-refresh-panel,
.task-row,
.alert-card {
  border-radius: 10px;
}

.sync-refresh-panel {
  margin-bottom: 18px;
  padding: 12px 15px;
  color: #365369;
  font-size: 13px;
  background: #edf6fb;
  border: 1px solid #d1e6f2;
}

.sync-refresh-running {
  color: #25658b;
  background: #eaf5fd;
  border-color: #c9e4f6;
}

.sync-refresh-success {
  color: #12634f;
  background: #e8f7f2;
  border-color: #c5eadf;
}

.sync-refresh-error {
  color: #963d3d;
  background: var(--red-soft);
  border-color: #efc7c7;
}

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

.metric-grid-points {
  margin-top: 14px;
}

.metric-card {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-width: 0;
  min-height: 132px;
  padding: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.metric-card::after {
  position: absolute;
  right: -30px;
  bottom: -44px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgb(40 120 200 / 7%), transparent 66%);
  border-radius: 50%;
  content: "";
}

.metric-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--blue);
  font-size: 14px;
  font-weight: 850;
  background: var(--blue-soft);
  border-radius: 11px;
}

.metric-copy {
  display: grid;
  min-width: 0;
}

.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-value {
  margin-top: 6px;
  font-size: clamp(27px, 3vw, 36px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.metric-helper {
  margin-top: 8px;
  overflow: hidden;
  color: #8592a2;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-success .metric-icon {
  color: #08735a;
  background: var(--brand-soft);
}

.metric-warning .metric-icon {
  color: #9a6500;
  background: var(--yellow-soft);
}

.metric-muted .metric-icon {
  color: #667485;
  background: var(--gray-soft);
}

.metric-points .metric-icon {
  color: #6548b8;
  background: #f0ebff;
}

.filter-bar,
.detail-panel,
.point-history-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 0.32fr) minmax(160px, 0.34fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 17px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #3d4b5c;
  font-size: 12px;
  font-weight: 700;
}

.field-grow {
  min-width: 0;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

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

.field input::placeholder,
.field textarea::placeholder {
  color: #9aa5b2;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(15 155 122 / 10%);
}

.field small,
.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  scrollbar-color: #bac5d1 #eef2f6;
  scrollbar-width: thin;
}

table {
  width: 100%;
  min-width: 1060px;
  border-collapse: separate;
  border-spacing: 0;
}

#verification-table {
  min-width: 1280px;
}

#verification-table th,
#verification-table td {
  white-space: nowrap;
}

th,
td {
  padding: 13px 14px;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #e7ebef;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #586779;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: #f7f9fb;
}

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

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: #f9fbfc;
}

.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.identifier {
  font-family: "SFMono-Regular", Consolas, monospace;
  color: #344355;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.strong-number {
  color: var(--brand-dark);
  font-weight: 850;
}

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

.muted-text {
  color: var(--muted);
  font-size: 11px;
}

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

.pagination,
.public-ranking-pagination {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.pagination {
  margin-top: 14px;
}

.pagination p,
.public-ranking-pagination p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.task-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 13px 15px;
  color: #536477;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.task-loading .task-message::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgb(15 155 122 / 10%);
  content: "";
}

.task-error {
  color: #963d3d;
  background: var(--red-soft);
  border-color: #efc7c7;
}

.task-empty {
  color: #667485;
  background: #f8fafc;
}

.detail-panel {
  margin-bottom: 14px;
  padding: 20px;
}

.detail-panel-heading,
.dialog-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.detail-panel h3,
.point-history-panel h3 {
  font-size: 15px;
}

.detail-grid,
.trace-list {
  margin: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.detail-label,
.detail-value {
  margin: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  background: #f7f9fb;
}

.detail-value {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #263445;
  font-size: 12px;
}

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

.trace-grid .detail-panel {
  margin-bottom: 0;
}

.trace-card {
  margin-top: 12px;
  padding: 13px;
  background: var(--surface-soft);
  border: 1px solid #e6ebef;
  border-radius: 9px;
}

.trace-list {
  display: grid;
  grid-template-columns: minmax(90px, 0.35fr) 1fr;
  gap: 7px 12px;
}

.trace-list dt,
.trace-list dd {
  margin: 0;
  font-size: 11px;
}

.trace-list dt {
  color: var(--muted);
  font-weight: 700;
}

.trace-list dd {
  overflow-wrap: anywhere;
}

dialog {
  width: min(680px, calc(100% - 28px));
  max-height: min(88vh, 820px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgb(11 20 31 / 56%);
  backdrop-filter: blur(3px);
}

dialog form {
  padding: 24px;
}

.dialog-heading {
  margin-bottom: 17px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.dialog-heading h2 {
  font-size: 22px;
}

.icon-button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  color: #5d6b7a;
  font-size: 22px;
  background: var(--surface-soft);
  border-color: var(--line);
}

.alert-card {
  padding: 12px 14px;
  color: #425467;
  font-size: 12px;
  line-height: 1.6;
  background: #eef5f8;
  border: 1px solid #d5e5ec;
}

.alert-error {
  color: #963d3d;
  background: var(--red-soft);
  border-color: #efc7c7;
}

fieldset {
  display: grid;
  gap: 9px;
  margin: 17px 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
}

.choice-card {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.choice-card input {
  margin-top: 3px;
  accent-color: var(--brand);
}

.choice-card span {
  display: grid;
  gap: 3px;
}

.choice-card small {
  color: var(--muted);
}

.choice-card.is-disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.point-balance-card {
  display: flex;
  gap: 7px 16px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 17px;
  padding: 15px;
  background: var(--brand-soft);
  border: 1px solid #c3ebdf;
  border-radius: 10px;
}

.point-user-name {
  font-size: 16px;
}

.point-balance-formula {
  color: #1d6f5a;
  font-size: 12px;
}

.point-form-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.34fr) 1fr;
  gap: 14px;
}

.point-history-panel {
  margin-top: 20px;
  padding: 17px;
}

.point-history-panel .table-scroll {
  margin-top: 12px;
  box-shadow: none;
}

.point-history-panel table {
  min-width: 560px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(390px, calc(100% - 32px));
  padding: 12px 15px;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  background: #203044;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

.toast-success {
  background: #0d715a;
}

.toast-error {
  background: #9b3636;
}

.toast-info {
  background: #315f88;
}

/* Login */
.login-page {
  background: #edf2f6;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(430px, 0.95fr) minmax(460px, 1.05fr);
  min-height: 100vh;
}

.login-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(42px, 7vw, 100px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 82% 18%, rgb(47 213 172 / 18%), transparent 27%),
    radial-gradient(circle at 12% 88%, rgb(49 116 176 / 18%), transparent 32%),
    linear-gradient(145deg, #142130, #1d3043 58%, #153f39);
}

.login-brand-panel::after {
  position: absolute;
  right: -130px;
  bottom: -160px;
  width: 430px;
  height: 430px;
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 50%;
  box-shadow: 0 0 0 58px rgb(255 255 255 / 2%), 0 0 0 116px rgb(255 255 255 / 2%);
  content: "";
}

.login-brand {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.brand-mark-large {
  width: 52px;
  height: 52px;
  font-size: 25px;
  border-radius: 14px;
}

.login-brand .eyebrow {
  color: #7ce3c9;
}

.login-brand h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1.16;
  letter-spacing: -0.04em;
}

.login-brand-intro {
  position: relative;
  z-index: 1;
  max-width: 580px;
  margin: 32px 0;
  color: #afbdcb;
  font-size: 16px;
  line-height: 1.8;
}

.login-feature-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  max-width: 570px;
}

.login-feature-list article {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  background: rgb(255 255 255 / 4%);
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 11px;
}

.login-feature-list article > span {
  display: inline-grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  color: #73dec3;
  font-size: 11px;
  font-weight: 800;
  background: rgb(31 199 158 / 12%);
  border-radius: 9px;
}

.login-feature-list strong {
  font-size: 13px;
}

.login-feature-list p {
  margin: 4px 0 0;
  color: #8fa1b2;
  font-size: 12px;
}

.login-brand-footer {
  position: relative;
  z-index: 1;
  margin: 34px 0 0;
  color: #71859a;
  font-size: 12px;
}

.login-form-panel {
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 78px);
}

.login-card {
  width: min(450px, 100%);
  padding: clamp(28px, 4vw, 42px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.login-card-heading h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.04em;
}

.login-intro {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.login-submit {
  width: 100%;
  margin-top: 2px;
}

.login-boundary {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 22px;
  padding-top: 18px;
  color: #7b8999;
  font-size: 11px;
  line-height: 1.65;
  border-top: 1px solid var(--line);
}

.login-boundary span {
  display: inline-grid;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #08735a;
  background: var(--brand-soft);
  border-radius: 50%;
}

.login-boundary p {
  margin: 0;
}

/* Public ranking */
.public-ranking-page {
  background:
    radial-gradient(circle at 14% 14%, rgb(31 199 158 / 10%), transparent 25%),
    linear-gradient(180deg, #edf4f2, #f6f8fa 52%, #edf2f5);
}

.public-ranking-shell {
  width: min(880px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.public-ranking-topbar {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 24px;
}

.public-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
}

.public-brand > span:last-child {
  display: grid;
}

.public-brand strong {
  font-size: 14px;
}

.public-brand small {
  color: var(--muted);
  font-size: 10px;
}

.public-ranking-hero {
  position: relative;
  display: flex;
  gap: 30px;
  align-items: center;
  justify-content: space-between;
  min-height: 245px;
  padding: clamp(30px, 6vw, 56px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 78% 18%, rgb(59 229 185 / 24%), transparent 28%),
    linear-gradient(135deg, #162434, #1d3b43 58%, #126b59);
  border-radius: 18px;
  box-shadow: 0 22px 50px rgb(23 51 58 / 18%);
}

.public-ranking-hero::after {
  position: absolute;
  right: -85px;
  bottom: -120px;
  width: 330px;
  height: 330px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 50%;
  box-shadow: 0 0 0 50px rgb(255 255 255 / 2%), 0 0 0 100px rgb(255 255 255 / 2%);
  content: "";
}

.public-ranking-hero > div:first-child {
  position: relative;
  z-index: 1;
}

.public-ranking-hero .eyebrow {
  color: #78e0c6;
}

.public-ranking-hero h1 {
  max-width: 580px;
  margin: 0;
  font-size: clamp(31px, 6vw, 50px);
  line-height: 1.18;
  letter-spacing: -0.05em;
}

.public-ranking-hero p:last-child {
  margin: 15px 0 0;
  color: #b8c9d2;
  font-size: 13px;
}

.public-ranking-emblem {
  position: relative;
  z-index: 1;
  display: grid;
  flex: 0 0 auto;
  width: 118px;
  height: 118px;
  place-items: center;
  color: #dffff7;
  background: rgb(255 255 255 / 8%);
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 50%;
  box-shadow: inset 0 0 0 9px rgb(255 255 255 / 3%);
}

.public-ranking-emblem span {
  align-self: end;
  font-size: 11px;
  letter-spacing: 0.25em;
}

.public-ranking-emblem strong {
  align-self: start;
  margin-top: 2px;
  font-size: 40px;
}

.public-ranking-card {
  position: relative;
  z-index: 2;
  margin: -22px 22px 0;
  padding: clamp(20px, 4vw, 30px);
  background: rgb(255 255 255 / 97%);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.public-ranking-heading {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.public-ranking-heading h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.public-ranking-heading p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.ranking-update-note {
  color: var(--muted);
  font-size: 11px;
}

.public-ranking-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.public-ranking-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 55px;
  padding: 8px 13px;
  background: #fafbfd;
  border: 1px solid #e7ebef;
  border-radius: 9px;
  transition: border-color 130ms ease, background 130ms ease, transform 130ms ease;
}

.public-ranking-row:hover {
  background: #fff;
  border-color: #ced8e1;
  transform: translateY(-1px);
}

.public-rank-number {
  display: inline-grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: #526273;
  font-size: 11px;
  font-weight: 850;
  background: #edf2f6;
  border-radius: 9px;
}

.public-rank-name {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-rank-points {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.public-ranking-row.is-gold {
  background: #fffaf0;
  border-color: #eedaa8;
}

.public-ranking-row.is-gold .public-rank-number {
  color: #8d6207;
  background: #ffe9ac;
}

.public-ranking-row.is-silver {
  background: #f8fafc;
  border-color: #d5dde5;
}

.public-ranking-row.is-silver .public-rank-number {
  color: #53606c;
  background: #dde4ea;
}

.public-ranking-row.is-bronze {
  background: #fff7f2;
  border-color: #ead3c5;
}

.public-ranking-row.is-bronze .public-rank-number {
  color: #8b5236;
  background: #f3d5c4;
}

.public-ranking-pagination {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.public-ranking-footer {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 20px 24px 0;
  color: #8491a0;
  font-size: 10px;
}

@media (min-width: 1024px) {
  .app-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
    height: 100vh;
    padding: 20px 15px;
    overflow-y: auto;
  }

  .sidebar-tools {
    margin-top: auto;
  }

  .app-header {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}

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

  .filter-bar {
    grid-template-columns: minmax(250px, 1fr) repeat(2, minmax(150px, 0.45fr));
  }

  .filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

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

@media (max-width: 1023px) {
  .sidebar {
    padding: 15px 18px;
  }

  .brand-block {
    margin-bottom: 14px;
  }

  .sidebar > .sidebar-label,
  .sidebar-tools .sidebar-label,
  .sidebar-boundary,
  .nav-copy small {
    display: none;
  }

  .main-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .nav-link {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 6px 10px;
  }

  .nav-icon {
    width: 29px;
    height: 29px;
  }

  .sidebar-tools {
    display: flex;
    gap: 8px;
    margin-top: 10px;
  }

  .sidebar-action {
    width: auto;
    min-height: 38px;
  }

  .app-header {
    align-items: flex-start;
  }

  .header-meta {
    align-items: flex-end;
  }

  .session-controls {
    padding-left: 0;
    border-left: 0;
  }

  .login-shell {
    grid-template-columns: minmax(330px, 0.85fr) minmax(400px, 1.15fr);
  }

  .login-feature-list article:nth-child(n + 3) {
    display: none;
  }
}

@media (max-width: 767px) {
  .brand-copy small,
  .sidebar-tools,
  .sync-summary {
    display: none;
  }

  .app-header {
    display: grid;
    min-height: auto;
    padding: 15px 18px;
  }

  .header-meta {
    justify-content: flex-start;
  }

  .session-controls {
    width: 100%;
  }

  .workspace {
    padding: 21px 16px 32px;
  }

  .section-heading {
    display: grid;
    align-items: start;
  }

  .section-actions {
    justify-content: flex-start;
  }

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

  .metric-card {
    min-height: 112px;
  }

  .filter-bar,
  .point-form-grid {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    grid-column: auto;
    justify-content: flex-start;
  }

  .filter-actions .button {
    flex: 1 1 110px;
  }

  .pagination,
  .public-ranking-pagination,
  .public-ranking-heading,
  .public-ranking-footer,
  .point-balance-card {
    align-items: stretch;
  }

  .pagination,
  .public-ranking-pagination,
  .public-ranking-heading,
  .public-ranking-footer {
    flex-direction: column;
  }

  .pagination > div {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

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

  .detail-grid {
    display: grid;
    border: 0;
  }

  .detail-label,
  .detail-value {
    border-left: 1px solid var(--line);
  }

  .detail-label {
    margin-top: 6px;
    border-top: 1px solid var(--line);
  }

  dialog form {
    padding: 19px;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: auto;
    padding: 34px 24px;
  }

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

  .login-brand-intro {
    margin: 22px 0 0;
    font-size: 13px;
  }

  .login-feature-list,
  .login-brand-footer {
    display: none;
  }

  .login-form-panel {
    padding: 24px 16px 40px;
  }

  .login-card {
    padding: 26px 22px;
  }

  .public-ranking-shell {
    width: min(100% - 18px, 880px);
    padding-top: 12px;
  }

  .public-ranking-topbar {
    padding: 8px 3px 15px;
  }

  .public-ranking-hero {
    min-height: 220px;
    padding: 28px 22px 42px;
  }

  .public-ranking-emblem {
    display: none;
  }

  .public-ranking-card {
    margin: -18px 8px 0;
    padding: 18px 14px;
  }

  .ranking-update-note {
    display: none;
  }

  .public-ranking-pagination .button {
    width: 100%;
  }

  .public-ranking-footer {
    gap: 5px;
    padding: 18px 12px 0;
  }
}

@media (max-width: 520px) {
  .sidebar {
    padding-inline: 12px;
  }

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

  .nav-icon {
    display: none;
  }

  .section-heading h2 {
    font-size: 27px;
  }

  .metric-card {
    padding: 17px;
  }

  .public-ranking-hero h1 {
    font-size: 31px;
  }

  .public-ranking-row {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 8px;
    padding-inline: 9px;
  }

  .public-rank-points {
    font-size: 12px;
  }

  .toast {
    right: 16px;
    bottom: 16px;
  }
}

/* Shipment intake, region rules and selected-user exports */
.task-success {
  color: #176b55;
  background: #eefaf6;
  border-color: #bde7da;
}

.upload-panel {
  margin-bottom: 18px;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

.preview-panel {
  margin-top: 14px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.preview-summary,
.preview-meta {
  display: grid;
  gap: 6px;
}

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

.preview-stat {
  display: grid;
  gap: 3px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.preview-stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.preview-stat-value {
  font-size: 22px;
}

.preview-success {
  color: #176b55;
  background: #eefaf6;
}

.preview-muted {
  color: #637181;
  background: #f1f4f7;
}

.preview-danger {
  color: #a33c3c;
  background: #fff2f2;
  border-color: #efcaca;
}

.province-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 330px;
  overflow-y: auto;
}

.province-option {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 38px;
  padding: 8px 9px;
  font-size: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.province-option:has(input:checked) {
  color: #0f6f59;
  background: #eefaf6;
  border-color: #a8ddce;
}

.province-option input {
  margin: 0;
}

.select-column {
  width: 42px;
  text-align: center;
}

.select-column input {
  width: 16px;
  height: 16px;
}

#ranking-table {
  min-width: 1160px;
}

#shipment-history-table {
  min-width: 1080px;
}

#region-rules-table {
  min-width: 1180px;
}

#region-rules-table td:nth-child(2) {
  min-width: 260px;
  max-width: 380px;
  white-space: normal;
  line-height: 1.55;
}

.wide-dialog {
  width: min(1180px, calc(100% - 28px));
  padding: 24px;
}

.wide-dialog table {
  min-width: 1120px;
}

@media (max-width: 767px) {
  .upload-form {
    grid-template-columns: 1fr;
  }

  .upload-form .button {
    width: 100%;
  }

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

  .wide-dialog {
    padding: 18px;
  }
}
