:root {
  --ink: #171b1a;
  --muted: #68706b;
  --paper: #f5f1e8;
  --bone: #fffaf0;
  --line: rgba(23, 27, 26, 0.14);
  --forest: #1f3a34;
  --copper: #b85c38;
  --green-soft: #dfe8d8;
  --shadow: 0 18px 58px rgba(20, 24, 22, 0.14);
  --radius: 8px;
  --font-body: "Aptos", "Segoe UI", sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --text-sm: 0.9rem;
  --text-base: 1rem;
  --title-sm: clamp(1.3rem, 2vw, 1.85rem);
  --title-md: clamp(1.55rem, 2.8vw, 2.35rem);
  --title-lg: clamp(2rem, 3.4vw, 3.2rem);
  font-family: var(--font-body);
}

* {
  box-sizing: border-box;
}

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

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

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  padding: 24px;
  color: var(--bone);
  background: var(--forest);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 42px;
  padding: 8px;
  border-radius: 14px;
  transition: background 180ms ease, transform 180ms ease;
}

.brand:hover {
  background: rgba(255, 250, 240, 0.08);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 250, 240, 0.96), rgba(231, 222, 203, 0.9));
  border: 1px solid rgba(255, 250, 240, 0.42);
  border-radius: 4px;
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(31, 58, 52, 0.08);
  font-size: 0;
}

.brand-mark::after {
  width: 35px;
  height: 40px;
  content: "";
  background: url("../assets/images/monotekton-mark-crop.png") center / contain no-repeat;
  filter: drop-shadow(0 1px 0 rgba(255, 250, 240, 0.35));
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  width: 128px;
  height: 14px;
  overflow: hidden;
  background: currentColor;
  -webkit-mask: url("../assets/images/monotekton-wordmark.png") left center / contain no-repeat;
  mask: url("../assets/images/monotekton-wordmark.png") left center / contain no-repeat;
  text-indent: -999px;
  white-space: nowrap;
}

.brand small {
  color: rgba(255, 250, 240, 0.68);
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar nav a {
  padding: 12px 14px;
  border-radius: var(--radius);
  color: rgba(255, 250, 240, 0.74);
}

.sidebar nav a.is-active,
.sidebar nav a:hover {
  color: var(--bone);
  background: rgba(255, 250, 240, 0.12);
}

.admin-shell {
  margin-left: 260px;
  padding: clamp(22px, 4vw, 46px);
}

.admin-header,
.form-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--copper);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1,
h2 {
  margin-bottom: 0;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.025em;
}

h1 {
  font-size: var(--title-lg);
  line-height: 1.04;
}

h2 {
  font-size: var(--title-md);
  line-height: 1.08;
}

.admin-intro,
.form-note {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.import-button {
  position: relative;
  overflow: hidden;
}

.import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
}

.button {
  padding: 0 16px;
}

.icon-button {
  width: 42px;
  background: var(--bone);
}

.button.primary {
  color: var(--bone);
  background: var(--forest);
  border-color: var(--forest);
}

.button.secondary {
  color: var(--forest);
  background: var(--bone);
}

.button.wide {
  width: 100%;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 34px 0;
}

.summary-grid article {
  padding: 22px;
  background: var(--bone);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summary-grid span {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 2.45rem);
}

.summary-grid p {
  margin: 0;
  color: var(--muted);
}

.control-room {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr;
  gap: 14px;
  margin: 0 0 18px;
}

.control-room article {
  min-height: 100%;
  padding: 18px;
  background: var(--bone);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.control-room h2,
.control-room h3 {
  margin: 0;
}

.storage-track {
  height: 9px;
  margin: 14px 0 0;
  overflow: hidden;
  background: rgba(31, 58, 52, 0.12);
  border-radius: 999px;
}

.storage-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--forest), var(--copper));
  border-radius: inherit;
  transition: width 180ms ease;
}

.health-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.health-list li {
  padding: 9px 10px;
  color: var(--forest);
  background: var(--green-soft);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 800;
}

.admin-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 10px;
  background: rgba(245, 241, 232, 0.9);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-tabs button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--forest);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.admin-tabs button.is-active {
  color: var(--bone);
  background: var(--forest);
}

