:root {
  --bg-1: #f2e6d7;
  --bg-2: #d8c1aa;
  --ink: #231710;
  --ink-soft: #6d5849;
  --card: rgba(255, 248, 240, 0.72);
  --card-strong: rgba(255, 251, 246, 0.92);
  --line: rgba(84, 47, 22, 0.14);
  --accent: #a12d1d;
  --accent-2: #dd7a3f;
  --gold: #e1bf72;
  --shadow: 0 24px 60px rgba(67, 34, 14, 0.16);
  --shadow-soft: 0 14px 30px rgba(67, 34, 14, 0.1);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(225, 191, 114, 0.45), transparent 20%),
    radial-gradient(circle at 88% 12%, rgba(161, 45, 29, 0.16), transparent 24%),
    radial-gradient(circle at 70% 80%, rgba(221, 122, 63, 0.18), transparent 18%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.2), transparent 30%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0, rgba(255, 255, 255, 0.02) 1px, transparent 1px, transparent 120px);
  mix-blend-mode: soft-light;
}

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

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

.site-header,
.hero-shell,
.auth-shell,
.dashboard-shell,
.editor-shell,
.shared-shell,
.profile-shell,
.editor-page {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 26px 0 18px;
}

.brand-wrap {
  display: grid;
  gap: 6px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 18px 35px rgba(161, 45, 29, 0.32);
}

.brand-text {
  font-size: 1.12rem;
  letter-spacing: 0.04em;
}

.brand-subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.nav-actions,
.hero-actions,
.feature-strip,
.dashboard-top,
.note-meta,
.note-footer,
.panel-header,
.form-row,
.report-head,
.tag-row,
.share-heading,
.share-output {
  display: flex;
  gap: 16px;
}

.nav-actions {
  align-items: center;
}

.nav-user,
.pill,
.tag-chip,
.report-stamp,
.security-badge {
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.solid-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.solid-button {
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 48%),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 20px 38px rgba(161, 45, 29, 0.28);
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.solid-button:hover,
.ghost-button:hover,
.scene-card:hover {
  transform: translateY(-2px);
}

.danger {
  color: var(--accent);
}

.wide {
  width: 100%;
}

.scene-card,
.hero-card,
.auth-card,
.note-card,
.empty-card,
.editor-panel,
.preview-panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.18)),
    var(--card);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transform-style: preserve-3d;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.scene-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.25), transparent 35%, transparent 65%, rgba(255, 255, 255, 0.12));
}

.hero-shell,
.auth-shell,
.dashboard-shell,
.shared-shell,
.profile-shell,
.editor-page {
  padding-bottom: 48px;
}

.hero-card {
  padding: 56px;
  margin-top: 12px;
  isolation: isolate;
}

.hero-glow {
  position: absolute;
  right: -40px;
  top: -70px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(225, 191, 114, 0.7), rgba(225, 191, 114, 0));
  filter: blur(8px);
  opacity: 0.9;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Palatino Linotype", serif;
}

.hero-card h1 {
  max-width: 840px;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  line-height: 0.96;
}

.hero-copy,
.muted-copy,
.note-card p,
.auth-card p,
.share-item p {
  color: var(--ink-soft);
}

.hero-copy {
  max-width: 690px;
  font-size: 1.08rem;
  line-height: 1.75;
  margin: 24px 0 0;
}

.hero-actions {
  margin-top: 28px;
}

.feature-strip {
  flex-wrap: wrap;
  margin-top: 36px;
}

.feature-strip article,
.report-stats div,
.share-item,
.share-output,
.share-panel,
.note-card,
.empty-card {
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.feature-strip article {
  min-width: 220px;
  flex: 1;
  padding: 18px;
  border-radius: var(--radius-md);
}

.feature-strip strong,
.note-card h2,
.report-card h2 {
  display: block;
  margin-bottom: 8px;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 120px);
}

.auth-card {
  width: min(560px, 100%);
  padding: 38px;
}

.stack-form,
.editor-form,
.share-form {
  display: grid;
  gap: 18px;
}

.block-toolbar {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.34);
}

.block-toolbar-head {
  display: grid;
  gap: 6px;
}

.block-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.block-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
}

.block-card-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(161, 45, 29, 0.1);
  color: var(--accent);
  font-weight: 700;
  flex: 0 0 auto;
}

.block-card-text {
  text-align: left;
}

.block-card-active {
  border-color: rgba(161, 45, 29, 0.32);
  box-shadow: 0 18px 30px rgba(161, 45, 29, 0.12);
}

.block-card-active .block-card-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.optional-block-hidden,
.preview-hidden {
  display: none !important;
}

.stack-form label,
.editor-form label,
.share-form label,
.share-output label {
  display: grid;
  gap: 8px;
}

input,
textarea,
select {
  width: 100%;
  color: var(--ink);
  border: 1px solid rgba(98, 56, 28, 0.14);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 2px 8px rgba(67, 34, 14, 0.05);
}

input[readonly],
textarea[readonly] {
  background: rgba(251, 247, 241, 0.95);
}

textarea {
  resize: vertical;
}

.flash-error,
.flash-success {
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: 16px;
}

.flash-error {
  color: #76180d;
  background: rgba(161, 45, 29, 0.12);
  border: 1px solid rgba(161, 45, 29, 0.18);
}

