:root {
  color-scheme: light;
  --bg: #f7f9ff;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --line: #e2e8f4;
  --line-strong: #d6deed;
  --text: #111827;
  --muted: #6f7b91;
  --blue: #4566f0;
  --blue-strong: #3552dc;
  --blue-soft: #eef3ff;
  --violet: #7c4dff;
  --violet-soft: #f2ebff;
  --green: #19b98f;
  --green-soft: #e9fbf5;
  --red: #e23d4b;
  --red-soft: #fff0f2;
  --amber: #dc8a10;
  --amber-soft: #fff5df;
  --shadow: 0 20px 46px rgba(76, 91, 120, 0.12);
  --shadow-soft: 0 10px 28px rgba(73, 91, 128, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  background: #f7f9ff;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 34px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: rgba(247, 249, 255, 0.72);
  backdrop-filter: blur(22px);
  border-right: 1px solid rgba(214, 222, 237, 0.86);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 58px;
}

.brand-mark,
.mini-logo {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, #6e7dff 0%, #3552dc 62%, #734eff 100%);
  box-shadow: 0 12px 24px rgba(69, 102, 240, 0.28);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  font-size: 27px;
}

.mini-logo {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 12px;
}

.brand strong,
.brand span,
.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.brand strong {
  font-size: 19px;
  line-height: 1.2;
}

.brand span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  border-radius: 13px;
  box-shadow: var(--shadow-soft);
}

.mode-button,
.nav-item,
.ghost-button,
.primary-action,
.icon-button,
.link-action,
.bottom-link {
  border: 0;
}

.mode-button {
  min-height: 40px;
  border-radius: 10px;
  background: transparent;
  color: #667089;
}

.mode-button.active {
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #4d6cff, #6a4df5);
  box-shadow: 0 10px 24px rgba(69, 102, 240, 0.26);
}

.nav-list {
  display: grid;
  gap: 14px;
}

.nav-item {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-radius: 12px;
  text-align: left;
  color: #5d687d;
  background: transparent;
  font-size: 16px;
}

.nav-icon {
  width: 22px;
  display: inline-grid;
  place-items: center;
  color: #7a859a;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  color: var(--blue);
  font-weight: 800;
  background: linear-gradient(135deg, rgba(230, 236, 255, 0.96), rgba(241, 244, 255, 0.86));
  box-shadow: inset 0 0 0 1px rgba(226, 232, 244, 0.62);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: var(--blue);
}

.sidebar-note {
  margin-top: auto;
  min-height: 88px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
}

.sidebar-note strong {
  font-size: 14px;
}

.sidebar-note span {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-note i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #27cf8c;
}

.workspace {
  min-width: 0;
  padding: 46px 32px 34px;
}

.topbar {
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 36px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 29px;
  font-weight: 900;
}

h2 {
  font-size: 19px;
  font-weight: 900;
}

.panel-description {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.top-actions,
.form-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.icon-button {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.88);
  color: #111827;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-soft);
  font-size: 24px;
}

.icon-button.has-badge::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  top: 10px;
  right: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #ff3b45;
}

.primary-action {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border-radius: 13px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, #4b6dff 0%, #3652dc 100%);
  box-shadow: 0 16px 30px rgba(69, 102, 240, 0.30);
}

.primary-action span {
  font-size: 22px;
  line-height: 1;
}

.topbar-action {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14px;
  white-space: nowrap;
}

.topbar-action span {
  font-size: 18px;
  line-height: 1;
}

.ghost-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  color: #69758c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.link-action,
.bottom-link {
  color: var(--blue);
  background: transparent;
  font-weight: 800;
}

.link-action.danger {
  color: var(--red);
}

.bottom-link {
  width: 100%;
  margin-top: 28px;
  min-height: 36px;
  color: #667089;
  font-size: 15px;
}

.page {
  display: none;
}

.active-page {
  display: block;
}

.hidden {
  display: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 26px;
}

