@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --shell-bg: #f3f6fb;
  --shell-bg-soft: #fbfcff;
  --shell-panel: rgba(255, 255, 255, 0.94);
  --shell-panel-strong: #ffffff;
  --shell-border: rgba(42, 60, 92, 0.08);
  --shell-border-strong: rgba(42, 60, 92, 0.14);
  --shell-text: #3b4a66;
  --shell-heading: #22314d;
  --shell-muted: #75839a;
  --shell-brand: #4c68a8;
  --shell-brand-strong: #21365e;
  --shell-brand-soft: rgba(76, 104, 168, 0.1);
  --shell-highlight: #5f7ec3;
  --shell-highlight-soft: rgba(95, 126, 195, 0.12);
  --shell-success: #218460;
  --shell-danger: #cc5757;
  --shell-shadow: 0 28px 72px rgba(28, 39, 64, 0.08);
  --shell-radius-xl: 32px;
  --shell-radius-lg: 24px;
  --shell-radius-md: 18px;
  --shell-radius-sm: 14px;
  --shell-font: 'Manrope', 'Noto Sans SC', system-ui, sans-serif;
  --shell-code: 'JetBrains Mono', monospace;
}

body.ui-shell-body {
  min-height: 100vh;
  font-family: var(--shell-font);
  color: var(--shell-text);
  background:
    radial-gradient(circle at top left, rgba(95, 126, 195, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(76, 104, 168, 0.08), transparent 30%),
    linear-gradient(180deg, #fbfcff 0%, #f5f7fb 48%, #edf1f7 100%);
  background-attachment: fixed;
  position: relative;
}

body.ui-shell-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.44) 1px, transparent 1px);
  background-size: 100% 24px;
  opacity: 0.35;
  pointer-events: none;
}

body.ui-shell-body .container {
  max-width: 1240px;
  padding: 32px 24px 64px;
  position: relative;
  z-index: 1;
}

body.ui-shell-body .header {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 253, 0.96));
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-xl);
  box-shadow: var(--shell-shadow);
  color: var(--shell-text);
  padding: 30px;
  margin-bottom: 18px;
  align-items: flex-start;
}

body.ui-shell-body .header::before {
  content: none;
}

body.ui-shell-body .header h1 {
  color: var(--shell-heading);
  font-family: var(--shell-font);
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
  margin-bottom: 12px;
  text-shadow: none;
}

body.ui-shell-body .subtitle {
  color: var(--shell-muted);
  font-size: 15px;
  font-family: var(--shell-font);
  margin-bottom: 8px;
}

body.ui-shell-body .muted {
  color: var(--shell-muted);
}

body.ui-shell-body .header .muted {
  font-size: 13px;
}

body.ui-shell-body .header-actions {
  gap: 10px;
}