.flash-success {
  color: #1a5e3e;
  background: rgba(43, 144, 87, 0.14);
  border: 1px solid rgba(43, 144, 87, 0.18);
}

.dashboard-top {
  justify-content: space-between;
  align-items: end;
  margin: 24px 0 22px;
}

.notes-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.note-card,
.empty-card {
  padding: 24px;
}

.note-card {
  border-radius: 26px;
}

.note-footer {
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-top: 18px;
  flex-wrap: wrap;
}

.editor-page,
.profile-shell {
  display: grid;
  gap: 24px;
}

.editor-main,
.profile-card {
  padding: 30px;
}

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

.editor-topbar,
.editor-actions,
.profile-head,
.editor-footer-line {
  display: flex;
  gap: 16px;
}

.editor-topbar {
  justify-content: space-between;
  align-items: start;
  margin-bottom: 22px;
}

.editor-actions {
  align-items: center;
  flex-wrap: wrap;
}

.editor-form-wide .markdown-area-full {
  min-height: 62vh;
}

.autosave-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.38);
}

.icon-button {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-size: 1.25rem;
}

.icon-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.autosave-badge[data-state="dirty"] {
  color: #8a6728;
}

.autosave-badge[data-state="saving"] {
  color: #205e91;
}

.autosave-badge[data-state="saved"] {
  color: #27704a;
}

.autosave-badge[data-state="error"] {
  color: #8e1c17;
}

.profile-head,
.editor-footer-line {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.shared-shell {
  display: grid;
  gap: 24px;
}

.shared-hero,
.shared-report,
.shared-editor,
.shared-message {
  padding: 30px;
}

.shared-hero {
  min-height: 280px;
  display: flex;
  align-items: end;
  background:
    radial-gradient(circle at top right, rgba(225, 191, 114, 0.45), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.16)),
    var(--card);
}

.shared-hero-copy {
  max-width: 900px;
}

.shared-hero h1 {
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  line-height: 0.94;
}

.shared-intro {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: 1.12rem;
  line-height: 1.8;
}

.shared-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.shared-report-head,
.shared-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  flex-wrap: wrap;
}

.shared-tags {
  margin-top: 18px;
}

.shared-report-body {
  font-size: 1.05rem;
}

.shared-editor {
  margin-bottom: 18px;
}

.shared-markdown-area {
  min-height: 420px;
}

.shared-message {
  width: 100%;
}

.tag-chip-muted {
  opacity: 0.75;
}

.editor-panel,
.preview-panel {
  padding: 30px;
}

.panel-header {
  justify-content: space-between;
  align-items: start;
  margin-bottom: 22px;
}

.markdown-area {
  min-height: 360px;
  font-family: Consolas, "Courier New", monospace;
}

.share-panel {
  margin-top: 24px;
  padding: 22px;
  border-radius: 24px;
}

.share-heading {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.share-output {
  align-items: end;
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
}

.share-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.share-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 20px;
}

.share-item strong {
  display: block;
  margin-bottom: 4px;
}

.ai-panel {
  padding: 24px;
}

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

.ai-chat-log {
  display: grid;
  gap: 12px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.ai-message {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.34);
}

.ai-message strong {
  display: block;
  margin-bottom: 6px;
}

.ai-message p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
  white-space: pre-wrap;
}

.ai-message-user {
  background: rgba(161, 45, 29, 0.12);
}

.ai-message-assistant {
  background: rgba(255, 255, 255, 0.5);
}

.ai-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.ai-apply-button {
  margin-top: 12px;
}

.preview-panel {
  position: sticky;
  top: 18px;
  align-self: start;
}

.report-card {
  position: relative;
  padding-top: 8px;
}

.report-head,
.tag-row {
  align-items: center;
  flex-wrap: wrap;
}

.report-summary {
  color: var(--ink-soft);
  font-size: 1.06rem;
  line-height: 1.75;
}

.report-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.report-stats div {
  padding: 18px;
  border-radius: 20px;
}

.report-stats dt {
  color: var(--ink-soft);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.report-stats dd {
  margin: 8px 0 0;
  font-weight: 700;
}

.report-body {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  line-height: 1.75;
}

.report-body h2,
.report-body h3 {
  margin-top: 1.3em;
}

.report-body ul,
.report-body ol {
  padding-left: 22px;
}

.severity-low {
  color: #27704a;
}

.severity-medium {
  color: #936400;
}

.severity-high {
  color: #c25312;
}

.severity-critical {
  color: #8e1c17;
}

.status-draft {
  color: #8a6728;
}

.status-review {
  color: #205e91;
}

.status-fixed {
  color: #27704a;
}

@media (max-width: 980px) {
  .editor-lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .site-header,
  .dashboard-top,
  .panel-header,
  .editor-topbar,
  .editor-actions,
  .profile-head,
  .editor-footer-line,
  .form-row,
  .share-output,
  .share-item,
  .shared-report-head,
  .shared-editor-head,
  .ai-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-card,
  .auth-card,
  .editor-panel,
  .preview-panel,
  .editor-main,
  .profile-card,
  .shared-hero,
  .shared-report,
  .shared-editor,
  .shared-message {
    padding: 24px;
  }

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