:root {
  --paper: #f4f7f5;
  --white: #ffffff;
  --ink: #17231e;
  --muted: #65716b;
  --line: #d5ded9;
  --moss: #236149;
  --moss-dark: #184634;
  --signal: #ffd84d;
  --danger: #a33b32;
  --shadow: 0 18px 50px rgba(31, 54, 43, 0.11);
  --sans: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--paper); font-family: var(--sans); }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 100; background: var(--ink); color: white; padding: .75rem 1rem; }
.skip-link:focus { top: 1rem; }

.kicker, .step-label {
  margin: 0 0 .65rem;
  color: var(--moss);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .75rem 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--moss); }
.button.primary:hover { background: var(--moss-dark); }
.button.quiet { border-color: var(--line); background: transparent; }
.button.publish { background: var(--signal); color: #28230f; }
.button.wide { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }

.login-page { min-height: 100vh; background: var(--ink); color: white; }
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
}
.login-intro {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: clamp(2rem, 7vw, 7rem);
  background:
    linear-gradient(135deg, rgba(35,97,73,.92), rgba(23,35,30,.96)),
    repeating-linear-gradient(90deg, transparent 0 89px, rgba(255,255,255,.04) 90px);
}
.login-intro::after {
  content: "";
  position: absolute;
  width: min(56vw, 700px);
  aspect-ratio: 1;
  top: -30%;
  right: -25%;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(255,255,255,.025), 0 0 0 160px rgba(255,255,255,.018);
}
.login-intro .kicker { color: #b9decf; }
.login-intro h1 {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3.7rem, 8vw, 8.5rem);
  font-weight: 400;
  line-height: .85;
  letter-spacing: -.06em;
}
.intro-copy { max-width: 510px; margin: 2rem 0 0; color: #c5d3cd; font-size: 1.08rem; line-height: 1.7; }
.product-mark, .brand-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}
.product-mark { width: 44px; margin-bottom: auto; }
.product-mark span, .brand-grid i { aspect-ratio: 1; background: var(--signal); border-radius: 2px; }
.product-mark span:nth-child(2), .product-mark span:nth-child(3), .brand-grid i:nth-child(2), .brand-grid i:nth-child(3) { opacity: .38; }
.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 7vw, 7rem);
  background: var(--paper);
  color: var(--ink);
}
.login-card .step-label { margin-bottom: 2rem; }
.form-stack { display: grid; gap: 1.2rem; }
label { display: grid; gap: .5rem; font-size: .82rem; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  padding: .86rem .95rem;
}
textarea { resize: vertical; }

.topbar {
  min-height: 70px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(244,247,245,.94);
  padding: .75rem clamp(1rem, 4vw, 4rem);
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); font-weight: 800; text-decoration: none; }
.brand-grid { width: 25px; gap: 2px; }
.site-identity { display: flex; align-items: center; gap: .5rem; font-family: var(--mono); font-size: .76rem; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #38a873; box-shadow: 0 0 0 4px rgba(56,168,115,.13); }
.topbar form { justify-self: end; }
.text-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; }