body.ui-shell-body .link-btn,
body.ui-shell-body .ghost-btn,
body.ui-shell-body .primary,
body.ui-shell-body .menu-btn,
body.ui-shell-body .card-btn,
body.ui-shell-body .btn,
body.ui-shell-body .entry-btn,
body.ui-shell-body .fb-btn,
body.ui-shell-body .filter-btn,
body.ui-shell-body .btn-primary,
body.ui-shell-body .btn-muted,
body.ui-shell-body .btn-danger {
  border-radius: 999px;
  font-family: var(--shell-font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

body.ui-shell-body .link-btn,
body.ui-shell-body .ghost-btn,
body.ui-shell-body .card-btn,
body.ui-shell-body .btn,
body.ui-shell-body .entry-btn,
body.ui-shell-body .filter-btn {
  background: rgba(255, 255, 255, 0.82);
  color: var(--shell-brand-strong);
  border: 1px solid var(--shell-border-strong);
  box-shadow: 0 10px 24px rgba(28, 39, 64, 0.05);
}

body.ui-shell-body .link-btn:hover,
body.ui-shell-body .ghost-btn:hover,
body.ui-shell-body .card-btn:hover,
body.ui-shell-body .btn:hover,
body.ui-shell-body .entry-btn:hover,
body.ui-shell-body .filter-btn:hover,
body.ui-shell-body .fb-btn:hover,
body.ui-shell-body .menu-btn:hover,
body.ui-shell-body .primary:hover,
body.ui-shell-body .btn-primary:hover,
body.ui-shell-body .btn-muted:hover,
body.ui-shell-body .btn-danger:hover {
  transform: translateY(-1px);
}

body.ui-shell-body .primary,
body.ui-shell-body .convert-btn.primary,
body.ui-shell-body .btn.btn-primary,
body.ui-shell-body .btn-primary,
body.ui-shell-body .btn[type='submit'] {
  background: linear-gradient(135deg, #6f8fd7, #4c68a8);
  color: #ffffff;
  border: 1px solid transparent;
  box-shadow: 0 16px 30px rgba(76, 104, 168, 0.24);
}

body.ui-shell-body .link-btn,
body.ui-shell-body .ghost-btn,
body.ui-shell-body .card-btn {
  color: var(--shell-brand-strong);
}

body.ui-shell-body .btn.btn-muted,
body.ui-shell-body .btn-muted {
  background: var(--shell-brand-soft);
  color: var(--shell-brand-strong);
  border-color: rgba(76, 104, 168, 0.18);
}

body.ui-shell-body .btn.btn-danger,
body.ui-shell-body .btn-danger,
body.ui-shell-body .entry-btn.entry-btn-del {
  background: rgba(204, 87, 87, 0.12);
  color: var(--shell-danger);
  border-color: rgba(204, 87, 87, 0.18);
}

body.ui-shell-body .top-tabs {
  padding: 8px;
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--shell-border);
  border-radius: 999px;
  box-shadow: 0 14px 30px rgba(28, 39, 64, 0.06);
}

body.ui-shell-body .menu-btn {
  background: transparent;
  color: var(--shell-muted);
  border: 1px solid transparent;
  padding: 10px 16px;
}

body.ui-shell-body .menu-btn.active {
  background: var(--shell-brand-soft);
  color: var(--shell-brand-strong);
  border-color: rgba(76, 104, 168, 0.18);
  box-shadow: none;
}

body.ui-shell-body .content,
body.ui-shell-body .grid-2 {
  gap: 18px;
}

body.ui-shell-body .card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-lg);
  padding: 24px;
  box-shadow: 0 18px 44px rgba(28, 39, 64, 0.07);
}

body.ui-shell-body .card:hover {
  border-color: var(--shell-border-strong);
}

body.ui-shell-body .card h3,
body.ui-shell-body .card h4 {
  color: var(--shell-heading);
  font-family: var(--shell-font);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-transform: none;
}

body.ui-shell-body textarea,
body.ui-shell-body input,
body.ui-shell-body select {
  background: #fcfdff;
  border: 1px solid rgba(42, 60, 92, 0.14);
  border-radius: 16px;
  color: var(--shell-heading);
  font-family: var(--shell-font);
  font-size: 14px;
  box-shadow: inset 0 1px 2px rgba(28, 39, 64, 0.04);
}

body.ui-shell-body textarea:focus,
body.ui-shell-body input:focus,
body.ui-shell-body select:focus {
  border-color: rgba(76, 104, 168, 0.42);
  box-shadow: 0 0 0 4px rgba(76, 104, 168, 0.1);
}

body.ui-shell-body label {
  display: block;
  margin-bottom: 8px;
  color: var(--shell-muted);
  font-family: var(--shell-font);
  font-size: 13px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

body.ui-shell-body .mono-textarea,
body.ui-shell-body .entry-code,
body.ui-shell-body .modal-pre {
  font-family: var(--shell-code);
  color: #314158;
}

body.ui-shell-body .notes-box,
body.ui-shell-body .feedback-bar,
body.ui-shell-body .dispute-panel {
  background: #f7faff;
  border: 1px solid var(--shell-border);
  border-radius: 18px;
  padding: 14px 16px;
}

body.ui-shell-body .feedback-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

body.ui-shell-body .fb-btn {
  background: #fff;
  color: var(--shell-heading);
  border: 1px solid var(--shell-border-strong);
  padding: 8px 14px;
  cursor: pointer;
}

body.ui-shell-body .fb-btn.fb-approve {
  background: rgba(33, 132, 96, 0.1);
  color: var(--shell-success);
  border-color: rgba(33, 132, 96, 0.16);
}

body.ui-shell-body .fb-btn.fb-dispute,
body.ui-shell-body .fb-btn.fb-dispute-submit {
  background: rgba(204, 87, 87, 0.1);
  color: var(--shell-danger);
  border-color: rgba(204, 87, 87, 0.14);
}

body.ui-shell-body .fb-btn.fb-dispute-cancel {
  background: rgba(255, 255, 255, 0.82);
  color: var(--shell-muted);
}

body.ui-shell-body .fb-status,
body.ui-shell-body .convert-status,
body.ui-shell-body .dispute-hint,
body.ui-shell-body .modal-status,
body.ui-shell-body .entry-meta,
body.ui-shell-body .hint,
body.ui-shell-body .error {
  font-family: var(--shell-font);
}

body.ui-shell-body .convert-status,
body.ui-shell-body .fb-status,
body.ui-shell-body .modal-status,
body.ui-shell-body .entry-meta,
body.ui-shell-body .hint {
  color: var(--shell-muted);
}

body.ui-shell-body .error {
  color: var(--shell-danger);
}

.console-shell,
.page-shell {
  position: relative;
  z-index: 1;
}

.console-kicker,
.page-kicker,
.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--shell-brand-soft);
  color: var(--shell-brand-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.console-hero h1 {
  max-width: none;
}

.page-layout {
  align-items: start;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  position: relative;
  z-index: 1;
}

.auth-stage {
  width: min(1040px, 100%);
  display: block;
  position: relative;
}

.auth-panel,
.auth-copy {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(245, 248, 253, 0.94));
  border: 1px solid var(--shell-border);
  border-radius: 30px;
  padding: 34px;
  box-shadow: var(--shell-shadow);
}

