:root {
  --background: #f2f5f7;
  --foreground: #111827;
  --card: #ffffff;
  --card-foreground: #111827;
  --muted: #f7f9fb;
  --muted-foreground: #607085;
  --popover: rgba(255, 255, 255, 0.72);
  --border: #dbe4ea;
  --input: #b8c4cf;
  --primary: #111827;
  --primary-foreground: #ffffff;
  --secondary: #f8fafc;
  --secondary-foreground: #111827;
  --accent: #e8f7f3;
  --accent-foreground: #0f4f45;
  --success: #047967;
  --success-bg: #ecfdf5;
  --warning: #a35b00;
  --warning-bg: #fff7ed;
  --destructive: #b42318;
  --destructive-bg: #fef2f2;
  --info: #1d4ed8;
  --info-bg: #eff6ff;
  --ring: #83a6c9;
  --radius: 8px;
  --glass-bg: rgba(255, 255, 255, 0.5);
  --glass-bg-strong: rgba(255, 255, 255, 0.68);
  --glass-bg-soft: rgba(255, 255, 255, 0.34);
  --glass-border: #dbe4ea;
  --glass-border-soft: #e7edf2;
  --glass-shadow: 0 18px 44px rgba(47, 70, 94, 0.12);
  --glass-shadow-soft: 0 7px 22px rgba(47, 70, 94, 0.07);
  --glass-blur: blur(20px) saturate(1.18);
  --shadow: var(--glass-shadow-soft);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #eef3f6;
}

.auth-panel {
  display: grid;
  gap: 20px;
  width: min(420px, 100%);
}

.auth-brand {
  padding: 0;
}

.auth-form {
  display: grid;
  gap: 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 24px;
  box-shadow: var(--glass-shadow);
}

.auth-form p {
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 1.5;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.36);
  padding: 4px;
}

.auth-tab {
  min-height: 34px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  font-weight: 700;
}

.auth-tab:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.auth-tab.active {
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.12);
}

.auth-register-note {
  border: 1px solid rgba(191, 219, 254, 0.78);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(239, 246, 255, 0.82), rgba(255, 255, 255, 0.48));
  padding: 10px 12px;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.5;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(29, 41, 57, 0.3);
}

.modal-panel {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 20px;
  box-shadow: var(--glass-shadow);
}

.modal-panel p {
  margin-top: 8px;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  height: 100vh;
  border-right: 1px solid var(--glass-border-soft);
  background: #f8fafc;
  padding: 18px 14px;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.5), 18px 0 48px rgba(47, 70, 94, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  height: 38px;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.92), rgba(31, 41, 55, 0.78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 12px 22px rgba(17, 24, 39, 0.14);
  color: var(--primary-foreground);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
}

.brand-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 13px;
  border: 1.8px solid currentColor;
  border-radius: 3px;
}

.brand-icon::before,
.brand-icon::after {
  position: absolute;
  top: 2px;
  width: 10px;
  height: 1.8px;
  background: currentColor;
  content: "";
}

.brand-icon::before {
  left: 1px;
  transform: rotate(35deg);
  transform-origin: left center;
}

.brand-icon::after {
  right: 1px;
  transform: rotate(-35deg);
  transform-origin: right center;
}

.brand > div:last-child {
  min-width: 0;
}

.brand-title {
  color: var(--foreground);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted-foreground);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: grid;
  align-content: start;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #44546a;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  border-color: var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.44);
  color: var(--foreground);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.nav-item.active {
  border-color: rgba(255, 255, 255, 0.34);
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.88), rgba(31, 41, 55, 0.72));
  color: var(--primary-foreground);
  box-shadow: 0 14px 28px rgba(17, 24, 39, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.nav-dot {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  opacity: 0.7;
}

.nav-item.active .nav-dot {
  background: currentColor;
}

.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--destructive);
  color: #fff;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.nav-item.active .nav-count {
  background: #fff;
  color: var(--destructive);
}

.sidebar-foot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
  padding: 10px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.sidebar-foot strong {
  color: var(--success);
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted-foreground);
}

.status-dot.ok {
  background: var(--success);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: -28px -28px 20px;
  border-bottom: 1px solid var(--glass-border-soft);
  background: rgba(248, 250, 252, 0.97);
  padding: 24px 28px 18px;
  box-shadow: 0 10px 32px rgba(47, 70, 94, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.page-heading {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: #54657a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--foreground);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  color: var(--foreground);
  font-size: 16px;
  font-weight: 650;
}

.topbar p:not(.eyebrow),
.panel-header p {
  margin-top: 5px;
  color: var(--muted-foreground);
  font-size: 13px;
}

.topbar-actions,
.form-actions,
.filters,
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  display: grid;
  align-content: center;
  min-height: 38px;
  max-width: 220px;
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 6px 10px;
  color: #334155;
  font-size: 12px;
  line-height: 1.2;
}

.user-chip strong,
.user-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip strong {
  color: var(--foreground);
  font-size: 13px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--secondary-foreground);
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 8px 18px rgba(47, 70, 94, 0.06);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button[aria-busy="true"] {
  cursor: progress;
}

.button.primary {
  border-color: rgba(255, 255, 255, 0.28);
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.9), rgba(31, 41, 55, 0.78));
  color: var(--primary-foreground);
}

