:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface2: #f3f4f6;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border2: #d1d5db;
  --primary: #1677ff;
  --danger: #ef4444;
  --warn: #f59e0b;
  --good: #10b981;
  --shadow: 0 10px 26px rgba(15, 23, 42, 0.10);
  --radius: 12px;
  --radius2: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar__title h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}
.topbar__meta {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(17, 24, 39, 0.80);
  font-size: 12px;
}

.todayBadge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(22, 119, 255, 0.08);
  font-weight: 750;
}

.todayBadge__k {
  color: rgba(17, 24, 39, 0.66);
  font-weight: 700;
}

.todayBadge__v {
  font-size: 13px;
  color: rgba(17, 24, 39, 0.92);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 9;
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.toolbar__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar__row--advanced {
  margin-top: 10px;
  padding: 10px 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: var(--radius);
}

.group {
  display: grid;
  gap: 8px;
  min-width: 240px;
}

.group__title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
}

.tabs { display: flex; gap: 8px; }
.tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 650;
}
.tab--active {
  border-color: rgba(22, 119, 255, 0.35);
  background: rgba(22, 119, 255, 0.08);
  color: rgba(17, 24, 39, 0.95);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 0 8px;
  height: 20px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.06);
  border: 1px solid var(--border);
  font-size: 12px;
  color: rgba(17, 24, 39, 0.78);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  overflow: hidden;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.tableWrap {
  flex: 1;
  background: var(--surface);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1160px;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  text-align: left;
  font-size: 12px;
  color: rgba(17, 24, 39, 0.86);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 10px 10px;
  white-space: nowrap;
  cursor: pointer;
}
.table thead th:last-child { border-right: none; }

.table thead th.th--actions { cursor: default; }
.table thead th.th--num { text-align: right; }

.table tbody td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
  font-size: 13px;
  color: rgba(17, 24, 39, 0.92);
}
.table tbody td:last-child { border-right: none; }
.table tbody tr:nth-child(even) td { background: rgba(17, 24, 39, 0.02); }
.table tbody tr:hover td { background: rgba(22, 119, 255, 0.06); }
.table tbody td.td--num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody td.td--muted { color: var(--muted); }
.table tbody td.td--nowrap { white-space: nowrap; }
.table tbody td.td--remarks { color: rgba(17, 24, 39, 0.70); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.04);
  font-size: 12px;
  white-space: nowrap;
}
.badge--overdue {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: rgba(127, 29, 29, 0.96);
}
.badge--soon {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.14);
  color: rgba(120, 53, 15, 0.96);
}
.badge--ok {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
  color: rgba(6, 95, 70, 0.96);
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 650;
  font-size: 13px;
  transition: transform 0.05s ease, border-color 0.15s ease, background 0.15s ease;
  user-select: none;
}
.btn:hover { border-color: var(--border2); background: #f9fafb; }
.btn:active { transform: translateY(1px); }
.btn--primary {
  border-color: rgba(22, 119, 255, 0.45);
  background: rgba(22, 119, 255, 0.10);
}
.btn--danger {
  border-color: rgba(239, 68, 68, 0.40);
  background: rgba(239, 68, 68, 0.08);
}
.btn--ghost {
  border-style: dashed;
  background: transparent;
}
.btn--compact {
  padding: 8px 10px;
}

.btn--file { position: relative; overflow: hidden; }
.btn--file input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.menu {
  position: relative;
  display: inline-flex;
}

.menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 20;
}

.menu__item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  color: rgba(17, 24, 39, 0.92);
}

.menu__item:hover {
  background: rgba(17, 24, 39, 0.04);
  border-color: rgba(17, 24, 39, 0.06);
}

.menu__item--danger {
  color: rgba(185, 28, 28, 0.96);
}

.input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: rgba(17, 24, 39, 0.92);
  outline: none;
  font-size: 13px;
}
.input:focus { border-color: rgba(22, 119, 255, 0.55); box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12); }
.textarea { resize: vertical; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row--inline { margin: 0; }
.field { margin-top: 10px; }
.field__label { margin-bottom: 8px; color: var(--muted); font-size: 12px; }

.input--search { flex: 1; min-width: 240px; }
.input--select { width: auto; min-width: 180px; }

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.seg__btn {
  border: none;
  background: transparent;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 750;
  font-size: 13px;
  color: rgba(17, 24, 39, 0.82);
}
.seg__btn + .seg__btn {
  border-left: 1px solid var(--border);
}
.seg__btn--active {
  background: rgba(22, 119, 255, 0.10);
  color: rgba(17, 24, 39, 0.95);
}

.listWrap {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 10px;
  padding: 2px;
}

.listEmpty {
  padding: 16px;
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.cardItem {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px 12px;
}

.cardHead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.cardTitle {
  font-weight: 800;
  font-size: 14px;
}
.cardMeta {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  color: rgba(17, 24, 39, 0.86);
  font-size: 12px;
}
.cardMeta .k {
  display: inline-block;
  min-width: 42px;
  color: var(--muted);
}
.cardMeta .v {
  font-weight: 650;
}
.cardRemarks {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  color: rgba(17, 24, 39, 0.74);
  font-size: 12px;
}
.cardFoot {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cardDelivered .switch span { font-size: 12px; color: rgba(17, 24, 39, 0.78); }

.thSort {
  margin-left: 6px;
  display: inline-flex;
  gap: 2px;
  opacity: 0.9;
  font-size: 11px;
  color: rgba(17, 24, 39, 0.62);
}

.actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}
.linkBtn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: rgba(17, 24, 39, 0.92);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}
.linkBtn:hover { border-color: var(--border2); background: #f9fafb; }
.linkBtn--danger { border-color: rgba(239, 68, 68, 0.40); background: rgba(239, 68, 68, 0.08); }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.switch input { width: 16px; height: 16px; }

.modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.modal {
  border: none;
  padding: 0;
  background: transparent;
}
.modal__card {
  width: min(840px, calc(100vw - 24px));
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal__card--login {
  width: min(520px, calc(100vw - 24px));
}

.modal__card--help {
  width: min(720px, calc(100vw - 24px));
}
.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-weight: 750; }
.iconBtn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: rgba(17, 24, 39, 0.86);
  cursor: pointer;
}
.modal__body { padding: 16px; }
.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}

.preview {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 12px;
  color: rgba(17, 24, 39, 0.76);
  font-size: 12px;
}

.help {
  display: grid;
  gap: 10px;
}

.help__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.help__h {
  font-weight: 850;
  color: rgba(17, 24, 39, 0.92);
}

.help__p {
  color: rgba(17, 24, 39, 0.76);
  line-height: 1.55;
}

.help__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: rgba(17, 24, 39, 0.06);
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(17, 24, 39, 0.10);
}

@media (max-width: 980px) {
  .topbar__actions { gap: 6px; }
  .input--search { min-width: 160px; }
  .input--select { min-width: 160px; }
  .table { min-width: 1100px; }
  .cardMeta { grid-template-columns: 1fr; }
}