.publish-rail {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .85rem clamp(1rem, 4vw, 4rem);
  background: var(--ink);
  color: white;
  box-shadow: 0 8px 24px rgba(23,35,30,.18);
}
.publish-rail > div { display: flex; align-items: center; gap: .8rem; }
.publish-rail span:not(.draft-flag) { color: #aebab3; font-size: .82rem; }
.draft-flag { background: var(--signal); color: #2c270d; padding: .35rem .55rem; border-radius: 3px; font-family: var(--mono); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; transform: rotate(-2deg); }
.publish-actions { flex-shrink: 0; }
.publish-rail .button.quiet { color: white; border-color: #536159; }

.workspace { width: min(1500px, 100%); margin: 0 auto; padding: clamp(2rem, 5vw, 5rem) clamp(1rem, 4vw, 4rem) 6rem; }
.workspace-head { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 2.2rem; }
.workspace h1 { margin: 0; font-family: var(--display); font-size: clamp(2.8rem, 5vw, 5rem); font-weight: 400; line-height: .95; letter-spacing: -.045em; }
.muted { margin: .8rem 0 0; color: var(--muted); }
.contact-sheet { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 1.75rem); }
.photo-card { min-width: 0; }
.photo-frame { position: relative; overflow: hidden; aspect-ratio: 4/5; background: #dce4e0; border-radius: 4px; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.photo-card:hover .photo-frame img { transform: scale(1.018); }
.photo-card.is-new .photo-frame { box-shadow: 0 0 0 3px var(--signal); }
.new-badge { position: absolute; top: .7rem; left: .7rem; background: var(--signal); padding: .35rem .55rem; border-radius: 2px; font-family: var(--mono); font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.photo-info { display: flex; justify-content: space-between; gap: .75rem; padding: .85rem .1rem 0; }
.photo-info h2 { overflow: hidden; margin: 0; font-size: .92rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.photo-info p { margin: .25rem 0 0; color: var(--muted); font-family: var(--mono); font-size: .68rem; }
.photo-info > div { min-width: 0; }
.icon-button { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { border-color: #e1bbb7; color: var(--danger); background: #fff5f4; }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.notice { margin: 0 0 1.5rem; border: 1px solid var(--line); border-left-width: 5px; border-radius: 6px; background: white; padding: .9rem 1rem; line-height: 1.5; }
.notice.success { border-left-color: var(--moss); }
.notice.error { border-left-color: var(--danger); color: #692820; }
.login-card .notice { margin-bottom: 1.2rem; }
.empty-state { display: grid; justify-items: center; padding: 8rem 1rem; text-align: center; border: 1px dashed #bdc9c3; }
.empty-state h2 { margin: 1.5rem 0 .5rem; font-family: var(--display); font-size: 2rem; font-weight: 400; }
.empty-state p { max-width: 520px; margin: 0 0 1.5rem; color: var(--muted); }
.empty-grid { display: grid; width: 90px; grid-template-columns: repeat(3,1fr); gap: 5px; }
.empty-grid span { aspect-ratio: 1; background: var(--line); }
.empty-grid span:nth-child(2) { background: var(--signal); }

.add-dialog { width: min(620px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); border: 0; border-radius: 12px; padding: 0; box-shadow: var(--shadow); }
.add-dialog::backdrop { background: rgba(16,27,22,.66); backdrop-filter: blur(4px); }
.dialog-form { display: grid; gap: 1rem; padding: clamp(1.2rem, 4vw, 2rem); }
.dialog-form header, .dialog-form footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog-form h2 { margin: 0; font-family: var(--display); font-size: 2.4rem; font-weight: 400; }
.dialog-close { border: 0; background: transparent; font-size: 2rem; color: var(--muted); cursor: pointer; }
.dialog-form footer { justify-content: flex-end; padding-top: .4rem; }
.drop-field { position: relative; display: grid; min-height: 175px; place-items: center; overflow: hidden; border: 1px dashed #9caba4; border-radius: 8px; background: #f8faf9; cursor: pointer; text-align: center; }
.drop-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-preview { position: absolute; inset: 0; background-position: center; background-size: cover; opacity: 0; transition: opacity .2s; }
.drop-preview.has-photo { opacity: .22; }
.drop-copy { position: relative; display: grid; gap: .35rem; }
.drop-copy strong { color: var(--moss); font-size: 1rem; }
.drop-copy small { color: var(--muted); font-weight: 500; }

@media (max-width: 1050px) {
  .contact-sheet { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { min-height: 48vh; padding: 2rem; }
  .login-card { padding: 2rem; }
  .product-mark { margin-bottom: 5rem; }
  .topbar { grid-template-columns: 1fr auto; }
  .site-identity { display: none; }
  .publish-rail, .publish-rail > div { align-items: stretch; }
  .publish-rail { position: static; flex-direction: column; }
  .publish-rail > div:first-child { display: grid; grid-template-columns: auto 1fr; }
  .publish-rail span:not(.draft-flag) { grid-column: 2; }
  .publish-actions { display: grid !important; grid-template-columns: 1fr 1fr; }
  .publish-actions .button { width: 100%; }
  .workspace-head { align-items: start; flex-direction: column; }
  .contact-sheet { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 460px) {
  .contact-sheet { grid-template-columns: 1fr; }
  .photo-frame { aspect-ratio: 5/4; }
  .publish-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

