:root {
  color-scheme: light;
  --ink: #162118;
  --muted: #657068;
  --line: #dfe6df;
  --surface: #ffffff;
  --soft: #f4f7f2;
  --green: #0f6b43;
  --green-dark: #0a4c30;
  --green-light: #e6f3ec;
  --amber: #a15c00;
  --amber-light: #fff3d9;
  --red: #a43b32;
  --red-light: #fff0ee;
  --shadow: 0 18px 45px rgba(24, 48, 32, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #edf2ec; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(172, 211, 185, .35), transparent 28rem),
    linear-gradient(180deg, #f7faf6 0, #eef3ed 100%);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(430px, 100%);
  padding: 42px;
  border: 1px solid rgba(15, 107, 67, .12);
  border-radius: 24px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 28px 90px rgba(25, 57, 37, .14);
  text-align: center;
}
.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 19px;
  color: #fff;
  background: linear-gradient(145deg, #168052, #094a2f);
  box-shadow: 0 12px 26px rgba(15, 107, 67, .25);
  font-size: 27px;
  font-weight: 800;
}
.brand-mark.small { width: 44px; height: 44px; margin: 0; border-radius: 13px; font-size: 19px; }
.eyebrow, .section-kicker {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1, h2, p { margin-top: 0; }
.login-card h1 { margin-bottom: 9px; font-size: 28px; letter-spacing: -.02em; }
.login-copy { margin-bottom: 30px; color: var(--muted); line-height: 1.7; }
.login-form { display: grid; gap: 17px; text-align: left; }
label { display: grid; gap: 8px; color: #354139; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid #ccd6cd;
  border-radius: 11px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  transition: border .18s, box-shadow .18s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 107, 67, .11); }
textarea { resize: vertical; }
.primary, .secondary, .text-button, .icon-button {
  border: 0;
  border-radius: 10px;
  font-weight: 750;
}
.primary { padding: 12px 18px; color: #fff; background: var(--green); box-shadow: 0 8px 18px rgba(15, 107, 67, .17); }
.primary:hover { background: var(--green-dark); }
.primary:disabled { opacity: .48; cursor: not-allowed; box-shadow: none; }
.secondary { padding: 10px 15px; color: var(--green-dark); background: var(--green-light); }
.secondary:hover { background: #d7ebdf; }
.wide { width: 100%; }
.form-error { min-height: 20px; margin: 0; color: var(--red); font-size: 13px; text-align: center; }
.security-note { margin: 24px 0 0; color: #7e8880; font-size: 12px; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px max(24px, calc((100vw - 1260px) / 2));
  border-bottom: 1px solid rgba(206, 218, 207, .85);
  background: rgba(250, 252, 249, .9);
  backdrop-filter: blur(16px);
}
.brand-row, .account-row { display: flex; align-items: center; gap: 13px; }
.brand-row h1 { margin: 0; font-size: 18px; }
.brand-row .eyebrow { margin-bottom: 3px; }
.account-row { color: var(--muted); font-size: 13px; }
.text-button { padding: 7px 10px; color: var(--green); background: transparent; }
.text-button:hover { background: var(--green-light); }

main { width: min(1260px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 70px; }
.toast {
  position: fixed;
  top: 78px;
  right: 24px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 48px));
  padding: 13px 16px;
  border: 1px solid #b8d9c4;
  border-radius: 11px;
  background: #effaf3;
  color: #174c2f;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.toast.error { border-color: #edc4c0; background: var(--red-light); color: var(--red); }
.hero-grid { display: grid; grid-template-columns: 1.55fr .85fr; gap: 18px; }
.hero-card, .carrier-card, .panel, .workflow-card, .metric-grid article {
  border: 1px solid rgba(201, 214, 202, .75);
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}
.hero-card { min-height: 190px; padding: 34px; border-radius: 20px; background: linear-gradient(135deg, #fff 20%, #eef7f1 100%); }
.hero-card h2 { max-width: 650px; margin-bottom: 13px; font-size: clamp(24px, 3vw, 38px); line-height: 1.2; letter-spacing: -.035em; }
.hero-card p:last-child { max-width: 650px; margin-bottom: 0; color: var(--muted); line-height: 1.75; }
.carrier-card { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; padding: 17px; border-radius: 20px; }
.carrier-card div { display: flex; flex-direction: column; justify-content: center; padding: 20px; }
.carrier-card div + div { border-left: 1px solid var(--line); }
.carrier-card span { color: var(--muted); font-size: 13px; }
.carrier-card strong { margin: 8px 0 4px; font-size: 28px; }
.carrier-card small { color: #7b867d; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin: 18px 0; }
.metric-grid article { padding: 21px 23px; border-radius: 16px; }
.metric-grid span, .metric-grid small { display: block; color: var(--muted); font-size: 12px; }
.metric-grid strong { display: block; margin: 8px 0 3px; font-size: 25px; letter-spacing: -.02em; }

.workflow-card, .panel { border-radius: 18px; }
.workflow-card { padding: 26px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading h2, .panel h2 { margin-bottom: 0; font-size: 20px; }
.section-heading > p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.workflow-steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; margin: 24px 0 0; padding: 0; list-style: none; }
.workflow-steps li { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; }
.workflow-steps li:not(:last-child)::after { content: ""; height: 1px; flex: 1; min-width: 10px; background: #cbd8cd; }
.workflow-steps b { width: 29px; height: 29px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-light); font-size: 12px; }
.workflow-steps span { display: grid; flex: none; font-size: 13px; font-weight: 750; white-space: nowrap; }
.workflow-steps small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }

.workspace-grid { display: grid; grid-template-columns: 1.45fr .75fr; gap: 18px; margin-top: 18px; }
.panel { padding: 26px; }
.section-heading.compact { margin-bottom: 22px; }
.form-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#uploadForm { display: grid; gap: 16px; }
.drop-zone {
  min-height: 178px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border: 1.5px dashed #a8b9aa;
  border-radius: 14px;
  background: var(--soft);
  text-align: center;
  transition: .18s ease;
}
.drop-zone:hover, .drop-zone:focus, .drop-zone.dragging { border-color: var(--green); background: #edf7f1; }
.drop-zone.has-file { border-style: solid; border-color: #77ae8c; background: #eef8f2; }
.file-symbol { margin-bottom: 4px; padding: 6px 9px; border-radius: 7px; color: #fff; background: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.drop-zone strong { max-width: 90%; word-break: break-all; }
.drop-zone span { color: var(--muted); font-size: 12px; }
.upload-result { margin-top: 16px; padding: 16px; border: 1px solid #b9dac5; border-radius: 12px; background: #f0faf4; font-size: 13px; line-height: 1.75; }
.upload-result.warning { border-color: #eacb91; background: var(--amber-light); }
.result-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 12px; }
.result-actions a, .result-actions button { text-decoration: none; }
.check-list { display: grid; gap: 17px; margin: 25px 0; padding: 0; list-style: none; }
.check-list li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; color: #3d4840; font-size: 13px; line-height: 1.55; }
.check-list i { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--green-light); }
.check-list i::after { content: "✓"; color: var(--green); font-size: 11px; font-style: normal; font-weight: 900; }
.boundary-note { padding: 16px; border-left: 3px solid var(--amber); border-radius: 8px; background: #fff8e9; }
.boundary-note strong { color: #764500; font-size: 13px; }
.boundary-note p { margin: 6px 0 0; color: #6e624f; font-size: 12px; line-height: 1.6; }

.records-panel { margin-top: 18px; }
.records-heading { align-items: center; }
.filter-row { display: grid; grid-template-columns: minmax(200px, 1fr) 160px 180px auto; gap: 10px; margin: 22px 0 15px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; min-width: 920px; border-collapse: collapse; font-size: 12px; }
th, td { padding: 13px 12px; border-bottom: 1px solid #e9eee9; text-align: left; vertical-align: middle; }
th { color: #68736a; background: #f5f8f4; font-size: 11px; font-weight: 750; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcf9; }
.batch-name { display: block; max-width: 230px; color: var(--ink); font-weight: 750; word-break: break-word; }
.subtext { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.pill { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; background: #eef2ee; color: #526057; font-size: 10px; font-weight: 750; white-space: nowrap; }
.pill.green { background: var(--green-light); color: var(--green-dark); }
.pill.amber { background: var(--amber-light); color: #784600; }
.pill.red { background: var(--red-light); color: var(--red); }
.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 6px 9px; border: 0; border-radius: 7px; color: var(--green-dark); background: #e9f3ed; font-size: 11px; font-weight: 700; }
.row-actions button:hover { background: #d7ebdf; }
.empty { padding: 34px; color: var(--muted); text-align: center; }

.dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 25px; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 30px 90px rgba(19, 39, 25, .25); }
.wide-dialog { width: min(850px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(20, 35, 25, .46); backdrop-filter: blur(3px); }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 22px; }
.dialog-header h2 { margin: 0; font-size: 21px; }
.icon-button { width: 34px; height: 34px; flex: none; color: #4f5d53; background: #eef2ee; font-size: 21px; line-height: 1; }
.dialog form { display: grid; gap: 15px; }
.dialog-note { margin: 0; padding: 11px 12px; border-radius: 8px; color: #6a5a3e; background: #fff7e7; font-size: 12px; line-height: 1.55; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.detail-grid div { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf7; }
.detail-grid span { display: block; color: var(--muted); font-size: 10px; }
.detail-grid strong { display: block; margin-top: 6px; font-size: 16px; }
.detail-section { margin-top: 22px; }
.detail-section h3 { margin: 0 0 10px; font-size: 14px; }
.detail-list { max-height: 180px; overflow: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfb; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; line-height: 1.7; }
.event-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.event-list li { padding: 10px 12px; border-left: 2px solid #a7c9b3; background: #f6f9f6; font-size: 11px; line-height: 1.55; }
.event-list time { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

@media (max-width: 980px) {
  .hero-grid, .workspace-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .workflow-steps { grid-template-columns: repeat(3, 1fr); gap: 16px 6px; }
  .workflow-steps li::after { display: none; }
}
@media (max-width: 680px) {
  .topbar { padding: 12px 16px; }
  .brand-row h1 { font-size: 16px; }
  .brand-row .eyebrow { display: none; }
  main { width: min(100% - 24px, 1260px); padding-top: 14px; }
  .hero-card, .panel, .workflow-card { padding: 20px; border-radius: 15px; }
  .hero-card { min-height: 0; }
  .hero-card h2 { font-size: 25px; }
  .carrier-card { min-height: 140px; }
  .carrier-card div { padding: 12px; }
  .metric-grid { gap: 9px; }
  .metric-grid article { padding: 16px; }
  .metric-grid strong { font-size: 20px; }
  .workflow-steps { grid-template-columns: repeat(2, 1fr); }
  .form-grid.two, .filter-row { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 8px; }
  .records-heading { display: flex; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .login-card { padding: 32px 24px; }
}
