:root {
  --teal: #129ba0;
  --teal-dark: #0e7479;
  --coral: #e95538;
  --ink: #17343a;
  --muted: #607276;
  --line: #dce4e2;
  --paper: #ffffff;
  --soft: #f4f7f5;
  --shadow: 0 20px 50px rgba(18, 52, 58, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(110deg, rgba(18, 155, 160, 0.92) 0 50%, rgba(18, 155, 160, 0) 50.2%),
    linear-gradient(rgba(16, 42, 45, 0.2), rgba(16, 42, 45, 0.2)),
    url("/assets/roofs/backdrop.jpg") center top / cover fixed,
    #edf2ef;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

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

.app-shell {
  min-height: 100vh;
  padding: 16px 24px 56px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 28px;
  width: min(1280px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 12px 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 190px;
}

.brand img {
  display: block;
  width: 142px;
  height: auto;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 1;
}

.topbar nav a {
  color: #566467;
  font-size: 15px;
}

.topbar nav a.active {
  color: var(--coral);
}

.quote-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 2px;
  padding: 0 22px;
  cursor: pointer;
  font-weight: 700;
}

.quote-button,
.primary-button {
  color: #fff;
  background: var(--coral);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.secondary-button.disabled {
  pointer-events: none;
  color: #9ca8aa;
  background: #f3f5f4;
}

.hidden {
  display: none !important;
}

.login-view,
.workspace-view {
  width: min(1280px, calc(100vw - 48px));
  margin: 54px auto 0;
}

.login-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 70px;
  align-items: center;
  min-height: 660px;
}

.login-copy {
  color: #fff;
  max-width: 660px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--coral);
  font-weight: 700;
  font-style: italic;
}

.login-copy .eyebrow,
.hero-band .eyebrow {
  color: #ff876d;
}

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

h1 {
  margin-bottom: 24px;
  font-size: clamp(42px, 6vw, 78px);
  line-height: 1.02;
  font-weight: 400;
}

h2 {
  margin-bottom: 6px;
  font-size: 23px;
}

.login-copy p:not(.eyebrow),
.hero-band p:not(.eyebrow) {
  max-width: 720px;
  font-size: 20px;
  line-height: 1.55;
}

.login-panel,
.tool-panel,
.result-panel {
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-panel {
  display: grid;
  gap: 18px;
  padding: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

.hint,
.status-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.hero-band {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  min-height: 280px;
  color: #fff;
  padding-top: 42px;
}

.hero-band h1 {
  max-width: 820px;
  font-size: clamp(38px, 5vw, 66px);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  padding: 8px 8px 8px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
}

.user-pill button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  color: #fff;
  background: var(--teal-dark);
  cursor: pointer;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.75fr);
  gap: 28px;
  align-items: start;
  margin-top: -26px;
}

.tool-panel,
.result-panel {
  padding: 26px;
}

.panel-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 8px 0 18px;
}

.panel-heading span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  font-weight: 700;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
}

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

.upload-box {
  place-items: center;
  min-height: 130px;
  border: 2px dashed #aac9c8;
  border-radius: 8px;
  color: var(--teal-dark);
  background: #eef8f7;
  cursor: pointer;
  text-align: center;
}

.upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-box span {
  color: var(--ink);
  font-size: 18px;
}

.photo-preview,
.result-frame {
  display: grid;
  place-items: center;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.photo-preview {
  min-height: 260px;
  margin: 16px 0 28px;
}

.result-frame {
  min-height: 420px;
}

.photo-preview img,
.result-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-frame img,
.history-card img {
  cursor: zoom-in;
}

.preview-empty {
  color: #7b8b8e;
  padding: 28px;
  text-align: center;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.tile-card {
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 22px rgba(23, 52, 58, 0.08);
  cursor: pointer;
  text-align: left;
}

.tile-card.selected {
  border-color: var(--coral);
}

.tile-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1.35;
  object-fit: cover;
}

.tile-card span,
.tile-card small {
  display: block;
  padding: 0 10px;
}

.tile-card span {
  padding-top: 10px;
  font-weight: 700;
}

.tile-card small {
  padding-bottom: 10px;
  color: var(--muted);
}

.generate-button {
  width: 100%;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 16px;
}

.history-section {
  margin-top: 48px;
  padding: 42px 0 0;
  background: #fff;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: 36px;
}

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

.history-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1.45;
  object-fit: cover;
  background: var(--soft);
}

.history-card div {
  padding: 14px;
}

.history-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.history-card p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer {
  width: min(1280px, calc(100vw - 48px));
  margin: 42px auto 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  text-align: center;
}

.image-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(7, 24, 28, 0.88);
  cursor: zoom-out;
}

.image-overlay img {
  max-width: min(1400px, 94vw);
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    flex-wrap: wrap;
  }

  .topbar nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .login-view,
  .workspace-grid,
  .hero-band {
    grid-template-columns: 1fr;
  }

  .workspace-grid {
    display: grid;
  }

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

@media (max-width: 620px) {
  .app-shell {
    padding: 10px 12px 36px;
  }

  .topbar,
  .login-view,
  .workspace-view,
  .site-footer {
    width: 100%;
  }

  .quote-button {
    width: 100%;
  }

  .form-grid,
  .result-actions,
  .tile-grid,
  .history-grid {
    grid-template-columns: 1fr;
  }

  .tool-panel,
  .result-panel,
  .login-panel {
    padding: 18px;
  }
}
