:root {
  color-scheme: dark;
  --bg: #070707;
  --panel: #11100d;
  --panel-2: #171511;
  --line: rgba(216, 170, 84, 0.18);
  --line-strong: rgba(236, 190, 93, 0.42);
  --gold: #d8aa54;
  --gold-strong: #f2cd75;
  --text: #f7f0df;
  --muted: #9f998d;
  --danger: #ec5f64;
  --ok: #5bd6a2;
  --info: #70b8ff;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.46);
  font-family: Inter, "Noto Sans SC", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(216, 170, 84, 0.14), transparent 34%),
    linear-gradient(145deg, #050505 0%, #0e0d0b 48%, #050505 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

html[data-enterprise-render-isolated="true"] #appView {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html.cw-enterprise-enabled #appView,
html.cw-enterprise-enabled .classic-shell,
html.cw-enterprise-enabled [data-classic-root],
body.cw-enterprise-enabled #appView,
body.cw-enterprise-enabled .classic-shell,
body.cw-enterprise-enabled [data-classic-root] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html[data-enterprise-render-isolated="true"] #enterpriseAppShellMount {
  min-height: 100vh;
}

.login-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background:
    radial-gradient(1100px 560px at 14% -10%, rgba(124, 176, 255, 0.09), transparent 60%),
    radial-gradient(900px 520px at 88% -6%, rgba(226, 192, 126, 0.08), transparent 55%),
    linear-gradient(180deg, #0a0e15 0%, #0b1017 45%, #090d14 100%);
}

.login-language-switch {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 4;
}

.login-panel {
  width: min(480px, 100%);
  padding: 40px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(21, 27, 38, 0.92), rgba(13, 17, 24, 0.96));
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.corewatcher-login-panel {
  width: min(1100px, 100%);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background:
    radial-gradient(circle at 16% 12%, rgba(36, 204, 255, 0.07), transparent 32%),
    radial-gradient(circle at 82% 10%, rgba(226, 192, 126, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(19, 24, 34, 0.94), rgba(12, 16, 23, 0.97));
  box-shadow: 0 44px 140px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.corewatcher-login-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 0;
  align-items: stretch;
}

.corewatcher-hero,
.corewatcher-auth-card {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.corewatcher-hero {
  position: relative;
  display: grid;
  gap: 24px;
  align-content: center;
  padding: 44px 44px 40px;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.corewatcher-wordmark {
  display: flex;
  gap: 16px;
  align-items: center;
}

.corewatcher-logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(226, 192, 126, 0.5);
  border-radius: 14px;
  color: #171207;
  background: linear-gradient(135deg, #f2d79f, #d9b56a);
  box-shadow: 0 10px 26px rgba(226, 192, 126, 0.25);
  font-weight: 800;
}

.core-pulse-login {
  position: relative;
  min-height: 260px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background:
    radial-gradient(circle, rgba(36, 204, 255, 0.1), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.008));
}

.pulse-ring,
.pulse-core {
  position: absolute;
  display: block;
  border-radius: 999px;
}

.pulse-ring {
  border: 1px solid rgba(124, 176, 255, 0.38);
  box-shadow: 0 0 40px rgba(36, 204, 255, 0.14);
  animation: cw-core-breathe 5.6s ease-in-out infinite;
}

.ring-one {
  width: 220px;
  height: 220px;
}

.ring-two {
  width: 150px;
  height: 150px;
  border-color: rgba(124, 176, 255, 0.42);
  animation-delay: -1.6s;
}

.pulse-core {
  width: 72px;
  height: 72px;
  background: radial-gradient(circle, #eaf6ff, #35b7ff 58%, rgba(36, 204, 255, 0.05));
  box-shadow: 0 0 46px rgba(36, 204, 255, 0.42);
  animation: cw-core-glow 5.6s ease-in-out infinite;
}

@keyframes cw-core-breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.035);
    opacity: 1;
  }
}

@keyframes cw-core-glow {
  0%,
  100% {
    box-shadow: 0 0 40px rgba(36, 204, 255, 0.36);
  }
  50% {
    box-shadow: 0 0 58px rgba(36, 204, 255, 0.5);
  }
}

.corewatcher-security-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.corewatcher-security-badges span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  color: #cfd8e3;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  font-weight: 600;
}

.corewatcher-security-badges span::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #7cb0ff;
  box-shadow: 0 0 0 3px rgba(124, 176, 255, 0.16);
}

.corewatcher-security-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.corewatcher-auth-card {
  align-content: center;
  padding: 44px 40px;
}

