/* Bottle Express admin: the site's palette, a plain working layout. */
:root {
  --ink: #302721;
  --muted: #6b5d50;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --rule: #d4ccbe;
  --accent: #682f35;
  --accent-dark: #4f2328;
  --ok: #2f6b3b;
  --warn: #8a5a12;
  --error: #9b2c2c;
  --radius: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.2; }
h2 { margin: 0 0 12px; font-size: 17px; }
h3 { margin: 6px 0 0; font-size: 15px; }
small { color: var(--muted); font-weight: 400; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  padding: 10px 24px;
  background: var(--ink);
  color: #f5f1e8;
}
.topbar a { color: inherit; text-decoration: none; }
.brand { font-weight: 700; letter-spacing: 0.02em; }
.brand span { font-weight: 400; opacity: 0.7; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.topbar nav a { padding: 6px 10px; border-radius: var(--radius); opacity: 0.85; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.12); opacity: 1; }
.topbar-end { display: flex; align-items: center; gap: 16px; margin-left: auto; font-size: 14px; }
.topbar-end form { margin: 0; }
.topbar .link-button { color: inherit; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e0a43a; vertical-align: middle; }

/* ------------------------------------------------------------ layout */
.page { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; }
.page-narrow { max-width: 460px; padding-top: 10vh; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.lede { margin: 0 0 18px; color: var(--muted); max-width: 70ch; }
.crumbs { margin: 0 0 4px; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; }
.card + .card, .card + form, form + .card { margin-top: 18px; }
.stack { display: grid; gap: 14px; align-content: start; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; align-items: end; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-top: 18px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.sticky-aside { position: sticky; top: 70px; max-height: calc(100vh - 86px); overflow-y: auto; }
@media (max-width: 960px) {
  .editor-layout { grid-template-columns: 1fr; }
  .sticky-aside { position: static; max-height: none; }
}

/* ------------------------------------------------------------ forms */
label, .label { display: grid; gap: 5px; margin: 0; font-weight: 600; font-size: 14px; }
label small, .label small { display: block; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; }
.input-large { font-size: 20px; font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: auto; }
.counter { justify-self: end; font-size: 12px; font-weight: 400; color: var(--muted); }
.counter.over { color: var(--error); font-weight: 600; }
details summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details[open] summary { margin-bottom: 8px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--accent-dark); }
.button:disabled { opacity: 0.55; cursor: wait; }
.button-quiet { background: transparent; color: var(--accent); }
.button-quiet:hover { background: rgba(104, 47, 53, 0.08); }
.button-large { padding: 14px 26px; font-size: 17px; }
.link-button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.danger { color: var(--error); }
.danger-zone { margin-top: 28px; }
.small { font-size: 13px; }

/* ------------------------------------------------------------ repeaters */
.repeater { display: grid; gap: 12px; justify-items: start; }
.repeater > .repeater-row { width: 100%; padding: 12px; border: 1px dashed var(--rule); border-radius: var(--radius); }
.repeater-row.row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; }
.repeater-row [data-remove-row] { justify-self: start; font-size: 13px; }

/* ------------------------------------------------------------ messages */
.flash { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid; background: #fff; }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.flash-ok { border-color: #b9d6bf; background: #eef7f0; color: var(--ok); }
.flash-info { border-color: var(--rule); }
.flash-error { border-color: #e2b4b4; background: #fbefef; color: var(--error); }
.flash-pending { border-color: #e9cf9c; background: #fdf6e7; color: var(--warn); }
.hint { margin: 0; color: var(--muted); font-size: 13.5px; }

/* ------------------------------------------------------------ tables, lists */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
.table th { font-size: 13px; color: var(--muted); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right !important; }
.price-input { width: 120px; text-align: right; font-variant-numeric: tabular-nums; }
.price-input.changed { border-color: var(--warn); background: #fdf6e7; }
.price-group { padding-bottom: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.toolbar input[type="search"] { max-width: 320px; }
.toolbar-end { justify-content: flex-end; margin-top: 18px; }
.prices .toolbar:first-of-type { position: sticky; top: 52px; z-index: 5; padding: 10px 0; background: var(--paper); }
.card > input[type="search"] { max-width: 320px; margin-bottom: 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.list li:last-child { border-bottom: 0; }
.list form { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0 0 14px; padding: 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: #eee6d8; color: var(--muted); font-size: 12px; font-weight: 600; }
.badge-published, .tone-ok.badge { background: #e3f1e6; color: var(--ok); }
.badge-draft { background: #f3eadb; color: var(--warn); }
.tone-error.badge { background: #f8e3e3; color: var(--error); }
.tone-running.badge { background: #fdf0d8; color: var(--warn); }
.tone-ok { color: var(--ok); }
.tone-error { color: var(--error); }
.tone-running { color: var(--warn); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 18px; }
.stat { display: grid; gap: 4px; padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); color: inherit; text-decoration: none; }
.stat:hover { border-color: var(--accent); }
.stat strong { font-size: 24px; }
.stat span { color: var(--muted); font-size: 13.5px; }

/* ------------------------------------------------------------ post editor */
.editor-head .hint { max-width: 80ch; }
.cover-preview { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--rule); }
.serp { display: grid; gap: 2px; padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; font-family: Arial, sans-serif; }
.serp-url { color: #4d5156; font-size: 12px; overflow-wrap: anywhere; }
.serp-title { color: #1a0dab; font-size: 18px; line-height: 1.3; }
.serp-desc { color: #4d5156; font-size: 13px; line-height: 1.5; }

/* The editing area reads like the published post. */
.ck.ck-editor__main > .ck-editor__editable {
  min-height: 420px;
  max-height: 75vh;
  padding: 8px 28px;
  font-size: 16px;
  line-height: 1.8;
  color: #4a3f36;
}
.ck-content h2 { margin: 1.4em 0 0.4em; font-size: 26px; line-height: 1.2; color: var(--ink); }
.ck-content h3 { margin: 1.2em 0 0.3em; font-size: 21px; color: var(--ink); }
.ck-content h4 { margin: 1em 0 0.3em; font-size: 17px; color: var(--ink); }
.ck-content a { color: var(--accent); }
.ck-content blockquote { margin: 1em 0; padding: 12px 18px; border-left: 3px solid var(--accent); background: #f3ede2; font-style: normal; }

/* Bottle rows: name, price, photo, remove. */
.repeater-row.bottle-row { grid-template-columns: minmax(0, 2fr) minmax(0, 0.8fr) minmax(0, 1.4fr) auto; }
.bottle-photo { align-content: start; }
.bottle-photo img { width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; }
.bottle-photo input[type="file"] { padding: 6px; font-size: 13px; }
@media (max-width: 700px) { .repeater-row.bottle-row { grid-template-columns: 1fr; } }
