/* ============================================================
   iMT 全功能管理平台 — 深色科技主题
   参考同行界面配色：深空蓝紫 + 霓虹青 + 高对比卡片
   ============================================================ */

:root {
  --bg-0: #0a0e1a;
  --bg-1: #10152a;
  --bg-2: #161c34;
  --bg-3: #1e2542;
  --card: rgba(30, 37, 66, .72);
  --card-solid: #1a2140;
  --border: rgba(90, 120, 200, .18);
  --border-lit: rgba(90, 160, 255, .35);

  --txt-0: #eef2fb;
  --txt-1: #a8b3d4;
  --txt-2: #6b7799;

  --acc: #38bdf8;
  --acc2: #6366f1;
  --acc-glow: rgba(56, 189, 248, .35);
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --gold: #fbbf24;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 32px rgba(0, 0, 0, .45);
  --shadow-lit: 0 0 0 1px rgba(90, 160, 255, .25), 0 8px 32px rgba(0, 0, 0, .5);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-0);
  color: var(--txt-0);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(120, 140, 200, .25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(120, 140, 200, .45); }

a { color: var(--acc); text-decoration: none; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

/* ==================== 布局 ==================== */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 218px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform .25s;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--acc) 0%, var(--acc2) 100%);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff;
  box-shadow: 0 0 20px var(--acc-glow);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-text strong { font-size: 14px; letter-spacing: .3px; }
.brand-text span { font-size: 11px; color: var(--txt-2); }

.nav { flex: 1; overflow-y: auto; padding: 10px 9px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  color: var(--txt-1);
  font-size: 13.5px;
  transition: all .16s;
  position: relative;
}
.nav-item:hover { background: rgba(90, 130, 220, .1); color: var(--txt-0); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(56, 189, 248, .18), rgba(99, 102, 241, .08));
  color: #fff;
  font-weight: 600;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0;
  background: var(--acc); box-shadow: 0 0 10px var(--acc);
}
.nav-icon { width: 17px; text-align: center; font-size: 14px; opacity: .85; }

.sidebar-foot {
  padding: 13px 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  display: flex; flex-direction: column; gap: 7px;
}
.foot-status { display: flex; align-items: center; gap: 7px; color: var(--txt-1); }
.foot-text { font-size: 12px; }
.foot-meta { color: var(--txt-2); font-size: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-on { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 2s infinite; }
.dot-off { background: var(--txt-2); }
.dot-warn { background: var(--warn); }
.dot-err { background: var(--err); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .4 } }

.btn-logout {
  display: block; text-align: center;
  padding: 7px; border-radius: 7px;
  background: rgba(239, 68, 68, .1);
  color: #fca5a5; font-size: 12px;
  border: 1px solid rgba(239, 68, 68, .2);
  transition: all .16s;
}
.btn-logout:hover { background: rgba(239, 68, 68, .2); color: #fff; }

/* ==================== 主区 ==================== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  height: 58px; flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: rgba(16, 21, 42, .8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.burger { display: none; background: none; border: none; color: var(--txt-0); font-size: 20px; cursor: pointer; }
.page-title { font-size: 16px; font-weight: 600; letter-spacing: .3px; flex: 1; }

.topbar-right { display: flex; align-items: center; gap: 13px; }
.run-badge {
  font-size: 12px; color: var(--txt-1);
  padding: 5px 11px; border-radius: 20px;
  background: rgba(56, 189, 248, .1);
  border: 1px solid rgba(56, 189, 248, .22);
}
.run-badge b { color: var(--acc); }
.clock {
  font-family: ui-monospace, monospace;
  font-size: 13px; color: var(--txt-1);
  padding: 5px 10px; border-radius: 7px;
  background: rgba(255, 255, 255, .04);
}
.user-chip { cursor: default; }
.avatar {
  width: 31px; height: 31px; border-radius: 50%;
  background: linear-gradient(135deg, var(--acc2), var(--acc));
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff;
}

.content { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }

/* ==================== 卡片 ==================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 19px;
  backdrop-filter: blur(10px);
  margin-bottom: 15px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-title { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title::before {
  content: ''; width: 3px; height: 15px; border-radius: 2px;
  background: linear-gradient(180deg, var(--acc), var(--acc2));
}
.card-sub { font-size: 12px; color: var(--txt-2); }

/* ==================== 统计卡 ==================== */
.stats-grid {
  display: grid; gap: 13px;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 17px;
  position: relative; overflow: hidden;
  transition: all .2s;
}
.stat:hover { border-color: var(--border-lit); transform: translateY(-2px); }
.stat::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--acc), var(--acc2));
  opacity: .7;
}
.stat-label { font-size: 12px; color: var(--txt-2); margin-bottom: 8px; }
.stat-value {
  font-size: 26px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #fff, var(--acc));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-value.gold { background: linear-gradient(135deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-value.ok { background: linear-gradient(135deg, #fff, var(--ok)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all .16s; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  color: #fff; box-shadow: 0 4px 14px rgba(56, 189, 248, .3);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(56, 189, 248, .45); transform: translateY(-1px); }
.btn-ghost { background: rgba(255, 255, 255, .05); color: var(--txt-1); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .1); color: var(--txt-0); }
.btn-ok { background: rgba(34, 197, 94, .16); color: #86efac; border-color: rgba(34, 197, 94, .3); }
.btn-ok:hover:not(:disabled) { background: rgba(34, 197, 94, .28); }
.btn-danger { background: rgba(239, 68, 68, .14); color: #fca5a5; border-color: rgba(239, 68, 68, .3); }
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, .26); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; padding: 11px; font-size: 14.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==================== 表单 ==================== */
.field { display: block; margin-bottom: 13px; }
.field-label { display: block; font-size: 12.5px; color: var(--txt-1); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=search],
select, textarea {
  width: 100%; padding: 9px 12px;
  background: rgba(10, 14, 26, .7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--txt-0); font-size: 13.5px; font-family: inherit;
  transition: all .16s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .12);
}
input::placeholder, textarea::placeholder { color: var(--txt-2); }
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
select { cursor: pointer; }
select option { background: var(--bg-2); color: var(--txt-0); }

