:root {
  --bg: #09111d;
  --bg-2: #111d2f;
  --panel: rgba(12, 22, 38, 0.92);
  --panel-2: rgba(18, 31, 52, 0.94);
  --panel-3: rgba(12, 18, 28, 0.88);
  --border: rgba(164, 188, 222, 0.18);
  --border-strong: rgba(164, 188, 222, 0.28);
  --text: #eef5ff;
  --muted: #a4b2cf;
  --accent: #8cc9ff;
  --accent-2: #57a2ff;
  --accent-warm: #f6cb73;
  --success: #73e4b0;
  --danger: #ffadad;
  --warning: #ffd674;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(140, 201, 255, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(246, 203, 115, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
}

body {
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.2), black 24%, black 76%, rgba(0, 0, 0, 0.2));
}

.app-shell {
  display: grid;
  grid-template-columns: 400px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(10, 16, 26, 0.94), rgba(11, 20, 34, 0.9));
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
}

.sidebar::after {
  content: "";
  position: absolute;
  top: 24px;
  right: 24px;
  width: 88px;
  height: 88px;
  border-radius: 28px;
  background: radial-gradient(circle at 30% 30%, rgba(140, 201, 255, 0.24), transparent 70%);
  filter: blur(4px);
  pointer-events: none;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 8px 0;
  line-height: 1.05;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 26px;
}

h3 {
  font-size: 20px;
}

.muted {
  color: var(--muted);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 2px 0 4px;
  color: var(--text);
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent-2);
}

.checkbox-row span {
  line-height: 1.3;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(140, 201, 255, 0.16);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
  min-height: 220px;
}

.provider-status-card,
.account-card,
.sidebar-card,
.detail-card,
.preview-panel,
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.provider-status-card,
.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}

.account-name {
  font-size: 18px;
  font-weight: 700;
}

.account-access {
  font-size: 13px;
}

.provider-status-label,
.card-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.provider-status-label {
  margin-bottom: 6px;
}

.provider-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.provider-openai {
  color: var(--accent);
  background: rgba(140, 201, 255, 0.14);
}

.provider-gemini {
  color: var(--success);
  background: rgba(115, 228, 176, 0.14);
}

.provider-loading,
.provider-unknown {
  color: var(--warning);
  background: rgba(255, 214, 116, 0.12);
}

.provider-model {
  font-size: 13px;
  text-align: right;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--accent-warm), #d9a73f);
  color: #14120d;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, filter 140ms ease, opacity 140ms ease;
}

button:hover,
.button:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

button:disabled,
.button.disabled,
.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.small-button {
  padding: 10px 12px;
}

.sidebar-card,
.detail-card {
  padding: 16px;
}

.empty-state-card {
  border-style: dashed;
}

.hidden {
  display: none !important;
}

#status-box {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
}

.main-pane {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

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

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 420px);
  gap: 18px;
  min-height: calc(100vh - 420px);
}

.preview-panel {
  position: relative;
  overflow: hidden;
  min-height: 640px;
}

.preview-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(9, 17, 29, 0.72), rgba(9, 17, 29, 0.82));
  backdrop-filter: blur(8px);
  text-align: left;
}

.preview-loading-spinner {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  animation: preview-spin 0.85s linear infinite;
  flex: 0 0 auto;
}

.preview-loading-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-loading-title {
  color: var(--text);
  font-weight: 700;
}

.preview-loading-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

@keyframes preview-spin {
  to {
    transform: rotate(360deg);
  }
}

#pdf-frame {
  width: 100%;
  height: 100%;
  min-height: 720px;
  border: 0;
  background: white;
}

.details-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rich-text b {
  color: var(--text);
}

.skills-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skill-row {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.audit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.audit-pill.success {
  color: var(--success);
}

.audit-pill.danger,
.error-text {
  color: var(--danger);
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 460px;
}

.login-card {
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: auto -20% 70% auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(140, 201, 255, 0.22), transparent 68%);
}

.login-copy,
.login-status {
  margin-bottom: 18px;
}

.login-form {
  position: relative;
  z-index: 1;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .content-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .sidebar,
  .main-pane,
  .login-body {
    padding: 18px;
  }

  .preview-toolbar,
  .provider-status-card,
  .account-card {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    font-size: 28px;
  }
}
