:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-alt: #eef3f8;
  --line: #d9e2ec;
  --line-strong: #b9c7d6;
  --text: #14213d;
  --muted: #5f6f81;
  --soft: #7e8ea3;
  --accent: #0f6cbd;
  --accent-strong: #0b4f8a;
  --accent-soft: #dfeefe;
  --success-soft: #e8f7ef;
  --danger-soft: #fdeaea;
  --shadow-lg: 0 30px 80px rgba(15, 35, 64, 0.12);
  --shadow-md: 0 16px 40px rgba(15, 35, 64, 0.1);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

html {
  font-size: 15px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 108, 189, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(20, 33, 61, 0.08), transparent 24%),
    linear-gradient(180deg, #f7f9fc 0%, #eff4f9 100%);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

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

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 290px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 22px;
  background: rgba(20, 33, 61, 0.96);
  color: #f8fbff;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 18px 0 48px rgba(11, 22, 40, 0.16);
  z-index: 20;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.app-brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #7fc8f8 0%, #0f6cbd 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.app-brand-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.app-brand-subtitle,
.app-nav-group-label,
.sidebar-status-label,
.app-eyebrow,
.section-kicker,
.page-note,
.metric-label,
.panel-kicker,
.empty-note {
  color: var(--soft);
  letter-spacing: 0.04em;
}

.app-brand-subtitle,
.app-nav-group-label,
.sidebar-status-label,
.app-eyebrow,
.section-kicker,
.panel-kicker {
  text-transform: uppercase;
  font-size: 0.72rem;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-nav-group-label {
  margin: 18px 10px 8px;
  color: rgba(255, 255, 255, 0.55);
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.82);
  transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.app-nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(3px);
}

.app-nav-link.active {
  background: linear-gradient(135deg, rgba(127, 200, 248, 0.22), rgba(15, 108, 189, 0.35));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.app-nav-icon {
  min-width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  font-weight: 700;
}

.app-sidebar-footer {
  margin-top: auto;
}

.sidebar-status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.92rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #56d364;
  box-shadow: 0 0 0 6px rgba(86, 211, 100, 0.12);
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 24px 24px 32px;
}

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

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-page-title {
  margin: 0;
  font-size: clamp(1.6rem, 1.8vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-chip {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid rgba(15, 108, 189, 0.12);
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

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

.app-content {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sidebar-toggle {
  width: 48px;
  height: 48px;
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-md);
}

.sidebar-toggle span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.app-overlay {
  display: none;
}

.page-hero,
.surface-panel,
.metrics-grid > .metric-card,
.feature-card,
.preview-section,
.empty-state {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(185, 199, 214, 0.55);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}

.page-hero {
  border-radius: var(--radius-xl);
  padding: 34px;
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 26px;
}

.hero-title {
  margin: 10px 0 12px;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero-copy,
.section-description,
.panel-description,
.page-note,
.metric-note,
.empty-note,
.form-hint {
  color: var(--muted);
}

.hero-actions,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-sidebar {
  display: grid;
  gap: 14px;
}

.hero-info-card,
.feature-card,
.metric-card,
.surface-panel,
.preview-section,
.empty-state {
  border-radius: var(--radius-lg);
}

.hero-info-card {
  padding: 18px;
  background: linear-gradient(180deg, rgba(15, 108, 189, 0.08), rgba(255, 255, 255, 0.88));
  border: 1px solid rgba(15, 108, 189, 0.1);
}

.info-value {
  display: block;
  margin-top: 8px;
  font-size: 1.4rem;
  font-weight: 700;
}

.info-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.metrics-grid,
.feature-grid,
.content-grid {
  display: grid;
  gap: 18px;
}

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

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

.metric-card,
.feature-card {
  padding: 22px;
}

.metric-value {
  margin-top: 8px;
  font-size: 2rem;
  font-weight: 700;
}

.feature-title,
.section-title,
.panel-title,
.preview-section h6 {
  margin: 8px 0 8px;
  font-weight: 700;
}

.surface-panel {
  padding: 24px;
}

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

.content-grid {
  grid-template-columns: 1.4fr 0.9fr;
}

.quick-links {
  display: grid;
  gap: 12px;
}

.quick-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-alt);
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.quick-link:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 108, 189, 0.35);
  background: #f7fbff;
}

.quick-link strong {
  display: block;
}

.quick-link span:last-child {
  color: var(--muted);
}

.action-card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-alt);
}

