:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --line: #d7dde5;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  --success: #027a48;
  --code-bg: #101828;
  --soft: #eef4f3;
}

* { box-sizing: border-box; }

[hidden],
.hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
}

.auth-panel {
  width: min(560px, 100%);
  padding: 28px;
}

.brand-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 24px;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 22px; line-height: 1.3; }
h3 { font-size: 18px; line-height: 1.35; }

.brand-row p,
.section-head p,
.hint,
.empty-state p,
.placeholder-card p,
.sidebar-note,
.topbar p {
  color: var(--muted);
  line-height: 1.6;
  margin-top: 6px;
}

.login-form { display: grid; gap: 16px; }
label { display: grid; gap: 8px; font-weight: 600; }

input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--text);
  background: #fff;
}

input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  border-color: var(--primary);
}

button {
  height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--primary-dark); }
button:disabled { cursor: not-allowed; opacity: 0.65; }

.secondary {
  margin-top: 18px;
  background: #eef2f6;
  color: var(--text);
}

.secondary:hover { background: #e3e8ef; }
.refresh-code { width: 100%; margin: 0 0 16px; }
.compact { height: 36px; margin-top: 0; }

.code-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 22px 0 16px;
}

.code-box code {
  min-height: 44px;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--code-bg);
  color: #fff;
  font-size: 15px;
}

.status-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

dt { color: var(--muted); }
dd { margin: 0; text-align: right; }

.error { color: var(--danger); line-height: 1.5; }
.success { color: var(--success); font-weight: 700; }

.dashboard-shell {
  width: min(1180px, 100%);
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
}

.session-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.session-bar strong { color: var(--text); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 14px;
  min-height: 0;
}

.sidebar,
.content-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sidebar {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.menu-list {
  display: grid;
  gap: 4px;
}

.menu-item {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  text-align: left;
}

.menu-item:hover,
.menu-item.active {
  background: var(--soft);
  color: var(--primary-dark);
}

.sidebar-note {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.content-panel {
  padding: 22px;
  min-height: 520px;
}

.module-content {
  display: grid;
  gap: 16px;
}

.placeholder-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.overview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.overview-card p { color: var(--muted); line-height: 1.5; }
.overview-card strong { color: var(--success); }
.muted-card strong { color: var(--danger); }
.matrix-section { display: grid; gap: 10px; margin-bottom: 18px; }
.matrix-section p { color: var(--muted); line-height: 1.5; }
.security-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.security-card { align-content: start; }
.status-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.status-title strong { color: var(--success); white-space: nowrap; }
.support-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.tag-grid span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--soft);
  color: var(--text);
  font-weight: 600;
}

.notice-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.danger-note { color: var(--danger); font-weight: 700; }

.log-panel { display: grid; gap: 16px; }
.log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.log-filter {
  display: grid;
  grid-template-columns: minmax(180px, 280px) auto;
  gap: 10px;
  align-items: center;
}
.log-filter input { height: 38px; font-size: 14px; }
.log-table-wrap { overflow-x: auto; }
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.log-table th,
.log-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
.log-table th {
  background: var(--soft);
  color: var(--primary-dark);
  font-weight: 700;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 820px) {
  .shell { padding: 16px; }
  .auth-panel { padding: 20px; }
  .brand-row { align-items: flex-start; }
  .code-box { grid-template-columns: 1fr; }
  .status-list div { display: grid; gap: 4px; }
  dd { text-align: left; }
  .dashboard-shell { min-height: auto; }
  .topbar { display: grid; }
  .session-bar { justify-content: flex-start; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .content-panel { min-height: 360px; }
  .overview-grid,
  .security-grid,
  .support-status-grid,
  .tag-grid { grid-template-columns: 1fr; }
}
