:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f9fbfc;
  --text: #182230;
  --muted: #667085;
  --line: #d9e1ea;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --shadow: 0 14px 36px rgba(24, 34, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

.shell {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 20px 16px 36px;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(440px, 100%);
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-copy,
.customer-line {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.auth-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.auth-tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.auth-tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: grid;
}

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

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

.eyebrow,
h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
}

.icon-button,
.primary,
.ghost,
.tab,
select,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.icon-button {
  width: 44px;
  height: 44px;
  background: var(--panel);
  color: var(--brand);
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

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

.metric {
  min-height: 82px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 22px;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 0 10px;
  background: var(--bg);
}

.tab {
  min-height: 40px;
  padding: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
}

.tool {
  display: none;
}

.tool.active {
  display: block;
}

.panel {
  margin-top: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro-panel {
  background: #fbfefd;
}

.intro-panel p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.lookup-line {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.lookup-line.found {
  color: var(--ok);
  font-weight: 700;
}

.lookup-line.missing,
.lookup-line.error,
.lookup-line.invalid {
  color: var(--warn);
}

.primary {
  grid-column: 1 / -1;
  height: 44px;
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

.primary:hover {
  background: var(--brand-dark);
}

.primary:disabled,
.ghost:disabled,
.icon-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.empty {
  color: var(--muted);
  font-size: 14px;
}

.item-card,
.event-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.item-card.is-hot {
  border-color: rgba(180, 35, 24, 0.4);
}

.item-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.rate {
  min-width: 120px;
  text-align: right;
}

.rate span {
  color: var(--muted);
  font-size: 12px;
}

.rate strong {
  display: block;
  margin-top: 3px;
  color: var(--accent);
  font-size: 20px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  padding: 4px 8px;
  background: #edf7f5;
  color: var(--brand-dark);
  border-radius: 999px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ghost {
  min-width: 76px;
  height: 34px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.ghost.compact {
  min-width: 56px;
  height: 38px;
}

.progress {
  height: 8px;
  overflow: hidden;
  background: #e7edf3;
  border-radius: 999px;
}

.progress i {
  display: block;
  height: 100%;
  background: var(--warn);
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 13px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.event-card {
  border-left: 4px solid var(--ok);
}

.event-card span,
.event-card time {
  color: var(--muted);
  font-size: 12px;
}

.notice {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}

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

  h1 {
    font-size: 24px;
  }

  .status-grid,
  .result-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    flex-direction: column;
  }

  .metric {
    min-height: 68px;
  }

  .item-main {
    flex-direction: column;
  }

  .rate {
    text-align: left;
  }
}
