:root {
  --accent: #e72176;
  --plum: #84146b;
  --ink: #241021;
  --muted: #8a7183;
  --line: #ece0e8;
  --bg: #f7f3f6;
  --card: #ffffff;
  --ok: #6fb74d;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
.topbar-brand, .login-logo, h1, h2 { font-family: "Poppins", "Inter", sans-serif; }
.hidden { display: none !important; }

/* ---- buttons / inputs ---- */
.btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.btn:hover { filter: brightness(1.03); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: #b23b2b; border-color: #e7c4bd; }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn-icon { padding: 4px 8px; font-size: 13px; line-height: 1; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, #fff); border-color: var(--accent); }
textarea { resize: vertical; min-height: 60px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; }

/* ---- login ---- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 34px; width: 340px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.06); }
.login-logo { font-size: 26px; font-weight: 900; text-align: center; }
.login-sub { text-align: center; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; font-size: 12px; margin-bottom: 8px; }
.login-error { color: #b23b2b; font-size: 13px; min-height: 18px; text-align: center; }

/* ---- topbar ---- */
.topbar { display: flex; align-items: center; gap: 20px; background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 18px; height: 58px; position: sticky; top: 0; z-index: 30; }
.topbar-brand { font-weight: 900; }
.topbar-brand span { color: var(--muted); font-weight: 500; }
.tabs { display: flex; gap: 4px; }
.tab { background: transparent; border: none; padding: 9px 14px; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--muted); }
.tab:hover { background: var(--bg); }
.tab.active { background: var(--ink); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.save-state { font-size: 12px; color: var(--muted); }
.save-state.saved { color: var(--ok); }

/* ---- main ---- */
.main { max-width: 1080px; margin: 0 auto; padding: 22px 18px 80px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.toolbar-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- cards / lists ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 700; }
.list-row .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--bg); color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.pill.us { background: #f3e7f0; color: var(--plum); }
.pill.uk { background: #fde9f2; color: var(--accent); }
.muted { color: var(--muted); }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 22px 0 10px; }

/* ---- badges editor ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 12px; font-weight: 600; }
.chip button { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 2px; }

/* ---- pricing editor ---- */
.pricing-editor { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; background: #fbfaf8; }
.pe-table-wrap { overflow-x: auto; }
.pe-table { border-collapse: collapse; width: 100%; }
.pe-table th, .pe-table td { border: 1px solid var(--line); padding: 4px; }
.pe-table th { background: var(--bg); }
.pe-col-head { display: flex; gap: 4px; align-items: center; }
.pe-col-head input { min-width: 90px; font-size: 12px; padding: 4px 6px; }
.pe-disc { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 800; color: var(--accent); cursor: pointer; }
.pe-disc input { min-width: 0 !important; width: auto; }
.pe-table td input { border: none; padding: 6px; font-size: 12.5px; background: transparent; border-radius: 4px; }
.pe-table td input:focus { background: #fff; outline: 1px solid var(--accent); }
.pe-rowctl { white-space: nowrap; width: 1%; }

/* ---- sheet builder sections ---- */
.builder { display: grid; grid-template-columns: 1fr; gap: 12px; }
.sec-item { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.sec-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #faf8f6; border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; }
.sec-head .grow { flex: 1; }
.sec-type { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 800; }
.sec-body { padding: 12px; }
.sortctl { display: flex; flex-direction: column; gap: 2px; }
.prodpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin: 8px 0; }
.prodpick label { display: flex; align-items: center; gap: 7px; font-size: 13px; background: var(--bg); padding: 6px 9px; border-radius: 8px; font-weight: 500; }
.prodpick input { width: auto; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

/* ---- editor two-col ---- */
.editor-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .editor-grid { grid-template-columns: 1fr; } }
.preview-pane { position: sticky; top: 72px; }
.preview-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.linkbox input { border: none; background: transparent; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* ---- modal ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; max-width: 720px; width: 100%; max-height: 88vh; overflow: auto; padding: 22px; }
.modal h3 { margin: 0 0 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; position: sticky; bottom: -22px; background: #fff; padding-top: 12px; }

/* ---- toast ---- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 10px; z-index: 60; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.toast.err { background: #b23b2b; }
