/* ==========================================================================
   弱电管理 · 页面样式（外壳 + 老师页 + 后台 + OLT 控制台）
   只排布局与间距，颜色/圆角/字号全部取自 app.css 的变量。
   ========================================================================== */

/* ---------- 外壳：顶栏 + 左侧导航 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 54px;
  padding: 0 20px;
}
.topbar__brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.topbar__logo { border-radius: 7px; flex: 0 0 auto; }
.topbar__name { font-size: 15px; font-weight: 600; white-space: nowrap; }
.topbar__user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.topbar__who { font-size: 13px; color: var(--text-2); white-space: nowrap; }

.shell { display: flex; min-height: calc(100vh - 54px); align-items: stretch; }

.sidebar {
  flex: 0 0 var(--nav-w);
  width: var(--nav-w);
  padding: 14px 10px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.sidebar__group { margin-bottom: 16px; }
.sidebar__label {
  padding: 0 10px 6px;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: .04em;
}
.sidebar__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
}
.sidebar__item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar__item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidebar__count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.content { flex: 1 1 auto; min-width: 0; padding: 20px 22px 56px; }
.content__head { margin-bottom: 16px; }
.content__title { font-size: 19px; }
.content__desc { margin-top: 5px; font-size: 13px; color: var(--text-3); }

/* ---------- 老师页（我的 IP） ---------- */

.my-wrap { max-width: 860px; margin: 0 auto; padding: 26px 18px 56px; }

.my-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.my-hero__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 19px;
  font-weight: 600;
}
.my-hero__name { font-size: 18px; font-weight: 600; }
.my-hero__sub { margin-top: 3px; font-size: 12.5px; color: var(--text-3); }

.my-section { margin-top: 20px; }
.my-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 14.5px;
  font-weight: 600;
}

.ip-card {
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ip-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.ip-card__addr { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.ip-card__meta { font-size: 12.5px; color: var(--text-3); }

.kv {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0;
}
.kv__k, .kv__v {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.kv__k { color: var(--text-3); }
.kv__v { font-family: var(--mono); }
.kv__row:last-child .kv__k, .kv__row:last-child .kv__v { border-bottom: 0; }
.kv__row { display: contents; }
.kv__v--plain { font-family: var(--font); }

.copy-btn { height: 26px; padding: 0 9px; font-size: 12px; }

/* ---------- 后台 ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat__label { font-size: 12.5px; color: var(--text-3); }
.stat__value {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat__hint { margin-top: 3px; font-size: 12px; color: var(--text-3); }
.stat--warn .stat__value { color: var(--warn); }
.stat--danger .stat__value { color: var(--danger); }
.stat--success .stat__value { color: var(--success); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; }
.toolbar .input--search { min-width: 230px; }

/* ---------- OLT 控制台 ---------- */

.olt-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.olt-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
}
.olt-status--online { border-left-color: var(--success); }
.olt-status--offline { border-left-color: var(--danger); background: var(--danger-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: 0 0 auto; }
.dot--ok { background: var(--success); }
.dot--bad { background: var(--danger); }

/* 一行安装命令：故意做成"能看懂是命令"的样子，
   但换行要能断（窄屏上这条命令很长，撑破布局就白写了）。 */
.install-cmd { margin-top: 10px; }
.install-cmd__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.install-cmd__code {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}

.uni-editor { display: flex; flex-direction: column; gap: 6px; }
.uni-row {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 10px;
}
.uni-row__label { font-size: 12.5px; color: var(--text-3); text-align: right; }

.console {
  max-height: 320px;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #1f2329;
  color: #e6e8eb;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
}
.console--light { background: var(--surface-2); color: var(--text); }

.cmd-list {
  margin: 0;
  padding: 12px 14px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.8;
}
.cmd-list li::before { content: "$ "; color: var(--text-3); }
.cmd-list li.is-key { color: var(--primary); font-weight: 600; }

/* ---------- 登录页 ---------- */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 392px;
  padding: 32px 28px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.login-logo { display: block; margin: 0 auto 16px; border-radius: 18px; }
.login-title { font-size: 19px; font-weight: 600; text-align: center; }
.login-sub { margin-top: 7px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.login-actions { margin-top: 24px; }
.login-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--text-3);
}
.login-or::before, .login-or::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}
.login-fallback { margin-top: 16px; }
.login-fallback > summary {
  list-style: none;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
}
.login-fallback > summary::-webkit-details-marker { display: none; }
.login-note {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.7;
}

/* ---------- 窄屏 ---------- */

@media (max-width: 900px) {
  .sidebar {
    flex: 0 0 100%;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 10px;
  }
  .shell { display: block; }
  .sidebar__nav { display: flex; gap: 6px; overflow-x: auto; }
  .sidebar__group { margin: 0; }
  .sidebar__label { display: none; }
  .sidebar__item { white-space: nowrap; }
  .content { padding: 16px 14px 48px; }
  .topbar__who { display: none; }
}

@media (max-width: 560px) {
  .kv { grid-template-columns: 84px 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .uni-row { grid-template-columns: 46px 1fr; }
}
