/* Requeue Content Calendar — styles (mobile first; desktop tweaks at the bottom) */

@font-face {
  font-family: 'Bahij TheSansArabic';
  src: url('/fonts/BahijTheSansArabic-Plain.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Bahij TheSansArabic';
  src: url('/fonts/BahijTheSansArabic-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --purple: #663CC2;
  --purple-dark: #5330A0;
  --purple-light: #F1ECFB;
  --purple-mid: #C9B8F0;
  --white: #FFFFFF;
  --ink: #1F1B2E;
  --muted: #6B6580;
  --line: #E7E3F0;
  --bg: #F6F4FB;
  --green: #1E8E52;
  --green-bg: #E4F5EA;
  --red: #D6383A;
  --red-bg: #FCE9E9;
  --amber: #A86E08;
  --amber-bg: #FFF3D6;
  --blue: #2B63D9;
  --blue-bg: #E7EEFC;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31,27,46,.04), 0 4px 16px rgba(31,27,46,.06);
  --tabbar-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font-latin: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-arabic: 'Bahij TheSansArabic', 'Segoe UI', 'Noto Naskh Arabic', 'Geeza Pro', Tahoma, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font-latin); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
body.locked { overflow: hidden; }
body.signed-in { padding-top: var(--safe-t); padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--purple); }
[dir="rtl"], .arabic, textarea, .caption { font-family: var(--font-arabic); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

.ico { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ico svg { width: 100%; height: 100%; }
.spacer { flex: 1; }
.hint { font-size: 13px; color: var(--muted); }
.desktop-only { display: none !important; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); font-weight: 600; line-height: 1.2; white-space: nowrap; text-decoration: none; color: var(--ink); transition: background .15s, border-color .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--purple); color: var(--white); border-color: var(--purple); }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.small .ico { width: 16px; height: 16px; }
.btn.lg { min-height: 52px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.grow { flex: 1; }
.btn.on { background: var(--purple-light); border-color: var(--purple-mid); color: var(--purple); }
.btn.light { background: var(--white); color: var(--purple); border-color: var(--white); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--ink); flex: none; }
.icon-btn:active { background: var(--purple-light); }
.icon-btn.danger { color: var(--red); }

/* ---------- inputs (16px+ so iPhone doesn't zoom in) ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea { font-size: 16px; }
.field input, .field select, .field textarea, .panel > textarea, .page select, .sheet select, .sheet input[type="url"] { min-height: 46px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); width: 100%; -webkit-appearance: none; appearance: none; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6580' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 34px !important; }
input[type="datetime-local"] { min-height: 46px; text-align: left; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--purple) !important; box-shadow: 0 0 0 3px rgba(102,60,194,.18); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--ink); opacity: 1; }
textarea { min-height: 180px; resize: vertical; line-height: 1.7; font-size: 17px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); background: radial-gradient(120% 80% at 50% 0%, #7B52D6 0%, var(--purple) 50%, var(--purple-dark) 100%); }
.login-card { background: var(--white); border-radius: 24px; padding: 28px 22px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card h1 { font-size: 24px; margin: 22px 0 6px; }
.login-card .lead { font-size: 15px; margin: 0 0 20px; line-height: 1.5; }
.login-card form { display: flex; flex-direction: column; gap: 8px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand b { display: block; font-size: 18px; color: var(--purple); }
.login-brand span { font-size: 13px; color: var(--muted); }
.mark { width: 40px; height: 40px; border-radius: 12px; background: var(--purple); color: var(--white); display: grid; place-items: center; font-size: 20px; font-weight: 800; flex: none; }
.code-input { font-size: 30px !important; letter-spacing: 10px; text-align: center; font-family: ui-monospace, Menlo, monospace; }

/* ---------- avatar ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--purple-light); color: var(--purple); font-weight: 800; font-size: 14px; display: grid; place-items: center; flex: none; }
.avatar.big { width: 56px; height: 56px; font-size: 20px; }

/* ---------- bottom tab bar (phones) ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: rgba(255,255,255,.94); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar button { flex: 1; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabbar button .ico { width: 24px; height: 24px; }
.tabbar button.active { color: var(--purple); }
.fab { position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 25; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--purple); color: var(--white); display: grid; place-items: center; box-shadow: 0 8px 24px rgba(102,60,194,.45); }
.fab .ico { width: 28px; height: 28px; }
.fab:active { transform: scale(.94); }

/* ---------- pages ---------- */
.page { padding: 12px 16px 24px; max-width: 1280px; margin: 0 auto; }
.page.narrow { max-width: 760px; }
.page-title { font-size: 26px; margin: 8px 0 14px; }
.section-title { font-size: 18px; margin: 26px 0 10px; }
main { padding: 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* ---------- calendar header ---------- */
.cal-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.period { display: flex; align-items: center; gap: 2px; }
.period h2 { margin: 0 4px; font-size: 21px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.period .icon-btn { width: 40px; height: 40px; background: var(--white); border: 1px solid var(--line); }
/* phone: month name on the left, ‹ › Today on the right */
.period > :first-child { order: 1; }
.period > :nth-child(3) { order: 2; margin-left: 4px; }
.period .btn { order: 3; margin-left: 6px; min-height: 40px; }
.seg { display: flex; background: #E9E5F3; border-radius: 12px; padding: 3px; }
.seg button { flex: 1; min-height: 36px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.active { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.searchrow { display: flex; gap: 8px; margin-bottom: 12px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; min-height: 44px; color: var(--muted); }
.search:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(102,60,194,.18); }
.search input { flex: 1; border: 0; outline: none; background: transparent; min-width: 0; padding: 10px 0; color: var(--ink); box-shadow: none; }
.search input:focus { box-shadow: none; }
.searchrow .btn span:not(.ico) { display: none; }
.filters { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.flabel { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 2px 0 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin: 0 -12px 4px; padding-left: 12px; padding-right: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); font-size: 14px; font-weight: 600; }
.pill.on { background: var(--purple); border-color: var(--purple); color: var(--white); }
.filters .hint { margin: 4px 0 0; }

/* ---------- category colors ---------- */
.cat-USER { --cat: #663CC2; }
.cat-RESTAURANT { --cat: #E0731E; }
.cat-OWNER { --cat: #1C8C7A; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--cat, var(--purple)); }

/* ---------- month grid ---------- */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; background: var(--white); border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow); }
.month .dow { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0 6px; }
.dow .full { display: none; }
.day { position: relative; min-height: 52px; padding: 4px 2px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; border: 0; outline-offset: -2px; }
.day.other { opacity: .35; }
.day .head { display: flex; justify-content: center; align-items: center; }
.day .num { font-weight: 600; font-size: 15px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; }
.day.today .num { color: var(--purple); font-weight: 800; }
.day.selected .num { background: var(--purple); color: var(--white); font-weight: 800; }
.day:active { background: var(--purple-light); }
.day .summary, .day .chip { display: none; }
.dots { display: flex; gap: 3px; align-items: center; justify-content: center; height: 9px; }
.dots .dot { width: 7px; height: 7px; }
.dots .dot.notready { box-shadow: 0 0 0 1.5px var(--white), 0 0 0 3px var(--red); width: 6px; height: 6px; margin: 0 1px; }
.dots .more { font-size: 9px; font-weight: 700; color: var(--muted); }
.summary { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.summary.ok { background: var(--green-bg); color: var(--green); }
.summary.bad { background: var(--red-bg); color: var(--red); }
.chip { font-size: 12px; padding: 4px 6px; border-radius: 8px; background: var(--purple-light); border-left: 3px solid var(--cat, var(--purple)); gap: 5px; align-items: center; overflow: hidden; width: 100%; }
.chip .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; font-family: var(--font-arabic); }
.chip .time { color: var(--muted); font-size: 11px; }
.chip.published { background: var(--green-bg); }
.chip.scheduled { background: var(--blue-bg); }
.chip.awaiting_approval { background: var(--amber-bg); }
.chip.failed { background: var(--red-bg); }
.ready-ico { font-weight: 900; font-size: 12px; width: 14px; text-align: center; flex: none; }
.ready-ico.ok { color: var(--green); } .ready-ico.bad { color: var(--red); }

/* ---------- agenda under the month ---------- */
.agenda { margin-top: 16px; }
.agenda-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.agenda-head h3, .group-title { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.agenda-empty { color: var(--muted); background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; margin: 0; }
.today-tag { font-size: 11px; font-weight: 700; color: var(--purple); background: var(--purple-light); padding: 2px 8px; border-radius: 999px; }
.group { margin-top: 20px; }
.group-title { margin-bottom: 10px; color: var(--ink); }

/* ---------- post cards ---------- */
.card { display: flex; gap: 12px; align-items: flex-start; background: var(--white); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer; border-left: 4px solid var(--cat, var(--purple)); }
.card:active { background: #FCFBFF; }
.card .thumb { width: 72px; height: 90px; object-fit: cover; border-radius: 10px; background: var(--purple-light); flex: none; display: block; }
.card .thumb.none { display: grid; place-items: center; color: var(--purple-mid); }
.card .thumb.none .ico { width: 28px; height: 28px; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-weight: 700; font-size: 15px; font-family: var(--font-arabic), var(--font-latin); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .cap { font-family: var(--font-arabic); font-size: 13px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.card .meta > span { display: inline-flex; align-items: center; gap: 5px; }
.card .meta .ico { width: 14px; height: 14px; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.rpill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.rpill.ok { background: var(--green-bg); color: var(--green); }
.rpill.bad { background: var(--red-bg); color: var(--red); }

/* ---------- week ---------- */
.week { display: flex; flex-direction: column; gap: 14px; }
.week .col h4 { margin: 0 0 8px; font-size: 15px; font-weight: 500; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.week .col h4 b { color: var(--ink); }
.week .col.today h4, .week .col.today h4 b { color: var(--purple); }
.add-slot { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1.5px dashed var(--purple-mid); border-radius: 12px; background: transparent; color: var(--purple); font-weight: 600; font-size: 14px; }
.add-slot .ico { width: 18px; height: 18px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.draft { background: #EEEDF3; color: var(--muted); }
.badge.ready { background: var(--green-bg); color: var(--green); }
.badge.awaiting_approval { background: var(--amber-bg); color: var(--amber); }
.badge.scheduled, .badge.publishing { background: var(--blue-bg); color: var(--blue); }
.badge.published { background: var(--green); color: var(--white); }
.badge.failed { background: var(--red-bg); color: var(--red); }

/* ---------- sheets (bottom sheet on phone, dialog on desktop) ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(31,27,46,.5); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet { background: var(--white); width: 100%; max-height: calc(100dvh - var(--safe-t) - 24px); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; overflow: hidden; animation: up .22s ease; padding-bottom: var(--safe-b); }
.sheet.wide { max-height: 100dvh; height: 100dvh; border-radius: 0; padding-top: var(--safe-t); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-head h3 { margin: 0; font-size: 17px; flex: 1; }
.sheet-body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; overscroll-behavior: contain; }
.sheet-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--white); flex: none; }
.sheet-foot .btn.primary.grow { max-width: 220px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.acct { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.acct b { font-size: 17px; display: block; }
.acct .badge { margin-top: 6px; }

/* ---------- editor ---------- */
.ed-cols { display: flex; flex-direction: column; gap: 0; }
.ed-col { min-width: 0; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.panel h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.panel > .field:last-child { margin-bottom: 0; }
.capmeta { margin-top: 6px; }
.capmeta.over { color: var(--red); font-weight: 700; }
.readystrip { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.readystrip.ok { background: var(--green-bg); color: var(--green); }
.readystrip.bad { background: var(--red-bg); color: var(--red); }
.rs-title { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.rs-items { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-item { font-size: 13px; font-weight: 600; background: rgba(255,255,255,.7); padding: 3px 10px; border-radius: 999px; }
.rs-item.ok { color: var(--green); } .rs-item.bad { color: var(--red); }
.warn { background: var(--amber-bg); color: var(--amber); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 8px; }
.err { background: var(--red-bg); color: var(--red); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 8px 0; }
.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.media-item { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 4/5; }
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item .pos { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.media-item .tools { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.media-item .tools button { background: transparent; border: 0; color: #fff; width: 36px; height: 40px; display: grid; place-items: center; }
.media-item .tools button:disabled { opacity: .3; }
.media-item .tools .ico { width: 18px; height: 18px; }
.dropzone { width: 100%; border: 2px dashed var(--purple-mid); border-radius: 12px; padding: 18px 12px; text-align: center; color: var(--muted); background: var(--purple-light); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; }
.dropzone b { color: var(--purple); font-size: 15px; }
.dropzone .ico { color: var(--purple); width: 26px; height: 26px; }
.dropzone.over { background: var(--purple-mid); }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--purple); width: 0; transition: width .2s; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.wf-desc { margin: 0; font-size: 15px; line-height: 1.5; }
.markbox { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.fold { padding: 0; }
.fold summary { list-style: none; padding: 14px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; cursor: pointer; display: flex; justify-content: space-between; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: '›'; font-size: 20px; line-height: 1; transform: rotate(90deg); transition: transform .15s; }
.fold[open] summary::after { transform: rotate(-90deg); }
.fold > :not(summary) { margin: 0 14px 14px; }
.activity { font-size: 13px; max-height: 220px; overflow: auto; }
.activity div { padding: 6px 0; border-bottom: 1px solid var(--line); }
.preview-ig { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.preview-ig .ph { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; font-weight: 700; }
.preview-ig .ph .av { width: 28px; height: 28px; border-radius: 50%; background: var(--purple); }
.preview-ig .pm { aspect-ratio: 4/5; background: var(--purple-light); display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.preview-ig .pm img, .preview-ig .pm video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.preview-ig .pc { padding: 10px; font-family: var(--font-arabic); white-space: pre-wrap; line-height: 1.7; font-size: 14px; max-height: 180px; overflow: auto; }

/* ---------- team ---------- */
.members { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.member { display: flex; align-items: center; gap: 12px; background: var(--white); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); flex-wrap: wrap; }
.member .who { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.member .who .hint { overflow: hidden; text-overflow: ellipsis; }
.member .who .badge { align-self: flex-start; margin-top: 4px; }
.member .ctrl { display: flex; align-items: center; gap: 4px; flex: 1 1 100%; padding-left: 50px; }
.member .ctrl select { flex: 1; min-height: 40px; padding-top: 8px; padding-bottom: 8px; }

/* ---------- reminder settings ---------- */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; font-size: 16px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 51px; height: 31px; border-radius: 999px; background: #E2DEEA; position: relative; flex: none; transition: background .2s; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: var(--white); box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--purple); outline-offset: 2px; }
.rule .hint, .master .hint { margin: 8px 0 0; }
.master { background: var(--purple-light); border-color: var(--purple-mid); }
.rule-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.rule-ctrl select { width: auto; flex: 1 1 200px; }
.rule-ctrl .hours { width: 76px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.loglist { display: flex; flex-direction: column; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.logrow { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.logrow:last-child { border-bottom: 0; }
.logmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.logmain .hint { font-size: 12px; overflow-wrap: anywhere; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); margin: 0 auto; max-width: 480px; background: var(--ink); color: var(--white); padding: 12px 16px; border-radius: 14px; z-index: 100; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,.3); text-align: center; }
body:not(.signed-in) .toast { bottom: calc(16px + var(--safe-b)); }
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }

/* ---------- generated images ---------- */
.gen-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.gen-tile { display: flex; flex-direction: column; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; background: var(--white); box-shadow: var(--shadow); text-align: left; }
.gen-tile img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--purple-light); }
.gen-cap { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; }
.gen-full { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: var(--purple-light); }
.sheet-foot a.btn .ico { width: 18px; height: 18px; }

/* ================= larger screens ================= */
@media (min-width: 560px) {
  .searchrow .btn span:not(.ico) { display: inline; }
  .cal-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .period > :first-child, .period h2, .period > :nth-child(3), .period .btn { order: initial; margin-left: 0; }
  .period { gap: 6px; }
  .period h2 { flex: none; margin: 0 6px; min-width: 190px; text-align: center; }
  .seg { min-width: 240px; }
  .gen-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
}

@media (min-width: 900px) {
  .desktop-only { display: inline-flex !important; }
  /* the bottom bar stays on every screen size; keep its buttons compact on wide screens */
  .tabbar { justify-content: center; }
  .tabbar button { flex: 0 1 120px; }
  .fab { right: 32px; }
  .page { padding: 20px 24px 40px; }

  /* month: full chips instead of dots */
  .month { gap: 6px; padding: 0; background: transparent; box-shadow: none; }
  .dow .full { display: inline; } .dow .short { display: none; }
  .day { min-height: 118px; padding: 6px; align-items: stretch; gap: 4px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
  .day.weekend { background: #FBFAFE; }
  .day.other { opacity: .45; background: transparent; }
  .day:hover { border-color: var(--purple-mid); box-shadow: 0 4px 14px rgba(102,60,194,.12); }
  .day.selected { border-color: var(--purple); box-shadow: 0 0 0 1px var(--purple); }
  .day .head { justify-content: space-between; }
  .day .num { width: 26px; height: 26px; font-size: 13px; }
  .day.today .num { background: var(--purple); color: var(--white); }
  .day.selected:not(.today) .num { background: transparent; color: var(--purple); }
  .day .summary { display: inline-block; }
  .day .chip { display: flex; cursor: pointer; }
  .day .chip:hover { filter: brightness(.97); }
  .dots { display: none; }

  .week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .week .col { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 280px; }
  .week .col.today { border-color: var(--purple); }
  .week .card { flex-direction: column; gap: 6px; padding: 6px; box-shadow: none; border: 1px solid var(--line); border-left: 4px solid var(--cat); }
  .week .card .thumb { width: 100%; height: auto; aspect-ratio: 4/5; }
  .week .card .meta .catname { display: none; }
  .week .card .rpill { white-space: normal; }

  .listview, .agenda, .group { max-width: 900px; }
  .card:hover { box-shadow: 0 6px 20px rgba(102,60,194,.14); }

  /* sheets become centered dialogs */
  .sheet-bg { align-items: center; padding: 24px; }
  .sheet { max-width: 440px; border-radius: 20px; max-height: calc(100vh - 48px); padding-bottom: 0; }
  .sheet.wide { max-width: 1000px; height: auto; max-height: calc(100vh - 48px); border-radius: 20px; padding-top: 0; }
  .ed-cols { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: start; background: var(--bg); }
  .sheet-foot .btn.primary.grow { flex: none; min-width: 140px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .member { flex-wrap: nowrap; }
  .member .ctrl { flex: none; padding-left: 0; }
  .member .ctrl select { flex: none; width: 150px; }
}