.metric-block {
  min-height: 128px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.metric-icon,
.panel-icon,
.hit-icon,
.channel-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 900;
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 25px;
}

.panel-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 17px;
}

.hit-icon,
.channel-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  font-size: 24px;
  color: var(--blue);
  background: var(--blue-soft);
}

.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.violet {
  color: var(--violet);
  background: var(--violet-soft);
}

.amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.green {
  color: var(--green);
  background: var(--green-soft);
}

.red {
  color: var(--red);
  background: var(--red-soft);
}

.metric-block span:not(.metric-icon),
.metric-block small {
  color: var(--muted);
}

.metric-block strong {
  display: block;
  margin: 8px 0 8px;
  font-size: 38px;
  line-height: 1;
  font-weight: 900;
}

.metric-block small b {
  color: var(--blue);
}

.content-grid {
  display: grid;
  gap: 26px;
}

.dashboard-health {
  margin-top: 26px;
}

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.98fr);
}

.panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel-head {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.title-with-icon {
  display: flex;
  align-items: center;
  gap: 14px;
}

.soft-label {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border-radius: 11px;
  color: #6b7690;
  background: rgba(246, 248, 252, 0.94);
  border: 1px solid var(--line);
  font-size: 13px;
}

.hit-list,
.rule-stack,
.plan-list {
  display: grid;
  gap: 18px;
}

.hit-row,
.rule-item {
  min-height: 96px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.70);
}

.rule-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.rule-item.is-disabled {
  background: rgba(247, 249, 252, 0.86);
}

.rule-item.is-disabled > div:first-child {
  opacity: 0.62;
}

.managed-rule-item {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 16px 18px;
}

.action-row,
.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.rule-state {
  min-width: 44px;
  color: var(--green) !important;
  font-weight: 800;
  text-align: right;
}

.rule-state.off {
  color: var(--muted) !important;
}

.rule-channel-summary {
  color: #5367a8 !important;
  font-weight: 700;
}

.rule-switch {
  cursor: pointer;
}

.rule-switch input:focus-visible + span {
  outline: 3px solid rgba(76, 108, 255, 0.2);
  outline-offset: 2px;
}

.rule-switch input:disabled + span {
  cursor: wait;
  opacity: 0.65;
}

