/* Lindian MOC system — stylesheet. No framework, no build step. */
:root {
  --navy: #1f3864;
  --navy-dark: #16294a;
  --mid: #2e5c8a;
  --accent: #b5651d;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #dfe4ec;
  --line-strong: #c3ccd9;
  --text: #1b2230;
  --muted: #66707f;
  --good: #1e6b2f;
  --good-bg: #e8f5eb;
  --warn: #9a6a00;
  --warn-bg: #fdf3dc;
  --bad: #a02020;
  --bad-bg: #fbe9e9;
  --info-bg: #e9f0f8;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(20, 32, 54, .09), 0 1px 2px rgba(20, 32, 54, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--mid); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 22px; color: var(--navy); }
h2 { font-size: 17px; color: var(--navy); }
h3 { font-size: 14px; color: var(--mid); text-transform: uppercase; letter-spacing: .05em; }
p { margin: 0 0 .7rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------------------------------------------------------------- layout */
.topbar {
  background: var(--navy); color: #fff; padding: 0 20px;
  display: flex; align-items: center; gap: 22px;
  height: 54px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.brand { font-weight: 700; font-size: 15px; letter-spacing: .02em; white-space: nowrap; }
.brand small { display: block; font-weight: 400; font-size: 10.5px; opacity: .72; letter-spacing: .04em; }
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a {
  color: #dce5f2; padding: 7px 12px; border-radius: var(--radius);
  font-size: 13.5px; text-decoration: none; white-space: nowrap;
}
.nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.nav a.on { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.nav .badge { background: var(--accent); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 5px; font-weight: 700; }
.who { font-size: 12.5px; text-align: right; white-space: nowrap; }
.who strong { display: block; font-size: 13px; }
.who span { opacity: .72; }

.wrap { max-width: 1440px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 240px; }
.sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

/* ---------------------------------------------------------------- panels */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.panel > h2, .panel > .panel-head {
  padding: 12px 16px; border-bottom: 1px solid var(--line); margin: 0;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; flex: 1; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-sidebar { grid-template-columns: minmax(0,1fr) 340px; align-items: start; }
@media (max-width: 1050px) { .cols-2, .cols-3, .cols-sidebar { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--mid);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .08s;
}
.kpi:hover { transform: translateY(-1px); }
.kpi .n { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.kpi .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
.kpi.alert { border-left-color: var(--bad); } .kpi.alert .n { color: var(--bad); }
.kpi.warn { border-left-color: var(--warn); } .kpi.warn .n { color: var(--warn); }
.kpi.ok { border-left-color: var(--good); }

/* ---------------------------------------------------------------- tables */
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f9fc; font-weight: 600; color: var(--navy); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tbody tr:hover { background: #f9fbfd; }
tr.clickable { cursor: pointer; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- pills */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.pill.grey { background: #eef1f5; color: #4a5666; }
.pill.blue { background: var(--info-bg); color: var(--mid); }
.pill.green { background: var(--good-bg); color: var(--good); }
.pill.amber { background: var(--warn-bg); color: var(--warn); }
.pill.red { background: var(--bad-bg); color: var(--bad); }
.pill.t1 { background: var(--bad-bg); color: var(--bad); }
.pill.t2 { background: var(--warn-bg); color: var(--warn); }
.pill.t3 { background: var(--good-bg); color: var(--good); }
.flag { font-size: 11px; color: var(--bad); font-weight: 700; margin-left: 6px; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 3px; color: #333d4d; }
label .req { color: var(--bad); margin-left: 2px; }
.help { font-size: 12px; color: var(--muted); margin: 2px 0 5px; font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong);
  border-radius: 4px; font: inherit; font-size: 13.5px; background: #fff; color: var(--text);
}
textarea { resize: vertical; min-height: 62px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(46,92,138,.35); outline-offset: -1px; border-color: var(--mid); }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .field-row { grid-template-columns: 1fr; } }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 14px; }
.checks label, .inline-check {
  display: flex; align-items: flex-start; gap: 7px; font-weight: 400; font-size: 13px;
  padding: 3px 0; cursor: pointer; margin: 0;
}
.checks input, .inline-check input { margin: 3px 0 0; flex-shrink: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; }
legend { font-weight: 700; color: var(--navy); padding: 0 6px; font-size: 13.5px; }

/* ---------------------------------------------------------------- buttons */
button, .btn {
  font: inherit; font-size: 13.5px; font-weight: 600; padding: 7px 14px;
  border-radius: 4px; border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .btn:hover { background: #f2f5f9; text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-good:hover { background: #175524; }
.btn-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-bad:hover { background: #841919; }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-warn:hover { background: #7d5600; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-link { border: none; background: none; color: var(--mid); padding: 2px 4px; }
.btn-link:hover { background: none; text-decoration: underline; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- messages */
.msg { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13.5px; border: 1px solid; }
.msg.err { background: var(--bad-bg); border-color: #eabcbc; color: #7e1a1a; }
.msg.ok { background: var(--good-bg); border-color: #b6ddc0; color: #14501f; }
.msg.warn { background: var(--warn-bg); border-color: #e8d09a; color: #6f4c00; }
.msg.info { background: var(--info-bg); border-color: #c2d5e9; color: #24486b; }
.msg ul { margin: 6px 0 0; padding-left: 20px; }
.msg li { margin-bottom: 3px; }
.msg strong { display: block; margin-bottom: 3px; }

/* ---------------------------------------------------------------- detail */
.dl { display: grid; grid-template-columns: 190px 1fr; gap: 0; font-size: 13.5px; }
.dl dt { font-weight: 600; color: #46505f; padding: 6px 10px 6px 0; border-bottom: 1px solid #eef1f5; }
.dl dd { margin: 0; padding: 6px 0; border-bottom: 1px solid #eef1f5; white-space: pre-wrap; }
@media (max-width: 620px) { .dl { grid-template-columns: 1fr; } .dl dt { border: none; padding-bottom: 0; } }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; flex-wrap: wrap; background: #f7f9fc; border-radius: var(--radius) var(--radius) 0 0; }
.tabs button {
  border: none; background: none; padding: 10px 14px; border-bottom: 2px solid transparent;
  border-radius: 0; color: var(--muted); font-size: 13.5px;
}
.tabs button:hover { background: rgba(46,92,138,.06); }
.tabs button.on { color: var(--navy); border-bottom-color: var(--navy); font-weight: 700; }
.tabs .count { background: #e3e9f1; color: #4a5666; border-radius: 8px; padding: 0 5px; font-size: 11px; margin-left: 5px; }

/* ---------------------------------------------------------------- chain */
.stage { border-left: 3px solid var(--line-strong); padding: 0 0 14px 16px; margin-left: 8px; position: relative; }
.stage:last-child { padding-bottom: 0; }
.stage::before {
  content: ''; position: absolute; left: -7px; top: 4px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--line-strong); border: 2px solid #fff;
}
.stage.done { border-left-color: var(--good); } .stage.done::before { background: var(--good); }
.stage.active { border-left-color: var(--accent); } .stage.active::before { background: var(--accent); }
.stage.bad { border-left-color: var(--bad); } .stage.bad::before { background: var(--bad); }
.stage h4 { font-size: 13.5px; margin-bottom: 5px; color: var(--navy); }
.approver { padding: 6px 0; border-bottom: 1px dashed #eaeef4; font-size: 13px; }
.approver:last-child { border-bottom: none; }
.approver .name { font-weight: 600; }
.approver .role { color: var(--muted); font-size: 12px; }
.approver .cmt { color: #3b4657; font-size: 12.5px; margin-top: 3px; white-space: pre-wrap; padding-left: 10px; border-left: 2px solid #e5eaf1; }

/* ---------------------------------------------------------------- docs */
.doc-req { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; border-bottom: 1px solid #eef1f5; font-size: 13px; }
.doc-req:last-child { border-bottom: none; }
.doc-req .tick { width: 17px; height: 17px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; }
.doc-req .tick.yes { background: var(--good); }
.doc-req .tick.no { background: var(--bad); }
.doc-req .basis { color: var(--muted); font-size: 12px; }
.gate-box { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.gate-box > .gh { padding: 8px 12px; background: #f7f9fc; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.gate-box > .gb { padding: 4px 12px; }

.uploader { display: grid; grid-template-columns: 190px 1fr auto; gap: 8px; align-items: end; }
@media (max-width: 700px) { .uploader { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- misc */
.audit-row { font-size: 12.5px; padding: 7px 0; border-bottom: 1px solid #eef1f5; }
.audit-row:last-child { border-bottom: none; }
.audit-row .meta { color: var(--muted); font-size: 11.5px; }
.audit-row .act { font-weight: 600; color: var(--navy); }
.mail { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.mail .mh { padding: 8px 12px; background: #f7f9fc; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.mail pre { margin: 0; padding: 12px; font-size: 12px; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 145px; }
.overlay {
  position: fixed; inset: 0; background: rgba(20,30,48,.55); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal { background: #fff; border-radius: 8px; max-width: 640px; width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.modal h2 { padding: 14px 18px; border-bottom: 1px solid var(--line); margin: 0; }
.modal .mb { padding: 18px; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: #f9fbfd; border-radius: 0 0 8px 8px; }

.login-wrap { max-width: 400px; margin: 7vh auto; }
.login-wrap .panel { padding: 26px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand h1 { color: var(--navy); font-size: 21px; }
.login-brand p { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.hint { background: var(--info-bg); border: 1px solid #c2d5e9; border-radius: var(--radius); padding: 10px 12px; font-size: 12.5px; margin-top: 16px; color: #24486b; }
.hint code { background: rgba(255,255,255,.75); padding: 1px 4px; border-radius: 3px; }

.spinner { text-align: center; padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mb0 { margin-bottom: 0; }
.mt12 { margin-top: 12px; }
.bar { height: 7px; background: #eef1f5; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--mid); }
.stat-line { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-bottom: 1px solid #eef1f5; }
.stat-line:last-child { border-bottom: none; }
@media print { .topbar, .btn-row, .tabs { display: none; } }