.brand-mark,
.side-brand {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--gold-strong);
  font-weight: 800;
  letter-spacing: 0;
  background: #11100d;
}

.eyebrow {
  margin: 18px 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(32px, 6vw, 54px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.login-copy {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}

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

label span {
  display: block;
  margin-bottom: 8px;
  color: #9aa5b4;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: rgba(9, 13, 20, 0.7);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus {
  border-color: rgba(124, 176, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(124, 176, 255, 0.16);
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(124, 176, 255, 0.5);
  color: #ffffff;
  background: linear-gradient(180deg, #6fa8ff, #3d7aff);
  font-weight: 650;
  transition: filter 140ms ease, background 140ms ease, border-color 140ms ease;
}

.primary-button:hover {
  filter: brightness(1.05);
}

.secondary-button {
  border-color: rgba(255, 255, 255, 0.1);
  color: #dfe6ef;
  background: rgba(255, 255, 255, 0.04);
}

.secondary-button:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.language-switch button {
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
}

.language-switch .language-select {
  width: auto;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
}

.passkey-login-row {
  display: grid;
  gap: 8px;
}

.passkey-login-row .secondary-button {
  width: 100%;
}

.passkey-enroll-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.passkey-enroll-actions button {
  width: 100%;
}

.legal-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 14px;
  display: flex;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.legal-footer a {
  color: var(--muted);
  text-decoration: none;
}

.legal-footer a:hover {
  color: var(--gold-strong);
  text-decoration: underline;
}

html[data-theme="light"] .legal-footer,
html[data-theme="light"] .legal-footer a {
  color: #64748b;
}

.update-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(720px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(16, 22, 31, 0.97);
  color: var(--text);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-size: 13px;
}

.update-banner .primary-button,
.update-banner .secondary-button {
  min-height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 12.5px;
  white-space: nowrap;
}

html[data-theme="light"] .update-banner {
  border-color: rgba(15, 23, 42, 0.12);
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

html[data-theme="light"] .language-switch .language-select {
  color: #334155;
}

html[data-theme="light"] .secondary-button {
  border-color: rgba(15, 23, 42, 0.16);
  color: #334155;
  background: #ffffff;
}

html[data-theme="light"] .secondary-button:hover {
  border-color: rgba(15, 23, 42, 0.24);
  background: #f1f5f9;
}

.language-switch button.active {
  border-color: transparent;
  color: #ffffff;
  background: linear-gradient(180deg, #6fa8ff, #3d7aff);
}

.ghost-button {
  color: var(--muted);
  background: transparent;
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.action-tile:disabled {
  cursor: wait;
  opacity: 0.55;
}

.state-line {
  min-height: 22px;
  color: var(--muted);
  font-size: 12.5px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: space-between;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(8, 8, 7, 0.92);
}

.side-title {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

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

.nav-item,
.mobile-nav-item {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav-item {
  padding: 0 14px;
}

.nav-item.active,
.mobile-nav-item.active {
  border-color: var(--line-strong);
  color: var(--gold-strong);
  background: rgba(216, 170, 84, 0.1);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.shell-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.status-badge,
.mode-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(112, 184, 255, 0.3);
  border-radius: 999px;
  color: var(--info);
  background: rgba(112, 184, 255, 0.08);
  font-size: 13px;
}

.top-session {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge.gold,
.mode-chip.gold {
  border-color: var(--line-strong);
  color: var(--gold-strong);
  background: rgba(216, 170, 84, 0.1);
}

.mode-chip.locked {
  border-color: rgba(91, 214, 162, 0.28);
  color: var(--ok);
  background: rgba(91, 214, 162, 0.08);
}

.mode-chip.danger-locked {
  border-color: rgba(236, 95, 100, 0.32);
  color: #ffd9d9;
  background: rgba(236, 95, 100, 0.1);
}

.safety-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 18px;
}

.connection-notice {
  margin: -2px 0 16px;
  padding: 14px;
  border: 1px solid rgba(91, 214, 162, 0.28);
  border-radius: 8px;
  color: var(--ok);
  background: rgba(91, 214, 162, 0.08);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

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

.metric-card,
.panel,
.approval-card,
.log-row,
.result-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(23, 21, 17, 0.96), rgba(12, 12, 11, 0.98));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

.metric-card {
  min-height: 128px;
  padding: 18px;
  min-width: 0;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 12px 0 6px;
  font-size: 34px;
  letter-spacing: 0;
}

.danger-card strong {
  color: var(--gold-strong);
}

.panel {
  padding: 20px;
}

.wide {
  min-height: 280px;
}

.panel-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-subtitle {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.running-grid,
.section-grid,
.action-grid,
.ops-grid,
.sandbox-grid,
.sandbox-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.running-item {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  min-width: 0;
}

.section-grid {
  margin-bottom: 16px;
}

.cw-preview-lab {
  min-height: 180px;
  margin-bottom: 16px;
  border-color: rgba(212, 175, 55, 0.42);
  background:
    radial-gradient(circle at 16% 18%, rgba(212, 175, 55, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(20, 26, 36, 0.96), rgba(9, 10, 12, 0.98));
}

.cw-preview-copy {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.cw-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cw-preview-view .panel {
  min-height: calc(100vh - 190px);
}

.cw-preview-frame {
  display: block;
  width: 100%;
  min-height: 680px;
  border: 1px solid rgba(212, 175, 55, 0.34);
  border-radius: 8px;
  background: #05070b;
}

.cw-preview-frame.mobile-frame {
  max-width: 430px;
  min-height: 844px;
  margin: 0 auto;
}

.section-card {
  min-height: 220px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(23, 21, 17, 0.94), rgba(9, 9, 8, 0.98));
  min-width: 0;
}

.section-card h3 {
  margin-bottom: 14px;
  color: var(--gold-strong);
  font-size: 17px;
}

.section-list {
  display: grid;
  gap: 8px;
}

.section-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(216, 170, 84, 0.1);
}

.section-row:last-child {
  border-bottom: 0;
}

.section-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.section-row strong {
  color: var(--text);
  font-size: 15px;
  text-align: right;
  overflow-wrap: anywhere;
}

.risk-detail-card {
  grid-column: span 2;
}

.risk-list {
  display: grid;
  gap: 10px;
}

.risk-entry {
  display: grid;
  gap: 5px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(216, 170, 84, 0.1);
}

.risk-entry:last-child {
  border-bottom: 0;
}

.risk-entry strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
}

.risk-entry small,
.empty-inline {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.mini-table-wrap {
  overflow-x: auto;
}

.mini-risk-table {
  min-width: 620px;
  font-size: 12px;
}

.mini-risk-table th,
.mini-risk-table td {
  padding: 10px;
}

.warn-text {
  color: var(--gold-strong) !important;
}

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

.running-item span {
  color: var(--muted);
  font-size: 13px;
}

.running-item strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 22px;
  overflow-wrap: anywhere;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.audit-panel {
  display: grid;
  gap: 16px;
}

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

.audit-summary-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(216, 170, 84, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.audit-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.audit-summary-card strong {
  display: block;
  margin-top: 6px;
  color: var(--gold-strong);
  font-size: 24px;
}

.audit-filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(160px, 0.7fr) minmax(160px, 0.7fr);
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid rgba(112, 184, 255, 0.16);
  border-radius: 8px;
  background: rgba(112, 184, 255, 0.045);
}

.audit-records {
  display: grid;
  gap: 10px;
}

.audit-record-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(17, 18, 20, 0.9), rgba(9, 10, 11, 0.96));
}

.audit-record-card[data-risk="high"] {
  border-color: rgba(236, 95, 100, 0.42);
}

.audit-record-main {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(120px, 0.8fr) minmax(180px, 1.2fr) minmax(110px, 0.7fr) minmax(110px, 0.7fr);
  gap: 12px;
  align-items: center;
}

.audit-record-main > div {
  min-width: 0;
}

.audit-record-main span,
.audit-record-details dt {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.audit-record-main strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 14px;
}

.audit-record-details {
  margin-top: 12px;
  border-top: 1px solid rgba(216, 170, 84, 0.12);
  color: var(--muted);
}

.audit-record-details summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  color: var(--gold-strong);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.audit-record-details dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.audit-record-details div {
  min-width: 0;
}

.audit-record-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.audit-record-details code {
  white-space: normal;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--gold);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: var(--text);
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--ok);
  background: rgba(91, 214, 162, 0.1);
  font-size: 12px;
  white-space: nowrap;
}

.pill.warn {
  color: var(--gold-strong);
  background: rgba(216, 170, 84, 0.12);
}

.pill.high {
  color: var(--danger);
  background: rgba(236, 95, 100, 0.12);
}

.log-list,
.approval-list {
  display: grid;
  gap: 10px;
}

.log-row {
  padding: 14px;
}

.log-row small,
.approval-card small {
  color: var(--muted);
}

.approval-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 16px;
}

.approval-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.reject-control {
  display: grid;
  width: min(240px, 100%);
  min-width: 180px;
  gap: 6px;
}

.reject-control span {
  margin-bottom: 0;
}

.reject-control input {
  min-height: 42px;
}

.reject-button {
  border-color: rgba(236, 95, 100, 0.54);
  color: #ffd9d9;
  background: rgba(236, 95, 100, 0.12);
}

.action-grid {
  margin-bottom: 16px;
}

.action-tile {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--gold-strong);
  background: rgba(216, 170, 84, 0.08);
  font-weight: 800;
  text-align: left;
}

.action-tile.high {
  border-color: rgba(236, 95, 100, 0.48);
  color: #ffd9d9;
  background: linear-gradient(180deg, rgba(236, 95, 100, 0.18), rgba(216, 170, 84, 0.06));
}

.ops-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.sandbox-status-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.sandbox-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.ops-tile,
.sandbox-tile {
  min-height: 132px;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: rgba(216, 170, 84, 0.07);
  text-align: left;
}

.ops-tile strong {
  color: var(--gold-strong);
  font-size: 16px;
}

.ops-tile span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.ops-tile.admin-only {
  border-color: rgba(112, 184, 255, 0.34);
  background: rgba(112, 184, 255, 0.06);
}

.ops-tile.locked {
  opacity: 0.48;
}

.sandbox-tile {
  min-height: 104px;
  color: var(--gold-strong);
}

.sandbox-tile.high {
  border-color: rgba(236, 95, 100, 0.48);
  color: #ffd9d9;
  background: linear-gradient(180deg, rgba(236, 95, 100, 0.16), rgba(216, 170, 84, 0.06));
}

.sandbox-tile.locked {
  opacity: 0.48;
}

.reports-panel {
  margin-top: 16px;
}

.report-list {
  display: grid;
  gap: 10px;
}

.report-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  min-width: 0;
}

.report-card strong,
.report-card p,
.report-card small {
  overflow-wrap: anywhere;
}

.report-card p,
.report-card small {
  color: var(--muted);
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.report-meta span {
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(216, 170, 84, 0.12);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.report-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 116px;
  text-decoration: none;
}

.form-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
}

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

.group-mapping-grid label,
.group-mapping-actions,
#pendingGroupBindings,
#groupMappingPreview,
#groupMappingResult {
  min-width: 0;
  overflow-wrap: anywhere;
}

.credential-vault-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.email-alert-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
  margin-top: 18px;
}

.email-recipient-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.email-recipient-form,
.email-recipient-actions {
  min-width: 0;
  overflow-wrap: anywhere;
}

.credential-vault-grid section,
.credential-card,
.credential-card strong,
.credential-card p,
.credential-card small,
.credential-card span,
.email-alert-grid section,
.email-alert-card,
.email-alert-card strong,
.email-alert-card p,
.email-alert-card small,
.email-alert-card span,
.email-recipient-grid,
.email-recipient-grid section,
.email-recipient-grid label,
.email-recipient-grid input,
.email-recipient-grid select {
  min-width: 0;
  overflow-wrap: anywhere;
}

.compact-heading {
  margin-bottom: 12px;
}

.group-mapping-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inline-admin-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(160px, 1fr) auto;
  gap: 8px;
  min-width: 360px;
}