.hit-meta,
.rule-item div {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.rule-item .action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.hit-meta strong,
.rule-item strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.hit-meta span,
.rule-item span {
  color: var(--muted);
  font-size: 13px;
}

.tag {
  display: inline-flex;
  min-width: 60px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.tag.good {
  color: #159673;
  background: var(--green-soft);
}

.tag.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.tag.risk {
  color: var(--red);
  background: var(--red-soft);
}

.channel-error {
  display: block;
  max-width: 240px;
  margin-top: 6px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.channel-health {
  display: grid;
  gap: 25px;
  padding-top: 18px;
}

.channel-health div {
  display: grid;
  grid-template-columns: auto 70px minmax(120px, 1fr) 60px 66px;
  align-items: center;
  gap: 18px;
}

.channel-health em {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #15a982;
  background: var(--green-soft);
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
}

.channel-health em::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}

.channel-health em.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: #e8edf6;
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, #4c6cff, #5472ff);
}

.panel-foot {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 45px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #62708a;
  background: rgba(248, 250, 255, 0.78);
}

.data-time {
  margin: 34px 0 0;
  text-align: center;
  color: #7b869b;
  font-size: 13px;
}

.toolbar {
  margin-bottom: 18px;
}

.glass-toolbar {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.toolbar input,
.toolbar select,
.editor-panel input,
.editor-panel select,
.inline-input {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.toolbar input {
  min-width: min(420px, 100%);
  flex: 1;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  min-height: 54px;
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.data-table th {
  color: #758198;
  font-size: 13px;
  background: rgba(246, 248, 252, 0.86);
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.compact td:first-child {
  color: var(--muted);
}

.switch {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
}

.switch.mini {
  width: 42px;
  height: 24px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #ccd5e4;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
  box-shadow: 0 2px 5px rgba(25, 34, 55, 0.18);
}

.switch.mini span::after {
  width: 18px;
  height: 18px;
}

.switch input:checked + span {
  background: var(--blue);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.switch.mini input:checked + span::after {
  transform: translateX(18px);
}

.editor-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.editor-panel label {
  display: grid;
  gap: 9px;
  color: #69758c;
}

.token-field {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
}

.token-field span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
}

.token-field.muted span {
  background: #f2f5fb;
  color: #717c91;
}

.form-actions {
  justify-content: flex-end;
}

.compact-action {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
  white-space: nowrap;
}

.channel-grid .metric-block strong {
  font-size: 28px;
}

.plan-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.plan-list article {
  min-height: 154px;
  display: grid;
  align-content: space-between;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
}

.plan-list article.selected {
  border-color: rgba(69, 102, 240, 0.56);
  background: linear-gradient(135deg, #eef3ff, #f6f2ff);
}

.plan-list strong,
.plan-list b,
.plan-list span {
  display: block;
}

.plan-list b {
  font-size: 32px;
}

.plan-list span {
  color: var(--muted);
}

.invite-box {
  min-height: 164px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, #eef3ff, #ffffff);
  margin-bottom: 16px;
}

.invite-box span {
  color: var(--muted);
}

.invite-box strong {
  font-size: 38px;
}

.queue-bars {
  display: grid;
  gap: 22px;
  padding-top: 16px;
}

.queue-bars div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 16px;
}

.queue-bars i {
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: #e8edf6;
  overflow: hidden;
}

.queue-bars i::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w);
  background: linear-gradient(90deg, #4c6cff, #5472ff);
  border-radius: inherit;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}

.donut {
  width: 154px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 34%, var(--violet) 34% 62%, var(--amber) 62% 83%, #b7c1d4 83% 100%);
  position: relative;
  box-shadow: 0 16px 30px rgba(69, 102, 240, 0.18);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 36px;
  background: #fff;
  border-radius: 50%;
}

.legend {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 11px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 9px;
}

.legend span {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.c1 { background: var(--blue); }
.c2 { background: var(--violet); }
.c3 { background: var(--amber); }
.c4 { background: #b7c1d4; }

.inline-input {
  width: 104px;
}

.check-line {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px !important;
}

.check-line input {
  min-height: auto;
}

.empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  min-height: 44px;
  max-width: min(420px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 12px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 18px 38px rgba(69, 102, 240, 0.28);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red);
}

.toast.warn {
  background: var(--amber);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.28);
  backdrop-filter: blur(8px);
}

.modal {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.22);
}

.modal-head,
.modal-actions {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 22px;
}

.modal-body {
  padding: 20px;
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.form-grid,
.detail-list {
  display: grid;
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.form-grid input,
.form-grid select {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
}

.rule-channel-picker {
  grid-column: 1 / -1;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.rule-channel-picker legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.rule-channel-picker > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.rule-channel-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.form-grid .rule-channel-option {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.form-grid .rule-channel-option:has(input:checked) {
  border-color: rgba(76, 108, 255, 0.52);
  background: var(--blue-soft);
}

.form-grid .rule-channel-option input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  accent-color: var(--blue);
}

.rule-channel-option span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.rule-channel-option strong,
.rule-channel-option small {
  overflow-wrap: anywhere;
}

.rule-channel-option small {
  color: var(--muted);
  font-size: 11px;
}

.rule-channel-empty {
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.detail-list p {
  margin: 0;
  line-height: 1.7;
  color: #344054;
}

.account-grid {
  align-items: start;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 20px;
}

.account-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #4566f0, #7356ee);
  font-size: 20px;
  font-weight: 800;
}

.account-identity div {
  display: grid;
  gap: 5px;
}

.account-identity strong {
  font-size: 17px;
}

.account-identity span:last-child,
.account-security-hint {
  color: var(--muted);
}

.account-details {
  margin: 0;
}

.account-details div {
  min-height: 52px;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.account-details dt {
  color: var(--muted);
}

.account-details dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.account-security-hint {
  margin: 0 0 18px;
  line-height: 1.65;
}

.account-password-form {
  max-width: 520px;
}

.password-visibility {
  color: var(--text) !important;
}

.account-password-submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.section-gap {
  margin-top: 28px;
}

.radio-line {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: rgba(248, 250, 255, 0.72);
}

.radio-line input {
  min-height: auto;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  align-items: center;
  gap: 44px;
  padding: 56px max(28px, 8vw);
}

.auth-brand {
  max-width: 620px;
}

.auth-brand .brand-mark {
  margin-bottom: 24px;
}

.auth-brand h1 {
  font-size: 44px;
  margin-bottom: 16px;
}

.auth-brand p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.auth-points {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.auth-points span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 800;
}

.auth-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.auth-card-header {
  margin-bottom: 20px;
}

.auth-card-header h2 {
  margin: 5px 0 0;
  font-size: 24px;
}

.auth-eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.auth-shell-admin .auth-brand {
  max-width: 540px;
}

.auth-brand-admin .auth-eyebrow {
  margin-bottom: 12px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 14px;
  background: var(--blue-soft);
  margin-bottom: 22px;
}

.auth-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, #4d6cff, #6a4df5);
}

.auth-tabs-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-tabs-three button {
  padding: 0 8px;
  font-size: 13px;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.auth-form input {
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 14px;
}

.sms-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.sms-send-button {
  min-width: 112px;
  white-space: nowrap;
}

.auth-form-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.auth-link-row {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.auth-link-row a {
  margin-left: 6px;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.auth-link-row a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

.nav-link {
  min-height: 52px;
}

.settings-switch-panel {
  margin-top: 26px;
}

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

.switch-line {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 1240px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-col,
  .plan-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .auth-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 30px 18px;
  }

  .auth-brand {
    max-width: none;
  }

  .auth-brand .brand-mark {
    margin-bottom: 16px;
  }

  .auth-brand h1 {
    font-size: 32px;
    margin-bottom: 10px;
  }

  .auth-brand p {
    font-size: 15px;
    line-height: 1.65;
  }

  .auth-points {
    margin-top: 18px;
  }

  .auth-card {
    padding: 20px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-width: 0;
    width: 100%;
    height: auto;
    padding: 14px;
    gap: 18px;
  }

  .brand {
    min-height: 42px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .nav-list {
    display: flex;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 13px;
    font-size: 13px;
  }

  .sidebar-note {
    display: none;
  }

  .workspace {
    width: 100%;
    padding: 22px 12px 28px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 18px;
  }

  .top-actions {
    width: 100%;
  }

  .user-top-actions {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .user-top-actions .topbar-action {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .user-top-actions .topbar-action span {
    display: none;
  }

  h1 {
    font-size: 24px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .metric-block {
    min-height: 124px;
    padding: 18px;
  }

  .panel {
    padding: 16px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar input,
  .toolbar select,
  .toolbar button {
    width: 100%;
  }

  .data-table {
    min-width: 760px;
  }

  .panel:has(.data-table) {
    overflow-x: auto;
  }

  .channel-health div {
    grid-template-columns: auto 64px minmax(100px, 1fr) 54px;
  }

  .channel-health em {
    grid-column: 3 / 5;
    width: max-content;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 460px) {
  .sms-code-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .sms-send-button {
    width: 100%;
  }

  .nav-list {
    display: flex;
  }

  .icon-button {
    width: 48px;
    height: 48px;
  }

  .primary-action {
    flex: 1;
  }

  .hit-row,
  .rule-item {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .metric-block {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
  }

  .metric-block strong {
    font-size: 34px;
  }

  .panel-foot {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }
}
