/* Ski Baltimore brand fonts, self-hosted (SIL Open Font License, see public/fonts/) */
@font-face { font-family: 'Bebas Neue'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/bebas-neue-latin.woff2) format('woff2'); }
@font-face { font-family: 'Inter Tight'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/inter-tight-latin.woff2) format('woff2'); }

/* Ski Baltimore palette: navy + text/line tones from the SkiBaltimore.com theme, cream from the lift-ticket hang tag */
:root {
  --navy: #1B2A4A; --navy-2: #111B30; --navy-3: #2C4170;
  --cream: #F3F1EC; --cream-2: #E4E0D6; --paper: #F7F6F3; --card: #FFFFFF;
  --ink: #111111; --ink-2: #5F5E5A; --muted: #6E6D68;
  --line: #E6E4DF; --line-2: #D4D1CA;
  --alert: #2C5BD0;
  --ok: #2E7D5B; --ok-bg: #E2EFE6; --warn: #9A6514; --warn-bg: #F8ECD4; --err: #A32D2D; --err-bg: #F8E5E5;
  --display: 'Bebas Neue', 'Arial Narrow', Impact, sans-serif;
  --body: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(27, 42, 74, .04), 0 10px 30px -14px rgba(27, 42, 74, .18);
}
/* The real snowflake, recolored through a mask so it takes currentColor in every spot */
.sf { display: block; flex: none; background: currentColor; -webkit-mask: url(/snowflake.png) center / contain no-repeat; mask: url(/snowflake.png) center / contain no-repeat; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--body); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); color: var(--navy); margin: 0; line-height: 1.1; }
h2 { font-size: 26px; font-weight: 400; letter-spacing: .03em; }
h3 { font-size: 22px; font-weight: 400; letter-spacing: .03em; margin-bottom: 4px; }
p { margin: 0 0 8px; }
code { background: var(--cream); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.hide { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.eyebrow { font: 600 11px/1 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.ic { flex: none; display: block; }
.boot { min-height: 100vh; background: var(--navy); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: var(--cream); position: sticky; top: 0; height: 100vh; padding: 22px 14px 18px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 26px; min-width: 0; }
.brand b { display: block; font: 400 22px/1 var(--display); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; opacity: .55; margin-top: 3px; }
.logo-box { flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--cream); color: var(--navy); overflow: hidden; }
.logo-box img { width: 100%; height: 100%; object-fit: cover; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: rgba(243, 241, 236, .7); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(243, 241, 236, .06); color: var(--cream); }
.nav a.on { background: rgba(243, 241, 236, .12); color: var(--cream); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 10px; }
.link-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 6px 0; color: rgba(243, 241, 236, .6); cursor: pointer; font-size: 14px; }
.link-btn:hover { color: var(--cream); }
.mode { display: inline-flex; align-items: center; gap: 7px; width: fit-content; padding: 4px 11px; border-radius: 99px; font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.mode i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mode.test { background: rgba(232, 178, 92, .16); color: #E8B25C; }
.mode.live { background: rgba(108, 196, 150, .16); color: #7FD3A6; }
.content { min-width: 0; }
.topbar { display: none; align-items: center; gap: 10px; background: var(--navy); color: var(--cream); padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 20; }
.topbar .brand { padding: 0; flex: 1; gap: 10px; }
.topbar .brand b { font-size: 19px; }
main { padding: 34px 44px 90px; max-width: 1240px; }
.tabbar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--navy); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid rgba(243, 241, 236, .08); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; font-size: 11px; font-weight: 500; color: rgba(243, 241, 236, .55); text-decoration: none; }
.tabbar a.on { color: var(--cream); }

/* ---------- page header / layout ---------- */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.ph h1 { font-size: 42px; font-weight: 400; letter-spacing: .03em; text-transform: uppercase; }
.ph p { margin: 6px 0 0; color: var(--muted); }
.ph-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-h a { font-size: 14px; font-weight: 600; text-decoration: none; }
.card-h a:hover { text-decoration: underline; }
.loading { padding: 60px 0; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--cream-2); border-top-color: var(--navy); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: 99px; border: 1px solid var(--navy); background: var(--navy); color: var(--cream); font-weight: 600; font-size: 14.5px; letter-spacing: .02em; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--navy-2); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--card); color: var(--navy); border-color: var(--line-2); }
.btn.secondary:hover { background: var(--cream); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--navy); }
.btn.ghost:hover { background: var(--cream); }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; text-decoration: none; flex: none; }
.icon-btn:hover { background: var(--cream); color: var(--navy); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.danger:hover { color: var(--err); background: var(--err-bg); }
.icon-btn:disabled { opacity: .25; pointer-events: none; }
.icon-btn.light { color: var(--cream); }
.icon-btn.light:hover { background: rgba(243, 241, 236, .12); color: var(--cream); }

/* ---------- forms ---------- */
.field { margin: 0 0 18px; }
.field > label, .lbl { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; line-height: 1.45; }
input:not([type]), input[type=text], input[type=search], input[type=password], input[type=number], input[type=url], input[type=email], select, textarea {
  width: 100%; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #9C9A94; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27, 42, 74, .12); }
textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px; background-repeat: no-repeat; background-position: right 12px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231B2A4A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.counter { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }
.counter.over { color: var(--err); font-weight: 600; }
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; width: 100%; height: 100%; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + span { background: var(--navy); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(27, 42, 74, .2); }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.check-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--navy); flex: none; }
.check-row b { display: block; font-size: 14.5px; font-weight: 600; }
.check-row small { color: var(--muted); font-size: 13px; }
.vars { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.var { border: 1px dashed var(--line-2); background: var(--paper); border-radius: 99px; padding: 2px 10px; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.var:hover { border-style: solid; border-color: var(--navy); color: var(--navy); }
details summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; list-style: none; display: flex; align-items: center; gap: 6px; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '›'; font-size: 18px; transition: transform .15s; display: inline-block; width: 10px; }
details[open] summary::before { transform: rotate(90deg); }

/* ---------- chips / pills ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: var(--cream); color: var(--navy); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip button { border: 0; background: none; padding: 0 0 0 2px; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; }
.chip button:hover { color: var(--err); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 8px; cursor: text; }
.chips-input:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27, 42, 74, .12); }
.chips-input input { border: 0 !important; box-shadow: none !important; padding: 3px 4px !important; flex: 1; min-width: 140px; width: auto; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--cream); color: var(--muted); }
.badge.err { background: var(--err-bg); color: var(--err); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); display: inline-block; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; margin-bottom: 22px; font-size: 14.5px; }
.banner .ic { margin-top: 2px; }
.banner.test { background: var(--warn-bg); color: #6F4A10; }
.banner.err { background: var(--err-bg); color: var(--err); }
.banner.warn { background: var(--warn-bg); color: #6F4A10; margin: 0 0 14px; }
.banner ul { margin: 6px 0 0; padding-left: 18px; }
.banner a { font-weight: 600; }

/* ---------- home ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.stat-ic { width: 32px; height: 32px; border-radius: 10px; background: var(--cream); color: var(--navy); display: grid; place-items: center; }
.stat b { display: block; font: 400 40px/1 var(--display); color: var(--navy); margin: 12px 0 4px; letter-spacing: .01em; }
.stat small { color: var(--muted); font-size: 13px; }
.stat.hero { background: var(--navy); border-color: var(--navy); color: var(--cream); }
.stat.hero b { color: var(--cream); }
.stat.hero .stat-top, .stat.hero small { color: rgba(243, 241, 236, .65); }
.stat.hero .stat-ic { background: rgba(243, 241, 236, .12); color: var(--cream); }
.progress { height: 6px; background: var(--cream); border-radius: 99px; overflow: hidden; margin: 6px 0 16px; }
.progress i { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.check { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.check:first-of-type { border-top: 0; }
.check-ic { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; color: transparent; }
.check.done .check-ic { background: var(--navy); border-color: var(--navy); color: var(--cream); }
.check.done b { color: var(--muted); text-decoration: line-through; }
.check b { display: block; font-size: 15px; font-weight: 600; }
.check span { font-size: 13.5px; color: var(--muted); }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); text-decoration: none; }
.mini-row:first-of-type { border-top: 0; }
.mini-row b { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row .muted { font-size: 13.5px; }

/* ---------- activity ---------- */
.act { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.act:first-child { border-top: 0; }
.act-ic { width: 32px; height: 32px; border-radius: 10px; background: var(--cream); color: var(--navy); display: grid; place-items: center; flex: none; }
.act.error .act-ic { background: var(--err-bg); color: var(--err); }
.act.skipped .act-ic { background: #EFEDE8; color: var(--muted); }
.act-main { flex: 1; min-width: 0; font-size: 14.5px; }
.act-main b { font-weight: 600; }
.act-d { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.act.error .act-d { color: var(--err); }
.act time { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter { border: 1px solid var(--line-2); background: var(--card); border-radius: 99px; padding: 6px 14px; cursor: pointer; font-size: 14px; font-weight: 500; }
.filter.on { background: var(--navy); border-color: var(--navy); color: var(--cream); }

/* ---------- automation list ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.row-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.row-card.off .row-main, .row-card.off .row-ic, .row-card.off .row-stat { opacity: .5; }
.row-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--navy); color: var(--cream); display: grid; place-items: center; flex: none; }
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main span { display: block; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-stat { text-align: right; padding: 0 6px; }
.row-stat b { display: block; font: 400 24px/1 var(--display); }
.row-stat span { font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 56px 20px; background: var(--card); border: 1px dashed var(--line-2); border-radius: 18px; }
.empty .flake { color: var(--cream-2); display: inline-block; margin-bottom: 10px; }
.empty h3 { font-size: 24px; }
.empty p { color: var(--muted); max-width: 440px; margin: 6px auto 20px; }

/* popover menu */
.pop { position: absolute; z-index: 60; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(27, 42, 74, .3); padding: 6px; min-width: 170px; }
.pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-size: 14.5px; }
.pop button:hover { background: var(--cream); }
.pop button.danger { color: var(--err); }

/* ---------- modal / drawer / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(27, 42, 74, .45); display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity .18s; }
.overlay.in { opacity: 1; }
.dialog { background: var(--card); border-radius: 20px; padding: 26px; width: 100%; max-width: 440px; max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .4); transform: translateY(8px) scale(.98); transition: transform .18s; }
.overlay.in .dialog { transform: none; }
.dialog.wide { max-width: 760px; }
.dialog h3 { font-size: 26px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.overlay.sheet { place-items: stretch end; padding: 0; }
.overlay.sheet .dialog { max-width: 460px; height: 100vh; max-height: none; border-radius: 0; transform: translateX(30px); }
.overlay.sheet.in .dialog { transform: none; }
.dialog-close { float: right; margin: -8px -8px 0 0; }
#toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--navy); color: var(--cream); padding: 11px 18px; border-radius: 99px; font-size: 14.5px; font-weight: 500; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .4); display: flex; align-items: center; gap: 8px; animation: tin .2s ease-out; }
.toast.err { background: var(--err); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* templates */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 18px; }
.tpl { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, box-shadow .15s; }
.tpl:hover { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27, 42, 74, .08); }
.tpl-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--cream); color: var(--navy); display: grid; place-items: center; margin-bottom: 8px; }
.tpl.blank .tpl-ic { background: transparent; border: 1px dashed var(--line-2); }
.tpl b { font-size: 15.5px; font-weight: 600; }
.tpl span { font-size: 13.5px; color: var(--muted); }

