/* ============================================================
   旭彭运维云端 · v2.0 后台/代理端样式（深度适配版）
   修复：输入框/选择框/下拉统一规格、表格滚动、模态滚动、
   日期改为下拉组合（避开原生日期控件布局bug）、移动端适配
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: #f1f5f9; color: #0f172a; font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ 全局表单控件统一规格（核心修复） ============ */
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=url], input[type=tel], input[type=search], input[type=date], input[type=time],
select, textarea {
  font-family: inherit; font-size: 14px; color: #0f172a;
  line-height: 1.5; height: 38px; padding: 0 12px;
  border: 1px solid #cbd5e1; border-radius: 8px;
  background: #fff; outline: none;
  width: 100%; max-width: 100%;
  -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
select {
  padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 13px;
}
select:disabled, input:disabled { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; }
textarea { height: auto; min-height: 80px; padding: 9px 12px; resize: vertical; line-height: 1.65; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:focus, select:focus, textarea:focus {
  border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
input::placeholder, textarea::placeholder { color: #a8b3c5; }
input[type=checkbox], input[type=radio] {
  width: 16px; height: 16px; cursor: pointer; accent-color: #2563eb; vertical-align: -3px; margin-right: 6px;
}
/* 文件上传控件 */
input[type=file] {
  font-family: inherit; font-size: 13px; color: #475569;
  width: 100%; border: 1.5px dashed #cbd5e1; border-radius: 8px;
  padding: 9px 12px; background: #f8fafc; cursor: pointer;
}
input[type=file]:hover { border-color: #93c5fd; background: #eff6ff; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: linear-gradient(180deg, #0f2547 0%, #16305c 100%);
  color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { padding: 22px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand .logo { display: flex; align-items: center; gap: 10px; }
.brand .logo-mark {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px;
}
.brand .logo-name { color: #fff; font-size: 15px; font-weight: 600; line-height: 1.25; }
.brand .logo-sub { color: #64748b; font-size: 11px; margin-top: 3px; }
.nav { padding: 10px 8px; flex: 1; }
.nav-title { font-size: 11px; color: #475569; padding: 14px 12px 6px; letter-spacing: 1px; }
.nav a {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px;
  color: #cbd5e1; margin-bottom: 2px; font-size: 14px; text-decoration: none; transition: background .15s;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, #2563eb, #3b82f6); color: #fff; font-weight: 500; }
.nav a .nav-badge { margin-left: auto; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #64748b; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 40; gap: 12px;
}
.topbar .crumb { color: #64748b; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb b { color: #0f172a; font-weight: 600; }
.topbar .who { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topbar .who .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg,#3b82f6,#8b5cf6);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.content { padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ============ 卡片与统计 ============ */
.card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card h3 { font-size: 15px; margin-bottom: 14px; color: #0f172a; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; padding: 18px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.stat .num { font-size: 25px; font-weight: 700; color: #1e293b; margin-top: 4px; word-break: break-all; }
.stat .num.blue { color: #2563eb; } .stat .num.green { color: #059669; }
.stat .num.orange { color: #d97706; } .stat .num.red { color: #dc2626; }
.stat .label { color: #64748b; font-size: 13px; }
.stat .foot { margin-top: 8px; font-size: 12px; color: #94a3b8; }

/* ============ 表格（横向滚动，不挤压） ============ */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 12px; color: #64748b; font-weight: 500;
  border-bottom: 2px solid #e2e8f0; white-space: nowrap; background: #f8fafc;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.tbl tbody tr:hover { background: #f0f7ff; }
table.tbl td.actions { white-space: nowrap; }
table.tbl td.actions .btn, table.tbl td.actions form { margin-right: 4px; }
.mono { font-family: Consolas, Monaco, monospace; font-size: 12.5px; }
.ellipsis { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 表格内嵌小输入框（数量/机器码等） */
.tbl-input {
  width: 90px !important; height: 30px !important; padding: 0 8px !important;
  font-size: 12.5px !important; border-radius: 6px !important;
}
.tbl-input.wide { width: 170px !important; }

/* ============ 徽章 ============ */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; line-height: 20px; white-space: nowrap; }
.badge.green  { background: #d1fae5; color: #047857; }
.badge.blue   { background: #dbeafe; color: #1d4ed8; }
.badge.orange { background: #fef3c7; color: #b45309; }
.badge.red    { background: #fee2e2; color: #b91c1c; }
.badge.gray   { background: #e2e8f0; color: #475569; }
.badge.purple { background: #ede9fe; color: #6d28d9; }
/* 在线状态点 */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.dot.on { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.dot.off { background: #cbd5e1; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff;
  color: #334155; font-size: 13px; font-family: inherit; line-height: 1;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: all .15s;
}
.btn:hover { border-color: #94a3b8; background: #f8fafc; }
.btn-primary { background: linear-gradient(135deg,#2563eb,#3b82f6); border-color: transparent; color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg,#1d4ed8,#2563eb); border-color: transparent; }
.btn-danger { background: #fff; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #f87171; }
.btn-sm { height: 28px; padding: 0 11px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 42px; padding: 0 24px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* 表单内按钮占满 */
.field .btn-block { width: 100%; }

/* ============ 表单（网格自适应） ============ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.field { min-width: 0; }
.field label { display: block; font-size: 13px; color: #475569; margin-bottom: 6px; font-weight: 500; }
.field label .req { color: #dc2626; margin-left: 2px; }
.field .hint { font-size: 12px; color: #94a3b8; margin-top: 4px; line-height: 1.5; }
.field textarea { width: 100%; }
.inline-check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #334155; padding: 9px 0; cursor: pointer; }
.inline-check input { margin: 0; }

/* ============ 日期时间下拉组合（替代 datetime-local，规避布局bug） ============ */
.dt-selects { display: flex; gap: 6px; flex-wrap: wrap; }
.dt-selects select { flex: 1; min-width: 62px; height: 36px; padding: 0 6px; font-size: 13px; }
.dt-selects select:first-child { flex: 1.4; min-width: 78px; }
.dt-selects .dt-sep { display: flex; align-items: center; color: #94a3b8; font-size: 13px; }
.dt-current { font-size: 12px; color: #2563eb; margin-top: 5px; }

/* ============ 搜索栏 ============ */
.searchbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.searchbar input, .searchbar select {
  height: 36px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 13px; font-family: inherit; outline: none; width: auto; min-width: 0;
}
.searchbar input { width: 200px; }
.searchbar input:focus, .searchbar select:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.searchbar .btn { height: 36px; }
.searchbar .hint-txt { color: #94a3b8; font-size: 12px; }

/* ============ 分页 ============ */
.pager { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 6px 12px; border-radius: 6px; border: 1px solid #e2e8f0; background: #fff;
  font-size: 13px; color: #334155; line-height: 1.4;
}
.pager a:hover { border-color: #93c5fd; color: #2563eb; text-decoration: none; }
.pager .cur { background: #2563eb; color: #fff; border-color: transparent; }

/* ============ 提示条 ============ */
.notice { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; line-height: 1.7; word-break: break-all; }
.notice.ok { background: #d1fae5; color: #065f46; }
.notice.err { background: #fee2e2; color: #991b1b; }
.notice.info { background: #dbeafe; color: #1e40af; }

/* ============ 模态框（可滚动，内容超高不再溢出） ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 580px; padding: 24px; box-shadow: 0 20px 60px rgba(15,23,42,.25); margin: auto; }
.modal h3 { font-size: 16px; margin-bottom: 18px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f2547 0%, #1e3a8a 55%, #312e81 100%); padding: 20px;
}
.login-box { background: #fff; border-radius: 16px; padding: 38px 36px; width: 100%; max-width: 400px; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.login-box .lg-mark {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 26px; font-weight: 700;
}
.login-box h2 { text-align: center; font-size: 19px; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: #94a3b8; font-size: 13px; margin-bottom: 24px; }
.login-box .field { margin-bottom: 14px; }
.login-box .btn-primary { width: 100%; height: 44px; font-size: 15px; margin-top: 6px; }
.login-foot { text-align: center; color: #64748b; font-size: 12px; margin-top: 18px; line-height: 1.9; }

/* ============ 空状态 / 上传区 ============ */
.empty { text-align: center; color: #94a3b8; padding: 40px 0; font-size: 13px; }
.upload-zone { border: 2px dashed #cbd5e1; border-radius: 12px; padding: 26px 20px; text-align: center; background: #f8fafc; transition: all .15s; }
.upload-zone:hover { border-color: #93c5fd; background: #eff6ff; }
.upload-zone .uz-ico { font-size: 34px; margin-bottom: 8px; }
.upload-zone .uz-main { font-size: 14px; color: #334155; font-weight: 600; }
.upload-zone .uz-sub { font-size: 12.5px; color: #94a3b8; margin-top: 5px; line-height: 1.7; }

/* ============ 响应式 ============ */
@media (max-width: 1000px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { border-bottom: none; padding: 12px 16px; flex-shrink: 0; }
  .nav { display: flex; flex-wrap: wrap; padding: 6px; flex: 1; }
  .nav-title { display: none; }
  .nav a { margin-bottom: 0; }
  .sidebar-foot { display: none; }
  .content { padding: 16px 12px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .topbar .crumb { font-size: 12px; }
  .searchbar input { width: 100%; }
  .searchbar .btn { flex: 1; }
  .searchbar { gap: 8px; }
  .modal-mask { padding: 20px 10px; }
  .modal { padding: 18px 14px; }
  .dt-selects select { min-width: 52px; }
  .tbl-input { width: 72px !important; }
  .card { padding: 14px; }
  .ellipsis { max-width: 130px; }
}
