:root {
  --bg: #f3f1ec;
  --ink: #161513;
  --muted: #6f6a63;
  --card: #fffcf7;
  --line: #e6e1d8;
  --accent: #1f4bff;
  --danger: #b42318;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.hidden { display: none !important; }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.auth-card {
  width: min(100%, 360px);
  padding: 28px;
  display: grid;
  gap: 12px;
}

.eyebrow {
  margin: 0;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-size: 13px;
}

h1 { margin: 0 0 8px; font-size: 28px; font-weight: 600; }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.error { color: var(--danger); font-size: 13px; margin: 0; white-space: pre-line; }
.save-meta { display: grid; gap: 4px; min-width: 0; }
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.chip { display: inline-flex; align-items: center; gap: 4px; }
.chip .chip-x {
  background: none;
  color: inherit;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.wrap { padding: 0 28px; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 28px 28px 12px;
}

.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  padding: 12px 28px 40px;
}

.reel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  font-weight: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.thumb {
  aspect-ratio: 9 / 16;
  background: #ddd6c8 center/cover no-repeat;
  position: relative;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(22, 21, 19, 0.72);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
}

.meta { padding: 12px; display: grid; gap: 6px; }
.caption {
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.9em;
}
.date { font-size: 12px; color: var(--muted); }

.reel { cursor: pointer; }
.reel.has-auto { outline: 2px solid var(--accent); }
.badge.auto { left: auto; right: 10px; background: var(--accent); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 21, 19, 0.45);
}
.modal-panel {
  position: relative;
  width: min(1100px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.18);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 18px 20px 8px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-head-actions { display: flex; gap: 8px; align-items: center; }
.icon-x {
  width: 36px;
  height: 36px;
  padding: 0;
  background: #f3f1ec;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}
.ghost-link {
  color: var(--muted);
  font-size: 13px;
}
.modal-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
}
.modal-form { padding: 12px 20px 16px; display: grid; gap: 12px; }
.modal-preview {
  background: #f6f5f2;
  padding: 20px 16px;
  display: grid;
  place-items: start center;
}
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); }
.tab {
  background: none;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  padding: 8px 0 10px;
  font-weight: 600;
}
.tab.active {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.pane { display: grid; gap: 12px; padding-top: 8px; }
select, textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  width: 100%;
}
.row-label { font-size: 13px; color: var(--muted); }
.chips, .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.chip, .tag {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip-add { background: #fff; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8eeff;
  border: 1px solid #c9d6ff;
  color: #1e3a8a;
  max-width: 100%;
}
.tag-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-x {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  background: #1e3a8a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  flex: 0 0 auto;
}
.tag-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  cursor: text;
  background: #fff;
}
.tag-box .tags { display: contents; }
.tag-box input {
  border: 0;
  padding: 4px;
  outline: none;
  flex: 1 1 140px;
  min-width: 120px;
  background: transparent;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.check input { width: auto; }
.pro {
  display: inline-block;
  background: #f5c400;
  color: #111;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: .02em;
}
.pro-lock { opacity: .72; }
.btn-yellow {
  background: #f5c400;
  color: #111;
}
.btn-yellow:disabled { opacity: .7; cursor: not-allowed; }
.btn-save { background: var(--accent); }
.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.upload-btn {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--ink);
}
.image-row { display: flex; gap: 10px; align-items: center; }
.image-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.cta-block {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.cta-head { display: flex; justify-content: space-between; align-items: center; }

.phone {
  width: 280px;
  height: 560px;
  background: #eceae4;
  border-radius: 32px;
  padding: 12px;
  box-shadow: inset 0 0 0 8px #dedbd3;
}
.phone-screen {
  height: 100%;
  background: #f2f2f2;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
}
.ig-card {
  margin: 36px 12px 0;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
}
.ig-image {
  aspect-ratio: 1 / 1;
  background: #ddd6c8 center/cover no-repeat;
}
.ig-body { padding: 10px 12px 12px; display: grid; gap: 8px; }
.ig-headline { font-weight: 700; font-size: 14px; }
.ig-desc { color: var(--muted); font-size: 12px; min-height: 1em; }
.ig-btn {
  width: 100%;
  background: #fff;
  color: var(--ink);
  border: 1px solid #e5e5e5;
  border-radius: 10px;
}
.ig-add {
  width: 100%;
  background: transparent;
  color: var(--muted);
  border: 1px dashed #cfcfcf;
}
.phone-input {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 860px) {
  .modal-split { grid-template-columns: 1fr; }
  .modal-preview { display: none; }
}

