/* ==========================================================================
   青岛易士通海运货代销售报价系统 —— 共享样式
   无框架、无外部字体、无 CDN，纯本地资源（保证可复制、离线可用）
   ========================================================================== */

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

:root {
    --brand: #10559a;
    --brand-dark: #0b3f75;
    --brand-light: #e8f0fa;
    --ok: #1a7f37;
    --ok-bg: #e6f4ea;
    --warn: #9a6700;
    --warn-bg: #fff8e1;
    --err: #b3261e;
    --err-bg: #fdecea;
    --line: #d8dee6;
    --text: #1f2933;
    --muted: #66727f;
    --bg: #f4f6f9;
    --card: #ffffff;
    --radius: 8px;
}

body {
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
    background: var(--brand);
    color: #fff;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 18px;
    height: 52px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .14);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar .logo { font-weight: 700; font-size: 16px; letter-spacing: .5px; white-space: nowrap; }
.topbar .ver { font-size: 12px; opacity: .75; }
.topbar nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.topbar nav a {
    color: #dce8f7; text-decoration: none; padding: 6px 12px;
    border-radius: 6px; font-size: 13px; white-space: nowrap;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .13); color: #fff; }
.topbar nav a.active { background: var(--brand-dark); color: #fff; font-weight: 600; }
.topbar .who { font-size: 13px; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.role-badge {
    background: rgba(255, 255, 255, .2); padding: 2px 8px;
    border-radius: 10px; font-size: 12px;
}
.role-badge.lv3 { background: #ffd66b; color: #5a3d00; font-weight: 600; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1500px; margin: 0 auto; padding: 18px; }
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
}
.card > h2 {
    font-size: 15px; margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--line); color: var(--brand-dark);
    display: flex; align-items: center; gap: 8px;
}
.card > h2 .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.col { flex: 1; min-width: 150px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- 表单 ---------- */
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=file], select, textarea {
    width: 100%; padding: 7px 9px; border: 1px solid var(--line);
    border-radius: 6px; font-size: 13px; font-family: inherit;
    background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(16, 85, 154, .12);
}
textarea { min-height: 90px; resize: vertical; font-family: Consolas, "Courier New", monospace; }

button {
    background: var(--brand); color: #fff; border: 0; padding: 8px 16px;
    border-radius: 6px; cursor: pointer; font-size: 13px; font-family: inherit;
    transition: background .15s;
}
button:hover { background: var(--brand-dark); }
button:disabled { background: #a9b4c0; cursor: not-allowed; }
button.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
button.ghost:hover { background: var(--brand-light); }
button.danger { background: var(--err); }
button.danger:hover { background: #8d1d17; }
button.sm { padding: 4px 10px; font-size: 12px; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f0f3f7; font-weight: 600; font-size: 12px; color: #445; white-space: nowrap; }
tr:hover td { background: #fafcff; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }

/* ---------- 提示 ---------- */
.alert { padding: 10px 12px; border-radius: 6px; margin-bottom: 10px; font-size: 13px; border-left: 4px solid; }
.alert.info { background: var(--brand-light); border-color: var(--brand); }
.alert.ok { background: var(--ok-bg); border-color: var(--ok); color: #14532d; }
.alert.warn { background: var(--warn-bg); border-color: var(--warn); color: #6b4700; }
.alert.err { background: var(--err-bg); border-color: var(--err); color: #7f1d1d; }
.alert ul { margin: 6px 0 0 18px; }
.tag {
    display: inline-block; padding: 1px 7px; border-radius: 9px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.tag.est { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d99a; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
/* 期次标记：同一船司同一箱型有两期都未过期时，标出"第N期/共N期" */
.tag.period {
    background: #eef4ff; color: var(--brand); border: 1px solid #c9dcf5;
    font-size: 11px; cursor: help;
}
.tag.err { background: var(--err-bg); color: var(--err); }
.tag.info { background: var(--brand-light); color: var(--brand-dark); }
.tag.muted { background: #eef1f4; color: var(--muted); }

/* ---------- 报价输出 ---------- */
.quote-text {
    background: #fbfcfe; border: 1px solid var(--line); border-radius: 6px;
    padding: 12px; font-family: Consolas, "Courier New", monospace;
    font-size: 13px; white-space: pre-wrap; word-break: break-all; line-height: 1.9;
}
.missing { color: var(--muted); }
.estimated { color: var(--warn); font-weight: 600; }
.lowest-row td { background: #eafaf0 !important; }
.lowest-row td:first-child { border-left: 4px solid var(--ok); }

/* 最低价星标 */
.star { color: #d97706; font-weight: 700; margin-left: 4px; }
.lowest-cell { position: relative; }
.lowest-cell .amt-lowest { color: #b45309; font-weight: 700; }

/* 市场价格指数图 */
.idx-wrap { margin-bottom: 18px; }
.idx-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.idx-head .name { font-weight: 700; color: var(--brand-dark); font-size: 14px; }
.idx-head .val { font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.idx-head .up { color: #b3261e; }
.idx-head .down { color: #1a7f37; }
.idx-legend { font-size: 12px; color: var(--muted); margin-left: auto; }
.idx-legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 4px; }
.idx-svg { width: 100%; background: #fbfcfe; border: 1px solid var(--line); border-radius: 6px; }
.idx-table { font-size: 12px; margin-top: 6px; }
.empty-hint { color: var(--muted); font-size: 12px; padding: 6px 0; }

/* ---------- 登录页 ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(140deg, #0b3f75 0%, #10559a 50%, #1b74c0 100%);
    padding: 20px;
}
.login-box {
    background: #fff; border-radius: 12px; padding: 32px 30px;
    width: 100%; max-width: 380px; box-shadow: 0 16px 48px rgba(0, 0, 0, .3);
}
.login-box h1 { font-size: 19px; color: var(--brand-dark); margin-bottom: 4px; text-align: center; }
.login-box .sub { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 22px; }
.login-box .field { margin-bottom: 14px; }
.login-box button { width: 100%; padding: 10px; font-size: 14px; margin-top: 6px; }
.login-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); text-align: center; line-height: 1.8; }

/* ---------- 其他 ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: Consolas, "Courier New", monospace; }
.center { text-align: center; }
.right { text-align: right; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.hidden { display: none !important; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--brand-light); border-radius: 8px; padding: 12px 14px; }
.stat .n { font-size: 24px; font-weight: 700; color: var(--brand-dark); line-height: 1.2; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot.green { background: var(--ok); } .dot.red { background: var(--err); } .dot.gray { background: #b6bec7; }
.spin {
    display: inline-block; width: 13px; height: 13px; border: 2px solid #fff;
    border-top-color: transparent; border-radius: 50%; animation: sp .7s linear infinite;
    vertical-align: -2px; margin-right: 6px;
}
@keyframes sp { to { transform: rotate(360deg); } }
.toast {
    position: fixed; right: 20px; bottom: 20px; z-index: 999; display: flex;
    flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast .item {
    background: #2c3641; color: #fff; padding: 10px 16px; border-radius: 6px;
    font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, .28); max-width: 420px;
    animation: slidein .18s ease-out;
}
.toast .item.ok { background: var(--ok); }
.toast .item.err { background: var(--err); }
.toast .item.warn { background: #8a6100; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }
.modal-mask {
    position: fixed; inset: 0; background: rgba(15, 25, 38, .5); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
    background: #fff; border-radius: 10px; padding: 22px; max-width: 620px; width: 100%;
    max-height: 86vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.modal h3 { font-size: 16px; margin-bottom: 12px; color: var(--brand-dark); }

/* ---------------------------------------------------------------- 统一智能输入框 */
/* 一个框同时接受"打字/粘贴文字"与"粘贴/拖入截图" —— 同事不用先想"这是图还是字" */
.smart-input {
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    overflow: hidden;
}
.smart-input:hover { border-color: #9fb4cd; }
.smart-input:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(16, 85, 154, .10);
}
.smart-input.dragover { border-color: var(--ok); background: #f6fdf8; }
.smart-input.pasting { border-color: #b45309; background: #fffdf7; }
.smart-input .smart-text {
    width: 100%;
    min-height: 82px;
    border: 0;
    border-radius: 0;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: transparent;
}
.smart-input .smart-text:focus { box-shadow: none; }
.smart-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-top: 1px dashed var(--line);
    background: #f8fbff;
}
.smart-hint { font-size: 12px; color: var(--muted); }
.smart-thumbs { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 0 12px; }
.smart-thumbs:not(:empty) { padding: 8px 12px 10px; border-top: 1px dashed var(--line); }
.ocr-panel {
    margin-top: 8px; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 6px; background: #fbfcfe;
}
.ocr-panel .ocr-text {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12.5px; white-space: pre-wrap; word-break: break-all;
    max-height: 190px; overflow: auto; margin-top: 6px;
    background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 8px;
}

/* ---------------------------------------------------------------- 粘贴图片区（价格录入页保留） */
/* 报价截图最常用的录入方式：直接 Ctrl+V，比"另存为文件再上传"快得多 */
.paste-zone {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 16px;
    margin-top: 10px;
    border: 2px dashed #b9c6d6;
    border-radius: 8px;
    background: #f8fbff;
    color: #46566a;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    outline: none;
}
.paste-zone:hover,
.paste-zone:focus {
    border-color: var(--brand);
    background: #eef5ff;
}
.paste-zone.dragover {
    border-color: var(--ok);
    background: #eefaf1;
}
.paste-zone.pasting {
    border-color: #b45309;
    background: #fff8ec;
}
.paste-icon { font-size: 17px; line-height: 1; }
.paste-thumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 8px 6px 0;
    padding: 3px 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 12px;
}
.paste-thumb img { height: 34px; border-radius: 3px; display: block; }
/* 报价有效期：过期/临近的颜色提示 */
.valid-cell { white-space: nowrap; font-size: 12px; }
.valid-cell.expired { color: var(--err); font-weight: 600; }
.valid-cell.soon { color: var(--warn); font-weight: 600; }
.valid-cell.none { color: var(--muted); }

/* ===== 录入页精简：手工表单折叠 ===== */
.stack > .card + .card { margin-top: 14px; }
.manual-fold {
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  padding: 8px 12px;
  background: #fbfcfe;
}
.manual-fold > summary {
  cursor: pointer;
  font-weight: 600;
  color: #2a5f8f;
  padding: 4px 0;
  list-style: none;
}
.manual-fold > summary::-webkit-details-marker { display: none; }
.manual-fold > summary::before { content: '▸ '; }
.manual-fold[open] > summary::before { content: '▾ '; }
.manual-fold[open] > summary { margin-bottom: 6px; }
label.inline { font-weight: normal; }

/* ===== 查询结果：特殊备注列 ===== */
.remark-cell { max-width: 260px; }
.remark-line {
  font-size: 12px;
  line-height: 1.45;
  color: #7a4a00;
  background: #fff7e6;
  border-left: 3px solid #f0b429;
  padding: 2px 6px;
  margin: 2px 0;
  border-radius: 3px;
  word-break: break-all;
}

/* ===== 核对表：备注输入 ===== */
.fz-rowremark { font-size: 12px; }
.fz-price.auto-filled {
  background: #eef7ee;
  border-color: #9ccf9c;
}

/* ===== 识别方式状态条（本地 / AI）===== */
.ai-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
}
.ai-banner .ai-tag {
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .08);
}
.ai-banner.ai-used { background: #e8f2fd; border-left: 4px solid #10559a; color: #0d3f73; }
.ai-banner.ai-warn { background: #fff7e6; border-left: 4px solid #f0b429; color: #7a4a00; }
.ai-banner.ai-local { background: #eef7ee; border-left: 4px solid #4c9a4c; color: #2f5d2f; }

/* ===== 直航 / 中转 标签 ===== */
.tag.direct {
  background: #e6f4ea; color: #1e7b34; border: 1px solid #a8d5b5;
  padding: 1px 6px; border-radius: 4px; font-size: 12px; white-space: nowrap;
}
.tag.transit {
  background: #fff3e0; color: #a85b00; border: 1px solid #f0c48a;
  padding: 1px 6px; border-radius: 4px; font-size: 12px; white-space: nowrap;
}
.fz-transit { font-size: 12px; }

/* ===== 价格输入框：隐藏数字上下箭头 =====
   为什么：type=number 的 spinner 会占掉宽度，
   窄列里 7000 会被挤成 "70C"（实测踩到）。 */
.fz-price::-webkit-outer-spin-button,
.fz-price::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.fz-price {
  -moz-appearance: textfield;
  appearance: textfield;
  font-variant-numeric: tabular-nums;
}
