/* 极光智联终端管理系统软件V1.0 - 自研样式表（无任何前端框架）
   湖南影影科技有限公司 */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #152238;
  --muted: #6b7a90;
  --line: #e4e9f2;
  --brand: #2f6fed;
  --brand-dark: #1d4ed8;
  --brand-soft: #e8f0ff;
  --green: #16a34a;
  --green-soft: #e7f7ee;
  --red: #dc2626;
  --red-soft: #fdeaea;
  --amber: #d97706;
  --amber-soft: #fdf3e3;
  --slate: #0e1729;
  --slate-2: #16213a;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(21, 34, 56, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--brand); text-decoration: none; }

/* ---------------------------------------------------------------- 布局 */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: linear-gradient(180deg, var(--slate) 0%, var(--slate-2) 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand b { display: block; color: #fff; font-size: 15px; letter-spacing: 1px; }
.brand small { display: block; color: #7c8db0; font-size: 11px; letter-spacing: 2px; }
.logo {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #38bdf8, var(--brand));
  color: #fff; font-weight: 700; font-size: 17px;
}
.logo.big { width: 52px; height: 52px; font-size: 26px; border-radius: 14px; }

#nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
#nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #b7c4da;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
#nav a i { font-style: normal; width: 16px; text-align: center; color: #64748b; }
#nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
#nav a.active { background: linear-gradient(90deg, rgba(47, 111, 237, .28), rgba(47, 111, 237, .06)); color: #fff; box-shadow: inset 2px 0 0 #38bdf8; }
#nav a.active i { color: #38bdf8; }
#nav a.hidden { display: none; }

.sidebar-foot {
  padding: 14px 18px;
  font-size: 11px;
  color: #5b6b85;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 600; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.content { padding: 22px 26px 24px; flex: 1; }

.app-footer {
  margin-top: auto;
  padding: 16px 26px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.app-footer a { color: var(--muted); }
.app-footer a:hover { color: var(--brand); text-decoration: underline; }

/* ---------------------------------------------------------------- 基础组件 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head .sub { color: var(--muted); font-size: 12px; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid.side { grid-template-columns: 380px minmax(0, 1fr); align-items: start; }

.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: .5px; }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat.accent { border-top: 3px solid var(--brand); }
.stat.green { border-top: 3px solid var(--green); }
.stat.red { border-top: 3px solid var(--red); }
.stat.amber { border-top: 3px solid var(--amber); }
.stat.slate { border-top: 3px solid #64748b; }

.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  padding: 8px 16px; border-radius: 8px; font-size: 13px;
  background: var(--brand); color: #fff; font-family: inherit;
  transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #f7f9fe; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn.block { width: 100%; padding: 10px; font-size: 14px; }
.btn.link { background: transparent; color: var(--brand); padding: 3px 6px; }
.btn.link:hover { background: var(--brand-soft); }
.btn.link.danger { color: var(--red); background: transparent; }
.btn.link.danger:hover { background: var(--red-soft); }
.btn.link.muted { color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }

input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; font-family: inherit; color: var(--ink); background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); }
label.field > span b { color: var(--red); font-weight: normal; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fbfcff;
}
tbody td { padding: 10px; border-bottom: 1px solid #f1f4fa; vertical-align: middle; }
tbody tr:hover { background: #f7faff; }
tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 28px 0; font-size: 13px; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; line-height: 18px; white-space: nowrap;
}
.badge.green { color: var(--green); background: var(--green-soft); }
.badge.red { color: var(--red); background: var(--red-soft); }
.badge.amber { color: var(--amber); background: var(--amber-soft); }
.badge.blue { color: var(--brand); background: var(--brand-soft); }
.badge.gray { color: var(--muted); background: #eef1f7; }

.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

.device-picker {
  max-height: 220px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; background: #fbfcff;
}
.device-picker label {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.device-picker label:hover { background: #eef4ff; }
.device-picker input { width: auto; }
.device-picker .tag { margin-left: auto; font-size: 11px; }
.picker-tools { display: flex; gap: 8px; margin-bottom: 6px; }

.param-row { display: grid; grid-template-columns: 1fr 1fr 30px; gap: 8px; margin-bottom: 8px; }
.param-row button { border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; color: var(--red); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button {
  appearance: none; background: transparent; border: none; border-bottom: 2px solid transparent;
  padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--muted); font-family: inherit;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------------------------------------------------------------- 弹窗与提示 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-start; justify-content: center; z-index: 100;
  padding: 60px 16px 30px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 540px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
  animation: pop .16s ease-out;
}
.modal.wide { max-width: 760px; }
@keyframes pop { from { transform: translateY(-8px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: none; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

#toast-root { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; border-left: 4px solid var(--green); border-radius: 8px;
  padding: 10px 14px; min-width: 220px; box-shadow: 0 8px 28px rgba(15, 23, 42, .18);
  font-size: 13px; animation: slide .18s ease-out;
}
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--brand); }
@keyframes slide { from { transform: translateX(16px); opacity: .4; } to { transform: none; opacity: 1; } }

.callout { padding: 10px 14px; border-radius: 8px; background: var(--brand-soft); color: #1d4ed8; font-size: 12.5px; margin-bottom: 12px; }
.callout.warn { background: var(--amber-soft); color: #92400e; }
.callout.mono { font-family: Consolas, monospace; word-break: break-all; }

/* ---------------------------------------------------------------- 登录页 */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 12% 20%, #1e3a8a 0%, #0b1222 45%, #070b14 100%);
}
.login-wrap { display: grid; grid-template-columns: 1fr 380px; gap: 60px; align-items: center; max-width: 1000px; padding: 30px; }
.login-hero { color: #e2e8f0; }
.login-hero h1 { font-size: 26px; margin: 20px 0 10px; letter-spacing: 1px; line-height: 1.35; }
.login-hero p { color: #93a4c3; font-size: 14px; }
.login-hero .login-brand { margin-top: 20px; color: #64748b; font-size: 12.5px; letter-spacing: .5px; }
.login-hero ul { margin: 22px 0 0; padding: 0; list-style: none; color: #7f92b3; font-size: 13px; line-height: 2; }
.login-hero li::before { content: "▹"; color: #38bdf8; margin-right: 8px; }
.login-card {
  background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.login-card h2 { margin: 0 0 22px; font-size: 19px; }
.login-card label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 12.5px; }
.login-card input { margin-top: 6px; padding: 10px 12px; }
.login-card .btn { margin-top: 6px; }
.login-error { background: var(--red-soft); color: var(--red); padding: 8px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 12px; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1280px) {
  .grid.c6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -240px; z-index: 50; transition: left .2s; }
  .sidebar.open { left: 0; }
  .grid.c2, .grid.c3, .grid.c6 { grid-template-columns: 1fr 1fr; }
  .login-wrap { grid-template-columns: 1fr; gap: 30px; }
  .login-hero { display: none; }
  .content { padding: 16px; }
  .app-footer { padding: 14px 16px 18px; }
  .topbar { padding: 14px 16px; }
}
@media (max-width: 560px) {
  .grid.c2, .grid.c3, .grid.c6 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
