:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --ink: #182230;
  --muted: #667085;
  --line: #d9e2ec;
  --accent: #1769e0;
  --accent-2: #0f9f7a;
  --danger: #c73535;
  --radius: 8px;
  --shadow: 0 16px 40px rgba(24, 34, 48, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; border-radius: var(--radius); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar {
  background: #101828;
  color: #e4eaf2;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display:block; font-size: 20px; font-weight: 760; margin-bottom: 26px; }
.nav { display: grid; gap: 6px; }
.nav a {
  color: #c9d4e2;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-weight: 650;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.main { min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 3;
}
.container { width: min(1180px, calc(100% - 44px)); margin: 26px auto 48px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, #f5f9ff 0%, #eef7f3 100%); }
.auth-card { width: min(460px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 30px; }
.hero {
  background: linear-gradient(135deg, #ffffff 0%, #eef6ff 72%, #eafaf4 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px;
  box-shadow: var(--shadow);
}
h1, h2, h3 { line-height: 1.15; margin: 0 0 12px; letter-spacing: 0; }
h1 { font-size: 36px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.panel, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel { padding: 22px; }
.card { padding: 18px; transition: transform .16s ease, box-shadow .16s ease; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.area-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: #eaf2ff;
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 12px;
}
.area-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 14px;
  background: #eaf2ff;
}
.area-cover-admin {
  width: 180px;
  max-width: 100%;
  margin-bottom: 0;
}
.area-admin-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.area-image-placeholder {
  width: 180px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #eaf2ff;
  color: var(--accent);
  font-size: 28px;
  font-weight: 800;
}
.area-form-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #f9fbfd;
}
.area-form-preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  margin-bottom: 8px;
}
.area-form-preview span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.search-row { display: flex; gap: 10px; margin-top: 22px; }
.search-row input { flex: 1; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 11px 12px;
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: 7px; font-weight: 680; color: #344054; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 760;
  cursor: pointer;
  min-height: 42px;
}
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--danger); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section { margin-top: 28px; }
.flash { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 18px; background: #eafaf4; border: 1px solid #b7ead8; color: #075c45; }
.flash.error { background: #fff1f1; border-color: #ffc9c9; color: #8a1f1f; }
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #f9fbfd; color: #475467; font-size: 13px; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #eef4ff; color: #175cd3; font-weight: 760; font-size: 12px; }
.badge.ok { background: #e9f9f1; color: #067647; }
.badge.warn { background: #fff7e6; color: #a15c07; }
.content {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}
.content p { margin: 0 0 14px; }
.content table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.content th, .content td { border: 1px solid var(--line); padding: 10px; }
.content blockquote { margin: 18px 0; padding: 14px 16px; border-left: 4px solid var(--accent); background: #f9fbfd; }
.editor-toolbar { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px; background: #f9fbfd; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.editor-toolbar button { min-width: 34px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 6px; font-weight: 800; cursor: pointer; padding: 0 8px; }
.editor {
  min-height: 420px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: #fff;
}
.html-source {
  min-height: 420px;
  font-family: Consolas, monospace;
  border-radius: 0 0 var(--radius) var(--radius);
}
.editor-help { background: #f9fbfd; }
.attachment-tags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.tag-button {
  display: grid;
  gap: 3px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
}
.tag-button span { font-family: Consolas, monospace; color: var(--accent); font-weight: 800; }
.tag-button small { color: var(--muted); overflow-wrap: anywhere; }
.upload-progress { min-height: 20px; font-size: 13px; color: var(--muted); }
.attachment-list { display: grid; gap: 10px; }
.attachment, .embed-card { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.embed-card { margin: 18px 0; align-items: center; }
.embed-card small { display: block; color: var(--muted); }
.embed-card.missing { color: #a15c07; background: #fff7e6; }
.embedded-media { margin: 22px 0; }
.embedded-media img, .embedded-media video { width: 100%; display: block; }
.embedded-media figcaption, .media-gallery figcaption { color: var(--muted); font-size: 13px; margin-top: 8px; }
.pdf-embed { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #f9fbfd; margin: 22px 0; }
.pdf-embed iframe { width: 100%; height: min(620px, 70vh); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.media-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 22px 0; }
.media-gallery figure { margin: 0; }
.media-gallery img { width: 100%; height: 240px; object-fit: cover; }
.comment { border-top: 1px solid var(--line); padding: 16px 0; }
.comment:first-child { border-top: 0; }
.split { display: grid; grid-template-columns: 1.5fr .8fr; gap: 22px; align-items: start; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.checkbox-line { display: flex; gap: 8px; align-items: center; font-weight: 520; }
.checkbox-line input { width: auto; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { position: static; padding: 16px 20px; }
  .container { width: min(100% - 28px, 1180px); }
  .grid.cols-2, .grid.cols-3, .grid.cols-5, .split, .attachment-tags, .media-gallery { grid-template-columns: 1fr; }
  .search-row { flex-direction: column; }
  h1 { font-size: 30px; }
}