.btn-app-primary,
.btn-app-secondary,
.btn-app-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn-app-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #3893d8 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(15, 108, 189, 0.28);
}

.btn-app-secondary {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

.btn-app-ghost {
  background: transparent;
  border-color: rgba(15, 108, 189, 0.25);
  color: var(--accent-strong);
}

.btn-app-primary:hover {
  box-shadow: 0 4px 10px rgba(15, 108, 189, 0.35);
  transform: translateY(-1px);
}

.btn-app-secondary:hover,
.btn-app-ghost:hover {
  transform: translateY(-1px);
}

.status-alert {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-weight: 500;
}

.status-alert.success {
  background: var(--success-soft);
  border-color: #b7e3c5;
  color: #1d6a3a;
}

.status-alert.error {
  background: var(--danger-soft);
  border-color: #f1bcbc;
  color: #8b2b2b;
}

.import-form {
  display: grid;
  gap: 18px;
}

.form-surface,
.info-surface {
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff 0%, #f2f7fb 100%);
}

.field-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.92rem;
  font-weight: 600;
}

.app-textarea,
.app-input,
.preview-section .form-control {
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.app-textarea,
.app-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 0.98rem;
}

.app-textarea {
  min-height: 320px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.55;
}

.app-textarea:focus,
.app-input:focus,
.preview-section .form-control:focus {
  border-color: rgba(15, 108, 189, 0.42);
  box-shadow: 0 0 0 0.3rem rgba(15, 108, 189, 0.12);
  outline: 0;
}

.helper-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.preview-grid {
  display: grid;
  gap: 18px;
}

.preview-section {
  padding: 22px;
}

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

.preview-section .section-heading h6 {
  margin: 0;
  font-size: 1rem;
}

.preview-section .badge-soft {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.preview-section .form-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.preview-section .form-control {
  min-height: 46px;
}

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

.app-table-wrap {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.app-table {
  margin: 0;
  vertical-align: middle;
}

.app-table thead th {
  background: #eff5fb;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.app-table tbody tr:hover {
  background: #f8fbfe;
}

.record-name {
  font-weight: 700;
}

.record-subtle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.tag-soft {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #edf4fb;
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.empty-state {
  padding: 42px 28px;
  text-align: center;
}

.privacy-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.15fr 0.85fr;
}

.policy-points {
  display: grid;
  gap: 14px;
}

.policy-point {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-alt);
}

.error-card {
  max-width: 840px;
}

.error-code {
  display: inline-block;
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: #8b2b2b;
  font-size: 0.8rem;
  font-weight: 700;
}

.request-id {
  padding: 14px 16px;
  border-radius: 14px;
  background: #f5f8fc;
  border: 1px solid var(--line);
}

.pdf-loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 18, 33, 0.42);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
}

.pdf-loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.pdf-loading-card {
  width: min(420px, 100%);
  padding: 28px 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 60px rgba(15, 35, 64, 0.18);
  text-align: center;
}

.pdf-loading-spinner {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 4px solid rgba(15, 108, 189, 0.14);
  border-top-color: var(--accent);
  animation: pdf-spin 0.8s linear infinite;
}

.pdf-loading-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
}

.pdf-loading-copy {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

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

@media (max-width: 1199px) {
  .page-hero,
  .content-grid,
  .privacy-grid,
  .feature-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    width: min(300px, calc(100vw - 36px));
  }

  .app-body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 24, 43, 0.42);
    z-index: 15;
  }

  .app-body.sidebar-open .app-overlay {
    display: block;
  }

  .app-main {
    width: 100%;
    padding: 18px 16px 24px;
  }

  .app-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .app-topbar-right {
    justify-content: flex-start;
  }

  .page-hero,
  .surface-panel,
  .preview-section,
  .metric-card,
  .feature-card,
  .empty-state {
    padding: 20px;
  }
}

@media (max-width: 767px) {
  html {
    font-size: 14px;
  }

  .hero-title {
    line-height: 1.05;
  }

  .hero-actions,
  .page-actions,
  .list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
