/* 门户：登录 + 侧栏后台（对齐嵌赛演示类管理台风格） */

.console-portal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.45rem 1rem;
  background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  font-size: 0.82rem;
  border-bottom: 1px solid #334155;
}
.console-portal-bar__back {
  color: #5eead4;
  font-weight: 600;
  text-decoration: none;
}
.console-portal-bar__back:hover {
  text-decoration: underline;
}
.console-portal-bar__hint {
  color: #94a3b8;
  font-size: 0.78rem;
}
.console-portal-bar__hint code {
  color: #fcd34d;
  font-size: 0.72rem;
}

/* —— 登录页 —— */
.login-page {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(
      135deg,
      rgba(15, 23, 42, 0.55) 0%,
      rgba(180, 83, 9, 0.35) 50%,
      rgba(251, 191, 36, 0.45) 100%
    ),
    linear-gradient(180deg, #1e3a5f 0%, #78350f 55%, #fbbf24 100%);
  font-family: var(--font, "Noto Sans SC", system-ui, sans-serif);
}
.login-hero-title {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
  letter-spacing: 0.06em;
  pointer-events: none;
  text-align: center;
  width: 100%;
  padding: 0 1rem;
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  padding: 2rem 2rem 1.75rem;
}
.login-card h1 {
  margin: 0 0 1.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
}
.login-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.85rem;
  background: #fafafa;
}
.login-field:focus-within {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}
.login-field__icon {
  font-size: 1rem;
  opacity: 0.65;
  user-select: none;
}
.login-field input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  outline: none;
  min-width: 0;
}
.login-toggle-pw {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0 0.15rem;
  opacity: 0.75;
}
.login-row-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
  color: #64748b;
}
.login-row-meta label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.login-row-meta a {
  color: #d97706;
  text-decoration: none;
}
.login-row-meta a:hover {
  text-decoration: underline;
}
.btn-login-primary {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 4px;
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
}
.btn-login-primary:hover {
  filter: brightness(1.05);
}
.btn-login-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.login-footnote {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: center;
  line-height: 1.5;
}

/* —— 门户后台框架 —— */
.portal-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  background: #f1f5f9;
  font-family: var(--font, "Noto Sans SC", system-ui, sans-serif);
  color: #0f172a;
}
.portal-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #334155;
}
.portal-brand {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
}
.portal-brand__logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}
.portal-user {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid #334155;
}
.portal-user__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #334155;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}
.portal-user__meta {
  font-size: 0.78rem;
  color: #94a3b8;
}
.portal-user__meta strong {
  display: block;
  color: #f8fafc;
  font-size: 0.9rem;
}
.portal-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}
.portal-nav a,
.portal-nav summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.portal-nav a:hover,
.portal-nav summary:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.portal-nav a.is-active,
.portal-nav details[open] > summary {
  background: rgba(20, 184, 166, 0.15);
  border-left-color: #14b8a6;
  color: #5eead4;
}
.portal-nav details {
  border: none;
}
.portal-nav details ul {
  margin: 0;
  padding: 0 0 0.35rem 0;
  list-style: none;
}
.portal-nav details li a {
  padding-left: 2.5rem;
  font-size: 0.82rem;
}
.portal-nav__bottom {
  border-top: 1px solid #334155;
  padding: 0.5rem 0;
}
.portal-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.portal-topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.85rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
}
.portal-content {
  flex: 1;
  padding: 1.25rem 1.5rem 2rem;
  overflow: auto;
}

/* 统计卡片 + 图表区 */
.portal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.portal-stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.portal-stat-card__label {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.35rem;
}
.portal-stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f766e;
}
.portal-panel {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}
.portal-panel h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  color: #0f172a;
}

/* 表格 */
.portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.portal-tabs button,
.portal-tabs a {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  color: #334155;
}
.portal-tabs button.is-active,
.portal-tabs a.is-active {
  background: #0f766e;
  color: #fff;
  border-color: #0f766e;
}
.portal-table-wrap {
  overflow-x: auto;
}
.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.portal-table th,
.portal-table td {
  border: 1px solid #e2e8f0;
  padding: 0.55rem 0.65rem;
  text-align: left;
}
.portal-table thead {
  background: #f8fafc;
}
.portal-table tbody tr:nth-child(even) {
  background: #fafafa;
}
.portal-table a {
  color: #0d9488;
  font-weight: 600;
}
.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
}
.badge--ok {
  background: #d1fae5;
  color: #065f46;
}
.badge--idle {
  background: #e2e8f0;
  color: #475569;
}
.badge--warn {
  background: #fef3c7;
  color: #92400e;
}
.portal-dev-serial {
  font-weight: 600;
  color: #0f172a;
}
.portal-dev-sub {
  font-size: 0.72rem;
  font-weight: 400;
  color: #64748b;
  margin-top: 0.2rem;
  line-height: 1.35;
}

/* 设备管理 · 工作情况：cam1 / gw 各自一盏灯，在线=绿灯 */
.portal-workpair {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
.portal-led {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.2rem 0.5rem 0.2rem 0.4rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.portal-led::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.portal-led--off {
  background: #e2e8f0;
  color: #64748b;
  border: 1px solid #cbd5e1;
}
.portal-led--off::before {
  background: #94a3b8;
  box-shadow: none;
}
.portal-led--on {
  color: #14532d;
  border: 1px solid #4ade80;
  background: linear-gradient(180deg, #ecfdf3 0%, #d1fae5 100%);
}
.portal-led--on::before {
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.95), 0 0 2px rgba(22, 101, 52, 0.4);
}

.portal-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: center;
}
.portal-toolbar input[type="search"] {
  padding: 0.45rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  min-width: 180px;
  font-size: 0.88rem;
}
.portal-pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: #64748b;
}
.portal-pagination button {
  padding: 0.25rem 0.55rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.hint-portal {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.5;
  margin-top: 0.5rem;
}

.chart-wrap {
  position: relative;
  height: 280px;
  max-width: 100%;
}

@media (max-width: 900px) {
  .portal-body {
    flex-direction: column;
  }
  .portal-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .portal-nav {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }
  .portal-nav a {
    flex: 1 1 auto;
  }
}
