:root {
  --red: #cd293a;
  --red-dark: #a81f2e;
  --red-soft: #fbeaec;
  --ink: #23262b;
  --ink-2: #4a4f57;
  --muted: #7a808a;
  --line: #e1e3e7;
  --line-2: #eef0f2;
  --bg: #f4f5f7;
  --card: #ffffff;
  --side: #2b2f36;
  --side-2: #363b44;
  --blue: #2a64b6;
  --green: #23824a;
  --green-soft: #e5f4ea;
  --amber: #a86500;
  --amber-soft: #fff3dc;
  --grey-soft: #eceef1;
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 Ubuntu, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-width: 1180px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 500; margin: 0; }
h2 { font-size: 18px; font-weight: 500; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 500; margin: 0 0 8px; }
small, .muted { color: var(--muted); }
code, .mono { font-family: Consolas, "Courier New", monospace; font-size: 14px; }

.preview-bar {
  background: #ffe28a; color: #4a3b00; text-align: center; padding: 7px 16px; font-size: 14px;
  border-bottom: 1px solid #e8c95c; position: sticky; top: 0; z-index: 30;
}

/* ---------- frame ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: #d7dae0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.preview-bar + .shell .side { top: 37px; height: calc(100vh - 37px); }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 16px; color: #fff; font-weight: 500; line-height: 1.15; border-bottom: 1px solid #3c414b; }
.brand:hover { text-decoration: none; }
.brand small { color: #aeb3bc; font-weight: 400; }
.logo { width: 38px; height: 38px; border-radius: 6px; background: var(--red); display: grid; place-items: center; font-weight: 700; letter-spacing: .5px; }
.side nav { padding: 8px 0 16px; flex: 1; }
.side h4 { margin: 16px 18px 4px; font-size: 11.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: #8d939e; }
.side nav a { display: block; padding: 7px 18px 7px 15px; color: #e3e6ea; border-left: 3px solid transparent; }
.side nav a:hover { background: var(--side-2); text-decoration: none; }
.side nav a.on { background: var(--side-2); border-left-color: var(--red); color: #fff; font-weight: 500; }
.me { padding: 14px 18px 18px; border-top: 1px solid #3c414b; font-size: 14px; display: grid; gap: 4px; }
.me a, .me .linkish { color: #c4c9d1; }
.me form { margin: 0; }
.main { padding: 26px 34px 60px; max-width: 1500px; width: 100%; }
.lone { display: grid; place-items: center; min-height: 92vh; padding: 20px; }

/* ---------- page head ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.head .sub { color: var(--muted); margin-top: 3px; }
.head .actions { display: flex; gap: 8px; align-items: center; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

.flash { background: var(--green-soft); border: 1px solid #b8dfc5; color: #18552f; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 18px; }
.error { background: var(--red-soft); border: 1px solid #efb9bf; color: #8a1622; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.note { background: #eef4fc; border: 1px solid #cddcf2; color: #24466f; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.warn { background: var(--amber-soft); border: 1px solid #f0d49b; color: #6d4300; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }

/* ---------- buttons and fields ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 500; font-size: 14.5px;
  padding: 8px 15px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; color: var(--ink);
  cursor: pointer; white-space: nowrap; line-height: 1.3;
}
.btn:hover { text-decoration: none; background: #f7f8f9; border-color: #cfd3d9; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.danger { color: #a3192a; border-color: #ecc0c5; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { padding: 4px 10px; font-size: 13.5px; }
.btn[disabled] { opacity: .5; cursor: default; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; text-align: left; }
.linkish:hover { text-decoration: underline; }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=datetime-local], input[type=tel], select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #cdd1d7; border-radius: 4px; padding: 7px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #f0b6bd; border-color: var(--red); }
textarea { resize: vertical; }
label { display: block; }
.field { margin-bottom: 14px; }
.field > span { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.field .hint { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; cursor: pointer; }
.check input { margin-top: 4px; }
.check small { display: block; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.formbar { display: flex; gap: 10px; align-items: center; margin-top: 6px; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.cols-even { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.stack > * + * { margin-top: 16px; }
dl.facts { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; font-size: 14.5px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; word-break: break-word; }

/* ---------- toolbar and tables ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar form { display: flex; gap: 8px; align-items: center; margin: 0; }
.toolbar input[type=search] { width: 320px; }
.toolbar select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 14px; }
.chip:hover { text-decoration: none; border-color: #c3c8cf; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip b { font-weight: 500; opacity: .7; margin-left: 3px; }

.tablewrap { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.list { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.list th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-2); background: #f8f9fa; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list th a { color: var(--ink-2); }
table.list th .mk { color: var(--red); font-size: 10px; margin-left: 3px; }
table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover td { background: #fafbfc; }
table.list tr.click { cursor: pointer; }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
table.list td.nowrap { white-space: nowrap; }
table.list td .snip { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
table.list .empty { text-align: center; color: var(--muted); padding: 30px; }
table.compact td, table.compact th { padding: 6px 10px; }

.pager { display: flex; gap: 4px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 14px; }
.pager .count { margin-right: auto; color: var(--muted); }
.pager a, .pager b, .pager .dis, .pager .gap { min-width: 34px; text-align: center; padding: 5px 9px; border-radius: 4px; }
.pager a { background: #fff; border: 1px solid var(--line); }
.pager a:hover { text-decoration: none; border-color: #c3c8cf; }
.pager b { background: var(--red); color: #fff; font-weight: 500; border: 1px solid var(--red); }
.pager .dis { color: #b9bdc4; }

.pill { display: inline-block; font-size: 12.5px; font-weight: 500; padding: 1px 9px; border-radius: 999px; background: var(--grey-soft); color: var(--ink-2); white-space: nowrap; }
.pill.s-active, .pill.s-published, .pill.s-lifetime { background: var(--green-soft); color: #1b6b3b; }
.pill.s-expired, .pill.s-hidden { background: var(--grey-soft); color: #666b73; }
.pill.s-locked { background: var(--red-soft); color: #a3192a; }
.pill.s-scheduled, .pill.s-published--sms-pending { background: var(--amber-soft); color: var(--amber); }
.pill.t-a { background: #e7effb; color: #234f8e; }
.pill.t-s { background: #f4e9fb; color: #6a2b8d; }
.pill.t-l { background: #e8f5f3; color: #1d6a5f; }
.pill.t-n { background: #fdf0e3; color: #8a4d0f; }
.pill.t-h { background: var(--red-soft); color: #a3192a; }
.pill.t-u { background: #e7effb; color: #234f8e; }
.pill.t-m { background: #e8f5f3; color: #1d6a5f; }

/* ---------- start page ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 13px 15px; color: var(--ink); display: block; }
a.stat:hover { text-decoration: none; border-color: #c3c8cf; }
.stat .n { font-size: 25px; font-weight: 500; line-height: 1.2; }
.stat .l { font-size: 13px; color: var(--muted); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.feed { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.feed li { padding: 6px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 10px; }
.feed li:last-child { border-bottom: 0; }
.feed .t { color: var(--muted); white-space: nowrap; min-width: 98px; }

/* ---------- login ---------- */
.login { width: 380px; }
.login .brand-big { display: flex; gap: 12px; align-items: center; justify-content: center; margin-bottom: 18px; font-size: 19px; font-weight: 500; }
.login .logo { width: 44px; height: 44px; color: #fff; font-size: 17px; }
.login .btn { width: 100%; justify-content: center; padding: 10px; font-size: 15.5px; }

/* ---------- post editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.editbox { position: relative; }
.editbox textarea { min-height: 420px; font-size: 15px; line-height: 1.55; font-family: Ubuntu, "Segoe UI", Arial, sans-serif; }
.editbox.drag textarea { outline: 3px dashed var(--red); background: #fff8f9; }
.edittools { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.edittools .muted { font-size: 13px; margin-left: auto; }
.uploading { position: absolute; right: 12px; bottom: 12px; background: var(--ink); color: #fff; padding: 5px 11px; border-radius: 4px; font-size: 13px; }
.phone {
  background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; position: sticky; top: 52px;
}
.phone .ph-head { background: #1d2025; color: #fff; padding: 9px 14px; font-size: 13px; display: flex; justify-content: space-between; }
.phone .ph-body { padding: 14px 16px; font-size: 15px; max-height: 70vh; overflow-y: auto; word-wrap: break-word; }
.phone .ph-body img { max-width: 100%; height: auto; display: block; margin: 4px 0; border-radius: 3px; }
.phone .ph-co { font-weight: 700; margin-bottom: 6px; }
.typebar { display: flex; gap: 6px; }
.typebar label { flex: 1; }
.typebar input { position: absolute; opacity: 0; pointer-events: none; }
.typebar span { display: block; text-align: center; padding: 8px 6px; border: 1px solid #cdd1d7; border-radius: 4px; cursor: pointer; font-size: 14px; background: #fff; }
.typebar input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.typebar input:focus-visible + span { outline: 2px solid #f0b6bd; }

/* ---------- images ---------- */
.dropzone {
  border: 2px dashed #c9cdd4; border-radius: 8px; padding: 22px; text-align: center; color: var(--ink-2); background: #fff; cursor: pointer;
  margin-bottom: 16px;
}
.dropzone.drag { border-color: var(--red); background: #fff8f9; }
.dropzone b { color: var(--red); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.tile .pic { height: 150px; background: #f1f2f4 center/contain no-repeat; display: block; border-bottom: 1px solid var(--line-2); }
.tile .meta { padding: 8px 10px; font-size: 13px; color: var(--muted); }
.tile .meta b { color: var(--ink); font-weight: 500; }
.tile .acts { display: flex; gap: 6px; padding: 0 10px 10px; flex-wrap: wrap; margin-top: auto; }
.tile .acts form { margin: 0; }
.tile.new { outline: 3px solid #8fd1a6; }

/* the picker dialog */
dialog.picker { width: 940px; max-width: 94vw; border: 0; border-radius: 10px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.picker::backdrop { background: rgba(20, 22, 26, .55); }
.picker .pk-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.picker .pk-body { padding: 16px 18px; max-height: 70vh; overflow-y: auto; }
.picker .dropzone { padding: 16px; }
.picker .pk-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.picker .pk-grid button { border: 2px solid transparent; border-radius: 6px; padding: 0; background: #f1f2f4; cursor: pointer; height: 120px; overflow: hidden; position: relative; }
.picker .pk-grid button:hover { border-color: var(--red); }
.picker .pk-grid img { width: 100%; height: 100%; object-fit: contain; display: block; }
.picker .pk-grid small { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.85); font-size: 11.5px; padding: 1px 4px; }

/* ---------- misc ---------- */
.copybox { background: #f8f9fa; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; white-space: pre-wrap; font-size: 14.5px; margin: 0 0 10px; }
.big-pass { font-family: Consolas, monospace; font-size: 18px; letter-spacing: .04em; background: #f8f9fa; border: 1px solid var(--line); border-radius: 4px; padding: 3px 10px; }
.bar { height: 7px; background: var(--line-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--green); }
.split { display: flex; align-items: center; gap: 8px; }
.toast { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 18px; border-radius: 6px; z-index: 100; font-size: 14px; }
hr.soft { border: 0; border-top: 1px solid var(--line-2); margin: 16px 0; }
.right { text-align: right; }
.pager.lazy > a, .pager.lazy > b, .pager.lazy > .dis, .pager.lazy > .gap { display: none; }
.pager.lazy { justify-content: flex-start; padding: 10px 2px 30px; }
.pager .more { color: var(--muted); margin-left: 12px; }
