:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #f1eee7;
  --text: #171717;
  --muted: #667085;
  --line: #ded8ce;
  --brand: #164e63;
  --brand-dark: #123d4d;
  --accent: #b45309;
  --danger: #b42318;
  --shadow: none;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button,
.file-trigger {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.file-trigger:focus-visible {
  outline: 3px solid rgba(22, 78, 99, 0.2);
  outline-offset: 2px;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 32px));
  min-height: 78px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(222, 216, 206, 0.9);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: auto;
  height: 34px;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 650;
}

.brand-name,
.brand-subtitle {
  display: block;
  line-height: 1.2;
}

.brand-name {
  font-size: 1.02rem;
  font-weight: 650;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
}

.public-shell,
.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

body[data-page="public"] .public-shell {
  padding-top: 34px;
}

.kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(1.9rem, 3.8vw, 3.15rem);
  font-weight: 560;
  letter-spacing: 0;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 560;
  letter-spacing: 0;
}

.showcase-section,
.admin-panel,
.login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
}

.showcase-section {
  min-height: 220px;
  border: 0;
  background: transparent;
  padding: 0;
}

.section-heading,
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.count-badge {
  flex: 0 0 auto;
  border: 1px solid #c7d7dd;
  border-radius: 999px;
  background: #edf7fa;
  color: var(--brand-dark);
  padding: 6px 11px;
  font-size: 0.84rem;
  font-weight: 600;
}

.empty-state {
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

.empty-state span {
  font-size: 0.95rem;
}

body[data-page="public"] .empty-state {
  min-height: 72px;
  place-items: start;
  border: 0;
  padding-top: 8px;
  text-align: left;
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(286px, 1fr));
  gap: 18px;
}

.site-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.site-image {
  aspect-ratio: 16 / 10;
  width: 100%;
  object-fit: cover;
  background: var(--surface-soft);
}

.site-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.site-content h3 {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.3;
}

.feature-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.feature-list li {
  position: relative;
  padding-left: 17px;
  line-height: 1.42;
}

.feature-list li::before {
  content: "";
  position: absolute;
  top: 0.65em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.card-actions,
.panel-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card-actions {
  margin-top: auto;
}

.primary-button,
.ghost-button,
.link-button,
.delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

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

.primary-button:hover,
.link-button:hover {
  background: var(--brand-dark);
}

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

.ghost-button:hover {
  background: var(--surface-soft);
}

.delete-button {
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.delete-button:hover {
  background: rgba(180, 35, 24, 0.14);
}

.primary-button:active,
.ghost-button:active,
.link-button:active,
.delete-button:active {
  transform: translateY(1px);
}

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

.login-card {
  display: grid;
  gap: 18px;
  width: min(430px, 100%);
  padding: 28px;
}

.login-copy h1 {
  font-size: clamp(1.55rem, 4.5vw, 2rem);
  line-height: 1.08;
}

.login-error {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 600;
}

.admin-header {
  width: 100%;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(330px, 430px) minmax(0, 1fr);
  gap: 24px;
  padding: 28px 0 38px;
}

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

.admin-preview {
  min-height: calc(100vh - 144px);
}

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

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

label span,
.field-group > span {
  color: #525c6a;
  font-size: 0.88rem;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

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

textarea {
  min-height: 132px;
  padding: 12px;
  line-height: 1.45;
  resize: vertical;
}

input:hover,
textarea:hover {
  border-color: #c7c0b5;
}

#importInput,
#imageFile {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.upload-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 5px;
}

.upload-row .ghost-button {
  min-height: 32px;
  padding: 0 10px;
}

.file-name {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.image-preview img {
  display: block;
  width: 100%;
  max-height: 190px;
  object-fit: cover;
}

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

.status-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  border-radius: 8px;
  background: #171717;
  color: #fff;
  padding: 12px 14px;
  box-shadow: none;
  font-size: 0.92rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.status-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 920px) {
  .showcase-intro,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .site-header,
  .public-shell,
  .admin-shell {
    width: min(100% - 20px, 1180px);
  }

  .site-header {
    min-height: 68px;
  }

  body[data-page="public"] .public-shell {
    padding-top: 24px;
  }

  .showcase-section,
  .admin-panel,
  .login-card {
    padding: 18px;
  }

  .section-heading,
  .panel-header {
    display: grid;
  }

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

  .panel-actions,
  .form-actions,
  .card-actions {
    width: 100%;
  }

  .primary-button,
  .ghost-button,
  .link-button,
  .delete-button {
    flex: 1;
    min-width: 0;
  }
}

body[data-page="public"] .showcase-section {
  padding: 0;
}