.admin-tab-panel {
  display: none !important;
}

.admin-tab-panel.is-active {
  display: grid !important;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.editor,
.site-content-panel,
.project-list-panel {
  padding: 22px;
  background: var(--bone);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.editor {
  display: grid;
  gap: 16px;
  scroll-margin-top: 18px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.editor.is-editing {
  border-color: rgba(184, 92, 56, 0.55);
  box-shadow: 0 20px 70px rgba(184, 92, 56, 0.2);
}

.editor.has-unsaved,
.editor-group.has-unsaved {
  border-color: rgba(184, 92, 56, 0.62);
  box-shadow: 0 18px 54px rgba(184, 92, 56, 0.14);
}

.editor.has-unsaved::before,
.editor-group.has-unsaved::before {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  color: var(--forest);
  background: #f3d5bc;
  border-radius: 999px;
  content: "Unsaved changes";
  font-size: 0.78rem;
  font-weight: 900;
}

.edit-helper {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  color: var(--forest);
  background: var(--green-soft);
  border: 1px solid rgba(31, 58, 52, 0.16);
  border-radius: var(--radius);
}

.edit-helper strong {
  font-size: 0.96rem;
}

.edit-helper span {
  color: var(--muted);
  line-height: 1.45;
}

.site-content-panel {
  margin-bottom: 18px;
}

.site-content-panel.is-hidden {
  display: none;
}

.site-content-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.editor-group {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf7;
}

.group-title {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.group-title > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--bone);
  background: var(--forest);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.group-title h3 {
  margin: 0 0 5px;
  font-size: 1rem;
}

.group-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 800;
}

label small {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
}

.file-upload {
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  color: var(--forest);
  background: var(--green-soft);
  border: 1px dashed rgba(31, 58, 52, 0.32);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
}

.file-upload.compact {
  min-height: 44px;
}

.file-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

input,
textarea,
select {
  width: 100%;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(31, 58, 52, 0.12);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toggle-stack {
  display: grid;
  align-content: end;
  gap: 8px;
}

.toggle-field {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.toggle-field input {
  width: 18px;
  height: 18px;
}

.admin-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.image-preview {
  display: grid;
  min-height: 170px;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background: var(--green-soft);
  border: 1px dashed rgba(31, 58, 52, 0.28);
  border-radius: var(--radius);
  font-weight: 800;
}

.image-preview img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.image-preview span {
  padding: 12px;
}

.sr-only-field {
  min-height: 0;
  height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.gallery-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gallery-toolbar div {
  display: grid;
  gap: 3px;
}

.gallery-toolbar span {
  color: var(--muted);
  line-height: 1.4;
}

.gallery-list {
  display: grid;
  gap: 10px;
}

.gallery-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 90px auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf7;
}

.gallery-thumb {
  display: grid;
  width: 112px;
  height: 76px;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background: var(--green-soft);
  border-radius: 6px;
  font-weight: 800;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-actions {
  display: flex;
  gap: 8px;
}

.admin-card {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf7;
}

.admin-card.is-current {
  border-color: rgba(184, 92, 56, 0.5);
  box-shadow: 0 14px 34px rgba(184, 92, 56, 0.13);
}

.admin-card img {
  width: 124px;
  height: 88px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--green-soft);
}

.admin-card h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.admin-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.detail-shortcut {
  display: inline-block;
  margin-top: 10px;
  color: var(--copper);
  font-size: 0.9rem;
  font-weight: 800;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.status-pills span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  color: var(--forest);
  background: var(--green-soft);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.danger {
  color: #8b2419;
  border-color: rgba(139, 36, 25, 0.22);
  background: #fff3ef;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .admin-shell {
    margin-left: 0;
  }

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

@media (max-width: 680px) {
  .admin-header,
  .form-heading,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-grid,
  .control-room,
  .field-row {
    grid-template-columns: 1fr;
  }

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

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

  .gallery-thumb {
    width: 100%;
    height: 180px;
  }

  .admin-card img {
    width: 100%;
    height: 180px;
  }

  .card-actions {
    width: 100%;
  }

  .card-actions button {
    flex: 1;
  }
}