/* ---------- editor ---------- */
.ed-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; margin: -34px -44px 22px; padding: 16px 44px; background: rgba(247, 246, 243, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.ed-name { flex: 1; min-width: 0; font: 600 22px/1.25 var(--body) !important; letter-spacing: -.01em; color: var(--navy) !important; border: 1px solid transparent !important; background: transparent !important; padding: 4px 8px !important; border-radius: 8px !important; box-shadow: none !important; }
.ed-name:hover { border-color: var(--line-2) !important; }
.ed-name:focus { border-color: var(--navy) !important; background: #fff !important; }
.dirty { font-size: 12.5px; font-weight: 600; color: var(--warn); background: var(--warn-bg); padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.ed-toggle { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 36px; align-items: start; }
.preview-col { position: sticky; top: 96px; }
.sec { margin-bottom: 30px; }
.sec-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.sec-h h2 { font-size: 26px; text-transform: uppercase; letter-spacing: .04em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 14px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.tile .ic { color: var(--ink-2); margin-bottom: 6px; }
.tile b { font-size: 14.5px; font-weight: 600; }
.tile span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.tile:hover { border-color: var(--line-2); }
.tile.on { border-color: var(--navy); background: var(--navy); color: var(--cream); }
.tile.on .ic, .tile.on span { color: rgba(243, 241, 236, .75); }
.steps { display: flex; flex-direction: column; }
.connector { width: 2px; height: 18px; background: var(--line-2); margin-left: 30px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); transition: border-color .15s; scroll-margin-top: 110px; }
.step.open { border-color: var(--line-2); }
.step.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 4px rgba(27, 42, 74, .25); } }
.step-h { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; cursor: pointer; user-select: none; }
.num { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: var(--cream); font-size: 13px; font-weight: 600; display: grid; place-items: center; flex: none; }
.step-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--cream); color: var(--navy); display: grid; place-items: center; flex: none; }
.step-t { flex: 1; min-width: 0; }
.step-t b { display: block; font-size: 15px; font-weight: 600; }
.step-t span { display: block; font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-tools { display: flex; align-items: center; gap: 2px; }
.chev { color: var(--muted); transition: transform .2s; padding: 0 4px; }
.step.open .chev { transform: rotate(180deg); }
.step-b { padding: 18px 18px 16px; border-top: 1px solid var(--line); }
.btn-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1.1fr) auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.next-row { display: flex; align-items: center; gap: 12px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 14px; font-weight: 600; color: var(--ink-2); }
.next-row select { flex: 1; }
.next-row.muted { font-weight: 500; color: var(--muted); }
.add-step { position: relative; }
.step-menu { margin-top: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; box-shadow: var(--shadow); }
.step-menu button { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px; border: 0; background: none; border-radius: 10px; cursor: pointer; }
.step-menu button:hover { background: var(--cream); }
.step-menu b { display: block; font-size: 14.5px; font-weight: 600; }
.step-menu span { display: block; font-size: 12.5px; color: var(--muted); }
.seg { display: none; background: var(--cream); border-radius: 99px; padding: 4px; margin-bottom: 16px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 99px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--navy); box-shadow: 0 1px 3px rgba(27, 42, 74, .12); }

