:root { --accent:#4f46e5; }
/* Tenant CMS. Accent comes from the client's own brand color (theme_css sets --accent). */
:root { --bg:#f4f5f7; --surface:#fff; --line:#e5e7eb; --text:#171c23; --muted:#667085; --radius:14px; --shadow:0 1px 2px rgba(16,24,40,.05),0 1px 3px rgba(16,24,40,.06); --ok:#16a34a; --bad:#dc2626; --warn:#d97706; }
@media (prefers-color-scheme: dark) { :root { --bg:#0e1116; --surface:#171b22; --line:#262c36; --text:#e8ebf0; --muted:#98a2b3; --shadow:none; } }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', Cairo, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent, #2563eb); text-decoration: none; }
h1 { font-size: 1.25rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.02rem; margin: 0 0 12px; } h2 small { font-weight: 400; color: var(--muted); }
small, .muted { color: var(--muted); } small { font-size: .82rem; }
.warn { color: var(--warn); } .nowrap { white-space: nowrap; }

/* shell */
.side { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; z-index: 30; transition: transform .25s; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; padding: 4px 8px 18px; }
.brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: var(--bg); }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text); font-weight: 500; }
.side a i { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: .85rem; color: #fff; background: var(--c, #64748b); flex: 0 0 30px; }
.side a:hover { background: var(--bg); } .side a.on { background: color-mix(in srgb, var(--accent, #2563eb) 12%, transparent); font-weight: 600; }
.side-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.side-foot a { font-weight: 400; color: var(--muted); padding: 6px 10px; } .side-foot a i { width: 22px; height: 22px; flex-basis: 22px; font-size: .7rem; border-radius: 6px; }
.who { padding: 8px 10px; font-weight: 600; font-size: .9rem; } .who small { display: block; font-weight: 400; }
.main { margin-inline-start: 248px; min-height: 100vh; }
.top { display: flex; align-items: center; gap: 12px; padding: 18px 28px 0; }
.burger { display: none; border: 0; background: var(--surface); width: 40px; height: 40px; border-radius: 10px; box-shadow: var(--shadow); font-size: 1rem; color: var(--text); }
.content { padding: 18px 28px 80px; max-width: 1100px; }

/* blocks */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.panel.flush { padding: 0; overflow: hidden; }
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; justify-content: space-between; }
.bar.filters { justify-content: flex-start; } .push { margin-inline-start: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: center; color: var(--text); }
.stat i { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--c); font-size: 1.1rem; }
.stat b { font-size: 1.5rem; line-height: 1.1; } .stat span { color: var(--muted); font-size: .85rem; line-height: 1.3; }
.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; } .todo li { display: flex; gap: 10px; align-items: baseline; } .todo i { color: var(--muted); } .todo .bad i { color: var(--bad); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:first-child td { border-top: 0; } .tbl .grow { width: 100%; } .tbl tr.off { opacity: .55; } .tbl tr.sub .grow { padding-inline-start: 44px; }
.tbl tr.group td { background: var(--bg); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 14px; }
.w-thumb { width: 56px; padding-inline-end: 0 !important; } .pad { padding: 24px !important; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--bg); } .thumb.sm { width: 40px; height: 40px; border-radius: 8px; vertical-align: middle; margin-inline-end: 8px; }
.thumb.wide { width: 120px; } .thumb.is-logo { object-fit: contain; padding: 4px; opacity: .8; }
.thumb-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); } .badge.info { background: color-mix(in srgb, #0ea5e9 16%, transparent); color: #0284c7; }
.pager { display: flex; gap: 6px; margin: 14px 0; } .pager a { padding: 6px 12px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); } .pager a.on { background: var(--accent); color: #fff; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--accent); } .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 5px 12px; font-size: .85rem; } .btn.block { width: 100%; justify-content: center; }
.icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; background: transparent; border-radius: 8px; color: var(--muted); cursor: pointer; font-size: .9rem; }
.icon:hover { background: var(--bg); color: var(--text); } .icon.danger:hover { color: var(--bad); }
form.inline { display: inline; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--surface); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent, #2563eb) 40%, transparent); border-color: var(--accent, #2563eb); }
.filters input[type=search] { width: 220px; } .filters select { width: auto; }
.field { margin-bottom: 14px; } .field > label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; } .field small { display: block; margin-top: 4px; }
.lang-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; } .lang-tag { flex: 0 0 34px; padding-top: 9px; font-size: .7rem; font-weight: 700; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; } .chk.big { margin-bottom: 12px; font-size: 1rem; } .chips-row { display: flex; gap: 22px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; } .chip input { display: none; } .chip span { display: inline-block; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: .9rem; }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; } .chip input:disabled + span { opacity: .7; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; } .switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd0d8; border-radius: 22px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); } .switch input:checked + span::before { transform: translateX(18px); }
.actions { display: flex; gap: 10px; margin-top: 8px; } .actions.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 40%); padding: 18px 0 10px; z-index: 5; }
.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; } .flash.ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); } .flash.error { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--bad); }

