/* Lennium public site. Colours come from the host's theme (/themes/{name}.css sets the
   variables below); everything else is shared. Mobile first, no framework. */

:root {
  --accent: #2e87b7; --accent-hover: #258cc7;
  --bg: #f6f7f9; --surface: #ffffff; --text: #2b2f33; --muted: #6b7280;
  --border: color-mix(in srgb, var(--text) 14%, transparent);
  --radius: 10px; --gap: 16px; --max: 1080px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Open Sans", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--font); background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gap); }

/* Header and navigation */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: var(--gap); min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); letter-spacing: .02em; }
.brand:hover { text-decoration: none; color: var(--accent); }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.site-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; color: var(--text); }
.site-nav a:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); text-decoration: none; }
.site-nav a[aria-current="page"] { background: var(--accent); color: #fff; }
.account { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.icon { width: 18px; height: 18px; flex: none; }

/* Layout slots */
main { padding: calc(var(--gap) * 1.5) 0 calc(var(--gap) * 3); }
.slot-hero { margin-bottom: var(--gap); }
.columns { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 840px) { .columns.has-aside { grid-template-columns: minmax(0, 1fr) 300px; } }
.slot-main, .slot-aside { display: grid; gap: var(--gap); align-content: start; }

/* Cards and widgets */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: calc(var(--gap) * 1.25); }
.card > :last-child { margin-bottom: 0; }

/* Forms */
.form { max-width: 440px; margin: 0 auto; }
.field { display: grid; gap: 4px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .95rem; }
.field small { color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], textarea, select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600;
  border: 0; border-radius: 8px; padding: 10px 18px; background: var(--accent); color: #fff; cursor: pointer; }
.btn:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.link { background: none; color: var(--accent); padding: 0; font-weight: 400; }
.btn.block { width: 100%; }
.alert { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid; }
.alert.error { color: #8a1c1c; background: #fdecec; border-color: #f2b8b8; }
.alert.ok { color: #1d5a2c; background: #eaf7ee; border-color: #b6e2c1; }
.choices { display: grid; gap: var(--gap); }
@media (min-width: 720px) { .choices { grid-template-columns: repeat(3, 1fr); } }
.choice h2 { display: flex; gap: 8px; align-items: center; }

.site-footer { border-top: 1px solid var(--border); padding: var(--gap) 0; color: var(--muted); font-size: .9rem; }

/* Administration */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 18px; border-bottom: 1px solid var(--border); }
.admin-nav a { padding: 8px 14px; border-bottom: 3px solid transparent; color: var(--text); }
.admin-nav a[aria-current] { border-color: var(--accent); font-weight: 600; }
.admin-section { margin: 28px 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.admin-table th, .admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.admin-table td.actions { white-space: nowrap; }
.admin-table td.actions form { display: inline; }
.btn.link.danger { color: #b42318; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.tag.muted-tag { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
.swatches { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.swatch { width: 22px; height: 22px; }
.admin-form { max-width: 640px; }
.admin-form.wide { max-width: none; }
.admin-form fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.field-row { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .field-row { grid-template-columns: 2fr 2fr 1fr; } }
.color-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.color-input { display: flex; gap: 8px; align-items: center; }
.color-input input[type=color] { width: 52px; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.editor-grid { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .editor-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; } }
.input-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.input-row select, .input-row input[type=search] { width: auto; flex: 1; min-width: 160px; }
.search-row { margin-bottom: 16px; max-width: 520px; }
.preview-form { margin-top: 16px; }
.theme-mock { --m-accent: #2e87b7; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: .85rem; }
.theme-mock .m-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--m-bar); color: var(--m-bartext); }
.theme-mock .m-avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--m-accent); }
.theme-mock .m-host { color: var(--m-accent); font-size: 1rem; flex: 1; }
.theme-mock .m-nav b { color: var(--m-accent); font-weight: 400; margin-right: 6px; }
.theme-mock .m-page { background: var(--m-bg); color: var(--m-text); padding: 14px; display: grid; gap: 10px; }
.theme-mock .m-title { color: var(--m-accent); font-size: 1.1rem; margin: 0; }
.theme-mock .m-box { background: var(--m-surface); border-radius: 6px; padding: 10px; }
.theme-mock .m-link { color: var(--m-accent); text-decoration: underline; }
.theme-mock .m-muted { color: var(--m-muted); }
.theme-mock .m-btn { justify-self: start; background: var(--m-accent); color: #fff; padding: 6px 14px; border-radius: 6px; }
.theme-mock .m-btn:hover { background: var(--m-hover); }
.theme-mock .m-footer { background: var(--m-footer); color: #fff; padding: 8px 12px; font-size: .75rem; }
.widget-rows { display: grid; gap: 12px; margin-bottom: 16px; }
.widget-row { display: grid; gap: 0 12px; grid-template-columns: 1fr; background: var(--surface); }
@media (min-width: 900px) { .widget-row { grid-template-columns: 1.4fr 1fr 90px 1.6fr; } .widget-row .full { grid-column: 1 / -1; } }
.widget-row legend { font-weight: 600; padding: 0 6px; }
.regions-help { margin-bottom: 10px; }
.regions-map { display: grid; gap: 4px; max-width: 520px; margin-top: 8px; }
.regions-row { display: flex; gap: 4px; }
.regions-row span { background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px dashed var(--accent); border-radius: 4px; padding: 6px; font-size: .75rem; text-align: center; }
.widget-help dt { font-weight: 600; margin-top: 8px; }
.widget-help dd { margin: 0 0 0 0; color: var(--muted); }

/* Administration site frame */
.admin-shell { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .admin-shell { grid-template-columns: 220px minmax(0, 1fr); align-items: start; } }
.admin-side { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
@media (min-width: 900px) { .admin-side { flex-direction: column; position: sticky; top: 72px; } }
.admin-side a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.admin-side a:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); text-decoration: none; }
.admin-side a.current { background: var(--accent); color: #fff; }
.admin-side .admin-home { font-weight: 700; }
.admin-main { min-width: 0; }
.admin-tiles { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: var(--gap); }
.admin-tile { display: grid; gap: 6px; align-content: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; color: var(--text); }
.admin-tile:hover { border-color: var(--accent); text-decoration: none; color: var(--text); box-shadow: 0 2px 10px rgb(0 0 0 / .06); }
.admin-tile.add { border-style: dashed; }
.tile-icon .icon { width: 28px; height: 28px; color: var(--accent); }
.tile-title { font-weight: 700; font-size: 1.1rem; color: var(--accent); }
.tile-text { color: var(--muted); font-size: .92rem; }
.tile-count { font-size: .85rem; font-weight: 600; }
.crumbs { margin: 0 0 4px; font-size: .9rem; color: var(--muted); }
.field-row.two { grid-template-columns: 1fr; }
@media (min-width: 720px) { .field-row.two { grid-template-columns: 1fr 1fr; } }
.check-grid { display: grid; gap: 4px 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
ul.plain { list-style: none; padding: 0; }
.small { font-size: .85rem; }
.btn.danger-outline { color: #b42318; border-color: #b42318; }
.fields-table input[type=text], .fields-table select { min-width: 120px; }

/* Hosts' control panel */
.panel-overview { display: grid; gap: 0 var(--gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .panel-overview { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.panel-overview .admin-section { margin: 12px 0; }
.panel-people { display: flex; align-items: end; gap: 14px; margin-bottom: 8px; }
.panel-people .avatar { border-radius: 50%; object-fit: cover; }
.panel-people .portrait { object-fit: contain; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checklist li { display: flex; gap: 10px; align-items: baseline; }
.checklist li > span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: .8rem; font-weight: 700; flex: none; }
.checklist li.done > span { background: #eaf7ee; color: #1d5a2c; }
.checklist li.todo > span { background: #fff4e5; color: #8a5300; }
.admin-table.figures td:not(:first-child) { font-size: 1.3rem; font-weight: 600; }
.pic-picker { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 0 0 16px; min-width: 0; }
.pic-picker legend { font-weight: 600; padding: 0 4px; }
.pic-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); max-height: 360px; overflow-y: auto; padding: 2px; }
.pic-grid.patterns { max-height: none; }
.pic { position: relative; display: block; aspect-ratio: 1; border: 2px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; background: color-mix(in srgb, var(--muted) 8%, transparent); }
.pic input { position: absolute; opacity: 0; pointer-events: none; }
.pic img, .pic .swatch { display: block; width: 100%; height: 100%; object-fit: cover; }
.pic .swatch { background-repeat: repeat; }
.pic.none { display: grid; place-items: center; text-align: center; font-size: .8rem; color: var(--muted); padding: 4px; }
.pic:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.pic:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Text editor (js/richtext.js) */
.rte { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); min-width: 0; }
.rte:focus-within { border-color: var(--accent); }
.rte-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; border-radius: 8px 8px 0 0; }
.rte-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--text); cursor: pointer; padding: 0; }
.rte-btn:hover, .rte-btn.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.rte-btn:disabled { opacity: .35; cursor: default; }
.rte-btn:focus-visible { outline: 2px solid var(--accent); }
.rte-block { width: auto; padding: 4px 6px; font-size: .85rem; margin-right: 4px; }
.rte-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.rte-area { min-height: 180px; max-height: 70vh; overflow-y: auto; padding: 12px 14px; outline: none; line-height: 1.6; overflow-wrap: anywhere; }
.rte-area img, .rte-area video, .rte-area iframe { max-width: 100%; height: auto; }
.rte-area audio { max-width: 100%; }
.rte-area blockquote { border-left: 3px solid var(--accent); margin: 8px 0; padding: 2px 12px; color: var(--muted); }
.rte-area pre { white-space: pre-wrap; background: color-mix(in srgb, var(--muted) 10%, transparent); padding: 8px; border-radius: 6px; }
.rte textarea.rte-source { border: 0; border-radius: 0 0 8px 8px; min-height: 240px; width: 100%; }
.rte-status { font-size: .85rem; color: var(--muted); padding: 0 10px; }
.rte-status:not(:empty) { padding: 6px 10px; border-top: 1px solid var(--border); }
.rte-status.error { color: #b42318; }
.rte-dialog { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 64px); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); color: var(--text); }
.rte-dialog::backdrop { background: rgb(0 0 0 / .45); }
.rte-dialog-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.rte-dialog-head h2 { margin: 0; font-size: 1.15rem; flex: 1 1 100%; }
.rte-dialog-head input { flex: 1; min-width: 160px; }
.rte-choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: 60vh; overflow-y: auto; padding: 2px; }
.rte-choice { display: grid; grid-template-rows: 100px auto; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.rte-choice:hover, .rte-choice:focus-visible { border-color: var(--accent); outline: none; }
.rte-choice img { width: 100%; height: 100px; object-fit: cover; border-radius: 4px; }
.rte-kind { display: grid; place-items: center; height: 100px; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 4px; }
.rte-kind svg { width: 36px; height: 36px; }
.rte-choice-title { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* My library */
.lib-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.lib-item { display: grid; gap: 6px; align-content: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; min-width: 0; }
.lib-item .thumb { display: grid; place-items: center; height: 130px; border-radius: 6px; overflow: hidden; background: color-mix(in srgb, var(--muted) 8%, transparent); color: var(--accent); }
.lib-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-item .thumb .icon { width: 40px; height: 40px; }
.lib-item .name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-item .meta { font-size: .8rem; color: var(--muted); }
.lib-preview { max-width: 100%; max-height: 420px; border-radius: 8px; display: block; margin-bottom: 12px; }
.upload-box { border: 2px dashed var(--border); border-radius: var(--radius); padding: 14px; margin: 12px 0 20px; }
.quota { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--muted) 18%, transparent); overflow: hidden; max-width: 360px; }
.quota span { display: block; height: 100%; background: var(--accent); }
/* Administration: languages */
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.btn.danger { background: #b42318; border-color: #b42318; color: #fff; }
.btn.danger:hover { background: #912018; }
details.danger-zone { margin-top: 24px; padding: 10px 14px; border: 1px solid #f1c4c0; border-radius: 8px; }
details.danger-zone summary { cursor: pointer; color: #b42318; font-weight: 600; }
.invitations .invitation { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 8px 0; border-top: 1px solid var(--border); }
.invitations .invitation form { margin: 0; }

/* Sign-in with other sites */
.external-signin { margin-top: 16px; display: grid; gap: 8px; }
.external-signin .or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; margin: 0; }
.external-signin .or::before, .external-signin .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.btn.provider { background: #fff; color: #222; border: 1px solid #c9ccd4; }
.btn.provider:hover { border-color: #888; }
.provider-badge { display: inline-block; min-width: 92px; font-weight: 600; }
.provider-google { color: #1a73e8; } .provider-facebook { color: #1877f2; } .provider-linkedin { color: #0a66c2; }
.provider-microsoft { color: #5e5e5e; } .provider-x, .provider-apple { color: #000; } .provider-reddit { color: #ff4500; }
.btn.provider.provider-facebook { background: #1877f2; border-color: #1877f2; color: #fff; }
.btn.provider.provider-x, .btn.provider.provider-apple { background: #000; border-color: #000; color: #fff; }
ul.connections { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
ul.connections li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--border); }
ul.connections .connection-who { flex: 1 1 200px; display: grid; }
ul.connections .actions { display: inline-flex; align-items: center; gap: 8px; }
.external-who { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.external-who img { border-radius: 50%; object-fit: cover; }
.card.form.wide-form { max-width: 560px; }
.share-network { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 0; border-top: 1px solid var(--border); }
.share-network:first-of-type { border-top: 0; }
.share-links { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.provider.provider-linkedin { background: #0a66c2; border-color: #0a66c2; color: #fff; }
.btn.provider.provider-reddit { background: #ff4500; border-color: #ff4500; color: #fff; }
ul.fb-posts { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 12px; }
.fb-post { display: flex; gap: 16px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.fb-post img { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; flex: none; }
.fb-post-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fb-save { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
@media (max-width: 560px) { .fb-post { flex-direction: column; } .fb-post img { width: 100%; height: auto; max-height: 240px; } }
