:root {
  --orange: #E8562E; --orange-deep: #C8401B; --brown: #563923; --yellow: #FEF1BA; --pastel-orange: #F9CE7C;
  --bg: #FFFBEA; --card: #FFFFFF; --line: #F3E2CC; --field: #E5C9A8; --muted: #7A5A40;
  --serif: 'Cormorant Garamond', Georgia, serif; --sans: 'Montserrat', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--brown); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
a { color: var(--orange-deep); }
:focus-visible { outline: 3px solid var(--orange-deep); outline-offset: 2px; }
h1 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 38px; line-height: 1.1; }
p { margin: 0; }
.muted { color: var(--muted); margin-top: 4px; }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.ref { font-size: 13px; color: var(--muted); }
.sub { margin: 6px 0 22px; font-size: 12px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 2px solid transparent; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-dark { background: var(--brown); color: var(--yellow); }
.btn-dark:hover { background: var(--orange-deep); color: #fff; }
.btn-line { background: transparent; color: var(--brown); border-color: var(--field); }
.btn-line:hover { border-color: var(--brown); }
.btn-danger { background: transparent; color: #A1271B; border-color: #EBC0B8; }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 13px; }
.link { background: none; border: 0; padding: 8px 0; color: var(--orange-deep); cursor: pointer; text-align: left; font-weight: 600; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
label.check input { width: 20px; height: 20px; accent-color: var(--orange-deep); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=number], select, textarea {
  min-height: 44px; padding: 0 12px; border: 1.5px solid var(--field); border-radius: 10px; background: #fff; color: var(--brown); font-size: 16px; font-weight: 400;
}
textarea { padding: 10px 12px; resize: vertical; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--yellow); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 20px; padding: 32px; box-shadow: 0 1px 0 var(--line); }
.auth-logo { height: 44px; width: auto; }
.auth-card h1 { font-size: 30px; }
.msg { margin-top: 16px; color: var(--muted); min-height: 1.5em; }
.msg.err { color: #A1271B; }

/* layout */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 230px; background: var(--yellow); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-family: var(--serif); font-weight: 700; font-size: 26px; color: var(--orange-deep); }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tabs button { text-align: left; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--brown); font-weight: 700; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--brown); color: var(--yellow); }
.side-foot { margin-top: auto; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
.side-foot .who { color: var(--brown); font-weight: 600; margin-bottom: 8px; word-break: break-all; }
.main { flex: 999 1 560px; min-width: 0; padding: 32px 32px 48px; }
@media (max-width: 640px) { .main { padding: 24px 16px; } h1 { font-size: 30px; } }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.card { margin-top: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.narrow { max-width: 640px; padding: 24px; }
.toast { position: sticky; top: 12px; z-index: 5; margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: #E3EEDF; color: #2C5427; font-weight: 600; }
.toast.err { background: #F6E1DC; color: #9B2C1F; }

/* forms */
.form-grid { padding: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.drop { grid-row: span 3; border: 2px dashed var(--field); border-radius: 14px; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 16px; }
.drop img { max-height: 200px; width: auto; border-radius: 8px; }
.drop img:not([src]), .drop img[src=""] { display: none; }
.drop input { font-size: 13px; max-width: 100%; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 640px; border-collapse: collapse; }
th { text-align: left; background: var(--yellow); font-size: 13px; font-weight: 700; padding: 12px; }
th:first-child, td:first-child { padding-left: 20px; }
th.r, td.r { text-align: right; padding-right: 20px; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
td.empty { padding: 28px 20px; color: var(--muted); }
.thumb { width: 42px; height: 56px; flex-shrink: 0; object-fit: cover; border-radius: 6px; background: var(--yellow); }
.item-cell { display: flex; align-items: center; gap: 12px; }
.row-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.on { background: #E3EEDF; color: #2C5427; }
.pill.off { background: #EEE6DD; color: #6B5442; }
.pill.wait { background: var(--yellow); color: #7A4B00; }

/* products: link row */
.link-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.link-row .grow { flex: 1 1 320px; }
.ok-msg { color: #2C5427; }
.err-msg { color: #9B2C1F; }
.thumb.wide { width: 56px; height: 42px; }
.cell-link { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
select { padding-right: 32px; }

/* blog editor */
.post-form { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.post-grid .wide { grid-column: 1 / -1; }
.wide-drop { grid-column: 1 / -1; grid-row: auto; min-height: 160px; }
.slug-field { display: flex; align-items: center; gap: 4px; border: 1.5px solid var(--field); border-radius: 10px; padding-left: 10px; background: #fff; overflow: hidden; }
.slug-field input { border: 0 !important; min-width: 0; flex: 1; padding-left: 0 !important; }
.slug-field .muted { margin: 0; white-space: nowrap; }
.editor { border: 1.5px solid var(--field); border-radius: 14px; overflow: hidden; background: #fff; }
.editor-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: var(--yellow); border-bottom: 1px solid var(--line); align-items: center; }
.editor-bar button, .bar-file { min-height: 36px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; background: #fff; color: var(--brown); font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; flex-direction: row; gap: 0; }
.editor-bar button:hover, .bar-file:hover { border-color: var(--brown); }
.editor-bar button[aria-pressed="true"] { background: var(--brown); color: var(--yellow); border-color: var(--brown); }
.bar-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.bar-gap { flex: 1; }
.editor textarea { width: 100%; border: 0; border-radius: 0; min-height: 360px; padding: 16px; font-size: 16px; line-height: 1.7; }
.editor textarea:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--orange-deep); }
.editor-help { padding: 8px 16px 12px; border-top: 1px solid var(--line); }
.prose { padding: 20px 24px; min-height: 360px; font-size: 17px; line-height: 1.75; }
.prose h2 { font-family: var(--serif); font-size: 30px; line-height: 1.15; margin: 1.2em 0 .4em; }
.prose h3 { font-size: 19px; margin: 1.2em 0 .3em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose figure { margin: 0 0 1em; }
.prose img { max-width: 100%; height: auto; border-radius: 12px; }
.prose figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.prose blockquote { border-left: 4px solid var(--orange); padding-left: 16px; font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.post-form .form-actions { align-items: center; }
.post-form .form-actions #b-state { margin-right: auto; }
.pill.sched { background: #E4ECF6; color: #23466E; }
.star { color: var(--orange-deep); font-weight: 700; }
.slug-preview { margin-top: -10px; word-break: break-all; }