/* item form: sizes, ingredients, branch grid */
.size-row, .ing-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; } .size-labels { display: flex; gap: 8px; flex: 1; } .size-price { width: 110px; flex: 0 0 110px; text-align: end; font-weight: 600; } .ing-price { width: 90px; flex: 0 0 90px; } .ing-row select { width: 140px; flex: 0 0 140px; }
.grid-wrap { overflow-x: auto; } table.bgrid { border-collapse: collapse; min-width: 100%; } .bgrid th { text-align: start; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 6px 10px; }
.bgrid td { padding: 6px 10px; border-top: 1px solid var(--line); } .bgrid td.name { font-weight: 600; white-space: nowrap; } .bgrid input[type=text] { width: 96px; text-align: end; } .bgrid tr.na input[type=text] { opacity: .35; }
.bgrid .hint { font-size: .75rem; color: var(--muted); font-weight: 400; display: block; }

/* settings */
.color { display: flex; gap: 8px; } .color input[type=color] { width: 46px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); } .color input[type=text] { width: 120px; font-family: ui-monospace, monospace; }
.preview { border-radius: 12px; overflow: hidden; margin-top: 4px; } .pv-hero { background: var(--pv-ink, #12161c); color: #fff; padding: 22px; display: flex; align-items: center; justify-content: space-between; } .pv-btn { background: var(--pv-accent, #b4472a); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: .85rem; }

/* login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--surface); width: 100%; max-width: 380px; padding: 32px 28px; border-radius: 18px; box-shadow: 0 10px 40px rgba(16,24,40,.12); text-align: center; }
.login-card img { width: 72px; height: 72px; object-fit: contain; } .login-card h1 { margin: 10px 0 2px; } .login-card p { margin: 0 0 20px; color: var(--muted); }
.login-card label { display: block; text-align: start; font-weight: 600; font-size: .88rem; margin: 12px 0 6px; } .login-card .btn { margin-top: 20px; }

@media (max-width: 900px) {
  .side { transform: translateX(-100%); } .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .main { margin-inline-start: 0; } .burger { display: grid; place-items: center; } .top { padding: 14px 16px 0; } .content { padding: 14px 16px 90px; }
  .grid2, .grid3 { grid-template-columns: 1fr; } .size-row { flex-wrap: wrap; } .size-labels { flex-basis: 100%; } .ing-row { flex-wrap: wrap; } .ing-row input[type=text] { flex: 1 1 120px; }
  .tbl td { padding: 10px; } .filters input[type=search] { width: 100%; }
}

.tbl tr.moved td { background: color-mix(in srgb, var(--accent, #2563eb) 12%, transparent); transition: background .6s; }

/* master panel additions */
.logo { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; font-weight: 800; font-size: .85rem; letter-spacing: -.02em; } .logo.big { width: 64px; height: 64px; font-size: 1.3rem; border-radius: 16px; margin-bottom: 8px; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #e5e7eb; color: #475569; }
.pill.active { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); } .pill.expiring, .pill.grace { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.expired, .pill.failed, .pill.suspended { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); } .pill.provisioning { background: color-mix(in srgb, #0ea5e9 16%, transparent); color: #0284c7; }
.tbl th { text-align: start; padding: 10px 14px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--bg); }
.tbl.mini td { padding: 6px 10px; font-size: .85rem; } .scroll { overflow-x: auto; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; } .two > * { min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row input, .row select { flex: 1 1 160px; width: auto; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.slug { display: flex; align-items: center; gap: 6px; } .slug span { color: var(--muted); white-space: nowrap; } .slug input { flex: 1; }
.radio { display: block; padding: 8px 0; cursor: pointer; } .radio small { color: var(--muted); }
.quote .q { width: 100%; border-collapse: collapse; } .quote .q td { padding: 5px 0; color: var(--muted); } .quote .q td:last-child { text-align: end; color: var(--text); font-variant-numeric: tabular-nums; }
.total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; } .total b { font-size: 1.6rem; }
.reveal { border: 2px solid var(--accent); } .reveal pre { background: var(--bg); padding: 14px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; font: .9rem/1.6 ui-monospace, monospace; margin: 10px 0; user-select: all; }
.panel.danger { border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--line)); } .btn.danger-btn { background: var(--bad); border-color: var(--bad); color: #fff; }
#slug-msg.ok { color: var(--ok); } #slug-msg.bad { color: var(--bad); }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
