/* Admin panel */
:root {
    --navy: #041b54; --blue: #284ba2; --blue-2: #004a99; --yellow: #febd30;
    --bg: #f3f5f9; --card: #fff; --line: #dfe4ec; --text: #1c2536; --muted: #667085;
    --danger: #c8321e; --ok: #157a3c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--blue-2); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
code { background: #eef1f6; padding: 1px 6px; border-radius: 4px; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 18px;
    border: 1px solid var(--blue-2); border-radius: 8px; background: var(--blue-2); color: #fff;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--navy); border-color: var(--navy); }
.btn:disabled { opacity: .7; cursor: progress; }
.btn.ghost { background: #fff; color: var(--blue-2); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--blue-2); background: #f5f8ff; }
.btn.small { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.btn.icon { min-height: 32px; width: 32px; padding: 0; background: #fff; color: var(--text); border-color: var(--line); }
.btn.icon:hover { background: #f5f8ff; border-color: var(--blue-2); }
.btn.danger { background: #fff; color: var(--danger); border-color: #f1c5be; }
.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert.success { background: #ecf8f0; border-color: #b9e3c7; color: var(--ok); }
.alert.error { background: #fdf0ee; border-color: #f1c5be; color: var(--danger); }
.note { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; background: #fff8e6; border: 1px solid #f6dc9c; }

/* Login / install */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, var(--blue), var(--navy)); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 36px 32px; box-shadow: 0 24px 60px rgba(0,0,0,.3); text-align: center; }
.auth-card h1 { font-size: 22px; color: var(--navy); }
.auth-card .muted { margin: 6px 0 22px; }
.auth-logo { width: 64px; height: 72px; object-fit: contain; margin: 0 auto 12px; display: block; }
.stack { display: grid; gap: 14px; text-align: left; }
.stack label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }

/* Inputs */
input[type=text], input[type=number], input[type=password], input:not([type]), select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--text); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(0, 74, 153, .15); }
textarea { resize: vertical; min-height: 90px; }

/* Layout */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 250px; background: var(--navy); color: #fff; overflow-y: auto; z-index: 30;
    transition: transform .25s;
}
.side-brand { display: block; padding: 22px 20px 18px; color: #fff; text-decoration: none; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-brand small { display: block; color: var(--yellow); font-weight: 500; font-size: 12px; margin-top: 2px; }
.sidebar nav { padding: 10px 0 30px; }
.sidebar nav a { display: block; padding: 8px 20px; color: rgba(255,255,255,.82); text-decoration: none; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.1); color: #fff; border-left-color: var(--yellow); }
.side-label { display: block; padding: 18px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.45); }
.main { margin-left: 250px; min-height: 100vh; }
.topnav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--line); }
.topnav h1 { font-size: 19px; flex: 1; }
.topnav-right { display: flex; gap: 8px; }
.topnav form { margin: 0; }
.menu-btn { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; }
.content { padding: 26px 28px 60px; max-width: 1100px; }
.lead { margin: 0 0 18px; color: var(--muted); }
.crumbs { margin: 0 0 14px; }
.crumbs a { text-decoration: none; }
.block-title { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 26px 0 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { display: block; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.tile:hover { border-color: var(--blue-2); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(4,27,84,.08); }
.tile strong { display: block; }
.tile span { color: var(--muted); font-size: 13px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 24px; margin-bottom: 18px; }
fieldset.card { min-width: 0; }
legend { font-weight: 700; font-size: 16px; padding: 0 6px; color: var(--navy); }
.form .field { margin-bottom: 20px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--danger); }
.help { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
.narrow { max-width: 480px; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.form-actions.sticky { position: sticky; bottom: 0; margin: 0 -24px -24px; padding: 14px 24px; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
form.form > .form-actions.sticky { margin: 0; border-radius: 12px; border: 1px solid var(--line); }
.card.form > .form-actions.sticky { margin: 0 -24px -24px; border: 0; border-top: 1px solid var(--line); }

/* Uploads */
.upload { display: grid; gap: 10px; padding: 14px; border: 1px dashed #c3ccda; border-radius: 10px; background: #fafbfd; }
.upload-preview { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.upload-preview:empty { display: none; }
.upload-preview img { max-width: 240px; max-height: 150px; border-radius: 6px; border: 1px solid var(--line); background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.remove { display: inline-flex; gap: 6px; align-items: center; color: var(--danger); font-size: 13px; cursor: pointer; }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: relative; width: 42px; height: 24px; border-radius: 24px; background: #c9d0db; transition: background-color .2s; flex: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(0,74,153,.3); }

/* Rich text */
.rich .ql-toolbar { border-radius: 8px 8px 0 0; border-color: var(--line); }
.rich .ql-container { border-radius: 0 0 8px 8px; border-color: var(--line); font: inherit; font-size: 15px; min-height: 180px; }

/* Lists */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.bar .lead { margin: 0; }
.list { padding: 6px 0; }
.list-heading { padding: 16px 20px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.row { display: flex; align-items: center; gap: 14px; padding: 10px 20px; border-top: 1px solid var(--line); }
.list > .row:first-child, .list-heading + .row { border-top: 0; }
.row.is-child { padding-left: 44px; background: #fafbfd; }
.row.is-hidden .row-title, .row.is-hidden .thumb { opacity: .5; }
.thumb { flex: none; width: 64px; height: 44px; border-radius: 6px; overflow: hidden; background: #eef1f6; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb em { font-size: 10px; color: var(--muted); font-style: normal; }
.row-title { flex: 1; min-width: 0; color: var(--text); text-decoration: none; font-weight: 600; }
.row-title small { display: block; font-weight: 400; color: var(--muted); }
.row-title:hover { color: var(--blue-2); }
.tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 20px; background: #eef1f6; color: var(--muted); font-size: 12px; font-weight: 500; }
.row-actions { display: flex; gap: 6px; flex: none; }
.row-actions form { margin: 0; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .side-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .main { margin-left: 0; }
    .menu-btn { display: inline-block; }
    .topnav { padding: 12px 16px; flex-wrap: wrap; }
    .content { padding: 18px 16px 50px; }
    .row { flex-wrap: wrap; }
    .row-actions { width: 100%; justify-content: flex-end; }
    .bar { flex-direction: column; align-items: flex-start; }
}

/* ---------- Simplified navigation ---------- */
.sidebar nav { padding-top: 14px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 11px 20px; font-weight: 500; }
.sidebar .ico { flex: none; opacity: .85; }
.badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 20px; background: var(--yellow); color: var(--navy); font-size: 12px; font-weight: 700; text-align: center; }
.content { max-width: 1240px; }

/* Dashboard */
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 8px; }
.action { display: flex; flex-direction: column; gap: 4px; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 14px; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.action:hover { border-color: var(--blue-2); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(4, 27, 84, .08); }
.action strong { font-size: 17px; margin-top: 10px; }
.action > span:last-child { color: var(--muted); font-size: 14px; }
.action-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: #eaf1ff; color: var(--blue-2); }
.action-ico .ico { width: 24px; height: 24px; }
.action.has-new .action-ico { background: #fff4d6; color: #a66b00; }

/* Lists */
.bar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { width: 220px !important; }
.btn .ico { width: 16px; height: 16px; }
.empty { color: var(--muted); }
.row-actions .btn { min-width: 58px; }
.tiles-2 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 18px; }
.nowrap { white-space: nowrap; }

/* Messages */
.msg-row .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: transparent; }
.msg-row.is-new .dot { background: var(--blue-2); }
.msg-row.is-new .row-title { font-weight: 700; }
.msg-row .row-title { font-weight: 500; }
.msg-meta { display: grid; grid-template-columns: 110px 1fr; gap: 8px 16px; margin: 0 0 20px; }
.msg-meta dt { color: var(--muted); }
.msg-meta dd { margin: 0; }
.msg-body { padding: 18px 20px; border-radius: 10px; background: #f7f9fc; border: 1px solid var(--line); white-space: normal; margin-bottom: 20px; line-height: 1.7; }
.form-actions form { margin: 0; }

/* ---------- Page editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.editor-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; }
.editor-side .card { margin: 0; padding: 18px; }
.side-title { margin: 0 0 14px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--navy); }
details.card > summary { cursor: pointer; list-style: none; margin: 0; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: '▸'; float: right; color: var(--muted); }
details.card[open] > summary { margin-bottom: 14px; }
details.card[open] > summary::after { content: '▾'; }
.side-actions { display: flex; gap: 8px; margin: 14px 0 6px; }
.side-actions .btn { flex: 1; }
.input-lg { font-size: 18px !important; font-weight: 600; }
.input-date { max-width: 220px; }
.slug { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: #f7f9fc; }
.slug span { padding: 0 2px 0 10px; color: var(--muted); }
.slug input { border: 0 !important; background: transparent; box-shadow: none !important; padding-left: 2px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.editor .card > .field:last-child { margin-bottom: 0; }
.editor .field { margin-bottom: 16px; }
.editor .help { font-size: 12.5px; }

.up { display: grid; gap: 10px; padding: 12px; border: 1px dashed #c3ccda; border-radius: 10px; background: #fafbfd; }
.up-preview:empty { display: none; }
.up-preview img { display: block; max-width: 100%; max-height: 170px; border-radius: 6px; border: 1px solid var(--line); background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.up-file { display: inline-block; padding: 8px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); text-decoration: none; font-weight: 600; }
.up-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.up-btns label.btn { cursor: pointer; }
.up-msg { flex-basis: 100%; }
.up-msg:empty { display: none; }

/* block cards */
.bblocks { display: flex; flex-direction: column; gap: 12px; }
.bblocks.is-nested { gap: 10px; padding: 12px; border-radius: 10px; background: #f3f6fb; border: 1px solid #e3e8f0; }
.bcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.bcard-item { border-radius: 10px; box-shadow: none; }
.bcard-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 4px; border-bottom: 1px solid var(--line); }
.bcard.is-collapsed .bcard-head { border-bottom: 0; }
.bcard.is-collapsed .bcard-body { display: none; }
.bcard-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.bcard-toggle strong { flex: none; font-size: 14.5px; }
.bcard-block > .bcard-head .bcard-toggle strong { color: var(--navy); }
.bcard-sub { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 13.5px; }
.chev { display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
.bcard.is-collapsed .chev { transform: rotate(-90deg); }
.bcard-tools { display: flex; gap: 4px; flex: none; }
.bt { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.bt:hover { background: #f1f4f9; border-color: var(--line); color: var(--text); }
.bt.armed { background: var(--danger); border-color: var(--danger); color: #fff; font-size: 12px; font-weight: 600; }
.bcard-body { padding: 16px 18px 18px; }
.bf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.bf { grid-column: 1 / -1; min-width: 0; }
.bf.half { grid-column: auto; }
.bf-label { display: block; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.bf .help { margin-top: 4px; }
.bf-checkbox { align-self: end; padding-bottom: 8px; }
.bf .rich .ql-container { min-height: 120px; }
.blist { display: flex; flex-direction: column; gap: 8px; }
.blist > .btn { align-self: flex-start; }
.blist .bcard-body { padding: 14px; }
.add-item { margin-top: 2px; }

.adder { position: relative; }
.adder-btn { width: 100%; border-style: dashed !important; min-height: 46px; }
.is-nested .adder-btn { min-height: 38px; }
.adder-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin-top: 8px; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(4, 27, 84, .12); }
.adder-menu[hidden] { display: none; }
.adder-opt { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.adder-opt:hover { border-color: var(--blue-2); background: #f0f5ff; color: var(--blue-2); }

/* table grid */
.tbl-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.tbl-grid { border-collapse: collapse; min-width: 100%; }
.tbl-grid td, .tbl-grid th { border: 1px solid #e6ebf2; padding: 0; vertical-align: top; }
.tbl-grid td { min-width: 120px; }
.tbl-grid textarea { display: block; width: 100%; min-height: 36px; border: 0 !important; border-radius: 0; padding: 8px; resize: none; font-size: 13.5px; line-height: 1.4; box-shadow: none !important; overflow: hidden; }
.tbl-grid textarea:focus { background: #f5f9ff; }
.tbl-grid tr.is-head textarea { background: #1755a7; color: #fff; font-weight: 600; }
.tbl-colctl, .tbl-rowctl, .tbl-corner { background: #f7f9fc; text-align: center; }
.tbl-rowctl { white-space: nowrap; width: 54px; }
.tbl-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 5px; font-size: 12px; }
.tbl-x:hover { color: var(--danger); }
.tbl-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

@media (max-width: 1100px) {
    .editor { grid-template-columns: minmax(0, 1fr); }
    .editor-side { position: static; order: -1; }
}
@media (max-width: 700px) {
    .bf-grid { grid-template-columns: minmax(0, 1fr); }
    .bcard-tools .bt:nth-child(3) { display: none; }
    .search { width: 100% !important; }
    .bar-right { width: 100%; }
}
.field > label.switch { display: inline-flex; margin-bottom: 0; }
.side-actions .btn { white-space: nowrap; padding-inline: 12px; }

/* =====================================================================
   Look & feel: school colours, flat paper-like surfaces, top navigation
   ===================================================================== */
:root {
    --navy: #13285e; --blue: #284ba2; --blue-2: #1d4fa3; --yellow: #febd30;
    --bg: #f5f4f0; --card: #fff; --line: #e3e0d7; --text: #1d2433; --muted: #6b6f7b;
}
body.admin { font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; font-size: 15px; background: var(--bg); display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
.ah { position: sticky; top: 0; z-index: 40; background: #fff; border-bottom: 1px solid var(--line); }
.ah-in { max-width: 1120px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; min-height: 64px; }
.ah-brand { display: flex; align-items: center; gap: 10px; color: var(--navy); text-decoration: none; font-weight: 700; font-size: 14.5px; line-height: 1.15; flex: none; }
.ah-brand img { width: 34px; height: 40px; object-fit: contain; }
.ah-brand small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 2px; }
.ah-nav { display: flex; align-items: stretch; gap: 4px; flex: 1; min-width: 0; align-self: stretch; }
.ah-nav > a { display: flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--text); text-decoration: none; font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.ah-nav > a:hover { color: var(--blue); }
.ah-nav > a.active { color: var(--blue); border-bottom-color: var(--yellow); font-weight: 600; }
.ah-nav-end { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 13.5px; }
.ah-nav-end a, .ah-nav-end button { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.ah-nav-end a:hover, .ah-nav-end button:hover { color: var(--blue); text-decoration: underline; }
.ah-nav-end form { margin: 0; }
.ah-menu { display: none; margin-left: auto; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 7px 12px; font: inherit; cursor: pointer; }
.ah .badge { margin: 0; background: var(--yellow); color: var(--navy); }

/* page */
.main { max-width: 1120px; margin: 0 auto; padding: 34px 24px 120px; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 28px; font-weight: 700; color: var(--navy); letter-spacing: -.01em; }
.page-head h1::after { content: ''; display: block; width: 60px; height: 4px; margin-top: 12px; border-radius: 2px;
    background: linear-gradient(90deg, var(--yellow) 0 55%, transparent 55% 64%, var(--yellow) 64% 88%, transparent 88% 94%, var(--yellow) 94%); }
.content { max-width: none; padding: 0; }
.lead { color: var(--muted); font-size: 15.5px; margin: 0 0 22px; }
.sidebar, .topnav { display: none; }

/* surfaces */
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: none; }
.btn { border-radius: 6px; background: var(--blue); border-color: var(--blue); font-weight: 600; }
.btn:hover { background: var(--navy); border-color: var(--navy); }
.btn.ghost { background: #fff; color: var(--blue); border-color: var(--line); }
input[type=text], input[type=search], input[type=email], input[type=date], input[type=url], input[type=password], input:not([type]), select, textarea {
    font: inherit; color: var(--text); background: #fff; border: 1px solid #d8d5cb; border-radius: 6px; padding: 9px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40, 75, 162, .14); }
.thumb:has(> em) { display: none; }
.list-heading { background: #faf9f6; color: var(--muted); font-size: 12.5px; letter-spacing: .02em; }
.row-title small { color: var(--muted); }
.tile { box-shadow: none; border-radius: 10px; }
.tile:hover { border-color: var(--blue); }
.h2 { font-size: 17px; font-weight: 700; color: var(--navy); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.badge { background: var(--yellow); color: var(--navy); }

/* home */
.finder { position: relative; max-width: 640px; margin: 0 0 34px; }
.finder input { font-size: 17px; padding: 14px 16px 14px 46px; border-radius: 8px; border-color: #cfcabd;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%236b6f7b' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 15px center; }
.finder-list { list-style: none; margin: 8px 0 0; padding: 6px; max-height: 300px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.finder-list a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 6px; color: var(--text); text-decoration: none; }
.finder-list a span { color: var(--muted); font-size: 13px; }
.finder-list a:hover, .finder-list a.is-first { background: #f2f5fb; color: var(--blue); }
.finder:not(.is-open) .finder-list { display: none; }
.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.plain-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.plain-list a { color: var(--text); text-decoration: none; font-weight: 500; }
.plain-list a:hover { color: var(--blue); text-decoration: underline; }
.plain-list span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.plain-list li.is-new a { font-weight: 700; }
.links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 14px 0 0; }
.links a { color: var(--blue); font-weight: 600; text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* ---------- page editor ---------- */
.editor { display: block; max-width: 920px; }
.edit-top { display: flex; justify-content: space-between; gap: 12px; margin: -6px 0 18px; }
.back { color: var(--blue); text-decoration: none; font-weight: 500; font-size: 14px; }
.back:hover { text-decoration: underline; }
.blocks-root { display: flex; flex-direction: column; gap: 22px; }
.sec-first + textarea + .blocks-root { margin-top: 22px; }
.sec { margin: 0; }
.sec-label { margin: 0 0 7px 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.sec-body { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.sec-note p { margin: 0; padding: 14px 18px; border-radius: 10px; background: #fbf7ea; border: 1px solid #efe2bb; color: #5d4a17; }
.sec-note a { color: var(--blue); font-weight: 600; }
.in-heading { font-size: 20px !important; font-weight: 700; color: var(--blue) !important; border-color: transparent !important; background: #f7f8fb !important; }
.in-heading:hover { border-color: #d8d5cb !important; }
.in-sub { font-weight: 600; color: var(--blue) !important; }
input.strong { font-weight: 600; }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.fld-hint { color: var(--muted); font-size: 12.5px; }
.req { color: #c8321e; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; margin-top: 4px; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.split-main, .split-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rt .ql-toolbar.ql-snow { border-color: #d8d5cb; border-radius: 6px 6px 0 0; background: #faf9f6; }
.rt .ql-container.ql-snow { border-color: #d8d5cb; border-radius: 0 0 6px 6px; font: inherit; font-size: 15px; }
.rt .ql-editor { min-height: 90px; line-height: 1.65; }

/* photos */
.ph { position: relative; display: flex; flex-direction: column; gap: 6px; }
.ph-pick { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; cursor: pointer; background: #f1efe9; border: 1px solid var(--line); }
.ph-wide .ph-pick { aspect-ratio: 16 / 10; }
.ph-flag .ph-pick { aspect-ratio: 3 / 4; }
.ph-portrait .ph-pick { aspect-ratio: 179 / 194; }
.ph-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-hover { position: absolute; inset: auto 0 0 0; padding: 7px; background: rgba(19, 40, 94, .78); color: #fff; font-size: 12.5px; font-weight: 600; text-align: center; opacity: 0; transition: opacity .15s; }
.ph-pick:hover .ph-hover, .ph-pick:focus-within .ph-hover { opacity: 1; }
.ph-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--blue); font-weight: 600; font-size: 14px; border: 2px dashed #cfd7ea; border-radius: 8px; }
.ph-empty b { font-size: 20px; }
.ph.is-busy .ph-pick { opacity: .5; }
.ph-remove { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; }
.ph-remove:hover { color: #c8321e; }
.ph-msg { font-size: 12.5px; color: #c8321e; }
.ph-msg:empty { display: none; }
.fileup { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.link-btn { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* card grids (people, photos, documents) */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.grid-photos, .grid-docs { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid-names { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gcard { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fcfbf8; }
.gcard input { padding: 6px 8px; font-size: 13.5px; background: #fff; }
.gcard .ph-pick { aspect-ratio: 282 / 233; }
.grid-photos .gcard .ph-pick { aspect-ratio: 362 / 266; }
.grid-docs .gcard .ph-pick { aspect-ratio: 3 / 4; }
.gcard-remove { align-self: flex-start; background: none; border: 0; padding: 2px 0 0; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.gcard-remove:hover, .gcard.confirm .gcard-remove { color: #c8321e; text-decoration: underline; }
.gcard-add { align-items: center; justify-content: center; min-height: 120px; border: 2px dashed #cfd7ea; background: none; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; }
.gcard-add b { font-size: 22px; }
.gcard-add:hover { background: #f4f7fd; }
.grid-names .gcard-add { min-height: 80px; }

/* single lines */
.lines { display: flex; flex-direction: column; gap: 8px; }
.line { display: flex; gap: 8px; align-items: flex-start; }
.line textarea, .line input { flex: 1; }
.line-remove { flex: none; width: 34px; height: 38px; border: 1px solid transparent; background: none; border-radius: 6px; color: var(--muted); cursor: pointer; }
.line-remove:hover { color: #c8321e; border-color: var(--line); background: #fff; }

/* houses */
.houses { display: grid; grid-template-columns: 1fr; gap: 14px; }
.house { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fcfbf8; }
.house-body { display: flex; flex-direction: column; gap: 10px; }
.house-ppl { display: grid; grid-template-columns: repeat(2, minmax(0, 170px)); gap: 14px; }
.house-p { display: flex; flex-direction: column; gap: 6px; }
.house-p input { padding: 6px 8px; font-size: 13.5px; }

/* tables */
.tbl-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.tbl-grid { border-collapse: collapse; width: 100%; }
.tbl-grid td { border: 1px solid #ebe8e0; padding: 0; vertical-align: top; min-width: 90px; }
.tbl-grid textarea { display: block; width: 100%; border: 0 !important; border-radius: 0; padding: 8px 10px; resize: none; font-size: 14px; line-height: 1.45; box-shadow: none !important; overflow: hidden; background: transparent; }
.tbl-grid textarea:focus { background: #f2f6fd; }
.tbl-grid tr.is-head td { background: #1755a7; }
.tbl-grid tr.is-head textarea { color: #fff; font-weight: 600; }
.tbl-grid td.is-joined textarea { color: #b3b0a6; }
.tbl-grid td.tbl-del { width: 34px; min-width: 34px; border: 0; background: #fff; text-align: center; }
.tbl-grid td.tbl-del button { border: 0; background: none; color: #b3b0a6; padding: 8px; cursor: pointer; }
.tbl-grid td.tbl-del button:hover { color: #c8321e; }
.tbl-grid tr.is-head td.tbl-del { background: #fff; }
.tbl-foot { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }

/* tabs inside the editor (look like the website's) */
.etabs { display: flex; flex-direction: column; gap: 18px; }
.etabs-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.etab { padding: 9px 14px; border: 0; border-radius: 7px; background: none; color: #43474d; font: inherit; font-weight: 500; font-size: 14px; cursor: pointer; }
.etab:hover { background: #f4f2ec; }
.etab.is-on { background: #1755a7; color: #fff; }
.etabs-panel { display: flex; flex-direction: column; gap: 22px; padding-left: 14px; border-left: 3px solid #e7e3d6; }
.etabs-panel[hidden] { display: none; }
.tab-name { max-width: 360px; }

/* more settings + save bar */
.more { margin-top: 30px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.more > summary { padding: 15px 20px; cursor: pointer; font-weight: 600; color: var(--navy); list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: '+'; display: inline-block; width: 18px; color: var(--muted); }
.more[open] > summary::before { content: '–'; }
.more > .split { padding: 4px 20px 20px; }
.slug { display: flex; align-items: center; border: 1px solid #d8d5cb; border-radius: 6px; background: #faf9f6; }
.slug span { padding-left: 12px; color: var(--muted); white-space: nowrap; font-size: 13.5px; }
.slug input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding-left: 2px; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: flex-end; align-items: center; gap: 18px;
    padding: 12px max(24px, calc((100vw - 1120px) / 2 + 24px)); background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); backdrop-filter: blur(4px); }
.savebar-status { color: var(--muted); font-size: 14px; }
.savebar-status.is-dirty { color: #8a5a00; font-weight: 600; }
.savebar .btn { min-width: 150px; min-height: 44px; }
.input-date { max-width: 220px; }

@media (max-width: 900px) {
    .ah-in { flex-wrap: wrap; gap: 10px; padding: 8px 16px; }
    .ah-menu { display: block; }
    .ah-nav { display: none; flex-basis: 100%; flex-direction: column; align-self: auto; padding-bottom: 8px; }
    body.side-open .ah-nav { display: flex; }
    .ah-nav > a { padding: 10px 4px; border-bottom: 0; border-left: 3px solid transparent; }
    .ah-nav > a.active { border-left-color: var(--yellow); }
    .ah-nav-end { margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
    .main { padding: 22px 16px 110px; }
    .dash, .split { grid-template-columns: minmax(0, 1fr); }
    .house { grid-template-columns: 1fr; }
    .house .ph-flag .ph-pick { aspect-ratio: 16 / 9; }
    .etabs-panel { padding-left: 0; border-left: 0; }
    .savebar { padding: 10px 16px; }
    .savebar-status { font-size: 12.5px; }
}
.tbl-grid .cell { min-height: 38px; padding: 8px 10px; font-size: 14px; line-height: 1.5; outline: none; white-space: normal; word-break: break-word; }
.tbl-grid .cell:focus { background: #f2f6fd; box-shadow: inset 0 0 0 2px #9db4e3; }
.tbl-grid tr.is-head .cell { color: #fff; font-weight: 600; }
.tbl-grid tr.is-head .cell:focus { background: #0f4590; }
.tbl-grid td.is-joined { background: #f6f5f1; }
.tbl-grid .cell b { font-weight: 700; }
.chip { display: inline-block; margin: 2px 0; padding: 1px 9px; border: 1px solid #bae6fd; border-radius: 999px; background: #e0f2fe; font-size: 12.5px; }
.rt .ql-editor p + p, .rt .ql-editor p + ul, .rt .ql-editor ul + p { margin-top: .75em; }
.rt .ql-editor li { margin-bottom: .35em; }
/* page list: quieter actions */
.card.list .row-actions .btn { min-height: 0; min-width: 0; padding: 4px 6px; border: 0; background: none; color: var(--blue); font-weight: 600; font-size: 14px; }
.card.list .row-actions .btn:hover { text-decoration: underline; background: none; }
.card.list .row-actions .btn.ghost { color: var(--muted); font-weight: 500; }
.card.list .row-actions .btn.danger { color: #c8321e; font-weight: 500; }
.card.list .row { padding-top: 13px; padding-bottom: 13px; }
.card.list .row:hover { background: #fbfaf7; }
.row-title { color: var(--text); }

/* ---------- Upload hints (format + size limit) ---------- */
.up-hint { display: block; margin-top: 6px; font-size: 12.5px; line-height: 1.4; color: #6b6a63; }
.up-hint-top { margin: 0 0 10px; }
.ph .up-hint { text-align: left; }
.up-error { display: block; color: #b42318; font-size: 13px; line-height: 1.4; margin-top: 6px; }
.ph-msg.up-error { font-weight: 500; }
.upload .up-hint { margin-top: 8px; }
.fileup { flex-wrap: wrap; }
.fileup .up-hint { flex-basis: 100%; margin-top: 2px; }
