:root {
  --navy-950: #041122;
  --navy-900: #071a33;
  --blue-600: #1769c2;
  --blue-500: #2380e2;
  --steel-800: #243043;
  --steel-700: #394452;
  --steel-500: #697686;
  --steel-200: #d9e0e8;
  --steel-100: #eef2f6;
  --white: #ffffff;
  --danger: #b42318;
  --success: #1d7f43;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(4, 17, 34, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: #101923;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 70% 10%, rgba(35, 128, 226, 0.24), transparent 30%),
    linear-gradient(135deg, var(--navy-950), #082846);
}

.login-card {
  width: min(100%, 430px);
  display: grid;
  gap: 16px;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card img {
  width: 260px;
  max-width: 100%;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.login-card h1 {
  margin: 8px 0 0;
  color: var(--navy-950);
  font-size: 28px;
  line-height: 1.1;
}

.login-card p {
  margin: 0;
  color: var(--steel-700);
}

.login-card label,
.field {
  display: grid;
  gap: 8px;
  color: var(--navy-950);
  font-size: 14px;
  font-weight: 750;
}

.login-card input,
.field input,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #c8d3df;
  border-radius: 7px;
  background: var(--white);
  color: #101923;
  font-size: 15px;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.login-card input:focus,
.field input:focus,
.field textarea:focus {
  outline: 3px solid rgba(35, 128, 226, 0.22);
  border-color: var(--blue-600);
}

.login-card button,
.admin-actions button,
.media-upload button,
.json-actions button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--blue-600);
  color: var(--white);
  cursor: pointer;
  font-weight: 850;
}

.login-card button:hover,
.admin-actions button:hover,
.media-upload button:hover,
.json-actions button:hover {
  transform: translateY(-1px);
  background: var(--blue-500);
}

.login-error,
.status-line.is-error {
  border-color: rgba(180, 35, 24, 0.22);
  background: #fff0ee;
  color: var(--danger);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
  background:
    linear-gradient(180deg, var(--navy-950), var(--navy-900));
  color: var(--white);
}

.admin-logo {
  display: block;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.admin-logo img {
  width: 100%;
  display: block;
}

.admin-tabs {
  display: grid;
  gap: 8px;
}

.admin-tabs button,
.logout-link {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  text-align: left;
  text-decoration: none;
}

.admin-tabs button:hover,
.admin-tabs button.is-active,
.logout-link:hover {
  background: var(--blue-600);
  color: var(--white);
}

.logout-link {
  margin-top: auto;
}

.admin-main {
  min-width: 0;
  padding: 28px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-header p {
  margin: 0 0 5px;
  color: var(--blue-600);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-header h1 {
  margin: 0;
  color: var(--navy-950);
  font-size: 32px;
  line-height: 1.1;
}

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

.admin-actions a,
.json-actions label {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 10px 16px;
  border: 1px solid #c8d3df;
  border-radius: 7px;
  background: var(--white);
  color: var(--navy-950);
  cursor: pointer;
  font-weight: 850;
  text-decoration: none;
}

.admin-actions .primary-action {
  background: var(--navy-950);
}

.status-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 1px solid rgba(29, 127, 67, 0.22);
  border-radius: var(--radius);
  background: #effaf3;
  color: var(--success);
  font-size: 14px;
  font-weight: 760;
}

.admin-content {
  display: grid;
  gap: 18px;
}

.panel {
  display: none;
}

.panel.is-active {
  display: grid;
  gap: 18px;
}

.panel-section {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(7, 26, 51, 0.1);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 14px 38px rgba(4, 17, 34, 0.06);
}

.panel-section h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: 22px;
  line-height: 1.2;
}

.panel-section > p {
  max-width: 760px;
  margin: -8px 0 0;
  color: var(--steel-700);
}

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

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

.field small,
.media-card small {
  color: var(--steel-500);
  font-size: 12px;
  font-weight: 650;
}

.media-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.media-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(7, 26, 51, 0.1);
  border-radius: var(--radius);
  background: #f8fafc;
}

.media-card h3 {
  margin: 0;
  color: var(--navy-950);
  font-size: 16px;
}

.media-preview {
  min-height: 160px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d7e0ea;
  border-radius: 7px;
  background:
    linear-gradient(45deg, #eff3f8 25%, transparent 25%),
    linear-gradient(-45deg, #eff3f8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eff3f8 75%),
    linear-gradient(-45deg, transparent 75%, #eff3f8 75%),
    #ffffff;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

.media-preview img,
.media-preview video {
  width: 100%;
  height: 180px;
  display: block;
  object-fit: cover;
}

.media-preview.logo-preview img {
  width: 86%;
  height: auto;
  padding: 16px;
  object-fit: contain;
  background: var(--navy-950);
}

.media-upload {
  display: grid;
  gap: 8px;
}

.media-upload input[type="file"] {
  width: 100%;
  font-size: 13px;
}

.nested-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(7, 26, 51, 0.08);
  border-radius: var(--radius);
  background: #f8fafc;
}

.nested-group h3 {
  margin: 0;
  color: var(--navy-950);
  font-size: 17px;
}

.array-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(7, 26, 51, 0.08);
  border-radius: var(--radius);
  background: var(--white);
}

.array-item > strong {
  color: var(--blue-600);
  font-size: 13px;
  text-transform: uppercase;
}

.json-editor {
  min-height: 520px;
  width: 100%;
  padding: 16px;
  border: 1px solid #c8d3df;
  border-radius: var(--radius);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}

.json-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.json-actions input {
  display: none;
}

@media (max-width: 1100px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .admin-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .logout-link {
    margin-top: 0;
  }

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

@media (max-width: 760px) {
  .admin-main {
    padding: 18px;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-actions {
    width: 100%;
    justify-content: stretch;
  }

  .admin-actions a,
  .admin-actions button {
    flex: 1 1 160px;
    justify-content: center;
  }

  .admin-tabs,
  .field-grid,
  .media-grid {
    grid-template-columns: 1fr;
  }
}
