/* ARES Mosaiko portal. Brand: coral #f25c54, gold #ffd166, aubergine #1a1033.
   Light theme by default, dark with [data-theme="dark"] (the app sets it from the user's choice or
   the system setting). Variable names are shared with suite.js and sections.js. */

@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-Variable.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

:root {
  --primary: #f25c54;
  --primary-strong: #e03e3e;
  --primary-soft: rgba(242, 92, 84, .12);
  --secondary: #7c4dbd;
  --gold: #ffd166;
  --dark: #1a1033;
  --success: #12a37a;
  --warning: #b07800;
  --danger: #d63a4a;
  --bg-core: #f6f3fa;
  --bg-tint: #efe9f7;
  --bg-card: #ffffff;
  --surface: #ffffff;
  --glass-border: #e4dcef;
  --text: #1a1033;
  --text-soft: #3a2d57;
  --text-muted: #6b5a8e;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(26, 16, 51, .06), 0 1px 3px rgba(26, 16, 51, .05);
  --shadow-md: 0 8px 28px rgba(26, 16, 51, .10);
  --font-main: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-head: 'Montserrat', var(--font-main);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-width: 248px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --primary: #ff6f66;
  --primary-strong: #ff8a80;
  --primary-soft: rgba(255, 111, 102, .16);
  --secondary: #b598ea;
  --success: #3fd3a2;
  --warning: #ffc44d;
  --danger: #ff6b7a;
  --bg-core: #120a22;
  --bg-tint: #22163b;
  --bg-card: #1b1130;
  --surface: #1b1130;
  --glass-border: #34254f;
  --text: #f4effc;
  --text-soft: #dcd2ee;
  --text-muted: #a99cc4;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg-core); color: var(--text); font-family: var(--font-main); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); letter-spacing: -.01em; }
code { font-family: var(--font-mono); font-size: .85em; }
.hidden { display: none !important; }
.muted, .hint { color: var(--text-muted); font-size: .8rem; }
.wrap { white-space: normal; word-break: break-word; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

/* ── forms and buttons ───────────────────────────────────── */
label { display: block; font-size: .78rem; font-weight: 650; color: var(--text-soft); margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; font: inherit; font-size: .92rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: .6rem .75rem; transition: border-color .15s, box-shadow .15s;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); }
input[type="range"] { padding: 0; accent-color: var(--primary); }
input[type="color"] { padding: 2px; height: 2.4rem; }
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-group { margin-bottom: 1rem; text-align: left; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; font-size: .88rem; color: var(--text-soft); margin: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .62rem 1.1rem; border: 1px solid transparent;
  border-radius: var(--radius-sm); font: inherit; font-size: .88rem; font-weight: 650; white-space: nowrap; cursor: pointer; line-height: 1.2;
  background: var(--primary); color: #fff; transition: background .15s, box-shadow .15s, filter .15s;
}
.btn:hover { background: var(--primary-strong); text-decoration: none; box-shadow: 0 4px 14px rgba(242, 92, 84, .28); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--dark); }
:root[data-theme="dark"] .btn-secondary { background: #3a2a5c; }
.btn-secondary:hover { background: #2c1a50; box-shadow: none; }
.btn-outline { background: transparent; border-color: var(--glass-border); color: var(--text-soft); }
.btn-outline:hover { background: var(--bg-tint); box-shadow: none; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b82c3a; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--bg-tint); box-shadow: none; }
.btn-ai { background: linear-gradient(135deg, #f25c54, #e23e7a 55%, #7c4dbd); }
.btn-ai:hover { filter: brightness(1.07); }
.btn-sm { padding: .38rem .7rem; font-size: .78rem; }
.btn-block { width: 100%; }
.btn .ico, .nav-item .ico { width: 18px; height: 18px; flex: none; }
.ico { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.msg { font-size: .85rem; min-height: 1.2em; margin-top: .6rem; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--success); }
.badge { display: inline-block; padding: .14rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 700; letter-spacing: .02em; background: var(--bg-tint); color: var(--text-soft); }
.badge-info { background: rgba(124, 77, 189, .14); color: var(--secondary); }
.badge-success { background: rgba(18, 163, 122, .14); color: var(--success); }
.badge-warn { background: rgba(201, 138, 0, .15); color: var(--warning); }
.badge-crit, .badge-danger { background: rgba(214, 58, 74, .14); color: var(--danger); }
.badge-muted { background: var(--bg-tint); color: var(--text-muted); }
.badge-ai { background: linear-gradient(135deg, #f25c54, #7c4dbd); color: #fff; }

/* ── cards, tables, page heads (also used by suite.js) ───── */
.glass, .card { background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card { padding: 1.25rem 1.4rem; }
.card + .card { margin-top: 1rem; }
.card h2 { font-size: 1rem; margin-bottom: .2rem; }
.card > .sub { color: var(--text-muted); font-size: .85rem; margin-bottom: 1rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin: 0 0 1.25rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.6rem; font-weight: 750; margin: 0; }
.page-head p { color: var(--text-muted); font-size: .9rem; margin-top: .25rem; max-width: 74ch; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); padding: .7rem .9rem; border-bottom: 1px solid var(--glass-border); background: var(--bg-tint); }
td { padding: .7rem .9rem; border-bottom: 1px solid var(--glass-border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.toolbar { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tb-search { display: flex; align-items: center; gap: .4rem; background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 0 .6rem; margin: 0; min-width: 240px; }
.tb-search input { border: none; box-shadow: none; padding: .5rem 0; background: transparent; }
.tb-search .ico { width: 16px; height: 16px; color: var(--text-muted); }
.tb-count { font-size: .8rem; color: var(--text-muted); }
.tb-spacer { flex: 1; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty strong { display: block; color: var(--text-soft); font-size: 1.05rem; margin-bottom: .3rem; }
.empty .ico { width: 44px; height: 44px; color: var(--primary); margin-bottom: .6rem; }

/* ── sign-in (standard design, as in FacturAres) ─────────── */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-aside { background: linear-gradient(150deg, #1a1033 0%, #8a2f4c 55%, #f25c54 100%); color: #ffe4e1; padding: 3rem 3.25rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.auth-aside .auth-logo { height: 60px; width: auto; align-self: flex-start; position: relative; z-index: 1; }
.auth-aside h2 { color: #fff; font-size: 1.85rem; line-height: 1.2; margin: 0 0 1rem; font-weight: 700; }
.auth-aside p { margin: 0 0 1.5rem; color: #ffd0cb; font-size: 1.02rem; max-width: 30rem; }
.auth-pitch { position: relative; z-index: 1; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.auth-points li { display: flex; gap: .7rem; align-items: flex-start; color: #fff0ee; }
.auth-points svg { flex: none; margin-top: 2px; fill: none; stroke: #ffd166; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.auth-aside .auth-foot { font-size: .8rem; color: #ffc2bc; position: relative; z-index: 1; }
.auth-main { display: flex; flex-direction: column; padding: 1.5rem 2rem 2.5rem; background: var(--bg-core); }
.auth-top { display: flex; justify-content: flex-end; min-height: 1.5rem; }
.auth-panel { width: 100%; max-width: 420px; margin: auto; padding-top: 1.5rem; }
.auth-panel h1 { font-size: 1.6rem; margin-bottom: .35rem; }
.auth-lead { color: var(--text-muted); margin-bottom: 1.25rem; }
.auth-card { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow-md); }
.auth-help { font-size: .82rem; color: var(--text-muted); margin-top: 1rem; }
.auth-below { margin-top: 1rem; display: grid; gap: .6rem; font-size: .88rem; }
.auth-demo { display: flex; gap: .7rem; align-items: center; padding: .7rem .9rem; border-radius: var(--radius-sm); background: rgba(255, 209, 102, .22); border: 1px solid rgba(201, 138, 0, .35); font-size: .85rem; margin-bottom: 1.1rem; color: var(--text-soft); }
.auth-demo-badge { background: #ffc44d; color: #1a1033; font-weight: 800; font-size: .7rem; letter-spacing: .08em; padding: .2rem .5rem; border-radius: 6px; }
.otp { text-align: center; font-size: 1.8rem; letter-spacing: .6rem; font-family: var(--font-mono); }
@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { padding: 1.5rem 1.5rem 1.75rem; }
  .auth-aside h2 { font-size: 1.35rem; margin-top: 1rem; }
  .auth-aside .auth-points, .auth-aside .auth-foot { display: none; }
  .auth-aside p { margin-bottom: 0; }
}

/* ── product page ────────────────────────────────────────── */
#landing { background: var(--bg-core); min-height: 100vh; }
.lp-wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
.lp-top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg-core) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--glass-border); }
.lp-top .lp-wrap { display: flex; align-items: center; gap: 1.5rem; height: 68px; }
.lp-logo img { height: 40px; display: block; }
.lp-top nav { display: flex; gap: 1.2rem; margin-left: auto; align-items: center; }
.lp-top nav a:not(.btn) { color: var(--text-soft); font-weight: 600; font-size: .9rem; }
.lp-hero { padding: 4.5rem 0 3.5rem; }
.lp-hero .lp-wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 3rem; align-items: center; }
.lp-eyebrow { display: inline-block; font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); margin-bottom: .8rem; }
.lp-hero h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); line-height: 1.08; font-weight: 800; margin-bottom: 1rem; }
.lp-hero h1 em { font-style: normal; background: linear-gradient(90deg, #ff8a5b, #f25c54, #e23e7a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-hero p { font-size: 1.1rem; color: var(--text-soft); max-width: 34rem; margin-bottom: 1.6rem; }
.lp-cta { display: flex; gap: .8rem; flex-wrap: wrap; }
.lp-btn-lg { padding: .85rem 1.4rem; font-size: 1rem; }
.lp-visual img { width: 100%; height: auto; display: block; filter: drop-shadow(0 24px 40px rgba(26, 16, 51, .25)); }
.lp-section { padding: 3.5rem 0; }
.lp-section h2 { font-size: 1.9rem; margin-bottom: .6rem; }
.lp-section .lp-intro { color: var(--text-muted); max-width: 60ch; margin-bottom: 2rem; }
.lp-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; counter-reset: step; }
.lp-step { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 1.3rem; }
.lp-step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; margin-bottom: .8rem; }
.lp-step h3, .lp-feature h3 { font-size: 1rem; margin-bottom: .3rem; }
.lp-step p, .lp-feature p { color: var(--text-muted); font-size: .9rem; }
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.lp-feature { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 1.3rem; }
.lp-feature .ico { width: 30px; height: 30px; color: var(--primary); margin-bottom: .6rem; }
.lp-faq details { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: .6rem; }
.lp-faq summary { font-weight: 650; cursor: pointer; }
.lp-faq details p { color: var(--text-muted); margin-top: .5rem; }
.lp-box { background: linear-gradient(135deg, #1a1033, #8a2f4c 60%, #f25c54); color: #fff; border-radius: 22px; padding: 2.5rem; display: flex; justify-content: space-between; align-items: center; gap: 2rem; flex-wrap: wrap; }
.lp-box h2 { color: #fff; }
.lp-box p { color: #ffd6d1; }
.lp-btn-light { background: #fff; color: #1a1033; }
.lp-btn-light:hover { background: #fff3f1; }
.lp-btn-outline-light { background: transparent; border-color: rgba(255, 255, 255, .6); color: #fff; }
.lp-btn-outline-light:hover { background: rgba(255, 255, 255, .1); box-shadow: none; }
.lp-foot { padding: 2rem 0 3rem; color: var(--text-muted); font-size: .85rem; }
.lp-foot .lp-wrap { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.lp-foot img { height: 30px; }
@media (max-width: 900px) {
  .lp-hero .lp-wrap { grid-template-columns: 1fr; }
  .lp-steps, .lp-features { grid-template-columns: 1fr 1fr; }
  .lp-top nav a:not(.btn) { display: none; }
}
@media (max-width: 560px) { .lp-steps, .lp-features { grid-template-columns: 1fr; } }

/* ── app shell ───────────────────────────────────────────── */
#app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--glass-border); padding: 1rem .8rem; display: flex; flex-direction: column; gap: .8rem; }
.sidebar .brand { padding: .2rem .4rem .6rem; }
.sidebar .brand img { height: 40px; display: block; }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin-top: .9rem; }
.nav-group:first-child { margin-top: 0; }
.nav-section-label { font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); padding: 0 .7rem; margin-bottom: .3rem; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 560; color: var(--text-soft); cursor: pointer; border: none; background: none; width: 100%; text-align: left; font-family: inherit; }
.nav-item:hover { background: var(--bg-tint); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 680; }
.sidebar-foot { margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--glass-border); display: grid; gap: .4rem; }
.profile { display: flex; align-items: center; gap: .6rem; padding: .3rem .4rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #ff8a5b, #e23e7a); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; }
.profile-text { min-width: 0; }
.profile-text b { display: block; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-text span { font-size: .72rem; color: var(--text-muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .8rem; padding: .8rem 1.6rem; border-bottom: 1px solid var(--glass-border); background: var(--surface); position: sticky; top: 0; z-index: 20; }
#topbar-crumb { font-size: .85rem; color: var(--text-muted); }
#topbar-crumb b { color: var(--text); }
.menu-btn { display: none; }
.view-host { padding: 1.6rem; max-width: 1400px; width: 100%; }
.demo-strip { background: rgba(255, 209, 102, .25); color: var(--text-soft); font-size: .85rem; padding: .45rem 1.6rem; border-bottom: 1px solid rgba(201, 138, 0, .3); }
.jobs-pill { margin-left: auto; display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--text-muted); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--glass-border); border-top-color: var(--primary); animation: spin .8s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-md); }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .view-host { padding: 1rem; }
  .topbar { padding: .7rem 1rem; }
}

/* ── library ─────────────────────────────────────────────── */
.dropzone { border: 2px dashed var(--glass-border); border-radius: var(--radius); padding: 1.4rem; text-align: center; background: var(--surface); transition: border-color .15s, background .15s; margin-bottom: 1rem; }
.dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone > .ico { width: 34px; height: 34px; color: var(--primary); }
.dropzone p { color: var(--text-muted); font-size: .9rem; margin: .3rem 0 .9rem; }
.dropzone .row { justify-content: center; }
.upload-status { margin-top: .9rem; text-align: left; display: grid; gap: .35rem; font-size: .85rem; }
.progress { height: 8px; background: var(--bg-tint); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #ff8a5b, #f25c54); width: 0; transition: width .2s; }
.lib-bar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.lib-bar select, .lib-bar input { width: auto; }
.lib-bar input[type="search"] { min-width: 200px; }
.selbar { position: sticky; top: 64px; z-index: 6; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .6rem .8rem; background: var(--dark); color: #fff; border-radius: var(--radius-sm); margin-bottom: .8rem; box-shadow: var(--shadow-md); }
.selbar .btn-outline { color: #fff; border-color: rgba(255, 255, 255, .35); }
.selbar .btn-outline:hover { background: rgba(255, 255, 255, .1); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg-tint); cursor: pointer; border: none; padding: 0; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.photo:hover img { transform: scale(1.03); }
.photo.is-hidden img { opacity: .4; filter: grayscale(.8); }
.photo .tick { position: absolute; top: 7px; left: 7px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .25); display: grid; place-items: center; }
.photo.selected { outline: 3px solid var(--primary); outline-offset: -3px; }
.photo.selected .tick { background: var(--primary); border-color: var(--primary); }
.photo.selected .tick::after { content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: none; border-right: none; transform: rotate(-45deg) translate(1px, -1px); }
.photo .flags { position: absolute; bottom: 6px; right: 6px; display: flex; gap: 4px; }
.photo .flags span { background: rgba(0, 0, 0, .55); color: #fff; font-size: .65rem; font-weight: 700; padding: .1rem .35rem; border-radius: 5px; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(10, 6, 20, .94); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 130px); object-fit: contain; border-radius: 6px; }
.lightbox .lb-bar { display: flex; gap: .5rem; margin-top: .8rem; color: #fff; align-items: center; flex-wrap: wrap; justify-content: center; font-size: .85rem; }
.lightbox .lb-close { position: absolute; top: 14px; right: 14px; }
.lightbox .btn-outline { color: #fff; border-color: rgba(255, 255, 255, .35); }
.lightbox .btn-outline:hover { background: rgba(255, 255, 255, .1); }

/* ── albums ──────────────────────────────────────────────── */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; align-items: start; }
.album-card { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer; transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; text-align: left; padding: 0; font: inherit; color: inherit; }
.album-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.album-card .cover { aspect-ratio: 4 / 3; background: var(--bg-tint); position: relative; width: 100%; overflow: hidden; }
.album-card .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* A portrait or square cover is shown whole on a blurred copy of itself, so its title stays visible. */
.album-card .cover img.fit { object-fit: contain; }
.album-card .cover img.blur { filter: blur(18px) brightness(.85); transform: scale(1.15); }
.album-card .cover .badge { position: absolute; top: 8px; left: 8px; }
.album-card .body { padding: .8rem 1rem 1rem; width: 100%; }
.album-card h3 { font-size: 1rem; margin-bottom: .2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-card .meta { font-size: .78rem; color: var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }

/* editor */
.editor-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.editor-head input.title-input { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; flex: 1; min-width: 220px; }
.editor { display: grid; grid-template-columns: 190px minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.pages-rail { display: grid; gap: .6rem; max-height: calc(100vh - 200px); overflow-y: auto; padding: .2rem; }
.page-thumb { border: 2px solid transparent; border-radius: 8px; cursor: pointer; position: relative; padding: 0; background: none; }
.page-thumb.active { border-color: var(--primary); }
.page-thumb .n { position: absolute; top: 3px; left: 6px; z-index: 3; font-size: .68rem; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.stage-wrap { background: var(--bg-tint); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.stage { position: relative; width: 100%; overflow: hidden; container-type: inline-size; user-select: none; -webkit-user-select: none; }
.stage.big { max-width: 900px; box-shadow: 0 10px 30px rgba(26, 16, 51, .25); }
.stage.mini { pointer-events: none; border-radius: 5px; }
.slot { position: absolute; overflow: hidden; touch-action: none; }
.slot.empty-slot { outline: 2px dashed rgba(127, 127, 127, .6); outline-offset: -2px; background: rgba(255, 255, 255, .22); display: grid; place-items: center; cursor: pointer; }
.stage.big .slot.empty-slot::after { content: "Drop a photo"; font-size: max(10px, 1.6cqw); font-weight: 700; color: rgba(60, 60, 60, .75); }
.slot.filled { cursor: grab; }
.slot.picked { box-shadow: inset 0 0 0 3px var(--gold); }
.slot.drop { box-shadow: inset 0 0 0 3px var(--primary); }
.slot img { position: absolute; max-width: none; pointer-events: none; }
.slot .shade { position: absolute; inset: 0; pointer-events: none; }
.stage .caption-band { position: absolute; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; white-space: nowrap; }
.stage .caption-band span { padding: 0 .9em; border-radius: 999px; line-height: 1.6; }
.stage .cover-title { position: absolute; left: 0; right: 0; text-align: center; font-weight: 700; line-height: 1.1; padding: 0 4%; }
.inspector { display: grid; gap: 1rem; }
.inspector .card { padding: 1rem; }
.inspector h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .6rem; }
.layout-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.layout-opt { aspect-ratio: 4 / 3; border: 2px solid var(--glass-border); border-radius: 6px; position: relative; cursor: pointer; background: var(--surface); padding: 0; }
.layout-opt.active { border-color: var(--primary); }
.layout-opt i { position: absolute; background: var(--text-muted); opacity: .5; border-radius: 1px; }
.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 5px; max-height: 300px; overflow-y: auto; }
.tray img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; cursor: grab; display: block; }
.tray img.used { opacity: .35; }
.zoom-row { display: flex; gap: .5rem; align-items: center; }
@media (max-width: 1200px) { .editor { grid-template-columns: 150px minmax(0, 1fr); } .inspector { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }
@media (max-width: 760px) { .editor { grid-template-columns: 1fr; } .pages-rail { grid-auto-flow: column; grid-auto-columns: 110px; max-height: none; overflow-x: auto; } }

/* designs */
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.design-card { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--radius); overflow: hidden; text-align: left; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.design-card.active { outline: 3px solid var(--primary); outline-offset: 1px; }
.design-swatch { aspect-ratio: 4 / 3; position: relative; display: grid; grid-template-columns: 1.3fr 1fr; grid-template-rows: 1fr 1fr; padding: 9% 9% 18%; background-size: cover; background-position: center; }
.design-swatch i { display: block; background: linear-gradient(135deg, #d9c9b8, #9fb6c9); }
.design-swatch i:nth-child(2) { background: linear-gradient(135deg, #e9b7a0, #c98d7a); }
.design-swatch i:nth-child(3) { background: linear-gradient(135deg, #a9c79a, #6f9a80); }
.design-swatch i:first-child { grid-row: span 2; }
.design-swatch b { position: absolute; left: 0; right: 0; bottom: 4%; text-align: center; font-size: .85rem; white-space: nowrap; overflow: hidden; }
.design-card .body { padding: .6rem .8rem .8rem; }
.design-card .body b { display: block; font-size: .9rem; }
.design-card .body span { font-size: .75rem; color: var(--text-muted); }
.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin-top: 1rem; }
.search-results figure { background: var(--surface); border: 1px solid var(--glass-border); border-radius: 10px; overflow: hidden; }
.search-results img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--bg-tint); }
.search-results figcaption { padding: .5rem .6rem; font-size: .72rem; color: var(--text-muted); display: grid; gap: .35rem; }

/* AI */
.ai-hero { background: linear-gradient(135deg, rgba(242, 92, 84, .12), rgba(124, 77, 189, .12)); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 1.1rem 1.3rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.ai-hero > .ico { width: 34px; height: 34px; color: var(--primary); }
.quota { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.quota .progress { width: 140px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 1rem; }
.stat b { display: block; font-size: 1.5rem; font-family: var(--font-head); }
.stat span { font-size: .78rem; color: var(--text-muted); }

/* dialogs */
.modal-back { position: fixed; inset: 0; background: rgba(10, 6, 20, .55); z-index: 90; display: grid; place-items: center; padding: 1rem; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-md); width: min(560px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1.4rem; }
.modal.wide { width: min(900px, 100%); }
.modal h2 { font-size: 1.15rem; margin-bottom: .3rem; }
.modal .sub { color: var(--text-muted); font-size: .88rem; margin-bottom: 1rem; }
.modal .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; flex-wrap: wrap; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; background: var(--dark); color: #fff; padding: .7rem 1.1rem; border-radius: 10px; font-size: .88rem; box-shadow: var(--shadow-md); max-width: calc(100% - 2rem); }
.toast.err { background: var(--danger); }
.copy-field { display: flex; gap: .4rem; }
.copy-field input { font-family: var(--font-mono); font-size: .8rem; }

/* Album fonts (SIL OFL), the same files the renderer uses. */
@font-face { font-family: 'Playfair Display'; src: url('/fonts/PlayfairDisplay-Variable.ttf') format('truetype'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Dancing Script'; src: url('/fonts/DancingScript-Variable.ttf') format('truetype'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Lora'; src: url('/fonts/Lora-Variable.ttf') format('truetype'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Caveat'; src: url('/fonts/Caveat-Variable.ttf') format('truetype'); font-weight: 400 700; font-display: swap; }

/* ── share dialog: social media ── */
.social { margin: 0 0 1.1rem; }
.social-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.social-card { display: flex; flex-direction: column; gap: .45rem; padding: .85rem .9rem; border: 1px solid var(--glass-border); border-radius: var(--radius-sm); background: var(--surface); }
.social-card h4 { display: flex; align-items: center; gap: .45rem; font-size: .95rem; }
.social-card h4 .ico { width: 20px; height: 20px; color: var(--primary); }
.social-card p { font-size: .84rem; line-height: 1.45; }
.social-note { color: var(--text-soft); background: var(--primary-soft); border-radius: 8px; padding: .4rem .55rem; }
.social-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; padding-top: .2rem; }
.social-actions .btn { font-size: .82rem; }