.inline-admin-form input {
  min-height: 38px;
}

.result-box {
  margin-top: 16px;
  padding: 14px;
  color: var(--muted);
  white-space: pre-wrap;
}

.state-banner,
.empty-state {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(216, 170, 84, 0.06);
}

.mobile-nav {
  display: none;
}

.telegram-welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(14px);
}

.telegram-welcome-card {
  width: 100%;
  max-width: min(420px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(23, 21, 17, 0.98), rgba(8, 8, 7, 0.98));
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}

.telegram-welcome-card h3 {
  margin-bottom: 12px;
  color: var(--gold-strong);
}

.telegram-welcome-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.65;
}

.telegram-welcome-card .secondary-button {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    padding: 20px 16px 88px;
  }

  .topbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .shell-status {
    justify-content: flex-start;
  }

  .metric-grid,
  .running-grid,
  .section-grid,
  .audit-summary-grid,
    .action-grid,
    .ops-grid,
    .sandbox-grid,
    .sandbox-status-grid,
    .credential-vault-grid,
    .email-recipient-grid,
    .email-alert-grid,
    .group-mapping-grid,
    .group-mapping-actions,
    .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .risk-detail-card {
    grid-column: span 2;
  }

  .mobile-nav {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: rgba(7, 7, 7, 0.96);
    box-shadow: var(--shadow);
  }

  .mobile-nav-item {
    min-height: 42px;
    padding: 0;
    text-align: center;
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .audit-filter-bar,
  .audit-record-main {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .login-panel {
    padding: 24px;
  }

  .corewatcher-login-panel {
    padding: 0;
    margin: 0;
    border-radius: 18px;
  }

  .login-view {
    padding: 16px 12px;
  }

  .corewatcher-hero {
    order: 2;
    padding: 30px 22px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .corewatcher-auth-card {
    order: 1;
    padding: 30px 22px;
  }

  .login-language-switch {
    top: 12px;
    right: 12px;
  }

  .corewatcher-login-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .corewatcher-hero,
  .corewatcher-auth-card {
    padding: 18px;
  }

  .corewatcher-wordmark {
    align-items: flex-start;
  }

  .core-pulse-login {
    min-height: 160px;
  }

  .ring-one {
    width: 156px;
    height: 156px;
  }

  .ring-two {
    width: 108px;
    height: 108px;
  }

  .pulse-core {
    width: 54px;
    height: 54px;
  }

  .telegram-welcome-card {
    padding: 22px;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 24px;
  }

  .metric-grid,
  .running-grid,
  .section-grid,
  .audit-summary-grid,
  .audit-filter-bar,
  .audit-record-main,
    .action-grid,
    .ops-grid,
    .sandbox-grid,
    .sandbox-status-grid,
    .credential-vault-grid,
    .email-recipient-grid,
    .email-alert-grid,
    .group-mapping-grid,
    .group-mapping-actions,
    .form-grid {
    grid-template-columns: 1fr;
  }

  .risk-detail-card {
    grid-column: auto;
  }

  .approval-card {
    grid-template-columns: 1fr;
  }

  .approval-actions {
    justify-content: stretch;
  }

  .approval-actions button,
  .reject-control,
  .report-link {
    width: 100%;
  }

  .report-card {
    grid-template-columns: 1fr;
  }

  .inline-admin-form {
    grid-template-columns: 1fr;
    min-width: 220px;
  }
}

/* ============================================================
   Light theme — base tokens + login page
   ============================================================ */

html[data-theme="light"] {
  --bg: #eef2f8;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.2);
  --gold: #a97e2f;
  --gold-strong: #8a6420;
  --text: #0f172a;
  --muted: #5b6a80;
  --danger: #dc2626;
  --ok: #0f9d6a;
  --info: #2f6fe4;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 20% 0%, rgba(226, 192, 126, 0.18), transparent 34%),
    linear-gradient(145deg, #f7f9fc 0%, #eef2f8 50%, #f4f6fa 100%);
  color: var(--text);
}

html[data-theme="light"] .login-view {
  background:
    radial-gradient(1100px 560px at 14% -10%, rgba(59, 130, 246, 0.1), transparent 60%),
    radial-gradient(900px 520px at 88% -6%, rgba(226, 192, 126, 0.18), transparent 55%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f8 45%, #f4f6fa 100%);
}

html[data-theme="light"] .login-panel {
  border-color: rgba(15, 23, 42, 0.1);
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
}

html[data-theme="light"] .corewatcher-login-panel {
  border-color: rgba(15, 23, 42, 0.08);
  background:
    radial-gradient(circle at 16% 12%, rgba(36, 204, 255, 0.1), transparent 32%),
    radial-gradient(circle at 82% 10%, rgba(226, 192, 126, 0.18), transparent 34%),
    linear-gradient(180deg, #ffffff, #f7f9fc);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

html[data-theme="light"] .corewatcher-hero {
  border-right-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .core-pulse-login {
  background:
    radial-gradient(circle, rgba(36, 204, 255, 0.16), transparent 46%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.03), rgba(15, 23, 42, 0.008));
}

html[data-theme="light"] .pulse-ring {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 34px rgba(59, 130, 246, 0.14);
}

html[data-theme="light"] .ring-two {
  border-color: rgba(169, 126, 47, 0.42);
}

html[data-theme="light"] .corewatcher-security-badges span {
  border-color: rgba(15, 23, 42, 0.1);
  color: #334155;
  background: #ffffff;
}

html[data-theme="light"] .corewatcher-security-note {
  color: #5b6a80;
}

html[data-theme="light"] input,
html[data-theme="light"] select {
  color: #0f172a;
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.16);
}

html[data-theme="light"] .language-switch {
  border-color: rgba(15, 23, 42, 0.1);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .language-switch button {
  color: #5b6a80;
}

html[data-theme="light"] .language-switch button.active {
  color: #ffffff;
  background: linear-gradient(180deg, #6fa8ff, #3d7aff);
}

html[data-theme="light"] .eyebrow {
  color: #a97e2f;
}

html[data-theme="light"] .state-line {
  color: #5b6a80;
}
