/* user.css — 用户门户专属视觉：在管理端样式之上换一套青绿色主色，
   让两套后台在视觉上一眼可辨，避免误操作。必须在 styles.css 之后引入。 */
:root {
  /* 对比度校正：白字按钮/正文强调 ≥4.5:1（WCAG AA） */
  --primary: #0f766e;
  --secondary: #115e59;
  --accent: #2dd4bf;
  --sidebar-w: 228px;
}
[data-theme="dark"] {
  --primary: #0f766e;
  --secondary: #115e59;
  --accent: #5eead4;
}

.sidebar { background: linear-gradient(180deg, var(--secondary), #062f2b); }
.sidebar-link.active { box-shadow: 0 6px 16px rgba(45, 212, 191, .35); }
.stat .value { color: var(--primary); }

/* 顶部横幅：明确标注这是「个人中心」，不是管理后台 */
.portal-banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; margin-bottom: 18px;
  border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 15%, transparent), transparent 70%);
  font-size: 14px; line-height: 1.6;
}
.portal-banner i { font-size: 20px; color: var(--primary); }

.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-avatar {
  width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; font-size: 26px; font-weight: 800;
}
.profile-name { font-size: 20px; font-weight: 800; }
.profile-meta { color: var(--text-soft); font-size: 13px; margin-top: 3px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.info-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.info-item .k { font-size: 12px; color: var(--text-soft); margin-bottom: 4px; }
.info-item .v { font-size: 15px; font-weight: 700; word-break: break-all; }

.readonly-hint { font-size: 12px; color: var(--text-soft); margin-top: 10px; }
.announce { border-left: 3px solid var(--primary); padding-left: 12px; }

/* 首页公告列表（用户登录页，V1.58：多条启用项按序展示） */
.announce-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.announce-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px;
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; line-height: 1.6; color: var(--text);
}
.announce-item i { color: var(--primary); margin-top: 3px; flex: 0 0 auto; font-size: 12px; }

/* ============================================================
   认证页（登录 / 注册 / 找回密码）· 参考彩虹聚合登录的卡片居中风格
   ============================================================ */

/* 认证卡片加宽，容纳多字段注册表单 */
.auth-card.auth-wide { width: min(460px, 100%); }

/* 标题区居中（logo + 大标题 + 副标题） */
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head .auth-brand { justify-content: center; margin-bottom: 14px; }
.auth-head .auth-title { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.auth-head .auth-sub { margin-bottom: 0; text-align: center; }

/* 带左侧图标的输入框（参考 input-group + auth-form-icon） */
/* 关键：图标定位在 .auth-input-group（仅包住输入框）内，避免因 .auth-field
   同时包含文字标签而把图标拉伸错位到整行（标签+输入框）的高度 */
.auth-input-group { position: relative; display: block; }
.auth-field .auth-icon {
  position: absolute; left: 1px; top: 1px; bottom: 1px; width: 42px;
  display: grid; place-items: center; color: var(--text-soft);
  border-right: 1px solid var(--border); pointer-events: none; font-size: 15px;
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  border-top-left-radius: 9px; border-bottom-left-radius: 9px;
}
.auth-field .input-field { padding-left: 54px; height: 46px; }

/* 渐变圆角全宽按钮（渐变两端白字对比度均 ≥4.5:1） */
.btn-gradient {
  width: 100%; justify-content: center; padding: 13px; border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff;
  font-size: 15px; font-weight: 700; border: none; box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 35%, transparent);
  transition: all .2s ease;
}
.btn-gradient:hover { filter: brightness(1.06); box-shadow: 0 10px 26px color-mix(in srgb, var(--primary) 45%, transparent); transform: translateY(-1px); }
.btn-gradient:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* 记住我 + 找回密码 一行 */
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 6px; font-size: 13px; }
.auth-row label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); cursor: pointer; }
.auth-row label input { accent-color: var(--primary); width: 17px; height: 17px; margin-right: 2px; }
.auth-row a { color: var(--primary); font-weight: 600; }
.auth-row a:hover { text-decoration: underline; }

