:root {
  --charcoal: #4e5552;
  --ink: #23231f;
  --gold: #b29869;
  --cream: #f6f4ef;
  --line: #e6e2d8;
  --grey: #65676b;
  --fbblue: #1877f2;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: #eef0f3; color: var(--ink); }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login {
  position: fixed; inset: 0; background: var(--cream);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.login__card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 40px 36px; width: 360px; max-width: 90vw; text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}
.login__mark {
  width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--charcoal); color: var(--cream);
  font-family: Georgia, "Times New Roman", serif; font-size: 34px;
  display: flex; align-items: center; justify-content: center;
}
.login__card h1 { font-size: 19px; margin: 0 0 6px; color: var(--ink); font-weight: 600; }
.login__card p { font-size: 14px; color: var(--grey); margin: 0 0 20px; line-height: 1.5; }
.login__card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; margin-bottom: 12px;
}
.login__card input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(178,152,105,0.2); }
.login__card button {
  width: 100%; padding: 12px; border: none; border-radius: 8px; background: var(--charcoal);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.login__card button:hover { background: var(--ink); }
.login__err { color: #c0392b; font-size: 13px; margin-top: 12px; min-height: 16px; }

/* ---------- Top bar ---------- */
.topbar {
  height: 56px; background: var(--ink); color: #fff; display: flex; align-items: center;
  padding: 0 18px; gap: 16px; position: sticky; top: 0; z-index: 20;
}
.topbar__brand { font-weight: 600; font-size: 15px; letter-spacing: 0.01em; }
.topbar__amp { color: var(--gold); font-family: Georgia, serif; font-size: 18px; margin-right: 4px; }
.topbar__status { margin-left: auto; font-size: 13px; color: #b9bbb0; min-width: 120px; text-align: right; }
.topbar__status.saved { color: #7ed49b; }
.topbar__status.saving { color: var(--gold); }
.topbar__logout {
  background: transparent; border: 1px solid #4a4a45; color: #d5d5cf; border-radius: 6px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.topbar__logout:hover { background: #333; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 300px 1fr; min-height: calc(100vh - 56px); }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

/* ---------- Sidebar ---------- */
.sidebar { background: #fff; border-right: 1px solid var(--line); overflow-y: auto; padding: 8px 0 40px; }
.concept__head {
  padding: 12px 18px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--gold);
}
.concept__name { font-size: 13px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; margin-top: 2px; }
.variant {
  display: flex; align-items: center; gap: 10px; padding: 9px 18px 9px 26px; cursor: pointer;
  font-size: 13.5px; color: #3a3a37; border-left: 3px solid transparent;
}
.variant:hover { background: var(--cream); }
.variant.active { background: var(--cream); border-left-color: var(--gold); font-weight: 600; color: var(--ink); }
.variant__tag { font-size: 11px; color: var(--grey); font-weight: 600; min-width: 22px; }
.variant__edited { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-left: auto; flex-shrink: 0; }

/* ---------- Main ---------- */
.main { display: grid; grid-template-columns: 1fr 380px; gap: 0; align-items: start; }
@media (max-width: 1180px) { .main { grid-template-columns: 1fr; } }

.preview { padding: 28px; display: flex; flex-direction: column; align-items: center; }
.preview__label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--grey); margin-bottom: 14px; align-self: flex-start;
}

/* ---------- Facebook card ---------- */
.fb {
  width: 500px; max-width: 100%; background: #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2); border: 1px solid #dddfe2;
}
.fb__head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px; }
.fb__avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--charcoal); color: var(--cream);
  font-family: Georgia, serif; font-size: 22px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fb__name { font-size: 14px; font-weight: 600; color: #050505; line-height: 1.2; }
.fb__meta { font-size: 12px; color: var(--grey); }
.fb__dots { margin-left: auto; color: var(--grey); font-size: 20px; }
.fb__primary { padding: 0 12px 10px; font-size: 15px; line-height: 1.4; color: #050505; white-space: pre-wrap; word-wrap: break-word; }
.fb__primary .conf { background: #fff3cd; box-shadow: 0 0 0 1px #ffe08a; border-radius: 2px; padding: 0 2px; }
.fb__img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: var(--cream); }
.fb__linkbar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: #f0f2f5; }
.fb__linktxt { flex: 1; min-width: 0; }
.fb__domain { font-size: 12px; color: var(--grey); text-transform: uppercase; letter-spacing: 0.02em; }
.fb__headline { font-size: 16px; font-weight: 600; color: #050505; line-height: 1.25; margin-top: 3px; word-wrap: break-word; }
.fb__cta { flex-shrink: 0; background: #e4e6eb; color: #050505; border: none; padding: 9px 16px; border-radius: 6px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.fb__react { display: flex; border-top: 1px solid #ced0d4; }
.fb__react div { flex: 1; text-align: center; color: var(--grey); font-size: 14px; font-weight: 600; padding: 8px; }

/* ---------- Editor ---------- */
.editor { padding: 28px 28px 60px; border-left: 1px solid var(--line); background: #fbfbfa; min-height: calc(100vh - 56px); }
@media (max-width: 1180px) { .editor { border-left: none; border-top: 1px solid var(--line); } }
.editor__title { font-size: 15px; font-weight: 700; color: var(--ink); margin: 0 0 2px; }
.editor__sub { font-size: 12.5px; color: var(--grey); margin: 0 0 20px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--charcoal); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.field textarea, .field input, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  font-family: inherit; color: var(--ink); background: #fff; resize: vertical;
}
.field textarea { min-height: 150px; line-height: 1.45; }
.field textarea:focus, .field input:focus, .field select:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(178,152,105,0.18);
}
.field .hint { font-size: 11.5px; color: var(--grey); margin-top: 5px; line-height: 1.4; }
.imgfield { display: flex; gap: 12px; align-items: center; }
.imgfield img { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.imgfield button { padding: 9px 14px; border: 1px solid var(--charcoal); background: #fff; color: var(--charcoal); border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.imgfield button:hover { background: var(--cream); }
.editor__actions { display: flex; gap: 10px; align-items: center; margin-top: 24px; }
.btn-save { padding: 11px 22px; border: none; border-radius: 8px; background: var(--charcoal); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-save:hover { background: var(--ink); }
.btn-reset { padding: 11px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--grey); font-size: 13px; cursor: pointer; }
.btn-reset:hover { border-color: var(--charcoal); color: var(--charcoal); }

/* ---------- Image modal ---------- */
.imgmodal { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 60; }
.imgmodal__box { background: #fff; border-radius: 12px; width: 640px; max-width: 92vw; max-height: 86vh; overflow: hidden; display: flex; flex-direction: column; }
.imgmodal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.imgmodal__head button { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--grey); line-height: 1; }
.imgmodal__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px 20px; overflow-y: auto; }
.imgmodal__grid figure { margin: 0; cursor: pointer; border: 2px solid transparent; border-radius: 8px; overflow: hidden; }
.imgmodal__grid figure:hover { border-color: var(--gold); }
.imgmodal__grid img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.imgmodal__grid figcaption { font-size: 11px; color: var(--grey); padding: 5px 6px; line-height: 1.3; }
.imgmodal__url { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.imgmodal__url input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.imgmodal__url button { padding: 9px 16px; border: 1px solid var(--charcoal); background: #fff; color: var(--charcoal); border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 13px; }