.button.primary:hover {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.96), rgba(40, 52, 70, 0.84));
}

.button.secondary {
  border-color: var(--glass-border);
  background: #f8fafc;
  color: var(--foreground);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
}

.button.ghost:hover {
  background: rgba(255, 255, 255, 0.4);
}

.button.danger {
  color: var(--destructive);
}

.notice {
  margin-bottom: 16px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  background: #eff6ff;
  padding: 11px 12px;
  color: #1e3a8a;
  font-size: 14px;
  box-shadow: var(--glass-shadow-soft);
}

#notice {
  position: fixed;
  top: var(--notice-top, 16px);
  right: 28px;
  z-index: 20;
  width: min(440px, calc(100vw - 304px));
  max-height: calc(100vh - var(--notice-top, 16px) - 16px);
  margin: 0;
  background: rgba(239, 246, 255, 0.96);
  overflow-y: auto;
  overflow-wrap: anywhere;
  line-height: 1.5;
  box-shadow: 0 16px 36px rgba(47, 70, 94, 0.16);
}

.notice.error {
  border-color: rgba(254, 202, 202, 0.72);
  background: linear-gradient(145deg, rgba(254, 242, 242, 0.82), rgba(255, 255, 255, 0.42));
  color: var(--destructive);
}

#notice.error {
  background: rgba(254, 242, 242, 0.98);
}

.account-health-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid rgba(252, 165, 165, 0.72);
  border-left: 4px solid var(--destructive);
  border-radius: var(--radius);
  background: rgba(254, 242, 242, 0.86);
  padding: 11px 12px;
  color: #7f1d1d;
  box-shadow: 0 8px 20px rgba(127, 29, 29, 0.07);
}

.account-health-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--destructive);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.account-health-copy {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  gap: 3px;
}

.account-health-copy strong {
  font-size: 14px;
}

.account-health-copy span {
  display: -webkit-box;
  overflow: hidden;
  color: #991b1b;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.account-health-banner .button {
  flex: 0 0 auto;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--card-foreground);
  box-shadow: var(--glass-shadow-soft);
}

.metric {
  position: relative;
  min-height: 118px;
  padding: 16px;
  overflow: hidden;
}

.metric::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(232, 247, 243, 0.42), transparent 42%);
  content: "";
}

.metric span {
  display: block;
  color: var(--muted-foreground);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 31px;
  font-weight: 750;
  line-height: 1.1;
}

.metric small {
  display: block;
  margin-top: 10px;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.45;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-fixed-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.dashboard-scroll {
  height: clamp(220px, 28vh, 320px);
  overflow: auto;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  border-bottom: 1px solid var(--glass-border-soft);
  background: #fbfcfd;
  padding: 14px 16px;
}

.table-header {
  align-items: flex-start;
}

.data-panel .table-header {
  display: grid;
  grid-template-columns: 1fr;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(360px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.data-panel,
.detail-panel {
  min-height: min(760px, calc(100vh - 132px));
}

.detail-panel {
  position: sticky;
  top: 104px;
}

.list {
  display: grid;
}

.readiness-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.readiness-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.42);
  padding: 13px 16px;
}

.readiness-item:nth-child(odd) {
  border-right: 1px solid rgba(255, 255, 255, 0.42);
}

.list-item {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.42);
  padding: 13px 16px;
}

.list-item:hover {
  background: rgba(255, 255, 255, 0.26);
}

.list-item:last-child {
  border-bottom: 0;
}

.list-title {
  color: var(--foreground);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.list-meta {
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 24px 16px;
  color: var(--muted-foreground);
  font-size: 14px;
  text-align: center;
}

.table-wrap {
  overflow: auto;
  scrollbar-color: #b7c3cf transparent;
  scrollbar-width: thin;
}

.management-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.management-table-wrap {
  height: clamp(320px, 44vh, 500px);
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.management-table-wrap:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
}

.panel-count {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.table-wrap table {
  min-width: 100%;
}

#accountsView .table-wrap table {
  min-width: 1200px;
}

#accountsView td:nth-child(1),
#accountsView td:nth-child(2),
#accountsView td:nth-child(3),
#accountsView td:nth-child(7),
#accountsView td:nth-child(8) {
  white-space: nowrap;
}