/* 底部跳转链接（参考 m-3 text-center） */
.auth-foot { margin-top: 20px; text-align: center; font-size: 13px; color: var(--text-soft); }
.auth-foot a { color: var(--primary); font-weight: 600; }

/* 验证码行：输入框 + 获取验证码按钮 */
.code-row { display: flex; gap: 10px; }
.code-row .input-field { flex: 1; }
.code-btn {
  flex: 0 0 auto; white-space: nowrap; padding: 0 16px; height: 46px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 13px; font-weight: 600; transition: all .18s;
}
.code-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--primary); }
.code-btn:disabled { opacity: .55; cursor: not-allowed; }

/* 协议勾选 */
.auth-agree { font-size: 13px; color: var(--text-soft); display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 8px; }
.auth-agree input { margin-top: 2px; accent-color: var(--primary); }
.auth-agree a { color: var(--primary); font-weight: 600; }

/* 响应式：移动端窄屏收紧内边距 */
@media (max-width: 480px) {
  .auth-card { padding: 24px 20px; }
  .auth-card.auth-wide { padding: 24px 18px; }
  .auth-page { padding: 16px; }
}

/* ============================================================
   认证页顶部入口导航条（数据面板 / 用户端 / 管理端）
   ============================================================ */
.auth-nav {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.auth-nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; color: var(--text); }
.auth-nav-brand .logo {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; font-size: 15px;
}
.auth-nav-spacer { flex: 1; }
.auth-nav-links { display: flex; gap: 4px; }
.auth-nav-links a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--text-soft); transition: all .18s; white-space: nowrap;
}
.auth-nav-links a:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.auth-nav-links a.active { color: #fff; background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent); }
.auth-nav-links a i { width: 14px; text-align: center; }
.auth-nav .icon-btn { flex: 0 0 auto; }

/* 移动端：导航条换行 */
@media (max-width: 560px) {
  .auth-nav { flex-wrap: wrap; padding: 9px 14px; }
  .auth-nav-spacer { display: none; }
  .auth-nav-links { order: 3; width: 100%; justify-content: space-between; }
  .auth-nav-links a { flex: 1; justify-content: center; padding: 7px 6px; font-size: 12px; }
}

/* ============================================================
   表单实时校验提示（注册页手机号 / 邮箱）
   ============================================================ */
.field-hint { display: none; font-size: 12px; line-height: 1.5; margin-top: 5px; }
.field-hint.error { display: block; color: var(--danger-text); }
.field-hint.ok { display: block; color: var(--success); }
.field-hint i { margin-right: 4px; }
.input-field.input-error { border-color: var(--danger); }
.input-field.input-error:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.input-field.input-ok { border-color: var(--success); }
.input-field.input-ok:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }

/* ============================================================
   V1.61：置顶公告横幅 / 数据看板 / 登录记录设备安全
   ============================================================ */
.top-announce { display: flex; align-items: flex-start; gap: 10px; margin: 14px 20px 0; padding: 12px 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: var(--radius-md);
  font-size: 14px; line-height: 1.6; }
.top-announce > i { color: var(--accent); margin-top: 3px; }
.top-announce-text { flex: 1; }
.top-announce-close { background: none; border: 0; color: var(--text-soft); font-size: 20px; line-height: 1;
  cursor: pointer; padding: 2px 6px; min-height: 32px; min-width: 32px; border-radius: 8px; }
.top-announce-close:hover { color: var(--text); background: var(--surface-2); }

