@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --bg: #f7f2ea;
  --bg-2: #fdf8f2;
  --panel: #ffffff;
  --text: #2a2623;
  --muted: #6f6a64;
  --accent: #d7906d;
  --accent-dark: #c47d5c;
  --border: #eadfd2;
  --success-bg: #e7f5f2;
  --success-text: #2e6d5f;
  --warning-bg: #fff4dd;
  --warning-text: #916200;
  --radius: 16px;
  --container: 720px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #fff3e6 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 0%, #e7f5f2 0%, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
}

header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(247, 242, 234, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner { max-width: var(--container); margin: 0 auto; padding: 20px 20px 14px; }
.header-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.profile-wrap { position: relative; display: flex; align-items: center; gap: 8px; }

h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.3px;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
}

h2 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.3px;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
}

.sub { color: var(--muted); font-size: 13px; }
.sub-spaced { margin-top: 6px; }
.lead { margin-top: 8px; font-size: 15px; line-height: 1.5; }

.nav-btn, button, input {
  font-family: inherit;
}

.nav-btn, button {
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  border-color: transparent;
}

button.secondary,
.ghost-btn {
  background: transparent;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 16px;
}

select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}

main { max-width: var(--container); margin: 0 auto; padding: 20px 20px 110px; }

.card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(83, 54, 32, 0.08);
}

.wizard-shell {
  display: grid;
  gap: 22px;
}

.wizard-head {
  display: grid;
  gap: 10px;
}

.step-kicker {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--warning-text);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

.step-progress {
  display: grid;
  gap: 8px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #f2e8db;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  transition: width 180ms ease;
}

.wizard-step {
  display: grid;
  gap: 18px;
}

.summary-list,
.source-list,
.stack-16,
.stack-12 {
  display: grid;
}

.summary-list,
.source-list,
.stack-16 { gap: 16px; }

.stack-12 { gap: 12px; }

.summary-item,
.source-item,
.state-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 16px;
}

.summary-index {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-weight: 700;
}

.summary-title,
.state-title {
  font-size: 16px;
  font-weight: 700;
}

.state-box {
  grid-template-columns: auto 1fr;
  background: var(--success-bg);
  border-color: #d0e9e3;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

.badge.done {
  background: #d7efe8;
  color: var(--success-text);
}

.compact-form {
  display: grid;
  gap: 10px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
}

.wide-btn {
  width: 100%;
}

.split-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.confirm-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  font-size: 14px;
}

.confirm-row.warning {
  color: #9a4b2f;
}

.confirm-warning {
  font-size: 13px;
  color: #9a4b2f;
}

.align-start {
  justify-self: start;
}

.alt-options {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fffaf5;
  overflow: hidden;
}

.alt-options summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  padding: 14px 16px;
}

.alt-options summary::-webkit-details-marker {
  display: none;
}

.alt-options-body {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.qr-wrap {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 16px;
}

.compact-qr img {
  max-width: min(220px, 70vw);
  height: auto;
}

.status {
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.source-list:empty {
  display: none;
}

.group-list {
  display: grid;
  gap: 12px;
}

.group-list:empty {
  display: none;
}

.group-item {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.group-main {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.group-check {
  margin-top: 3px;
}

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

.thread-list {
  display: grid;
  gap: 8px;
  padding-left: 34px;
}

.thread-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.thread-title {
  font-size: 14px;
}

.source-copy {
  min-width: 0;
}

.source-url {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.source-remove {
  justify-self: end;
  align-self: center;
}

.sticky-actions {
  position: sticky;
  bottom: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.sticky-actions button {
  min-height: 50px;
}

.warnings-dialog {
  width: min(560px, calc(100vw - 24px));
  border: none;
  border-radius: 20px;
  padding: 0;
  background: transparent;
}

.warnings-dialog::backdrop {
  background: rgba(23, 18, 13, 0.45);
}

.warnings-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.warnings-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.info-list {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.dialog-actions {
  justify-content: end;
}

.menu-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-card {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(300px, 90vw);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,.12);
  padding: 12px;
}

.profile-card-email {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  word-break: break-word;
}

.profile-card-nav {
  display: grid;
  gap: 8px;
}

.profile-card-nav .nav-btn {
  width: 100%;
  text-align: center;
}

.hidden { display: none !important; }

@media (max-width: 640px) {
  .header-top { display: grid; grid-template-columns: 1fr auto; align-items: start; }
  .profile-wrap { justify-self: end; margin-left: auto; }
  main { padding: 16px 16px 108px; }
  .card { padding: 18px; border-radius: 20px; }
  h1 { font-size: 30px; }
  h2 { font-size: 28px; }
  .split-actions,
  .sticky-actions {
    grid-template-columns: 1fr;
  }
  .sticky-actions {
    bottom: 8px;
    padding: 10px;
  }
  .source-item,
  .state-box {
    grid-template-columns: 1fr;
  }
  .source-remove {
    justify-self: stretch;
  }
}
