:root {
  --color-text: #1c1d1f;
  --color-muted: #6d7278;
  --color-line: #e4e2dd;
  --color-bg: #faf9f6;
  --color-panel: #ffffff;
  --color-accent: #61746b;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

button,
input,
textarea {
  font: inherit;
}

button,
.header-actions a {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--color-text);
  background: var(--color-text);
  color: #fff;
  cursor: pointer;
}

button.secondary,
.section-head button,
.header-actions button,
.header-actions a {
  background: transparent;
  color: var(--color-text);
}

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

label {
  display: block;
  margin: 18px 0 8px;
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.admin-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) 0;
}

.login-panel {
  width: min(440px, 100%);
  margin: 10vh auto 0;
  padding: 32px;
  background: var(--color-panel);
  border: 1px solid var(--color-line);
}

.back-link {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--color-muted);
  border-bottom: 1px solid currentColor;
}

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

h1 {
  margin-bottom: 24px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
  font-weight: 520;
}

h2 {
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.form-message,
.save-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--color-accent);
}

.dashboard-header,
.section-head,
.admin-footer,
.header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-header {
  margin-bottom: 28px;
}

.section-kicker {
  margin-bottom: 10px;
  color: var(--color-accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-section {
  margin-bottom: 20px;
  padding: clamp(22px, 4vw, 34px);
  background: var(--color-panel);
  border: 1px solid var(--color-line);
}

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

.section-head p {
  margin-bottom: 0;
  color: var(--color-muted);
}

.gallery-admin {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.gallery-card {
  padding: 12px;
  background: #f4f3ee;
  border: 1px solid var(--color-line);
}

.gallery-card.is-dragging {
  opacity: 0.55;
}

.gallery-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  background: #dedbd3;
}

.gallery-card input[type="file"] {
  margin-top: 12px;
  padding: 10px;
  background: #fff;
}

.gallery-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.gallery-controls button {
  min-height: 38px;
  padding: 8px 10px;
  border-color: var(--color-line);
  background: #fff;
  color: var(--color-text);
}

.gallery-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.drag-handle {
  cursor: grab;
}

.admin-footer {
  position: sticky;
  bottom: 0;
  padding: 18px 0;
  background: rgba(250, 249, 246, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 860px) {
  .dashboard-header,
  .section-head,
  .admin-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .gallery-admin {
    grid-template-columns: 1fr;
  }
}
