/* Admin layout — wider canvas using same design tokens as customer site */

body.admin {
  display: block;
  align-items: initial;
  justify-content: initial;
  padding: 0;
  background: #EBE5D9;
}

/* Impersonation banner — shown when WeCircle admin is logged in as an organizer */
.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px;
  background: #B65C3D;
  color: #FBF8F3;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.impersonation-banner .ib-icon { font-size: 18px; }
.impersonation-banner .ib-text { flex: 1; }
.impersonation-banner .ib-text strong { font-weight: 600; }
.impersonation-banner .ib-stop {
  height: 32px;
  padding: 0 14px;
  background: #FBF8F3;
  color: #1E2A26;
  border: none;
  border-radius: 999px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.impersonation-banner .ib-stop:hover { background: #fff; }

.admin-shell {
  width: 100%;
  max-width: 1100px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
}

.admin-header {
  background: var(--ink);
  color: #FBF8F3;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-header .brand {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.admin-header .brand small {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-top: 2px;
}
.admin-header .user {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0.85;
}
.admin-header .user a, .admin-header .user button {
  color: #FBF8F3;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}

.admin-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 0 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: sticky;
  top: 0;
  z-index: 5;
  scrollbar-width: thin;
}
.admin-nav::-webkit-scrollbar { height: 4px; }
.admin-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.admin-nav a {
  padding: 14px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.admin-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.admin-nav a:hover { color: var(--ink); background: rgba(0,0,0,0.02); }

.admin-main {
  flex: 1;
  padding: 28px 28px 60px;
}
.admin-main h1.page-title {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.admin-main p.page-lead {
  color: var(--ink-2);
  margin: 0 0 24px;
  font-size: 15px;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 14px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-row h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  margin: 0;
}

/* tables */
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  font-size: 14px;
}
.admin-table thead th {
  background: #F0EBDF;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.admin-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(207, 216, 200, 0.18); }
.admin-table .actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.admin-table .swatch {
  display: inline-block;
  width: 22px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid #aaa;
  vertical-align: middle;
}

/* form panels */
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn-sm {
  height: 36px;
  font-size: 13px;
  padding: 0 16px;
}
.btn-danger {
  background: var(--terra);
  color: #FBF8F3;
}

.wysiwyg {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.wysiwyg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 241, 234, 0.6);
}
.wysiwyg-toolbar button {
  height: 30px;
  min-width: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
}
.wysiwyg-toolbar button:hover { background: rgba(30, 42, 38, 0.06); }
.wysiwyg-toolbar button:active { background: rgba(30, 42, 38, 0.12); }
.wysiwyg-sep {
  width: 1px;
  background: var(--line);
  margin: 4px 4px;
}
.wysiwyg-editor {
  min-height: 180px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.55;
  outline: none;
}
.wysiwyg-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-3);
}
.wysiwyg-editor h2 { font-family: 'DM Serif Display', serif; font-size: 22px; margin: 14px 0 6px; }
.wysiwyg-editor h3 { font-family: 'DM Serif Display', serif; font-size: 18px; margin: 12px 0 4px; }
.wysiwyg-editor p { margin: 0 0 10px; }
.wysiwyg-editor ul, .wysiwyg-editor ol { margin: 0 0 10px 24px; }
.wysiwyg-editor a { color: var(--moss); text-decoration: underline; }

.admin-dialog {
  border: none;
  border-radius: 18px;
  padding: 22px 24px 20px;
  max-width: 560px;
  width: calc(100% - 24px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(30, 42, 38, 0.35), 0 2px 6px rgba(30, 42, 38, 0.08);
}
.admin-dialog::backdrop {
  background: rgba(30, 42, 38, 0.45);
  backdrop-filter: blur(2px);
}
.admin-dialog .dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
}
.admin-dialog .form-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.empty-card {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-2);
}
.flash {
  background: var(--sage);
  color: #2A3A2C;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-size: 14px;
}
.flash.error { background: #F2D9CE; color: #5A2A18; }

/* login centred panel */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 22px;
  border: 1px solid var(--line);
  padding: 32px 28px;
}
.login-card h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  margin: 0 0 4px;
}
.login-card p.lead {
  color: var(--ink-2);
  margin: 0 0 22px;
  font-size: 14px;
}
