:root {
  --bg: #b670db;
  --bg-mid: #d8a2f5;
  --bg-end: #b670db;
  --surface: #ffffff;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.93);
  --control: #ffffff;
  --surface-strong: #fff0f6;
  --ink: #222533;
  --muted: #707487;
  --line: #eadde5;
  --rose: #e94f8d;
  --rose-dark: #bf2e68;
  --mint: #2f9f8f;
  --mint-soft: #dff6ef;
  --blue: #5966dc;
  --blue-soft: #e8ebff;
  --gold: #f4ba3f;
  --danger: #d94b4b;
  --danger-soft: #ffe3e3;
  --notice-bg: #fff8e7;
  --notice-line: #f0d08d;
  --notice-ink: #7c5512;
  --location-soft: #fff2d2;
  --location-ink: #765015;
  --placeholder-bg: linear-gradient(135deg, #fbe3ee, #e8f5ff);
  --active-control: #222533;
  --active-control-ink: #ffffff;
  --brand-mark-bg: #222533;
  --brand-mark-ink: #ffffff;
  --archive-bg: #f0edf2;
  --archive-ink: #5f5564;
  --secret-soft: #fff4ce;
  --secret-ink: #7a5510;
  --proposal-soft: #efe6ff;
  --proposal-ink: #7040a4;
  --shadow: 0 18px 50px rgba(57, 18, 81, 0.24);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #121018;
  --bg-mid: #171b2a;
  --bg-end: #0f1219;
  --surface: #1b1f2b;
  --panel: rgba(27, 31, 43, 0.92);
  --panel-soft: rgba(27, 31, 43, 0.88);
  --control: #151822;
  --surface-strong: #261a2a;
  --ink: #f7eff6;
  --muted: #aaa4b5;
  --line: #3a3345;
  --rose: #ff6fa9;
  --rose-dark: #ff9ac4;
  --mint: #4cc1ae;
  --mint-soft: #173c37;
  --blue: #8f9bff;
  --blue-soft: #222b56;
  --gold: #ffd36a;
  --danger: #ff7777;
  --danger-soft: #3b2028;
  --notice-bg: #2d2616;
  --notice-line: #604f26;
  --notice-ink: #f4d996;
  --location-soft: #332a18;
  --location-ink: #f2cc72;
  --placeholder-bg: linear-gradient(135deg, #372033, #172a38);
  --active-control: #f4d7e7;
  --active-control-ink: #211823;
  --brand-mark-bg: #f7eff6;
  --brand-mark-ink: #211823;
  --archive-bg: #2f2935;
  --archive-ink: #d8cfdd;
  --secret-soft: #3a3017;
  --secret-ink: #f4d47b;
  --proposal-soft: #2f2540;
  --proposal-ink: #d9bcff;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-mid) 52%, var(--bg-end) 100%);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.is-hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(500px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

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

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-lockup.compact {
  gap: 10px;
}

.brand-lockup > div {
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--brand-mark-bg);
  color: var(--brand-mark-ink);
  font-weight: 900;
  font-size: 1.35rem;
}

.brand-lockup.compact .brand-mark {
  width: 40px;
  height: 40px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--rose-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 3.4vw, 2rem);
  line-height: 1.02;
  white-space: nowrap;
}

h2,
h3 {
  margin-bottom: 0;
  line-height: 1.1;
}

.login-form,
.item-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.profile-switch,
.app-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.profile-choice,
.tab-button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.profile-choice.is-selected,
.tab-button.is-active {
  background: var(--active-control);
  color: var(--active-control-ink);
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(89, 102, 220, 0.14);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 900;
}

.primary-button {
  background: var(--rose);
  color: #fff;
}

.primary-button:hover {
  background: var(--rose-dark);
}

.secondary-button {
  background: var(--blue-soft);
  color: var(--blue);
}

.ghost-button {
  background: var(--control);
  border: 1px solid var(--line);
  color: var(--ink);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-button {
  width: 40px;
  padding: 0;
  background: var(--control);
  border: 1px solid var(--line);
  color: var(--muted);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
  color: var(--ink);
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--blue);
}

.theme-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.theme-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 18px;
  top: -2px;
  left: 7px;
  border-radius: 50%;
  background: var(--control);
  opacity: 0;
  transition: opacity 0.16s ease;
}