/* ---------- phone preview ---------- */
.preview-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.mini-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.mini-check input { accent-color: var(--navy); }
.phone { width: 100%; max-width: 360px; height: 640px; margin: 0 auto; border: 10px solid var(--navy); border-radius: 44px; background: #fff; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 60px -28px rgba(27, 42, 74, .55); }
.phone-top { display: flex; align-items: center; gap: 10px; padding: 18px 14px 12px; border-bottom: 1px solid #EFEFEF; }
.phone-top b { display: block; font-size: 14px; font-weight: 600; color: #111; }
.phone-top small { display: block; font-size: 11.5px; color: #8E8E8E; }
.ph-av { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: var(--cream); display: grid; place-items: center; overflow: hidden; flex: none; }
.ph-av img { width: 100%; height: 100%; object-fit: cover; }
.phone-body { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; font-family: -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif; font-size: 14px; color: #111; }
.b-row { display: flex; align-items: flex-end; gap: 6px; max-width: 86%; }
.b-row.me { align-self: flex-end; }
.b-row .ph-av { width: 22px; height: 22px; }
.b-bot { background: #EFEFEF; border-radius: 18px; padding: 9px 13px; white-space: pre-wrap; word-break: break-word; line-height: 1.35; }
.b-bot.card { padding: 0; overflow: hidden; background: #fff; border: 1px solid #DBDBDB; white-space: normal; min-width: 180px; }
.b-bot.card .b-text { padding: 10px 13px; white-space: pre-wrap; }
.b-btn { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; border: 0; border-top: 1px solid #DBDBDB; background: #fff; padding: 9px; font-weight: 600; font-size: 13.5px; color: #0064E0; cursor: pointer; }
.b-btn:hover { background: #FAFAFA; }
.b-btn:disabled { cursor: default; }
.b-user { background: #3797F0; color: #fff; border-radius: 18px; padding: 9px 13px; white-space: pre-wrap; word-break: break-word; line-height: 1.35; }
.b-img { border-radius: 16px; max-width: 200px; max-height: 220px; object-fit: cover; background: #EFEFEF; min-height: 60px; min-width: 120px; }
.b-note { align-self: center; text-align: center; font-size: 11.5px; color: #8E8E8E; max-width: 90%; padding: 2px 0; line-height: 1.4; }
.b-note.warn { color: #9A6514; background: #FFF6E5; border-radius: 10px; padding: 6px 10px; }
.sim-comment { align-self: stretch; display: flex; gap: 10px; padding: 10px; border: 1px solid #EFEFEF; border-radius: 14px; font-size: 13px; margin-bottom: 4px; }
.sim-post { width: 44px; height: 44px; border-radius: 8px; flex: none; background: linear-gradient(135deg, var(--navy), var(--navy-3)); display: grid; place-items: center; color: var(--cream); }
.sim-story { align-self: flex-end; text-align: right; font-size: 11.5px; color: #8E8E8E; }
.sim-story-card { width: 90px; height: 150px; border-radius: 12px; margin: 4px 0 0 auto; background: linear-gradient(160deg, var(--navy), #3A5283); display: grid; place-items: center; color: var(--cream); }
.phone-input { display: flex; gap: 8px; padding: 10px 12px 16px; border-top: 1px solid #EFEFEF; }
.phone-input input { border-radius: 99px !important; padding: 8px 14px !important; font-size: 14px !important; background: #F5F5F5 !important; border-color: transparent !important; }
.phone-input input:disabled { opacity: .6; }
.phone-input button { border: 0; background: none; color: #0064E0; font-weight: 600; cursor: pointer; }
.phone-input button:disabled { color: #B2DFFC; cursor: default; }

/* ---------- contacts ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search { flex: 1; min-width: 220px; position: relative; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px !important; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
.toolbar select { width: auto; min-width: 160px; }
.table { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.c-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, 1.2fr) 130px; gap: 14px; align-items: center; width: 100%; padding: 13px 18px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.c-row:hover { background: var(--paper); }
.c-row.head { cursor: default; border-top: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--paper); padding-top: 10px; padding-bottom: 10px; }
.c-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.c-who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-who small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-info { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-when { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--cream); color: var(--navy); display: grid; place-items: center; font: 400 17px/1 var(--display); flex: none; text-transform: uppercase; }
.avatar.lg { width: 56px; height: 56px; font-size: 24px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; font-size: 14.5px; margin: 18px 0 22px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.drawer-sec { padding: 18px 0; border-top: 1px solid var(--line); }
.drawer-sec h4 { margin: 0 0 10px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tag-add { display: flex; gap: 8px; margin-top: 10px; }
.tag-add input { flex: 1; }

/* ---------- settings ---------- */
.settings { display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.brand-edit { display: flex; gap: 22px; align-items: flex-start; margin: 16px 0 6px; }
.brand-edit > div:last-child { flex: 1; }
.logo-prev { width: 96px; height: 96px; border-radius: 22px; background: var(--navy); color: var(--cream); display: grid; place-items: center; overflow: hidden; flex: none; }
.logo-prev img { width: 100%; height: 100%; object-fit: cover; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.right { display: flex; justify-content: flex-end; }
.srow { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.srow:first-of-type { border-top: 0; }
.sdot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.sdot.ok { background: var(--ok-bg); color: var(--ok); }
.sdot.warn { background: var(--warn-bg); color: var(--warn); }
.srow b { display: block; font-weight: 600; }
.srow span { font-size: 14px; color: var(--muted); }
.howto { margin-top: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.howto b { display: block; margin-bottom: 6px; }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 18px; }
.aud { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.aud b { font-size: 16px; }

/* ---------- login ---------- */
.login { min-height: 100vh; background: var(--navy); display: grid; place-items: center; padding: 24px;
  background-image: radial-gradient(circle at 20% 10%, rgba(243, 241, 236, .07), transparent 40%), radial-gradient(circle at 80% 90%, rgba(243, 241, 236, .05), transparent 40%); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 24px; padding: 34px 30px 28px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .5); }
.login-card .logo-box { margin: 0 auto 16px; background: var(--navy); color: var(--cream); }
.login-card h1 { text-align: center; font-size: 38px; font-weight: 400; text-transform: uppercase; letter-spacing: .08em; }
.login-card > p { text-align: center; margin: 4px 0 24px; }
.form-err { color: var(--err); font-size: 14px; min-height: 20px; margin: -6px 0 10px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
}
@media (max-width: 980px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .preview-col { position: static; }
  .editor.pane-build .preview-col, .editor.pane-preview .build { display: none; }
  .seg { display: flex; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar, .tabbar { display: flex; }
  main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .ph h1 { font-size: 34px; }
  .ph { margin-bottom: 18px; }
  .ed-head { margin: -20px -16px 16px; padding: 10px 12px; top: 54px; flex-wrap: wrap; }
  .ed-name { font-size: 19px !important; order: 1; flex-basis: calc(100% - 50px); }
  .ed-head > a { order: 0; }
  .ed-head .dirty, .ed-head .ed-toggle, .ed-head .btn { order: 2; }
  .ed-head .btn { margin-left: auto; }
  .card { padding: 18px; }
  .c-row { grid-template-columns: minmax(0, 1fr) auto; }
  .c-row .c-info, .c-row .c-tags { display: none; }
  .c-row.head { display: none; }
  .c-row:nth-child(2) { border-top: 0; }
  .btn-row { grid-template-columns: minmax(0, 1fr) auto; }
  .btn-row > :nth-child(2), .btn-row > :nth-child(3) { grid-column: 1 / 2; }
  .btn-row > :nth-child(4) { grid-row: 1; grid-column: 2; }
  .btn-row { padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
  .row-stat { display: none; }
  .phone { height: 600px; }
  .overlay.sheet { place-items: end stretch; }
  .overlay.sheet .dialog { max-width: none; height: auto; max-height: 88vh; border-radius: 22px 22px 0 0; transform: translateY(30px); padding-bottom: calc(26px + env(safe-area-inset-bottom)); }
  .brand-edit { flex-direction: column; }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (max-width: 520px) {
  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat b { font-size: 32px; }
  .two { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile span { display: none; }
  .kv { grid-template-columns: 90px 1fr; }
}
