/* ListHub：方案二外壳。组件、颜色、字号、圆角全部来自 /_ui/ui-kit.css 的 --uk-* 变量，
   这里只放 ListHub 自己的排布（lh- 前缀）。本文件不在 cascade layer 里，总是覆盖 kit。 */

.hidden { display: none !important; }
[hidden] { display: none !important; }

.lh-muted { color: var(--uk-ink-2); }
.lh-faint { color: var(--uk-ink-3); }
.lh-warn { color: var(--uk-orange); }
.lh-bad { color: var(--uk-red); }

/* ---------- 登录（对照 /opt/wux-portal/login.html） ---------- */
.lh-login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--uk-bg); }
.lh-login-card {
  width: 100%; max-width: 380px; background: var(--uk-surface); border-radius: var(--uk-r-sheet); padding: 32px 28px 28px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .07);
}
.lh-login-mark { width: 44px; height: 44px; margin-bottom: 18px; background: var(--uk-c-list); }
.lh-login-mark .uk-icon { width: 20px; height: 20px; }
.lh-login-card h1 { font-size: var(--uk-fs-title); font-weight: 700; margin: 0 0 4px; letter-spacing: 0; }
.lh-login-sub { color: var(--uk-ink-2); font-size: 13px; margin: 0 0 24px; }
.lh-login-form { display: grid; gap: 14px; }
.lh-login-field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--uk-ink); }
.lh-login-field .uk-input { width: 100%; height: 40px; font-size: 15px; padding-right: 44px; }
.lh-login-pw { position: relative; }
.lh-login-toggle {
  position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border-radius: 16px; border: 0; background: transparent;
  color: var(--uk-ink-3); display: grid; place-items: center; cursor: pointer;
}
.lh-login-toggle:hover { background: var(--uk-fill); color: var(--uk-ink); }
.lh-login-submit { width: 100%; height: 40px; border-radius: 20px; font-size: 15px; margin-top: 4px; }
.lh-login-error {
  margin: 0 0 16px; padding: 10px 12px; font-size: 13px; border-radius: var(--uk-r-row);
  background: var(--uk-red-soft); color: var(--uk-red);
}

/* ---------- 外壳 ---------- */
.lh-mark { background: var(--uk-c-list); }
.lh-side .uk-find input::-webkit-search-cancel-button { cursor: pointer; }
.lh-logout { color: var(--uk-ink-2); }
.lh-sheet { flex-direction: column; }
.lh-main { min-width: 0; }
.lh-mobile-bar { display: none; }

/* 页头：状态分段控件放不下时自己横向滚，不撑破页面 */
.uk-page-actions .uk-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
/* 分段可横向滚动：触屏放大的点击区不能把它撑出纵向滚动 */
.uk-page-actions .uk-seg > *::after { height: 100%; }
.uk-page-actions .uk-seg::-webkit-scrollbar { display: none; }
.uk-seg > * { flex: none; }
.lh-status-select { display: none; }
.uk-page-head h1 { overflow-wrap: anywhere; }

/* ---------- 分组列表 ---------- */
.lh-groups { display: grid; gap: 18px; container-type: inline-size; min-width: 0; }
.lh-group { min-width: 0; }
.lh-group-head { align-items: center; min-width: 0; }
.lh-group-head > span:not(.lh-substatus):not(.lh-group-tags) { min-width: 0; }
.lh-group-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }

/* 网段状态：组头上的小胶囊选择框 */
.lh-substatus {
  position: relative; margin-left: auto; flex: none; display: inline-flex; align-items: center;
  height: 24px; border-radius: 12px; background: var(--uk-gray-soft); color: var(--uk-ink-2);
}
.lh-substatus select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; cursor: pointer;
  height: 24px; padding: 0 24px 0 10px; border-radius: 12px; font-size: var(--uk-fs-small); font-weight: 600;
}
.lh-substatus .uk-icon { position: absolute; right: 7px; width: 12px; height: 12px; pointer-events: none; }
.lh-substatus.st-selling { background: var(--uk-green-soft); color: var(--uk-green); }
.lh-substatus.st-idle { background: var(--uk-blue-soft); color: var(--uk-blue); }
.lh-substatus.st-unsubscribed { background: var(--uk-red-soft); color: var(--uk-red); }

