:root { --brand: #1f4e79; --ink: #1d2733; --muted: #6b7684; --line: #e3e7ec; --soft: #f5f7fa; }
body { color: var(--ink); background: #fff; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: color-mix(in srgb, var(--brand) 85%, #000); border-color: color-mix(in srgb, var(--brand) 85%, #000); color: #fff; }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.text-break { overflow-wrap: anywhere; }
.pre-wrap { white-space: pre-wrap; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

/* Public */
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.site-header .brand { font-weight: 700; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.site-header .brand img { max-height: 40px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; padding: 1.5rem 0; margin-top: 3rem; }
.lang-switch a { padding: .2rem .5rem; border-radius: .3rem; text-decoration: none; font-size: .85rem; }
.lang-switch a.on, .lang-switch .on { background: var(--brand); color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters > * { flex: 1 1 180px; }
.view-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: .5rem; overflow: hidden; }
.view-tabs a { padding: .4rem .9rem; text-decoration: none; color: var(--ink); }
.view-tabs a.on, .view-tabs a.active { background: var(--brand); color: #fff; }
.event-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.event-card { border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; display: flex; flex-direction: column; background: #fff; height: 100%; }
.event-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--soft); }
.event-body { padding: 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.event-title { font-size: 1.1rem; font-weight: 600; margin: 0; }
.event-date { color: var(--brand); font-weight: 600; font-size: .9rem; }
.chip, .cat { display: inline-block; font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); }
.swatch { display: inline-block; width: .75rem; height: .75rem; border-radius: 50%; vertical-align: middle; margin-right: .3rem; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.month-grid .dow { font-size: .75rem; text-transform: uppercase; color: var(--muted); padding: .3rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--soft); }
.month-grid .day { min-height: 105px; padding: .3rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .8rem; min-width: 0; }
.month-grid .day .num { font-weight: 600; color: var(--muted); }
.month-grid .day.other { background: #fafbfc; color: #b0b7c0; }
.month-grid .day.today .num { color: var(--brand); }
.month-grid .day a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; background: color-mix(in srgb, var(--brand) 12%, #fff); border-radius: .25rem; padding: 0 .25rem; margin-top: .15rem; }
.week-list { display: grid; gap: .5rem; }
.week-day { border: 1px solid var(--line); border-radius: .5rem; padding: .6rem .8rem; }
/* V1.0.0 FRC2: keep event artwork compact in Week view without changing List or Details views. */
.week-day .event-img { height: 160px; aspect-ratio: auto; object-fit: cover; }
.detail-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: .75rem; }
.detail-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; color: var(--muted); margin: .75rem 0; }
.detail-desc { white-space: pre-wrap; }
.reg-form, .auth-card, .success-box { max-width: 560px; margin: 0 auto; border: 1px solid var(--line); border-radius: .75rem; padding: 1.5rem; background: #fff; }
.auth-card { max-width: 420px; margin-top: 3rem; }
.success-box { text-align: center; }
body.embed { background: transparent; }
@media (max-width: 767px) {
  .month-grid .day { min-height: 64px; }
  .month-grid .day a { font-size: .7rem; }
}

/* Admin */
.admin { background: var(--soft); }
.admin-header { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; }
.admin-header a, .admin-header .brand { color: #fff; text-decoration: none; font-weight: 600; }
.admin-shell { display: flex; min-height: calc(100vh - 52px); }
.admin-nav { width: 230px; flex: 0 0 230px; background: #fff; border-right: 1px solid var(--line); padding: 1rem .5rem; display: flex; flex-direction: column; gap: .15rem; }
.admin-link { display: block; padding: .45rem .75rem; border-radius: .4rem; color: var(--ink); text-decoration: none; }
.admin-link:hover { background: var(--soft); }
.admin-link.active { background: color-mix(in srgb, var(--brand) 14%, #fff); color: var(--brand); font-weight: 600; }
.admin-main { flex: 1; min-width: 0; padding: 1.5rem; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.stat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-bottom: 1.5rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: .75rem; padding: 1rem; }
.stat .num, .stat strong { font-size: 1.6rem; display: block; color: var(--brand); }
.admin-form { max-width: 900px; }
.narrow { max-width: 640px; }
.activity { list-style: none; padding: 0; }
.activity li, .comment { padding: .4rem 0; border-bottom: 1px solid var(--line); }
.overdue { color: #b42318; font-weight: 600; }
.done { text-decoration: line-through; color: var(--muted); }
.ai-box { border: 1px dashed var(--line); border-radius: .5rem; padding: .75rem; background: #fff; }
.ai-box pre { white-space: pre-wrap; font-family: inherit; }
.status-confirmed, .campaign-sent, .marketing-subscribed { background: #d1f2df !important; color: #0f5132 !important; }
.status-waitlisted, .status-pendingpayment, .campaign-sending, .campaign-scheduled { background: #fff1c2 !important; color: #7a5a00 !important; }
.status-cancelled, .campaign-failed, .marketing-unsubscribed { background: #fde2e1 !important; color: #8a1c13 !important; }
.campaign-draft, .marketing-unknown, .marketing-pending { background: #e7ebf0 !important; color: #3d4752 !important; }
@media (max-width: 991px) {
  .admin-nav { position: fixed; top: 52px; left: 0; bottom: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; overflow-y: auto; }
  .admin-nav.open { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.2); }
  .admin-main { padding: 1rem; }
}
@media (max-width: 767px) {
  table.table-cards thead, .table-responsive-cards table thead { display: none; }
  table.table-cards tr, .table-responsive-cards table tr { display: block; border: 1px solid var(--line); border-radius: .5rem; margin-bottom: .75rem; background: #fff; }
  table.table-cards td, .table-responsive-cards table td { display: grid; grid-template-columns: 40% 1fr; gap: .75rem; border: 0; padding: .4rem .75rem; }
  td[data-label]::before { content: attr(data-label); font-weight: 600; color: var(--muted); }
  .table-responsive-cards table td:not([data-label]) { display: flex; flex-wrap: wrap; gap: .4rem; }
}

/* Badge helpers (Bootstrap 5.1 compatible) */
.text-bg-success { background: #198754 !important; color: #fff !important; }
.text-bg-secondary { background: #6c757d !important; color: #fff !important; }
.text-bg-warning { background: #ffc107 !important; color: #000 !important; }
.text-bg-danger { background: #dc3545 !important; color: #fff !important; }
.text-bg-info { background: #0dcaf0 !important; color: #000 !important; }
.text-bg-light { background: #f8f9fa !important; color: #000 !important; }
.text-bg-primary { background: var(--brand) !important; color: #fff !important; }
.badge { color: var(--ink); background: #e7ebf0; }

.badge.cat { background: var(--cat, var(--brand)) !important; color: #fff !important; }
.month-grid .day a.chip, .week-day a.chip { border-left: 3px solid var(--cat, var(--brand)); border-radius: .2rem; }

/* v0.4.1 organization branding */
.admin-header .admin-brand { display:flex; align-items:center; gap:.55rem; min-width:0; }
.admin-header .brand-logo { display:block; max-height:34px; max-width:150px; width:auto; object-fit:contain; background:#fff; border-radius:4px; padding:2px; }
.settings-logo-preview { display:block; max-height:72px; max-width:240px; width:auto; object-fit:contain; border:1px solid var(--line); border-radius:6px; padding:6px; background:#fff; }
.site-header .brand img { width:auto; max-width:180px; object-fit:contain; }
@media (max-width: 575.98px) { .admin-header .brand-logo { max-width:90px; max-height:30px; } .admin-header .admin-brand span { max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } }

/* v0.6.1: consistent in-app confirmation dialog */
.ceh-confirm-dialog { border: 0; padding: 0; background: transparent; max-width: 92vw; }
.ceh-confirm-dialog::backdrop { background: rgba(0,0,0,.38); }
.ceh-confirm-dialog .card { border: 0; }
summary.btn { list-style: none; cursor: pointer; }
summary.btn::-webkit-details-marker { display:none; }