.auth-panel,
.auth-copy {
  min-height: 540px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}

.auth-panel::after,
.auth-copy::after {
  content: '';
  position: absolute;
  right: -18%;
  bottom: -22%;
  width: 58%;
  aspect-ratio: 1;
  border: 1px solid rgba(76, 104, 168, 0.14);
  border-radius: 36px;
  transform: rotate(18deg);
  background:
    linear-gradient(135deg, rgba(76, 104, 168, 0.08), transparent 54%),
    repeating-linear-gradient(90deg, rgba(76, 104, 168, 0.08) 0 1px, transparent 1px 18px);
  pointer-events: none;
}

.auth-panel h1,
.auth-copy h1 {
  color: var(--shell-heading);
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
  margin-bottom: 18px;
}

.auth-lead {
  color: var(--shell-muted);
  font-size: 17px;
  line-height: 1.7;
  max-width: 34rem;
  margin-bottom: 26px;
}

.auth-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--shell-brand-soft);
  border: 1px solid rgba(76, 104, 168, 0.18);
  color: var(--shell-brand-strong);
  font-size: 13px;
  font-weight: 700;
}

.auth-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  position: relative;
  z-index: 1;
}

.auth-metric {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--shell-border);
  border-radius: 22px;
  padding: 18px;
  backdrop-filter: blur(10px);
}

.auth-metric strong {
  display: block;
  color: var(--shell-brand-strong);
  font-size: 26px;
  line-height: 1;
  margin-bottom: 10px;
}

.auth-metric span {
  color: var(--shell-muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-login-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 8px 0 28px;
  padding: 18px;
  border: 1px solid var(--shell-border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 34px rgba(28, 39, 64, 0.06);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}

.auth-login-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--shell-heading);
  font-size: 16px;
  font-weight: 800;
}

.auth-login-copy::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--shell-brand);
  box-shadow: 0 0 0 5px rgba(76, 104, 168, 0.12);
  flex: 0 0 auto;
}

.auth-login-btn {
  width: 100%;
  margin-top: 4px;
  padding: 15px 18px;
  background: linear-gradient(135deg, #6f8fd7, #4c68a8);
  color: #ffffff;
  border: 0;
  box-shadow: 0 16px 30px rgba(76, 104, 168, 0.24);
}

.auth-login-btn {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 20px 42px rgba(76, 104, 168, 0.28);
}

.auth-login-btn::after {
  content: '→';
  margin-left: 10px;
  font-family: var(--shell-font);
  font-weight: 800;
}

.auth-login-panel .auth-login-btn {
  width: auto;
  min-width: 176px;
  flex: 0 0 176px;
  margin-top: 0;
}

.workspace-frame .card {
  min-height: 100%;
}

.workspace-frame .card .header-actions {
  justify-content: flex-start;
}

.corpus-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-label {
  color: var(--shell-muted);
  font-size: 13px;
  font-weight: 700;
}

body.ui-shell-body .filter-btn {
  padding: 9px 14px;
  color: var(--shell-muted);
}

body.ui-shell-body .filter-btn.active {
  background: var(--shell-brand-soft);
  color: var(--shell-brand-strong);
  border-color: rgba(29, 125, 168, 0.22);
  font-weight: 700;
}

.corpus-count {
  color: var(--shell-brand-strong);
  font-size: 13px;
  font-weight: 800;
}

.corpus-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.corpus-loading,
.corpus-empty,
.corpus-error {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--shell-border);
  border-radius: 22px;
  padding: 22px;
  color: var(--shell-muted);
}

