:root {
  --bg: #f4f6f8; --panel: #ffffff; --ink: #1d2733; --muted: #5d6b7a; --line: #dde3e9;
  --accent: #1f6feb; --accent-soft: #e6efff; --keep: #1a7f37; --keep-soft: #e3f4e8;
  --ask: #9a6700; --ask-soft: #fff4d6; --drop: #b42318; --drop-soft: #fdecea; --wait: #57606a; --wait-soft: #eef1f4;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 12px; }
button:hover { border-color: #b7c1cc; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1a5fd0; }
button.danger { color: var(--drop); }
button:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: #fff; width: 100%;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

header.top { background: #0f2238; color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 52px; position: sticky; top: 0; z-index: 5; }
header.top .brand { font-weight: 600; white-space: nowrap; }
header.top nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
header.top nav a { color: #c8d3df; padding: 6px 12px; border-radius: 6px; white-space: nowrap; }
header.top nav a.on, header.top nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
header.top .who { color: #c8d3df; font-size: 13px; white-space: nowrap; display: flex; gap: 10px; align-items: center; }
header.top .who button { background: transparent; color: #c8d3df; border-color: #3a5068; padding: 3px 10px; }

main { max-width: 1180px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0 0 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 200px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border-radius: 999px; padding: 4px 12px; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs .n { opacity: .7; margin-left: 4px; }
label.field { display: block; margin-bottom: 10px; }
label.field span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
.row select { width: auto; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8fafc; }
tr.detail td { background: #fafbfc; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; }
.b-keep { background: var(--keep-soft); color: var(--keep); }
.b-ask { background: var(--ask-soft); color: var(--ask); }
.b-drop { background: var(--drop-soft); color: var(--drop); }
.b-wait { background: var(--wait-soft); color: var(--wait); }
.grade { font-weight: 600; }

.quotes { margin: 6px 0 0; padding-left: 18px; }
.quotes li { margin-bottom: 4px; }
.quotes q { color: var(--muted); }

.mail { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.mail-list { max-height: 72vh; overflow-y: auto; }
.mail-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.mail-item.on { border-color: var(--accent); background: var(--accent-soft); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { list-style: none; padding: 0; margin: 8px 0; }
.checks li { padding: 2px 0; }
.ok { color: var(--keep); }
.bad { color: var(--drop); }
.warn { color: var(--ask); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #0f2238; color: #fff; padding: 8px 16px; border-radius: 8px; z-index: 20; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.overdue td { background: #fff8e6; }

.login { max-width: 360px; margin: 12vh auto; }
.login h1 { margin-bottom: 16px; }
.error { color: var(--drop); margin: 8px 0 0; min-height: 1.4em; }

@media (max-width: 860px) {
  .mail, .pair { grid-template-columns: 1fr; }
  header.top { gap: 12px; padding: 0 12px; }
  header.top .who span { display: none; }
  main { padding: 12px; }
}

.mt { margin-top: 10px; }
.mb { margin-bottom: 12px; }
.mb6 { margin-bottom: 6px; }
.between { justify-content: space-between; }
.w110 { width: 110px; }
.full { width: 100%; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
h2.h2 { font-size: 16px; margin: 0 0 6px; }

/* risk monitor */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.tile .n { font-size: 26px; font-weight: 600; line-height: 1.2; }
.t-red .n { color: var(--drop); }
.t-yellow .n { color: var(--ask); }
.t-green .n { color: var(--keep); }
.alert-item { border-top: 1px solid var(--line); padding: 10px 0; }
.alert-item:first-child { border-top: 0; }
button.on-btn { background: var(--ink); color: #fff; border-color: var(--ink); }
.overdue-panel { border-color: #f0c36d; background: #fffaf0; }
tr.muted td { color: var(--muted); }
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
