:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d9dde3;
  --accent: #2563eb;
  --danger: #dc2626;
  --success: #15803d;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #111827;
  color: white;
  padding: 14px 18px;
}
.topbar nav { display: flex; gap: 12px; flex-wrap: wrap; }
.topbar a { color: #e5e7eb; text-decoration: none; }
.brand { font-weight: 700; }
.page { padding: 18px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.grid-editor {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
}
.left-panel { max-height: calc(100vh - 110px); overflow: auto; }
.preview-panel { min-height: 700px; }
.page-grid-2 {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
}
.field-group { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
}
input[type="checkbox"] { transform: translateY(1px); }
button {
  border: 0;
  border-radius: 10px;
  background: #e5e7eb;
  color: #111827;
  padding: 9px 12px;
  cursor: pointer;
}
button.success { background: #dcfce7; color: #166534; }
button.danger { background: #fee2e2; color: #991b1b; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.inline-fields, .toolbar-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.inline-fields > div { flex: 1; }
.toolbar-row.compact { justify-content: flex-end; }
.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
#stageWrapper {
  margin-top: 12px;
  border: 1px dashed #b8c0cc;
  border-radius: 14px;
  background: #eef2f7;
  padding: 14px;
  min-height: 480px;
  overflow: auto;
}
#editorStage {
  min-height: 420px;
}
.help-text, small { color: var(--muted); }
.element-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fafafa;
}
.element-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,0.12); }
.element-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.asset-card, .list-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.asset-card img { width: 100%; height: 160px; object-fit: cover; background: #f9fafb; }
.asset-card.wide img { height: 90px; object-fit: contain; }
.asset-meta { padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.list-cards { display: flex; flex-direction: column; gap: 10px; }
.list-card { padding: 14px; flex-direction: row; justify-content: space-between; align-items: center; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; vertical-align: top; }
.hidden { display: none; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; font-size: 12px; }
@media (max-width: 1100px) {
  .grid-editor, .page-grid-2 { grid-template-columns: 1fr; }
  .left-panel { max-height: none; }
}


.collapsible {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
  margin-bottom: 14px;
  overflow: hidden;
}
.collapsible summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
  list-style: none;
}
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
}
.collapsible:not([open]) summary::after {
  content: "▸";
}
.collapsible-body {
  padding: 0 14px 14px;
}
.exact-preview-wrap {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.exact-preview-image {
  display: block;
  width: 100%;
  max-width: 900px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
}
.element-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.element-actions { display: flex; gap: 8px; align-items: center; }
.element-card .field-group.inline { display: flex; gap: 14px; flex-wrap: wrap; }


.logout-form {
  display: inline-block;
  margin: 0;
}

.logout-button {
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  padding: 10px 12px;
}

.auth-form button {
  padding: 12px;
  cursor: pointer;
}

.auth-error {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffe4e4;
  color: #9b1c1c;
}