.corpus-entry {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--shell-border);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 16px 34px rgba(44, 54, 74, 0.08);
}

.entry-header,
.entry-header-right,
.entry-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.entry-header {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge-approved {
  background: rgba(33, 132, 96, 0.1);
  color: var(--shell-success);
}

.badge-disputed {
  background: rgba(204, 87, 87, 0.1);
  color: var(--shell-danger);
}

.badge-mode {
  background: rgba(29, 125, 168, 0.1);
  color: var(--shell-brand-strong);
}

.entry-section {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.entry-section-label {
  color: var(--shell-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.entry-no-correction {
  text-transform: none;
  letter-spacing: 0;
}

.entry-code,
.modal-pre {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 260px;
  background: #f8fbff;
  border: 1px solid var(--shell-border);
  border-radius: 16px;
  padding: 14px;
}

.modal-overlay,
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 40;
  background: rgba(39, 48, 63, 0.32);
  backdrop-filter: blur(14px);
}

.modal {
  display: none;
}

.modal.show {
  display: grid;
  place-items: center;
}

.modal-box,
.modal-body {
  width: min(720px, 92vw);
  background: var(--shell-panel-strong);
  border: 1px solid var(--shell-border);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shell-shadow);
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.modal-title {
  color: var(--shell-heading);
  font-size: 24px;
  margin-bottom: 8px;
}

.modal-label {
  color: var(--shell-muted);
}

.modal-actions {
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--shell-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(56, 76, 104, 0.1);
  font-size: 14px;
}

th {
  color: var(--shell-muted);
  background: rgba(248, 242, 233, 0.88);
  font-family: var(--shell-font);
  font-size: 13px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.role-badge.root {
  background: rgba(242, 166, 73, 0.12);
  color: #a76314;
  border: 1px solid rgba(242, 166, 73, 0.22);
}

.role-badge.user {
  background: rgba(29, 125, 168, 0.1);
  color: var(--shell-brand-strong);
  border: 1px solid rgba(29, 125, 168, 0.18);
}

.msg {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
}

.msg.ok {
  background: rgba(33, 132, 96, 0.1);
  color: var(--shell-success);
}

.msg.err {
  background: rgba(204, 87, 87, 0.1);
  color: var(--shell-danger);
}

.model-row {
  background: #f8fbff;
  border: 1px solid var(--shell-border);
  border-radius: 18px;
  padding: 18px;
}

.model-name {
  color: var(--shell-heading);
  font-family: var(--shell-font);
  font-size: 16px;
}

.model-meta {
  color: var(--shell-muted);
  font-family: var(--shell-font);
  font-size: 13px;
}

@media (max-width: 980px) {
  .auth-stage,
  .auth-metrics,
  body.ui-shell-body .header,
  body.ui-shell-body .grid-2 {
    grid-template-columns: 1fr;
  }

  .console-hero h1,
  .page-hero h1 {
    max-width: none;
  }

  body.ui-shell-body .header-actions {
    justify-content: flex-start;
  }

  .entry-header {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  body.ui-shell-body .container,
  .auth-shell {
    padding: 20px 16px 40px;
  }

  body.ui-shell-body .header,
  .auth-panel,
  .auth-copy,
  body.ui-shell-body .card,
  .modal-box,
  .modal-body,
  .corpus-entry {
    padding: 20px;
    border-radius: 22px;
  }

  body.ui-shell-body .top-tabs {
    flex-wrap: wrap;
    border-radius: 22px;
  }

  body.ui-shell-body .menu-btn,
  body.ui-shell-body .link-btn,
  body.ui-shell-body .ghost-btn,
  body.ui-shell-body .primary,
  body.ui-shell-body .btn,
  body.ui-shell-body .entry-btn,
  body.ui-shell-body .fb-btn,
  body.ui-shell-body .filter-btn {
    width: 100%;
    justify-content: center;
  }

  .filter-group,
  .auth-chips,
  .header-actions,
  .modal-actions,
  .entry-header-right,
  .entry-badges {
    width: 100%;
  }

  .auth-login-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-login-panel .auth-login-btn {
    width: 100%;
    flex: 0 0 auto;
    min-width: 0;
  }
}