.form-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-grid .span2 { grid-column: span 2; }

/* ==================== 表格 ==================== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 12px;
  background: rgba(10, 14, 26, .6);
  color: var(--txt-2); font-weight: 500; font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(90, 120, 200, .08); }
tbody tr { transition: background .14s; }
tbody tr:hover { background: rgba(90, 130, 220, .07); }
tbody tr:last-child td { border-bottom: none; }
.td-mono { font-family: ui-monospace, monospace; font-size: 12.5px; }
.td-num { font-variant-numeric: tabular-nums; text-align: right; }
.td-actions { white-space: nowrap; }

/* ==================== 徽标 ==================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 11px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge-ok { background: rgba(34, 197, 94, .15); color: #86efac; }
.badge-warn { background: rgba(245, 158, 11, .15); color: #fcd34d; }
.badge-err { background: rgba(239, 68, 68, .15); color: #fca5a5; }
.badge-info { background: rgba(56, 189, 248, .15); color: #7dd3fc; }
.badge-mute { background: rgba(120, 140, 200, .13); color: var(--txt-1); }
.badge-gold { background: rgba(251, 191, 36, .15); color: var(--gold); }

/* ==================== 账号卡片 ==================== */
.acct-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.acct {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  transition: all .2s;
  position: relative;
}
.acct:hover { border-color: var(--border-lit); box-shadow: var(--shadow-lit); }
.acct.sel { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc), var(--shadow); }
.acct-top { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.acct-phone { font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.acct-check { width: 17px; height: 17px; accent-color: var(--acc); cursor: pointer; flex-shrink: 0; }
.acct-line { font-size: 12px; color: var(--txt-1); margin-bottom: 6px; display: flex; gap: 7px; align-items: center; }
.acct-line b { color: var(--txt-0); font-weight: 500; }
.acct-badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.acct-acts { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 11px; border-top: 1px solid var(--border); }

/* ==================== 实时日志 ==================== */
.logbox {
  background: #070a14; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px; height: 460px; overflow-y: auto;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px; line-height: 1.75;
}
.logbox.tall { height: 620px; }
.logline { white-space: pre-wrap; word-break: break-all; color: #94a3b8; }
.logline.ok { color: #4ade80; }
.logline.win { color: var(--gold); font-weight: 700; background: rgba(251, 191, 36, .09); display: block; padding: 2px 4px; border-radius: 3px; }
.logline.err { color: #f87171; }
.logline.warn { color: #fbbf24; }
.logline.info { color: #60a5fa; }
.logline .ts { color: #475569; margin-right: 8px; }
.logline .ph { color: #a78bfa; margin-right: 6px; }

/* ==================== 工具栏 ==================== */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .grow { flex: 1; min-width: 150px; }
.toolbar input[type=search], .toolbar select { width: auto; min-width: 130px; }

/* ==================== Toast ==================== */
.toast-wrap {
  position: fixed; top: 18px; right: 18px; z-index: 9999;
  display: flex; flex-direction: column; gap: 9px;
}
.toast {
  padding: 11px 17px; border-radius: var(--radius-sm);
  background: var(--card-solid); border: 1px solid var(--border);
  color: var(--txt-0); font-size: 13px; box-shadow: var(--shadow);
  min-width: 210px; max-width: 360px;
  animation: slideIn .22s ease-out;
  display: flex; align-items: center; gap: 8px;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--err); }
.toast.warn { border-left: 3px solid var(--warn); }
.toast.info { border-left: 3px solid var(--acc); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ==================== 空状态 ==================== */
.empty { text-align: center; padding: 46px 20px; color: var(--txt-2); }
.empty-icon { font-size: 38px; opacity: .35; margin-bottom: 12px; }
.empty-text { font-size: 13.5px; }

/* ==================== 模态 ==================== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(4px);
  display: none; place-items: center; z-index: 9000; padding: 20px;
}
.modal-mask.show { display: grid; }
.modal {
  background: var(--bg-2); border: 1px solid var(--border-lit);
  border-radius: var(--radius); width: 100%; max-width: 540px;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow);
  animation: popIn .2s ease-out;
}
.modal.wide { max-width: 780px; }
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--txt-2); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--txt-0); }
.modal-body { padding: 19px 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

/* ==================== 登录页 ==================== */
.login-body {
  display: grid; place-items: center;
  min-height: 100vh; position: relative; overflow: hidden;
}
.login-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(56, 189, 248, .16), transparent 46%),
    radial-gradient(circle at 82% 78%, rgba(99, 102, 241, .16), transparent 46%),
    radial-gradient(circle at 50% 50%, rgba(139, 92, 246, .07), transparent 62%),
    var(--bg-0);
}
.login-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(90, 130, 220, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 130, 220, .05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 50%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, transparent 72%);
}
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 392px;
  background: rgba(22, 28, 52, .82);
  border: 1px solid var(--border-lit);
  border-radius: 19px;
  padding: 34px 32px 26px;
  backdrop-filter: blur(20px);
  box-shadow: 0 22px 64px rgba(0, 0, 0, .6), 0 0 0 1px rgba(90, 160, 255, .1);
}
.login-head { text-align: center; margin-bottom: 24px; }
.login-logo {
  width: 58px; height: 58px; margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  display: grid; place-items: center;
  font-size: 20px; font-weight: 800; color: #fff;
  box-shadow: 0 0 32px var(--acc-glow);
}
.login-head h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; letter-spacing: .5px; }
.login-head p { font-size: 12.5px; color: var(--txt-2); }
.pwd-wrap { position: relative; }
.pwd-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 14px; opacity: .5;
}
.pwd-toggle:hover { opacity: 1; }
.login-error {
  color: #fca5a5; font-size: 12.5px; min-height: 19px;
  margin-bottom: 10px; text-align: center;
}
.login-foot {
  text-align: center; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--txt-2);
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.first-run {
  background: rgba(251, 191, 36, .09);
  border: 1px solid rgba(251, 191, 36, .28);
  border-radius: var(--radius-sm);
  padding: 11px 14px; margin-bottom: 18px;
  font-size: 12px; display: flex; flex-direction: column; gap: 5px;
}
.first-run strong { color: var(--gold); font-size: 12.5px; }
.first-run code {
  color: #fff; background: rgba(0, 0, 0, .35);
  padding: 5px 9px; border-radius: 5px; font-size: 13px;
  letter-spacing: 1px; text-align: center;
}
.first-run span { color: var(--txt-2); font-size: 11px; }
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 15px; }
.alert-warn { background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .3); color: #fcd34d; }

/* ==================== 错误页 ==================== */
.error-page { display: grid; place-items: center; min-height: 100vh; text-align: center; }
.error-code { font-size: 76px; font-weight: 800; opacity: .25; margin-bottom: 10px; }
.error-msg { font-size: 15px; color: var(--txt-1); margin-bottom: 20px; }

/* ==================== 分段控件 ==================== */
.seg { display: inline-flex; background: rgba(10, 14, 26, .6); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg button {
  padding: 6px 14px; border-radius: 6px; border: none;
  background: none; color: var(--txt-1); font-size: 12.5px;
  font-family: inherit; cursor: pointer; transition: all .15s;
}
.seg button.active { background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; font-weight: 500; }

/* ==================== 进度条 ==================== */
.bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.07); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--acc), var(--acc2)); transition: width .4s; }
.bar.ok > i { background: linear-gradient(90deg, var(--ok), #4ade80); }

/* ==================== 响应式 ==================== */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 100; height: 100vh;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.7); }
  .burger { display: block; }
  .content { padding: 15px 14px 34px; }
  .topbar { padding: 0 14px; }
  .clock { display: none; }
  .form-grid .span2 { grid-column: auto; }
}