#rulesView th:first-child,
#rulesView td:first-child {
  white-space: nowrap;
}

.data-table-wrap {
  max-height: min(720px, calc(100vh - 218px));
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid #e8edf2;
  padding: 11px 14px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f8fa;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

td {
  color: #1e293b;
  overflow-wrap: anywhere;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr[data-email-row],
tbody tr[data-alert-row] {
  cursor: pointer;
}

tbody tr:hover td {
  background: #f8fafc;
}

tbody tr.selected td {
  background: rgba(232, 247, 243, 0.46);
}

tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--success);
}

.rule-keyword-summary {
  display: grid;
  gap: 4px;
  min-width: 220px;
  max-width: 520px;
}

.rule-keyword-preview {
  display: -webkit-box;
  overflow: hidden;
  color: #334155;
  line-height: 1.45;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rule-keyword-count {
  color: var(--muted-foreground);
  font-size: 12px;
}

tbody tr.account-row-error td {
  background: rgba(254, 242, 242, 0.54);
}

tbody tr.account-row-error td:first-child {
  box-shadow: inset 3px 0 0 var(--destructive);
}

tbody tr.account-row-error:hover td {
  background: rgba(254, 226, 226, 0.64);
}

.row-actions {
  flex-wrap: wrap;
}

.row-actions .button {
  min-height: 30px;
  border-color: transparent;
  background: transparent;
  padding: 6px 8px;
  font-size: 12px;
  box-shadow: none;
}

.row-actions .button:hover {
  background: #eef3f6;
  transform: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge.ok {
  border-color: rgba(187, 247, 208, 0.72);
  background: rgba(236, 253, 245, 0.72);
  color: var(--success);
}

.badge.warn {
  border-color: rgba(253, 230, 138, 0.72);
  background: rgba(255, 247, 237, 0.72);
  color: var(--warning);
}

.badge.danger {
  border-color: rgba(254, 202, 202, 0.72);
  background: rgba(254, 242, 242, 0.72);
  color: var(--destructive);
}

.badge.neutral {
  border-color: var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.38);
  color: #475569;
}

.form-panel {
  padding-bottom: 2px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.compact-form {
  margin-top: 8px;
  border-top: 1px solid var(--glass-border-soft);
  padding-top: 16px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.field-stack {
  display: grid;
  align-content: start;
  gap: 6px;
}

.field-help {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.recipient-editor {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--glass-border-soft);
  border-bottom: 1px solid var(--glass-border-soft);
  background: rgba(248, 250, 252, 0.34);
  padding: 14px 0;
}

.recipient-editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.recipient-editor-heading h3 {
  margin: 0;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.4;
}

.recipient-editor-heading p {
  margin: 3px 0 0;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.5;
}

.recipient-count {
  flex: 0 0 auto;
  min-width: 46px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.recipient-input-grid {
  display: grid;
  grid-template-columns: minmax(170px, 0.9fr) minmax(220px, 1.35fr) minmax(150px, 0.8fr) auto;
  align-items: end;
  gap: 12px;
}

.recipient-add-button {
  min-height: 36px;
  white-space: nowrap;
}

.recipient-list {
  display: grid;
  gap: 8px;
}

.recipient-list-empty {
  border: 1px dashed var(--input);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.recipient-list-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(100px, auto) 32px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--glass-border-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.46);
  padding: 6px 8px 6px 10px;
}

.recipient-list-value,
.recipient-list-name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #334155;
  font-size: 13px;
}

.recipient-list-name {
  color: var(--muted-foreground);
  text-align: right;
}

.recipient-remove-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.recipient-remove-button:hover {
  background: rgba(254, 226, 226, 0.72);
  color: var(--destructive);
}

.settings-channel {
  display: grid;
  gap: 14px;
  border-bottom: 1px solid var(--glass-border-soft);
  padding: 2px 0 18px;
}

.settings-channel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.settings-channel-heading h3 {
  margin: 0;
  color: var(--foreground);
  font-size: 15px;
  line-height: 1.4;
}

.settings-channel-heading p {
  margin-top: 4px;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.5;
}

.settings-channel-fields,
.credential-management-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.credential-management {
  border-bottom: 1px solid var(--glass-border-soft);
  padding-bottom: 14px;
}

.credential-management summary {
  cursor: pointer;
  color: #475569;
  font-size: 13px;
  font-weight: 650;
}

.credential-management-body {
  margin-top: 12px;
}

.form-grid .wide,
.field-options,
.form-actions {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--foreground);
  padding: 8px 10px;
  line-height: 1.4;
}

input,
select {
  min-height: 36px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #9caebf;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input::placeholder {
  color: #94a3b8;
}

.filters {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.data-panel .filters {
  display: grid;
  grid-template-columns: minmax(128px, 160px) minmax(220px, 1fr) minmax(116px, 140px);
  width: 100%;
  justify-content: stretch;
}

.filters select {
  width: 150px;
}

.filters input {
  width: min(300px, 36vw);
}

.data-panel .filters select,
.data-panel .filters input {
  width: 100%;
}

.checkline {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-height: 36px;
}

.checkline input,
.field-options input {
  width: auto;
  min-height: 0;
}

.field-options {
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.24);
  padding: 12px;
}

.field-options legend {
  padding: 0 6px;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 600;
}

.field-options label {
  display: inline-flex;
  align-items: center;
  margin: 5px 16px 5px 0;
  gap: 6px;
  color: #334155;
  font-size: 13px;
}

.detail {
  min-height: 240px;
  margin: 0;
  overflow: auto;
  padding: 16px;
  color: #334155;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.6;
}

.detail.empty-detail {
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  text-align: center;
}

.detail-section {
  display: grid;
  gap: 12px;
}

.detail-title {
  margin-bottom: 2px;
  color: var(--foreground);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 9px 12px;
}

.detail-label {
  color: var(--muted-foreground);
  font-weight: 600;
}

.detail-value {
  color: #1f2937;
}

.detail-body {
  min-height: 180px;
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  background: #f8fafc;
  padding: 12px;
  color: #1f2937;
  white-space: pre-wrap;
}

.form-anchor {
  scroll-margin-top: 112px;
}

.detail-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.44);
}