.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); }
.dash-card-label { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.dash-card-value { font-size: 30px; font-weight: 800; margin-top: 6px; color: var(--primary);
  font-variant-numeric: tabular-nums; line-height: 1.15; }
.dash-card-sub { font-size: 12px; color: var(--text-soft); margin-top: 6px; }
.dash-charts { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; }
.dash-chart { padding: 16px; }
.dash-chart-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.dash-chart-title i { color: var(--accent); }
.chart-box { width: 100%; height: 300px; }
.section-sub { font-size: 12px; font-weight: 500; color: var(--text-soft); margin-left: 6px; }

.ua-detail { display: block; font-size: 11px; color: var(--text-soft); margin-top: 2px; word-break: break-all; }
.logout-all-bar { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.logout-all-bar > i { font-size: 20px; color: var(--danger); }
.logout-all-bar > div { flex: 1; }
.logout-all-title { font-weight: 700; font-size: 14px; }
.logout-all-desc { font-size: 12px; color: var(--text-soft); margin-top: 3px; line-height: 1.5; }

@media (max-width: 768px) {
  .dash-charts { grid-template-columns: 1fr; }
  .chart-box { height: 240px; }
  .logout-all-bar { flex-wrap: wrap; }
  .logout-all-bar .btn { width: 100%; }
  .top-announce { margin: 10px 12px 0; }
}

/* ============================================================
   V1.63：未读消息角标 / 我的消息列表
   ============================================================ */
.nav-badge { display: inline-block; margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.sidebar-link .nav-badge { margin-left: auto; }
.msg-list { display: flex; flex-direction: column; gap: 10px; }
.msg-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.msg-item:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.msg-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.msg-item.unread { border-left: 3px solid var(--accent); }
.msg-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg-title { font-weight: 700; font-size: 14px; }
.msg-unread-badge { padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent); font-size: 11px; font-weight: 700; }
.msg-time { margin-left: auto; font-size: 12px; color: var(--text-soft); }
.msg-body { margin-top: 8px; font-size: 13px; line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }

/* ============================================================
   V1.64：安全设置 / 双因子认证 / 登录两步验证
   ============================================================ */
.sec-cards { display: flex; flex-direction: column; gap: 14px; }
.sec-card-head { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.sec-card-head i { color: var(--accent); }
.sec-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.totp-secret-box { padding: 12px 14px; border: 1px dashed var(--border); border-radius: 10px;
  background: var(--surface-2); margin-bottom: 14px; }
.totp-secret-label { font-size: 12px; color: var(--text-soft); margin-bottom: 6px; }
.totp-secret { font-family: ui-monospace, Consolas, monospace; font-size: 19px; font-weight: 700;
  letter-spacing: .14em; color: var(--primary); overflow-wrap: anywhere; user-select: all; }
.totp-secret-hint { font-size: 12px; color: var(--text-soft); margin-top: 6px; line-height: 1.6; }
.totp-step { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.totp-input { letter-spacing: .4em; font-size: 18px; text-align: center; font-family: ui-monospace, Consolas, monospace; }

/* ============================================================
   V1.65：移动端台账卡片视图（≤768px 表格转卡片）
   ============================================================ */
@media (max-width: 768px) {
  .card-table { min-width: 0 !important; }
  .card-table thead { display: none; }
  .card-table, .card-table tbody, .card-table tr, .card-table td { display: block; width: 100%; }
  .card-table tr { margin-bottom: 12px; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
  .card-table tr:hover { border-color: var(--accent); }
  .card-table td { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
    padding: 7px 0; border: none; text-align: right; overflow-wrap: anywhere; }
  .card-table td::before { content: attr(data-label); font-weight: 700; color: var(--text-soft);
    text-align: left; flex: 0 0 38%; }
  .card-table td[data-label="操作"] { justify-content: flex-end; border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 10px; }
  .card-table td[data-label="操作"]::before { content: none; }
}

/* ============================================================
   V1.70：数据草稿
   ============================================================ */
.draft-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--surface); }
.draft-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.draft-item-title { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.draft-item-time { margin-left: auto; font-size: 12px; color: var(--text-soft); }
.draft-item-note { margin-top: 6px; font-size: 12px; color: var(--text-soft); border-top: 1px dashed var(--border); padding-top: 6px; }

/* ============================================================
   V1.73：工程日报 · 钢板产值式批量明细编辑器
   ============================================================ */
.report-tbl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 16px 0 8px; flex-wrap: wrap; }
.rth-title { font-size: 13px; font-weight: 700; color: var(--text); }
.report-table-wrap { max-height: 520px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.report-table-wrap table { min-width: 1500px; }
.report-table-wrap .tbl { font-size: 13px; }
.report-table-wrap .tbl th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); white-space: nowrap; }
.report-table-wrap .tbl td { vertical-align: top; }
.rp-seq { text-align: center; font-weight: 700; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.rp-date-cell { white-space: nowrap; font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.rp-cell-box { display: flex; flex-direction: column; gap: 5px; width: 100%; min-width: 0; }
.rp-input { width: 100%; padding: 7px 9px; font-size: 14px; line-height: 1.3; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); }
.rp-input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); border-color: var(--accent); }
.rp-num { text-align: right; font-variant-numeric: tabular-nums; }
.rp-del { min-width: 36px; color: var(--danger-text, #dc2626); }
.report-total-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; margin-top: 10px;
  padding: 10px 14px; border-radius: 10px; font-weight: 700; font-size: 13px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); }
.report-total-row .rt-item { font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-total-row .rt-label { color: var(--text-soft); font-weight: 600; margin-right: 4px; }
.report-submit-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.report-submit-hint { font-size: 12px; color: var(--text-soft); }
.rp-batch { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.rp-batch-count { font-size: 12px; padding: 2px 9px; border-radius: 999px; font-weight: 700; color: var(--primary);
  background: color-mix(in srgb, var(--accent) 14%, transparent); }
.rp-batch-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.rp-batch-detail { margin-top: 8px; }
.rp-mini { max-height: 320px; overflow: auto; }
.rp-mini table { min-width: 980px; font-size: 12px; }
.rp-mini th, .rp-mini td { padding: 5px 8px; white-space: nowrap; }

/* ============================================================
   V1.74：当前工程切换器 / 常用数据（类目）管理
   ============================================================ */
.project-switch { display: flex; align-items: center; gap: 8px; margin-right: 12px; }
.project-switch > i { color: var(--accent); }
.project-switch .input-field { width: auto; min-width: 180px; max-width: 260px; font-size: 13px; padding: 7px 10px; }
.dict-cards, #dict-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.dict-card .section-title { display: flex; align-items: center; gap: 8px; }
.dict-count { font-size: 11px; font-weight: 600; color: var(--text-soft); padding: 1px 8px;
  border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.dict-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.dict-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 999px;
  background: var(--surface-2); font-size: 13px; font-weight: 600; }
.dict-chip-del { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0;
  border-radius: 50%; background: transparent; color: var(--text-soft); cursor: pointer; font-size: 13px; }
.dict-chip-del:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-text, #dc2626); }
.dict-empty { font-size: 12px; color: var(--text-soft); padding: 4px; }
.dict-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.dict-add-input { flex: 1; min-width: 140px; }
.dict-batch { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 768px) {
  .project-switch { order: 10; width: 100%; margin: 6px 0 0; }
  .project-switch .input-field { flex: 1; min-width: 0; max-width: none; }
  .dict-cards, #dict-cards { grid-template-columns: 1fr; }
}

/* ≤768px：编辑表格转卡片（data-label 由 ::before 消费），输入控件在卡片内可达 */
@media (max-width: 768px) {
  .report-table-wrap { max-height: none; overflow: visible; border: none; }
  .report-table-wrap table { min-width: 0 !important; }
  .report-table-wrap .tbl thead { display: none; }
  .report-table-wrap .tbl, .report-table-wrap .tbl tbody, .report-table-wrap .tbl tr { display: block; width: 100%; }
  .report-table-wrap .tbl tr { margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
  .report-table-wrap .tbl td { display: flex; justify-content: space-between; align-items: flex-start;
    gap: 10px; padding: 6px 0; border: none; text-align: right; }
  .report-table-wrap .tbl td::before { content: attr(data-label); font-weight: 700; color: var(--text-soft);
    text-align: left; flex: 0 0 34%; font-size: 12px; padding-top: 8px; }
  .report-table-wrap .tbl td .rp-cell-box { flex: 1; }
  .report-table-wrap .tbl td[data-label="操作"] { justify-content: flex-end; }
  .report-table-wrap .tbl td[data-label="操作"]::before { content: none; }
  .rp-input { font-size: 16px; } /* 移动端 ≥16px 防 iOS 聚焦缩放 */
  .rp-date-cell { padding-top: 8px; }
}
