/* Zhisheng Logistics Manager - single stylesheet. Quiet, dense, readable. */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --line: #e4e7ec; --line-strong: #d0d5dd;
  --ink: #101828; --ink-2: #475467; --ink-3: #98a2b3;
  --accent: #1f4fd8; --accent-ink: #ffffff; --accent-soft: #eef3ff;
  --green: #067647; --green-soft: #ecfdf3; --amber: #b54708; --amber-soft: #fffaeb;
  --red: #b42318; --red-soft: #fef3f2; --violet: #5925dc; --violet-soft: #f4f3ff;
  --blue: #175cd3; --blue-soft: #eff8ff;
  --radius: 8px; --shadow: 0 1px 2px rgba(16,24,40,.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.section-title { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 12px; display: flex; gap: 8px; align-items: center; }
.muted { color: var(--ink-2); } .small { font-size: 12px; } .mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; display: block; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.overdue { color: var(--red); font-weight: 600; }
.top-gap { margin-top: 12px; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; padding: 4px 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.brand-text { font-size: 13.5px; line-height: 1.25; }
.brand-lg .brand-mark { width: 36px; height: 36px; font-size: 14px; }
.brand-lg .brand-text { font-size: 17px; }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--ink-2); font-weight: 500; }
.nav-link:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.me { width: 100%; padding: 0 8px 6px; }
.me-name { font-weight: 600; font-size: 13px; } .me-role { color: var(--ink-3); font-size: 12px; }
.main { padding: 24px 32px 48px; min-width: 0; max-width: 1280px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; min-height: 36px; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.page-actions form { margin: 0; }
.crumbs { color: var(--ink-3); font-size: 12.5px; margin: -8px 0 10px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid transparent; font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #1a43ba; }
.btn-secondary { background: var(--panel); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #fecdca; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; }
.link.danger { color: var(--red); }

/* cards & layout */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.col-main, .col-side { min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow); }
.stat:hover { border-color: var(--line-strong); text-decoration: none; }
.stat-label { color: var(--ink-2); font-size: 12.5px; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-warn .stat-value { color: var(--red); }
.stats-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }

/* forms */
.form { max-width: 920px; } .form.narrow { max-width: 560px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 20px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field-wide { grid-column: 1 / -1; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field-hint { font-size: 12px; color: var(--ink-3); }
.field-error { font-size: 12px; color: var(--red); }
input, select, textarea { font: 14px var(--font); color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; padding: 7px 10px; min-height: 36px; width: 100%; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[disabled], select[disabled] { background: var(--bg); color: var(--ink-2); }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); margin: 0; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; padding: 4px 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.stack .btn { align-self: flex-start; }
.inline { display: flex; gap: 8px; align-items: center; } .inline select { width: auto; }
.alert { background: var(--red-soft); color: var(--red); border: 1px solid #fecdca; border-radius: 6px; padding: 9px 12px; margin-bottom: 12px; font-size: 13px; }
.flash { background: var(--green-soft); color: var(--green); border: 1px solid #abefc6; border-radius: 6px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }

/* toolbar & tables */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar select { width: auto; max-width: 220px; }
.search { position: relative; flex: 1 1 280px; }
.search svg { position: absolute; left: 10px; top: 10px; color: var(--ink-3); }
.search input { padding-left: 32px; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 12px; background: #fafbfc; border-bottom: 1px solid var(--line); padding: 9px 12px; white-space: nowrap; }
.table td { border-bottom: 1px solid var(--line); padding: 10px 12px; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: #fafbfc; }
.row-link { color: var(--ink); font-weight: 500; }
.sub { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.wrap { white-space: normal; word-break: break-word; max-width: 520px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 2px; }
.empty { color: var(--ink-3); font-size: 13px; padding: 10px 0; }

/* badges & tags */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-neutral { background: #f2f4f7; color: var(--ink-2); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 4px; background: #f2f4f7; color: var(--ink-2); margin: 0 4px 3px 0; white-space: nowrap; }

/* detail page */
.detail-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin: 0; }
.kv dt { font-size: 12px; color: var(--ink-3); } .kv dd { margin: 1px 0 0; word-break: break-word; }
.notes { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.notes p { margin: 4px 0 0; white-space: pre-wrap; }
.contact { padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact:last-of-type { border-bottom: 0; }
.contact-name { font-weight: 500; display: flex; gap: 6px; align-items: center; }
.contact-actions { display: flex; gap: 12px; margin-top: 4px; }
.contact-actions form { margin: 0; }
.add-contact { margin-top: 10px; } .add-contact summary { list-style: none; } .add-contact summary::-webkit-details-marker { display: none; }
.add-contact[open] summary { margin-bottom: 10px; }
.activity-form { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.activity-form .grid { grid-template-columns: repeat(3, 1fr); margin-bottom: 10px; }
.activity-form .form-actions { border: 0; padding-top: 0; margin-bottom: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 14px 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.tl-meta { font-size: 12px; color: var(--ink-2); }
.tl-body { white-space: pre-wrap; margin-top: 3px; }
.mini-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }

/* dashboard */
.list { list-style: none; margin: 0; padding: 0; }
.list li a { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); min-width: 0; }
.list strong { white-space: nowrap; }
.list li:last-child a { border-bottom: 0; }
.list li a:hover { text-decoration: none; background: #fafbfc; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 88px 1fr 32px; gap: 8px; align-items: center; color: var(--ink); font-size: 13px; }
.bar-row:hover { text-decoration: none; }
.bar-row .mono { text-align: right; }
.bar { height: 8px; background: #f2f4f7; border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--ink-3); }
.tone-green { background: var(--green); } .tone-amber { background: #f79009; } .tone-red { background: #f04438; }
.tone-blue { background: #2e90fa; } .tone-violet { background: #7a5af8; } .tone-neutral { background: var(--ink-3); }
.w-0{width:0}.w-5{width:5%}.w-10{width:10%}.w-15{width:15%}.w-20{width:20%}.w-25{width:25%}.w-30{width:30%}.w-35{width:35%}.w-40{width:40%}.w-45{width:45%}.w-50{width:50%}.w-55{width:55%}.w-60{width:60%}.w-65{width:65%}.w-70{width:70%}.w-75{width:75%}.w-80{width:80%}.w-85{width:85%}.w-90{width:90%}.w-95{width:95%}.w-100{width:100%}

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 8px 24px rgba(16,24,40,.06); }

/* responsive */
@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { flex-direction: row; overflow-x: auto; width: 100%; order: 3; }
  .nav-link span { white-space: nowrap; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .me { display: none; }
  .main { padding: 16px; }
  .grid, .activity-form .grid { grid-template-columns: 1fr; }
  .toolbar select { max-width: none; flex: 1 1 140px; }
  .page-head { flex-wrap: wrap; }
}
[dir=rtl] .search svg { left: auto; right: 10px; } [dir=rtl] .search input { padding-left: 10px; padding-right: 32px; }
