:root {
  --midnight: #14213d;
  --storybook: #243b73;
  --royal: #315aa7;
  --gold: #f2b84b;
  --signal-red: #c94c4c;
  --mint: #2fa39a;
  --ivory: #fff9ec;
  --parchment: #f6eddc;
  --ink: #1d2433;
  --muted: #667085;
  --line: #e4d8c7;
  --surface: #ffffff;
  --shadow: 0 20px 60px rgba(20, 33, 61, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(20, 33, 61, 0.08), rgba(242, 184, 75, 0.1)),
    var(--ivory);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(20, 33, 61, 0.12), rgba(242, 184, 75, 0.16)),
    var(--ivory);
}

.auth-panel {
  display: grid;
  gap: 18px;
  width: min(430px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.agreement-field {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 10px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.agreement-field input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.agreement-field a,
.legal-links a,
.sidebar-legal a,
.policy-page a {
  color: var(--royal);
  font-weight: 800;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.turnstile-container {
  min-height: 65px;
}

.auth-brand h1 {
  margin: 0;
  color: var(--midnight);
  font-size: 1.45rem;
}

.auth-tabs {
  grid-auto-flow: column;
  width: 100%;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form .primary-action {
  width: 100%;
}

.auth-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.text-action {
  border: 0;
  background: transparent;
  color: var(--royal);
  font-weight: 800;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  background:
    linear-gradient(180deg, rgba(242, 184, 75, 0.08), transparent 28%),
    var(--midnight);
  color: white;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: var(--gold);
  color: var(--midnight);
  font-weight: 900;
  box-shadow: inset 0 -6px 0 rgba(20, 33, 61, 0.12);
}

.eyebrow,
.label {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-lockup h1,
.topbar h2,
.pin-dialog h2 {
  margin: 0;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: rgba(242, 184, 75, 0.45);
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.plan-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(242, 184, 75, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
}

.plan-panel button {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: transparent;
  color: white;
  font-weight: 800;
}

.billing-dialog {
  width: min(780px, calc(100% - 24px));
}

.billing-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.billing-plan {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.billing-plan h3,
.billing-plan p {
  margin: 0;
}

.billing-price {
  font-size: 1.45rem;
  font-weight: 900;
}

.billing-plan button {
  margin-top: 8px;
}

.plan-panel strong {
  display: block;
  font-size: 1.4rem;
}

meter {
  width: 100%;
  height: 10px;
  margin-top: 14px;
}

.plan-panel p:last-child {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.85rem;
}

.account-panel {
  display: grid;
  gap: 8px;
  padding: 0 6px;
}

.account-panel strong {
  overflow: hidden;
  color: white;
  text-overflow: ellipsis;
}

.account-panel button {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.sidebar-legal {
  display: flex;
  gap: 14px;
  padding-top: 4px;
  font-size: 0.75rem;
}

.sidebar-legal a {
  color: rgba(255, 255, 255, 0.68);
}

.policy-page {
  min-height: 100vh;
  background: var(--ivory);
  color: var(--ink);
}

.policy-header {
  border-bottom: 1px solid var(--line);
  background: var(--midnight);
  color: white;
}

.policy-header-inner,
.policy-content {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
}

.policy-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.policy-header a {
  color: white;
  font-weight: 800;
  text-decoration: none;
}

.policy-content {
  padding: 48px 0 72px;
  line-height: 1.7;
}

.policy-content h1 {
  margin: 0 0 8px;
  font-size: 2.75rem;
  letter-spacing: 0;
}

.policy-content h2 {
  margin: 36px 0 8px;
  font-size: 1.2rem;
  letter-spacing: 0;
}

.policy-content p,
.policy-content ul {
  color: var(--muted);
}

.policy-updated {
  margin-bottom: 32px;
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  .policy-content h1 {
    font-size: 2rem;
  }
}

.main-content {
  min-width: 0;
  padding: 28px;
}

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

.topbar h2 {
  font-size: clamp(1.7rem, 4vw, 3.1rem);
  line-height: 1;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
}

.primary-action,
.secondary-action,
.danger-action,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  padding: 0 16px;
  background: var(--signal-red);
  color: white;
  box-shadow: 0 10px 22px rgba(201, 76, 76, 0.22);
}

.secondary-action {
  border: 1px solid var(--storybook);
  padding: 0 16px;
  background: white;
  color: var(--storybook);
}

.danger-action {
  border: 1px solid rgba(201, 76, 76, 0.36);
  padding: 0 16px;
  background: #fff5f4;
  color: #9f3030;
}

.icon-button {
  width: 44px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card,
.workbench,
.detail-panel,
.pin-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 96px;
  padding: 16px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.workbench {
  padding: 16px;
}

.boards-view {
  display: grid;
  gap: 16px;
}

.boards-toolbar,
.board-editor-head,
.board-placement-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.boards-toolbar h3,
.board-editor-head h3 {
  margin: 0;
  font-size: 1.35rem;
}

.boards-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.board-library {
  display: grid;
  gap: 10px;
}

.board-list {
  display: grid;
  gap: 8px;
}

.board-list-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.board-list-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.board-list-item.is-selected,
.board-list-item:hover {
  border-color: var(--gold);
  background: var(--ivory);
}

.board-empty {
  display: grid;
  gap: 10px;
  padding: 18px 4px;
  color: var(--muted);
}

.board-empty p {
  margin: 6px 0 0;
  font-size: 0.86rem;
}

.board-empty .secondary-action {
  justify-self: start;
}

.board-editor {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.virtual-board {
  position: relative;
  overflow: hidden;
  width: min(100%, 820px);
  min-height: 520px;
  margin-inline: auto;
  padding: 58px;
  border: 12px solid #8e5b37;
  box-shadow:
    inset 0 0 42px rgba(20, 33, 61, 0.18),
    0 20px 50px rgba(20, 33, 61, 0.18);
}

.template-classic_cork {
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 30%, rgba(95, 55, 28, 0.18) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 65%, rgba(95, 55, 28, 0.14) 0 1px, transparent 2px),
    #c8925c;
  background-size: 34px 32px, 27px 29px, auto;
}

.template-round_velvet {
  width: min(100%, 650px);
  min-height: 0;
  aspect-ratio: 1;
  border-color: #c7a14b;
  border-radius: 50%;
  background: #263967;
}

.template-storybook_arch {
  min-height: 600px;
  border-color: #9b6552;
  border-radius: 48% 48% 8px 8px / 28% 28% 8px 8px;
  background: #3b8f87;
}

.template-collector_crest {
  width: min(100%, 700px);
  min-height: 650px;
  padding: 84px 76px 130px;
  border: 0;
  clip-path: polygon(50% 0, 94% 15%, 86% 72%, 50% 100%, 14% 72%, 6% 15%);
  background:
    linear-gradient(#b63f4b, #8c3344) padding-box;
  box-shadow: inset 0 0 0 14px #e0b657;
}

.template-mouse_cork {
  width: min(100%, 720px);
  min-height: 0;
  aspect-ratio: 1.08;
  padding: 110px 76px 74px;
  border: 0;
  background:
    radial-gradient(circle at 22% 28%, rgba(95, 55, 28, 0.2) 0 2px, transparent 3px),
    radial-gradient(circle at 68% 66%, rgba(95, 55, 28, 0.15) 0 1px, transparent 2px),
    #c8925c;
  background-size: 34px 32px, 27px 29px, auto;
  filter: drop-shadow(0 20px 24px rgba(20, 33, 61, 0.24));
  -webkit-mask:
    radial-gradient(circle at 25% 25%, #000 0 20%, transparent 20.5%),
    radial-gradient(circle at 75% 25%, #000 0 20%, transparent 20.5%),
    radial-gradient(circle at 50% 63%, #000 0 38%, transparent 38.5%);
  mask:
    radial-gradient(circle at 25% 25%, #000 0 20%, transparent 20.5%),
    radial-gradient(circle at 75% 25%, #000 0 20%, transparent 20.5%),
    radial-gradient(circle at 50% 63%, #000 0 38%, transparent 38.5%);
}

.board-pin-grid {
  z-index: 1;
  position: absolute;
  inset: 0;
}

.board-pin-piece {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 112px;
  min-width: 0;
  transform: translate(-50%, -50%);
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.board-pin-piece.is-dragging {
  z-index: 4;
  cursor: grabbing;
}

.board-pin-image {
  width: 82px;
  aspect-ratio: 1;
  border: 4px solid #f5d37b;
  border-radius: 50%;
  background: var(--storybook);
  background-position: center;
  background-size: cover;
  box-shadow: 0 8px 16px rgba(20, 33, 61, 0.28);
}

.board-pin-piece strong {
  width: 100%;
  overflow: hidden;
  color: white;
  font-size: 0.72rem;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(20, 33, 61, 0.8);
  white-space: nowrap;
}

.board-pin-actions {
  position: absolute;
  top: -8px;
  right: 8px;
}

.board-pin-actions button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  background: rgba(20, 33, 61, 0.82);
  color: white;
  font-weight: 900;
}

.board-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.86);
  text-align: center;
  text-shadow: 0 1px 3px rgba(20, 33, 61, 0.72);
}

.board-placement-bar {
  justify-content: center;
  padding: 12px 0;
}

.board-placement-bar select {
  width: min(360px, 100%);
}

.template-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.template-picker legend {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  color: var(--midnight);
  font-size: 0.85rem;
  font-weight: 800;
}

.template-option {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.template-option:has(input:checked) {
  border-color: var(--gold);
  background: var(--ivory);
}

.template-option input {
  position: absolute;
  opacity: 0;
}

.template-swatch {
  width: 38px;
  height: 38px;
  border: 3px solid #8e5b37;
}

.swatch-cork { background: #c8925c; }
.swatch-velvet { border-radius: 50%; background: #263967; border-color: #c7a14b; }
.swatch-arch { border-radius: 50% 50% 4px 4px; background: #3b8f87; }
.swatch-crest { clip-path: polygon(50% 0, 96% 16%, 82% 73%, 50% 100%, 18% 73%, 4% 16%); background: #b63f4b; border-color: #e0b657; }
.swatch-mouse-cork {
  border: 0;
  background: #c8925c;
  -webkit-mask:
    radial-gradient(circle at 25% 25%, #000 0 21%, transparent 22%),
    radial-gradient(circle at 75% 25%, #000 0 21%, transparent 22%),
    radial-gradient(circle at 50% 64%, #000 0 39%, transparent 40%);
  mask:
    radial-gradient(circle at 25% 25%, #000 0 21%, transparent 22%),
    radial-gradient(circle at 75% 25%, #000 0 21%, transparent 22%),
    radial-gradient(circle at 50% 64%, #000 0 39%, transparent 40%);
}

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

.segment-control {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--parchment);
}

.segment-control button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment-control button.is-selected {
  background: white;
  color: var(--midnight);
  box-shadow: 0 2px 8px rgba(20, 33, 61, 0.12);
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

select {
  min-height: 44px;
  padding: 0 12px;
}

.collection-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

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

.pin-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  text-align: left;
  box-shadow: 0 8px 22px rgba(20, 33, 61, 0.08);
}

.pin-card.is-selected {
  outline: 3px solid rgba(242, 184, 75, 0.72);
}

.pin-card-image,
.detail-image,
.photo-preview {
  background:
    linear-gradient(135deg, rgba(49, 90, 167, 0.95), rgba(47, 163, 154, 0.72)),
    var(--storybook);
}

.pin-card-image {
  aspect-ratio: 1;
  background-size: cover;
  background-position: center;
}

.pin-card-body {
  padding: 12px;
}

.pin-card h3 {
  margin: 0;
  font-size: 1rem;
}

.pin-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 10px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--parchment);
  color: var(--midnight);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-panel {
  position: sticky;
  top: 20px;
  align-self: start;
  padding: 14px;
}

.detail-image {
  min-height: 220px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
}

.detail-copy h3 {
  margin: 10px 0 4px;
  font-size: 1.45rem;
}

.detail-copy p:last-child {
  margin: 0;
  color: var(--muted);
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.identity-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 11px;
  border: 1px solid rgba(47, 163, 154, 0.42);
  border-radius: 8px;
  background: #effaf8;
}

.identity-panel[hidden] {
  display: none;
}

.identity-panel a {
  color: var(--midnight);
  font-size: 0.88rem;
  font-weight: 900;
  text-decoration: none;
}

.identity-panel a:hover {
  text-decoration: underline;
}

.identity-clear,
.match-action {
  min-height: 32px;
  border: 1px solid var(--mint);
  border-radius: 6px;
  padding: 0 10px;
  background: white;
  color: #19766f;
  font-size: 0.78rem;
  font-weight: 900;
}

.match-action.is-confirmed {
  background: var(--mint);
  color: white;
}

.detail-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.pricing-basis {
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  background: var(--ivory);
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
  font-weight: 900;
}

.source-list {
  display: grid;
  gap: 8px;
}

.source-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.source-item span {
  color: var(--muted);
  font-size: 0.84rem;
}

.source-item:hover,
.source-item.is-active {
  border-color: rgba(242, 184, 75, 0.86);
  background: var(--ivory);
}

.comps-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.comps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.comps-head h4 {
  margin: 0;
  font-size: 1.05rem;
}

.comps-list {
  display: grid;
  gap: 8px;
}

.comp-row {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.comp-row strong,
.comp-row a {
  color: var(--midnight);
  font-size: 0.92rem;
  font-weight: 900;
  text-decoration: none;
}

.comp-row a:hover {
  text-decoration: underline;
}

.comp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.comp-price {
  color: var(--midnight);
  font-weight: 900;
}

.comp-delete {
  justify-self: start;
  min-height: 32px;
  border: 1px solid rgba(201, 76, 76, 0.36);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff5f4;
  color: #9f3030;
  font-size: 0.78rem;
  font-weight: 800;
}

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

.empty-badge {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--midnight);
  font-size: 2rem;
  font-weight: 900;
}

.empty-state h3 {
  margin: 16px 0 0;
}

.empty-state p {
  margin: 6px 0 18px;
  color: var(--muted);
}

.pin-dialog {
  width: min(760px, calc(100vw - 24px));
  padding: 0;
}

.pin-dialog::backdrop {
  background: rgba(20, 33, 61, 0.58);
}

.pin-dialog form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.form-message.is-error {
  color: #9f3030;
}

.form-message.is-success {
  color: #19766f;
}

.form-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--midnight);
  font-size: 0.85rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

.field-stack {
  display: grid;
  gap: 12px;
}

.photo-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.photo-capture-stack {
  display: grid;
  align-content: start;
  gap: 10px;
}

.photo-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px dashed rgba(20, 33, 61, 0.2);
  border-radius: 8px;
  color: white;
  background-size: cover;
  background-position: center;
}

.photo-preview span {
  font-size: 2rem;
}

.camera-dialog {
  width: min(680px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.camera-dialog::backdrop {
  background: rgba(20, 33, 61, 0.72);
}

.camera-shell {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.camera-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #070b14;
}

.camera-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-guide {
  position: absolute;
  inset: 12%;
  border: 2px solid rgba(242, 184, 75, 0.86);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(20, 33, 61, 0.18);
  pointer-events: none;
}

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

@media (max-width: 520px) {
  .camera-actions {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 18px;
  }

  .nav-list {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .plan-panel {
    margin-top: 0;
    margin-left: auto;
    min-width: 220px;
  }

  .collection-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .main-content {
    padding: 16px;
  }

  .billing-plans {
    grid-template-columns: 1fr;
  }

  .topbar,
  .topbar-actions,
  .collection-toolbar,
  .dialog-head,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    min-width: 0;
    width: 100%;
  }

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

  .segment-control {
    grid-auto-flow: row;
    width: 100%;
  }

  .segment-control button {
    width: 100%;
  }

  .plan-panel {
    width: 100%;
    margin-left: 0;
  }

  .boards-layout {
    grid-template-columns: 1fr;
  }

  .board-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .virtual-board,
  .template-storybook_arch,
  .template-collector_crest,
  .template-mouse_cork {
    min-height: 440px;
    padding: 46px 30px;
  }

  .board-placement-bar,
  .boards-toolbar,
  .board-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

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