/* 标准溶液计算审核 · Web —— 深色 Fluent 风格 */
:root {
  --bg: #0e0f12;
  --bg-grad-a: #101319;
  --bg-grad-b: #0b0c0f;
  --panel: #17181c;
  --panel-border: #26282e;
  --cell-head: #121316;
  --cell-input: #000000;
  --cell-out: #0b1016;
  --text: #e6e6e6;
  --text-dim: #9aa0a8;
  --accent: #2563eb;
  --accent-deep: #1e40af;
  --accent-soft: rgba(37, 99, 235, .16);
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 8px;
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(37, 99, 235, .10), transparent 60%),
    linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b) 40%, var(--bg));
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px;
}

/* ---------- 头部 ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px 10px;
  max-width: 1340px;
  margin: 0 auto;
}
.header-right { display: flex; align-items: center; gap: 10px; }

/* 缩放控件 */
.zoom-ctl {
  display: inline-flex; align-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .02);
}
.zoom-btn {
  background: transparent; border: none;
  color: var(--text-dim);
  font-family: var(--font); font-size: 17px; line-height: 1;
  padding: 6px 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.zoom-btn:hover { background: var(--accent-soft); color: var(--text); }
.zoom-val {
  font-size: 13.5px; min-width: 56px; text-align: center;
  border-left: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 9px;
  box-shadow: 0 0 0 1px var(--panel-border), 0 4px 14px rgba(0, 0, 0, .4);
}
.brand h1 { font-size: 22px; font-weight: 600; letter-spacing: .5px; }
.brand-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 1px; }
.gh-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-dim); text-decoration: none; font-size: 14px;
  padding: 6px 12px; border: 1px solid var(--panel-border); border-radius: 999px;
  transition: color .15s, border-color .15s, background .15s;
}
.gh-link:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- 布局 ---------- */
/* 居中限宽版式; 配合缩放按钮(CSS zoom)整块长宽等比放大 */
.container { max-width: 1340px; margin: 0 auto; padding: 4px 24px 28px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}

/* ---------- 参数区 ---------- */
.params {
  display: flex; flex-wrap: wrap; gap: 12px 20px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.field { display: flex; align-items: center; gap: 8px; }
.field > label { color: var(--text-dim); font-size: 14.5px; white-space: nowrap; }
.daterange { display: inline-flex; align-items: center; gap: 6px; }
.tilde { color: var(--text-dim); }

select, input {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--cell-input);
  border: 1px solid #2c2e34;
  border-radius: 6px;
  padding: 7px 9px;
  min-height: 36px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
select:hover, input:hover:not(.out) { border-color: #3c4048; }
select:focus, input:focus:not(.out) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select { cursor: pointer; }
select:invalid, select option[value=""] { color: var(--text-dim); }
input::placeholder { color: #5c626b; }
input[type="date"] { padding: 4px 6px; color-scheme: dark; }

/* 摩尔质量红色警示(氯化锌模式) */
input.molar-alert { color: #ff4d4d; font-weight: 600; }

/* ---------- 记录表 ---------- */
.sheet { padding: 12px; }
.table-wrap { overflow-x: auto; }
.grid {
  display: grid;
  grid-template-columns: minmax(176px, 1.5fr) repeat(8, minmax(88px, 1fr));
  gap: 7px;
  min-width: 980px;
}
.cell { display: flex; align-items: stretch; justify-content: stretch; }
.cell > input { width: 100%; text-align: center; }
.s2 { grid-column: span 2; }
.s4 { grid-column: span 4; }
.s9 { grid-column: span 9; }

.cell.head {
  align-items: center; justify-content: center;
  background: var(--cell-head);
  color: #d5d8dc;
  border-radius: 6px;
  padding: 6px 8px;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.25;
  min-height: 38px;
}
.cell.chip {
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1d4ed8, var(--accent-deep));
  border-radius: 6px;
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: 6px;
  text-indent: 6px;
  min-height: 38px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

/* 输出格 */
input.out {
  background: var(--cell-out);
  border-color: #22304a;
  color: #cfe3ff;
  cursor: default;
}
input.out.out-strong { color: #7db4ff; font-weight: 700; font-size: 16.5px; }
input.out.exceed {
  color: #ff6b6b;
  border-color: #7f1d1d;
  background: rgba(127, 29, 29, .18);
  font-weight: 700;
}

.cell.note {
  background: var(--cell-head);
  border-radius: 6px;
  color: var(--text-dim);
  text-align: center;
  padding: 8px;
  font-size: 13.5px;
}

/* ---------- 按钮 ---------- */
.actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 2px 0;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font); font-size: 15.5px;
  color: var(--text);
  background: #202227;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  padding: 10px 24px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: #292c33; border-color: #3a3e46; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  border-color: #1e40af;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(37, 99, 235, .35);
}
.btn.primary:hover { background: linear-gradient(135deg, #3b76f0, #234bc4); }
.btn.danger-ghost:hover { border-color: #7f1d1d; color: #ff8383; background: rgba(127, 29, 29, .12); }

/* ---------- 页脚 ---------- */
.app-footer {
  margin-top: 18px;
  text-align: center;
  color: #565c66;
  font-size: 12px;
}
.app-footer .dot { margin: 0 6px; }

/* ---------- Toast ---------- */
#toast-root {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  width: max-content; max-width: 92vw;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  pointer-events: auto;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 15px;
  border: 1px solid;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  animation: toast-in .22s ease-out;
  white-space: pre-line;
}
.toast .t-title { font-weight: 700; margin-right: 2px; }
.toast.success { background: #10241a; border-color: #14532d; color: #86efac; }
.toast.error   { background: #2a1214; border-color: #7f1d1d; color: #fca5a5; }
.toast.warning { background: #2a2010; border-color: #92600d; color: #fcd34d; }
.toast.hide { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- 窄屏 ---------- */
@media (max-width: 720px) {
  .container, .app-header { padding-left: 12px; padding-right: 12px; }
  .params { gap: 8px 12px; }
  .actions { justify-content: stretch; }
  .actions .btn { flex: 1; justify-content: center; }
}
