:root {
  --bg: #eef3f8;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe4ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #14b8a6;
  --warning: #f59e0b;
  --danger: #ef4444;
  --success: #22c55e;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  --radius: 24px;
  --sidebar: #0b1220;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(37, 99, 235, 0.18), transparent 32%),
    radial-gradient(circle at 95% 12%, rgba(20, 184, 166, 0.18), transparent 30%),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.access-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(11, 18, 32, 0.94), rgba(17, 24, 39, 0.86)),
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.48), transparent 36%);
}

.access-card {
  width: min(520px, 100%);
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(24px);
}

.access-card h1 {
  margin: 10px 0 12px;
  font-size: clamp(36px, 6vw, 58px);
  letter-spacing: -0.05em;
}

.access-card .muted {
  color: rgba(255, 255, 255, 0.76);
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 26px 0;
}

.access-grid span {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #3b82f6, #14b8a6);
  color: white;
  font-weight: 900;
  letter-spacing: -0.08em;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98)),
    var(--sidebar);
  color: white;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px 24px;
}

.sidebar-brand strong {
  display: block;
  font-size: 17px;
}

.sidebar-brand span {
  display: block;
  color: #94a3b8;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  color: #cbd5e1;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.15);
}

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

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

.topbar h2,
.panel h3,
.hero-panel h1 {
  margin: 0;
  letter-spacing: -0.04em;
}

.topbar h2 {
  font-size: 30px;
}

.topbar-actions,
.hero-actions,
.table-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.tiny {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  font-weight: 750;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.66);
}

.btn.small {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 13px;
}

.btn.full {
  width: 100%;
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 18px;
  background: rgba(37, 99, 235, 0.08);
  color: #1e3a8a;
}

.notice.error {
  border-color: rgba(239, 68, 68, 0.18);
  background: rgba(239, 68, 68, 0.08);
  color: #991b1b;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.hero-panel,
.panel {
  border: 1px solid rgba(219, 228, 239, 0.86);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  margin-bottom: 20px;
  padding: 30px;
  display: flex;
  justify-content: space-between;
  gap: 22px;
}

.hero-panel h1 {
  max-width: 780px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 0.98;
}

.panel {
  padding: 22px;
}

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

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

.metric {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-strong);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  letter-spacing: -0.06em;
}

.two-col,
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.form-panel,
.settings-panel {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 760;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.stack {
  display: grid;
  gap: 12px;
}

.item-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

.item-card h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.item-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.chip-board {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.chip small {
  color: var(--muted);
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.1);
  color: #0f766e;
  font-size: 12px;
  font-weight: 850;
}

.pill.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

.wizard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wizard-summary,
.form-actions {
  grid-column: 1 / -1;
}

.wizard-summary {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.wizard-summary h4 {
  margin: 0 0 8px;
}

.wizard-summary ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.log-box,
.empty {
  padding: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
  color: var(--muted);
  line-height: 1.65;
  white-space: pre-wrap;
}

.quality-row {
  margin-bottom: 14px;
}

.quality-row div:first-child {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.bar {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
}

.bar span {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #475569;
  background: #f8fafc;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tr:hover td {
  background: #f8fbff;
}

.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  font-weight: 900;
}

.status {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.template-grid,
.export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.template-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  display: grid;
  gap: 10px;
}

.export-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

.draft-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.draft-controls .form-actions {
  grid-column: 1 / -1;
}

.draft-summary {
  margin-top: 2px;
}

.draft-card,
.lead-pool-card,
.notification-card {
  overflow-wrap: anywhere;
}

.notification-card.unread {
  border-color: rgba(37, 99, 235, 0.32);
  background: #f8fbff;
}

.warning-text {
  margin-top: 8px !important;
  color: #92400e !important;
  font-weight: 750;
}

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

.toggle-row label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.toggle-row input {
  width: auto;
}

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

.log-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.log-item strong {
  display: block;
}

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

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
}

.modal-card {
  position: relative;
  width: min(980px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  background: white;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: #f1f5f9;
  font-size: 24px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.detail-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.detail-box span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid,
  .two-col,
  .page-grid,
  .template-grid,
  .export-grid,
  .draft-controls,
  .wizard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 16px;
  }

  .hero-panel,
  .topbar,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .nav,
  .access-grid,
  .toggle-row,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .access-card {
    padding: 28px;
  }
}