/* 一行：名称 | 状态 | 客户 | 到期 | 箭头（原稿 150 / 92 / 1fr / 130 / 16） */
.lh-row {
  display: grid; grid-template-columns: minmax(0, 300px) 92px minmax(0, 1fr) 130px 17px;
  align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
}
.lh-row > .uk-icon:last-child { margin-left: 0; }
.lh-c-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.lh-c-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.lh-c-name small { font-size: 12px; color: var(--uk-ink-3); flex: none; }
.lh-c-name > b { flex: none; }
/* 配置标签（表名 :端口 主/备）：跟在网段后面是弱信息；子行里单独出现并缩进 */
.lh-profile { display: inline-flex; align-items: baseline; gap: 4px; min-width: 0; overflow: hidden; color: var(--uk-ink-3); font-size: 12.5px; }
.lh-profile-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lh-profile-port { flex: none; }
.lh-c-name.is-sub { padding-left: 18px; }
.lh-c-name.is-sub .lh-profile { color: var(--uk-ink-2); font-size: 13px; }
.lh-flag-ctl { display: inline-flex; align-items: center; gap: 6px; }
.lh-flag-ctl .lh-substatus { margin-left: 0; }
.lh-role {
  flex: none; align-self: center; font-size: 11px; font-weight: 600; line-height: 18px; padding: 0 6px;
  border-radius: 9px; background: var(--uk-gray-soft); color: var(--uk-ink-2);
}
.lh-c-status { display: flex; }
.lh-c-cust { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lh-cust-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-c-exp { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-chev { color: var(--uk-ink-3); max-width: 17px; }
/* kit 窄屏规则给 .uk-glist-row > * 设了 width:auto !important（层内 !important 压不过），
   SVG 会退回默认 300px 宽，所以用 max-width 卡住 */
.uk-glist-row.is-selected { background: var(--uk-blue-soft); }
.uk-glist-row.is-selected, .uk-glist-row.is-selected + .uk-glist-row { border-top-color: transparent; }
.uk-glist-row.is-clickable.is-selected:hover { background: var(--uk-blue-soft); }

@container (max-width: 620px) {
  .lh-row {
    grid-template-columns: minmax(0, 1fr) auto 17px;
    grid-template-areas: "name status chev" "cust exp chev";
    row-gap: 2px; padding: 8px 12px;
  }
  .lh-c-name { grid-area: name; }
  .lh-c-status { grid-area: status; justify-content: flex-end; }
  .lh-c-cust { grid-area: cust; font-size: 13px; }
  .lh-subrow .lh-c-cust { padding-left: 18px; }
  .lh-c-exp { grid-area: exp; font-size: 13px; text-align: right; }
  .lh-chev { grid-area: chev; }
  .lh-group-head:has(.lh-group-tags) { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .lh-group-head > b { grid-column: 1; }
  .lh-group-head > .lh-substatus, .lh-group-head > .lh-group-tags { grid-column: 2; grid-row: 1; }
  .lh-group-head > span:not(.lh-substatus):not(.lh-group-tags) { grid-column: 1 / -1; }
  .lh-finding { flex-wrap: wrap; row-gap: 2px; padding-block: 8px; }
  .lh-finding-what { order: 3; flex-basis: 100%; }
}

/* 体检行 */
.lh-finding { gap: 12px; }
.lh-finding-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; }
.lh-finding-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.lh-finding-name small { font-size: 12px; color: var(--uk-ink-3); }
.lh-finding-what { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.lh-row-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.lh-row-tools .uk-btn { height: 30px; padding: 0 12px; font-size: 13px; }

/* ---------- 详情 ---------- */
.lh-detail { display: flex; flex-direction: column; gap: 18px; container-type: inline-size; min-width: 0; }
.lh-back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 2px; height: 28px; margin: -6px 0 -10px -6px; padding: 0 8px 0 2px;
  border: 0; border-radius: 14px; background: transparent; color: var(--uk-blue); font-weight: 500; cursor: pointer;
}
.lh-back:hover { background: var(--uk-blue-soft); }
.lh-back-icon { transform: rotate(180deg); }
.lh-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: -6px; font-size: var(--uk-fs-small); }
.lh-detail-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.lh-detail-col { display: grid; gap: 22px; min-width: 0; }
.lh-detail-sec { min-width: 0; }
@container (max-width: 760px) {
  .lh-detail-cols { grid-template-columns: minmax(0, 1fr); }
}

.lh-form { background: var(--uk-sub); border-radius: var(--uk-r-card); padding: 2px 14px; }
.lh-field { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 50px; padding: 7px 0; }
.lh-field + .lh-field { border-top: 1px solid var(--uk-sep); }
.lh-field label { color: var(--uk-ink-2); font-size: 13.5px; }
.lh-field .uk-input, .lh-field .uk-select, .lh-field .uk-textarea { width: 100%; min-width: 0; }
.lh-field .uk-textarea { resize: vertical; line-height: 1.5; }
.lh-field:has(textarea) { align-items: start; }
.lh-field:has(textarea) label { padding-top: 8px; }

.lh-lines {
  background: var(--uk-sub); border-radius: var(--uk-r-card); max-height: 62vh; overflow: auto; padding: 10px 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.7;
}
.lh-line { display: flex; padding: 0 14px; white-space: pre; width: max-content; min-width: 100%; }
.lh-line:hover { background: var(--uk-fill); }
.lh-pw { border: 0; background: none; padding: 0; font: inherit; color: var(--uk-ink-3); cursor: pointer; }
.lh-pw.is-shown { color: var(--uk-ink); }

.lh-deliveries .uk-glist-row { gap: 10px; }
.lh-delivery-who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-new-delivery {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; padding-block: 8px;
}
.lh-new-delivery > .uk-input:first-child { grid-column: 1 / -1; }
.lh-new-delivery .uk-input { width: 100%; min-width: 0; }
@container (max-width: 520px) {
  .lh-new-delivery { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lh-new-delivery > .uk-btn { grid-column: 1 / -1; }
  .lh-deliveries .uk-glist-row { flex-wrap: wrap; padding-block: 8px; }
}

/* ---------- 对话框、提示 ---------- */
.lh-dialog-body { display: grid; gap: 8px; color: var(--uk-ink-2); }
.lh-dialog-body p { margin: 0; }
.lh-dialog-list { margin: 2px 0; color: var(--uk-ink); }
.lh-dialog-list .uk-glist-row { gap: 10px; min-height: 38px; font-size: 13.5px; }
.uk-empty .uk-btn { margin-top: 6px; }

/* ---------- 窄屏：<768px 导航单独一屏，和 MailHub 一致 ---------- */
@media (max-width: 767px) {
  .lh-shell { flex-direction: column; padding: 0; }
  .lh-shell .lh-side { display: none; position: static; width: 100%; height: auto; min-height: 100vh; padding: 16px; overflow: visible; }
  .lh-shell[data-pane="sidebar"] .lh-side { display: flex; }
  .lh-shell[data-pane="sidebar"] .lh-sheet { display: none; }
  .lh-sheet { border-radius: 0; min-height: 100vh; box-shadow: none; }
  .lh-mobile-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px 0; }
  .lh-mobile-find { flex: 1; min-width: 0; background: var(--uk-fill); box-shadow: none; }
  .is-detail .lh-mobile-find { visibility: hidden; }
  .lh-main { padding: 14px 16px 24px; }
  .lh-row-tools .uk-btn { padding: 0 10px; }
  /* 页头：标题和「立即同步」一行，状态分段单独一行 */
  .uk-page-head > .uk-page-actions { display: contents; }
  .uk-page-head #sync-btn { margin-left: auto; }
  /* 手机上状态筛选换成下拉框（分段按钮一行放不下） */
  .uk-page-head .uk-seg { display: none; }
  .uk-page-head .lh-status-select { display: block; order: 10; flex: 1 1 100%; min-width: 0; }
  #page-detail .uk-page-head > .uk-page-actions { display: flex; flex: 1 1 100%; margin-left: 0; }
}