:root[data-theme="dark"] .theme-icon::after {
  opacity: 1;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint);
  font-size: 0.86rem;
  font-weight: 900;
}

.app-tabs {
  grid-template-columns: repeat(4, 1fr);
  position: sticky;
  top: 0;
  z-index: 5;
  margin-bottom: 16px;
  box-shadow: 0 10px 24px rgba(48, 42, 56, 0.06);
}

.recap-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #f0c7d9;
  border-radius: 8px;
  background: var(--surface-strong);
}

.recap-banner div {
  display: grid;
  gap: 2px;
}

.recap-banner span {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  align-items: start;
}

.workspace.is-full-width {
  grid-template-columns: 1fr;
}

.workspace.is-full-width .list-panel,
.editor-panel.is-hidden + .list-panel {
  grid-column: 1 / -1;
}

.mobile-panel-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 900;
}

.mobile-panel-toggle::after {
  content: "+";
  color: var(--rose-dark);
  font-size: 1.2rem;
  line-height: 1;
}

.mobile-panel-toggle.is-open::after {
  content: "-";
}

.editor-panel,
.list-panel {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.editor-panel {
  position: sticky;
  top: 90px;
  padding: 18px;
}

.panel-heading,
.list-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.input-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.visibility-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
}

.visibility-toggle input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--rose);
}

.visibility-toggle span {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid.single-grow {
  grid-template-columns: 1fr;
}

.notice {
  border: 1px solid var(--notice-line);
  border-radius: 8px;
  background: var(--notice-bg);
  color: var(--notice-ink);
  padding: 10px 12px;
  font-weight: 700;
}

.list-panel {
  min-height: 580px;
  padding: 18px;
}

.stats-line {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-align: right;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(120px, 1fr)) repeat(2, minmax(88px, 0.7fr)) repeat(2, minmax(118px, auto));
  gap: 10px;
  align-items: end;
  margin: 18px 0;
}

.archive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.archive-toggle input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--rose);
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.item-card {
  display: grid;
  grid-template-rows: 170px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  min-width: 0;
}

.item-card.is-archived {
  opacity: 0.72;
}

.item-card.is-private {
  border-color: rgba(244, 186, 63, 0.65);
}

.item-card.is-proposal {
  border-color: rgba(112, 64, 164, 0.45);
}

.item-card.is-purchased {
  opacity: 0.78;
}

.item-image {
  position: relative;
  background: var(--placeholder-bg);
  overflow: hidden;
}

.item-image-link {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.item-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--rose-dark);
  font-size: 2rem;
  font-weight: 900;
}

.item-body {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.item-title {
  color: var(--ink);
  font-weight: 900;
  line-height: 1.18;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
}

.pill.price {
  background: var(--mint-soft);
  color: var(--mint);
}

.pill.archive {
  background: var(--archive-bg);
  color: var(--archive-ink);
}

.pill.location {
  background: var(--location-soft);
  color: var(--location-ink);
}

.pill.desire {
  background: var(--surface-strong);
  color: var(--rose-dark);
  letter-spacing: 0;
}

.pill.secret {
  background: var(--secret-soft);
  color: var(--secret-ink);
}

.pill.proposal {
  background: var(--proposal-soft);
  color: var(--proposal-ink);
}

.pill.purchased {
  background: var(--mint-soft);
  color: var(--mint);
}

.heart-rating {
  display: grid;
  grid-template-columns: repeat(5, 44px);
  gap: 8px;
}

.heart-rating button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
  color: var(--rose-dark);
  font-size: 1.2rem;
  font-weight: 900;
}

.heart-rating button.is-active {
  background: var(--surface-strong);
  border-color: var(--rose);
}