.alert-delivery-list {
  display: grid;
  gap: 8px;
  margin-top: 9px;
}

.alert-delivery-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border-bottom: 1px solid var(--glass-border-soft);
  padding: 7px 0;
}

.alert-delivery-item:last-child {
  border-bottom: 0;
}

.compact-detail {
  min-height: 96px;
  border-top: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 1240px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workbench {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

  .data-table-wrap {
    max-height: 640px;
  }
}

@media (min-width: 721px) {
  #accountsView .management-table-wrap .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  #accountsView .management-table-wrap th:last-child,
  #accountsView .management-table-wrap td:last-child {
    position: sticky;
    right: 0;
    width: 152px;
    min-width: 152px;
    background: #ffffff;
    box-shadow: -1px 0 0 #e2e8ee;
  }

  #accountsView .management-table-wrap th:last-child {
    top: 0;
    z-index: 3;
    background: #f5f8fa;
  }

  #accountsView .management-table-wrap tr:hover td:last-child {
    background: #f8fafc;
  }

  #accountsView .management-table-wrap tr.account-row-error td:last-child {
    background: #fef7f7;
  }

  #accountsView .management-table-wrap tr.selected td:last-child {
    background: #f0faf7;
  }

  #accountsView .management-table-wrap tr.account-row-error.selected td:last-child {
    background: #fef7f7;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-foot {
    display: none;
  }

  .topbar,
  .two-column,
  .readiness-list {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
    margin: 0 0 16px;
    padding: 0;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  #notice {
    right: 16px;
    width: min(440px, calc(100vw - 32px));
  }

  .readiness-item:nth-child(odd) {
    border-right: 0;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .filters {
    justify-content: flex-start;
  }

  .filters input {
    width: min(100%, 360px);
  }

  .recipient-input-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipient-add-button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 16px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid,
  .form-grid,
  .settings-channel-fields,
  .credential-management-body,
  .recipient-input-grid {
    grid-template-columns: 1fr;
  }

  .settings-channel-heading {
    display: grid;
  }

  .recipient-list-item {
    grid-template-columns: auto minmax(0, 1fr) 32px;
  }

  .recipient-list-name {
    grid-column: 2;
    text-align: left;
  }

  .recipient-remove-button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .metric {
    min-height: 112px;
  }

  .panel-header,
  .table-header {
    display: grid;
    justify-items: start;
  }

  .panel-header-actions {
    justify-content: space-between;
    width: 100%;
  }

  .filters,
  .topbar-actions {
    width: 100%;
  }

  .eyebrow {
    display: none;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar-actions .user-chip {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
  }

  .modal-actions {
    display: grid;
  }

  .account-health-banner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .account-health-banner .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .data-panel .filters {
    grid-template-columns: 1fr;
  }

  .filters select,
  .filters input,
  .form-actions .button,
  .topbar-actions .button {
    width: 100%;
  }

  .data-panel,
  .detail-panel {
    min-height: auto;
  }

  .data-table-wrap {
    max-height: 560px;
  }

  .management-table-wrap {
    height: clamp(280px, 52vh, 420px);
  }

  .dashboard-scroll {
    height: 280px;
  }

  .table-wrap table {
    min-width: 720px;
  }

  #accountsView .table-wrap table {
    min-width: 1120px;
  }

  .detail-meta-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
