:root {
  --ink: #12313d;
  --muted: #5d7080;
  --line: #d7e8ea;
  --teal: #00a79d;
  --blue: #1177a8;
  --red: #ff003d;
  --paper: #eefafa;
  --shadow: 0 18px 45px rgba(18, 49, 61, 0.12);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 90% -10%, rgba(0, 167, 157, 0.14), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, rgba(17, 119, 168, 0.12), transparent 55%),
    #f6fbfa;
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans Thai", Tahoma, sans-serif;
}

[hidden] {
  display: none !important;
}

/* ---------- Login screen ---------- */

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

.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(18, 49, 61, 0.18);
  padding: 38px 34px;
  text-align: center;
}

.login-card img {
  height: 54px;
  object-fit: contain;
  margin-bottom: 14px;
}

.login-eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.login-hint {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  color: #0f6d72;
}

.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfefd;
  color: var(--ink);
  font: inherit;
  padding: 13px 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-card input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(0, 167, 157, 0.14);
}

.login-button {
  width: 100%;
  margin-top: 6px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--teal), var(--blue));
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0.02em;
  min-height: 50px;
  padding: 0 20px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.login-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 167, 157, 0.35);
  filter: brightness(1.04);
}

.login-button:disabled {
  cursor: wait;
  filter: grayscale(0.3);
}

.login-status {
  margin-top: 14px;
  border-radius: 10px;
  background: #fff0f2;
  color: #bd1736;
  font-size: 14px;
  font-weight: 750;
  padding: 11px 12px;
}

.login-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- Admin app ---------- */

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  padding: 20px clamp(18px, 4vw, 56px);
  backdrop-filter: blur(18px);
}

.admin-header p {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-header h1 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.2;
}

.admin-header nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-header a,
.admin-header button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0 20px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.admin-header a:hover,
.admin-header button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(18, 49, 61, 0.12);
}

button[data-save] {
  border-color: transparent;
  background: linear-gradient(120deg, var(--teal), var(--blue));
  color: white;
}

.logout-button {
  color: #bd1736;
}

.admin-shell {
  display: grid;
  grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
  gap: 22px;
  padding: 28px clamp(18px, 4vw, 56px) 64px;
}

.admin-note,
.block {
  border: 1px solid rgba(215, 232, 234, 0.9);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

.admin-note {
  position: sticky;
  top: 108px;
  height: fit-content;
  padding: 22px;
}

.admin-note h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.admin-note p {
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

.admin-search {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfefd;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 11px 16px;
}

.admin-search:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(0, 167, 157, 0.12);
}

code {
  border-radius: 6px;
  background: var(--paper);
  padding: 2px 6px;
}

.status {
  border-radius: 10px;
  background: #f2f8f8;
  color: var(--muted);
  margin-top: 16px;
  padding: 12px;
  font-weight: 750;
  font-size: 14px;
}

.status.is-ok {
  background: #e7fbf5;
  color: #08765f;
}

.status.is-error {
  background: #fff0f2;
  color: #bd1736;
}

.editor {
  display: grid;
  gap: 18px;
}

.block {
  overflow: hidden;
}

.block summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 24px;
  transition: background 0.15s ease;
}

.block summary:hover {
  background: #f6fcfb;
}

.block summary::-webkit-details-marker {
  display: none;
}

.block summary strong {
  display: block;
  font-size: 20px;
}

.block summary span {
  color: var(--muted);
  font-size: 13px;
}

.fields {
  display: grid;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding: 22px 24px 26px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > label {
  color: #0f6d72;
  font-weight: 900;
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfefd;
  color: var(--ink);
  font: inherit;
  padding: 12px 14px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 167, 157, 0.12);
}

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

/* Bilingual inputs */

.lang-grid {
  display: grid;
  gap: 10px;
}

.lang-input {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.lang-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 5px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.lang-badge.is-th {
  background: rgba(0, 167, 157, 0.12);
  color: #067d75;
}

.lang-badge.is-en {
  background: rgba(17, 119, 168, 0.12);
  color: #0d5f86;
}

.image-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.image-row img {
  width: 180px;
  height: 116px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eefafa;
  object-fit: cover;
}

.image-actions {
  display: grid;
  gap: 10px;
}

.image-actions input[type="file"] {
  width: 100%;
}

.image-actions input[type="text"] {
  font-size: 14px;
}

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

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

  .admin-note {
    position: static;
  }
}