.item-note,
.item-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.item-actions a,
.item-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--ink);
  padding: 0 11px;
  font-size: 0.84rem;
  font-weight: 900;
  text-decoration: none;
  line-height: 1;
}

.item-actions .accept-action {
  background: var(--mint-soft);
  color: var(--mint);
}

.item-actions .reject-action {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 300px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.empty-state strong {
  color: var(--ink);
  display: block;
  margin-bottom: 6px;
}

.recap-view {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 24px 0 50px;
}

.recap-copy {
  text-align: center;
  max-width: 620px;
}

.recap-copy p:last-child {
  color: var(--muted);
}

.recap-deck {
  width: min(420px, 100%);
  min-height: 560px;
  display: grid;
  place-items: center;
}

.recap-card {
  width: 100%;
  min-height: 540px;
  display: grid;
  grid-template-rows: 300px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  touch-action: pan-y;
  user-select: none;
}

.recap-card .item-body {
  align-content: start;
}

.recap-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: min(520px, 100%);
}

.recap-actions button {
  min-height: 52px;
}

.recap-card {
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.recap-card.swipe-out-left {
  transform: translateX(-120%) rotate(-14deg);
  opacity: 0;
}

.recap-card.swipe-out-right {
  transform: translateX(120%) rotate(14deg);
  opacity: 0;
}

.recap-card.swipe-out-down {
  transform: translateY(80px) scale(0.94);
  opacity: 0;
}

.history-list {
  width: min(620px, 100%);
}

.history-heading {
  margin: 18px 0 10px;
  text-align: center;
}

.history-items {
  display: grid;
  gap: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px 14px;
}

.history-item span {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.proposal-recap {
  width: min(720px, 100%);
}

.proposal-recap.is-empty {
  display: none;
}

.proposal-recap .history-heading {
  margin-top: 8px;
}

.proposal-items {
  display: grid;
  gap: 10px;
}

.proposal-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
}

.proposal-thumb {
  width: 64px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--placeholder-bg);
}

.proposal-thumb img,
.proposal-thumb .item-placeholder {
  width: 100%;
  height: 100%;
}

.proposal-item-body {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.proposal-item-body strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.proposal-item-body span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.settings-view {
  display: grid;
  gap: 16px;
  padding-bottom: 34px;
}

.settings-panel {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 16, 24, 0.48);
}

.modal-card {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    position: static;
  }

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

  .search-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
  }

  .login-heading {
    gap: 12px;
  }

  .login-panel .brand-lockup {
    gap: 10px;
  }

  .login-panel .brand-mark {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  h1 {
    font-size: clamp(1.55rem, 7vw, 1.85rem);
  }

  .topbar-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .brand-lockup.compact .brand-mark {
    display: none;
  }

  .app-tabs {
    bottom: 10px;
    top: auto;
    position: fixed;
    left: 10px;
    right: 10px;
    z-index: 20;
    margin-bottom: 0;
  }

  .workspace,
  .recap-view,
  .settings-view {
    padding-bottom: 84px;
  }

  .mobile-panel-toggle {
    display: inline-flex;
    width: 100%;
  }

  .editor-panel:not(.is-open-mobile),
  .filters:not(.is-open-mobile) {
    display: none;
  }

  .login-panel,
  .editor-panel,
  .list-panel,
  .settings-panel {
    padding: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .search-field,
  .archive-toggle {
    grid-column: 1 / -1;
  }

  .items-grid {
    grid-template-columns: 1fr;
  }

  .item-card {
    grid-template-rows: 210px auto;
  }

  .recap-card {
    min-height: 500px;
    grid-template-rows: 270px auto;
  }

  .recap-deck {
    min-height: 520px;
  }

  .recap-actions {
    grid-template-columns: 1fr;
  }

  .history-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-item span {
    text-align: left;
  }

  .heart-rating {
    grid-template-columns: repeat(5, minmax(38px, 1fr));
  }

  .heart-rating button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .login-panel .brand-mark {
    display: none;
  }

  h1 {
    font-size: clamp(1.45rem, 7vw, 1.7rem);
  }
}
