/* Conflr accounts — what is particular to this service.
 *
 * Buttons, pills, cards, tables and fields live in the shared `components.css`;
 * this file only holds the account service's own layout. */

/*
 * The palette lives in `shared/theme/tokens.css` and navigation in `nav.css`,
 * copied here with `components.css` by `php tools/sync-theme.php` and linked
 * from the layout — tokens, components, this file, nav: a later rule wins.
 *
 * No `--module` override on purpose: this service is not one of the modules, it
 * is the door to all of them, so it keeps the neutral Auth slate the tokens
 * default to. Being visibly *not* green or blue is the point — you can tell at a
 * glance that you have stepped out of a module and into your account.
 */

/* ==========================================================================
   Modules as this service draws them (partials/modules.html.twig)
   ========================================================================== */

.mod-tile {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 9px;
    background: var(--h-soft);
    color: var(--h-ink);
}
.mod-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    white-space: nowrap;
}
.mod-chip::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--h, var(--module));
}
.mod-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ==========================================================================
   Signed out: panel | form
   ========================================================================== */

body.signed-out { background: var(--bg); }
.auth-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 100vh;
}
.auth-panel {
    display: flex;
    flex-direction: column;
    padding: 48px 54px 40px;
    background: var(--panel);
    color: var(--panel-text);
}
.auth-logo { display: block; width: 140px; height: auto; }
.auth-pitch { margin: auto 0; max-width: 440px; }
.auth-pitch-title {
    margin: 0 0 18px;
    color: var(--surface);
    font-size: 40px;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
}
.auth-pitch-sub { margin: 0 0 30px; color: var(--panel-text); font-size: 16px; line-height: 1.55; }
.auth-mods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.auth-mods li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: var(--r-md);
    background: var(--panel-2);
    color: var(--surface);
    font-size: 15px;
    font-weight: 600;
}
.auth-mods .mod-tile { width: 30px; height: 30px; border-radius: 7px; background: var(--h-strong); color: var(--surface); }
.auth-foot { margin: 0; color: var(--panel-muted); font-size: 13px; }
.auth-mhead { display: none; }

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
}
.auth-form { width: 100%; max-width: 400px; }
.auth-form h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -0.02em; }
.auth-lede { margin: 0 0 26px; color: var(--text-2); font-size: 15px; }
.auth-form .callout { margin-bottom: 20px; }
.auth-form > p { line-height: 1.55; }

.auth-fields .row,
.stack-fields .row { margin-bottom: 18px; }
.auth-fields label,
.stack-fields label {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
}
.auth-fields input:not([type=checkbox]):not([type=radio]),
.stack-fields input:not([type=checkbox]):not([type=radio]),
.stack-fields select,
.stack-fields textarea { width: 100%; }
.auth-fields input:not([type=checkbox]):not([type=radio]) { min-height: 46px; font-size: 15px; }
.btn-lg { min-height: 46px; font-size: 15px; }
.auth-fields .btn-lg { margin-top: 6px; }
.auth-aside {
    margin: 22px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.55;
}

/* Label on the left, a link on the right ("Password · Forgot it?"). */
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.label-row a { font-size: 13.5px; color: var(--module-ink); text-decoration: underline; }

/* A password field with its Show button inside. */
.reveal { position: relative; }
.reveal input { padding-right: 68px; }
.reveal-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    min-height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--module-ink);
    font: 600 13.5px/1 var(--font);
    cursor: pointer;
}
.reveal-btn:hover { background: var(--surface-2); }
.reveal-btn:focus-visible { outline: 2px solid var(--module); outline-offset: 0; }

/* Rules ticked while the password is typed. */
.pw-rules { margin: 8px 0 0; padding: 0; list-style: none; color: var(--text-2); font-size: 13.5px; }
.pw-rules li { display: flex; align-items: center; gap: 8px; }
.pw-rules li::before {
    content: "";
    width: 12px;
    height: 12px;
    flex: none;
    border: 1.5px solid var(--line-strong);
    border-radius: 50%;
}
.pw-rules li.is-met { color: var(--success-ink); }
.pw-rules li.is-met::before {
    width: 12px;
    height: 7px;
    border: solid var(--success);
    border-width: 0 0 2px 2px;
    border-radius: 0;
    transform: translateY(-2px) rotate(-45deg);
}

@media (max-width: 900px) {
    .auth-split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .auth-panel { padding: 28px 24px 30px; }
    .auth-pitch, .auth-foot { display: none; }
    .auth-mhead { display: block; margin-top: 26px; }
    .auth-mhead-title { margin: 0 0 6px; color: var(--surface); font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
    .auth-mhead-sub { margin: 0; color: var(--panel-text); font-size: 15px; }
    .auth-main { align-items: flex-start; padding: 26px 24px 40px; }
    .auth-form h1, .auth-lede { display: none; }
    .auth-aside { border-top: 0; padding-top: 0; text-align: center; }
}

/* ==========================================================================
   Signed in, outside the admin: home and my account
   ========================================================================== */

body.solo { background: var(--bg); }
.solo-wrap { display: grid; place-items: center; min-height: 100vh; padding: 40px 20px; }
.solo-card {
    width: 100%;
    max-width: 480px;
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}
.solo-card.is-wide { max-width: 860px; padding: 0; }
.solo-logo { display: block; width: 96px; height: auto; }
.solo-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 32px;
    border-bottom: 1px solid var(--line);
}
.solo-head a { font-weight: 600; color: var(--module-ink); }
.solo-who { display: flex; align-items: center; gap: 14px; margin: 26px 0 24px; }
.solo-card.is-wide .solo-who { margin: 26px 32px 6px; }
.solo-who .avatar { width: 52px; height: 52px; font-size: 16px; background: var(--module-soft); color: var(--module-ink); }
.solo-who strong { display: block; font-size: 18px; }
.solo-who small { color: var(--text-2); font-size: 13.5px; }
.solo-title { margin: 26px 0 6px; font-size: 24px; }
.solo-sub { margin: 0 0 22px; color: var(--text-2); }
.solo-eyebrow {
    margin: 0 0 10px;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.launcher {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 10px;
    margin: 0 0 26px;
}
.launcher-mod {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 8px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}
a.launcher-mod:hover { border-color: var(--h); background: var(--h-soft); text-decoration: none; }
.launcher-mod.is-locked { color: var(--text-3); cursor: not-allowed; }
.launcher-mod.is-locked .mod-tile { background: var(--surface-2); color: var(--text-3); }
.launcher-mod small { margin-top: -6px; color: var(--text-3); font-size: 12px; font-weight: 400; }

.link-list { margin: 0 0 22px; border: 1px solid var(--line); border-radius: var(--r-md); }
.link-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
}
.link-list a + a { border-top: 1px solid var(--line); }
.link-list a:hover { background: var(--surface-head); text-decoration: none; }
.link-list span { flex: 1; min-width: 0; }
.link-list strong { display: block; font-weight: 600; }
.link-list small { color: var(--text-2); font-size: 13.5px; }
.link-list svg { color: var(--text-3); flex: none; }

.solo-foot { display: flex; justify-content: space-between; align-items: center; }
.solo-foot form { margin: 0; }
.solo-foot a, .solo-foot .btn-link { font-weight: 600; color: var(--module-ink); }

/* My account: Profile | Password, side by side. */
.account-cols { display: grid; grid-template-columns: 1fr 1fr; }
.account-cols > section { padding: 22px 32px 32px; }
.account-cols > section + section { border-left: 1px solid var(--line); }
.account-cols h2 { margin: 0 0 2px; font-size: 17px; }
.account-cols .section-sub { margin: 0 0 18px; color: var(--text-2); font-size: 13.5px; }
.solo-card .flashes { padding: 18px 32px 0; }
.solo-card .flashes .callout { margin: 0; }

@media (max-width: 700px) {
    .solo-card { padding: 24px 20px; }
    .solo-head { padding: 18px 20px; }
    .solo-card.is-wide .solo-who { margin: 20px 20px 0; }
    .account-cols { grid-template-columns: 1fr; }
    .account-cols > section { padding: 18px 20px 24px; }
    .account-cols > section + section { border-left: 0; border-top: 1px solid var(--line); }
    .solo-card .flashes { padding: 16px 20px 0; }
}

/* ==========================================================================
   Admin
   ========================================================================== */

/* The sidebar's card: not a module switcher, a sign of where you are. */
.side-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}
.side-card .mod-tile { width: 32px; height: 32px; border-radius: 8px; background: var(--module-strong); color: var(--surface); }
.side-card strong { display: block; font-size: 15px; line-height: 1.25; }
.side-card small { color: var(--text-3); font-size: 12.5px; }
.side-nav a .side-n { margin-left: auto; color: var(--text-3); font-size: 13px; font-weight: 500; }

/* Filters across the top of a list card. */
.card-toolbar { margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-toolbar select { min-width: 190px; }

/* Accounts list: who, with their face. */
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who .avatar { background: var(--module-soft); color: var(--module-ink); }
.who-text { min-width: 0; line-height: 1.35; }
.who-text a, .who-text strong { font-weight: 600; color: var(--text); }
.who-text small { display: block; color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.who-text .tag { margin-left: 6px; vertical-align: 1px; }
tr.is-off .who-text a, tr.is-off td { color: var(--text-3); }
.cell-sub { display: block; color: var(--text-3); font-size: 12.5px; }
.list-foot { padding: 12px 20px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13px; }

/* Organisation: the accounts in it, in the aside. */
.mini-people { margin: 0; padding: 0; list-style: none; }
.mini-people li { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.mini-people li + li { border-top: 1px solid var(--line); }
.mini-people .who-text { flex: 1; }

/* Account form: the modules as tickable tiles, under "Only these". */
.module-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
form.form label.module-pick {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 6px 12px 6px 8px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    font-weight: 500;
    cursor: pointer;
}
.module-pick .mod-tile { width: 26px; height: 26px; border-radius: 6px; }
.module-pick:has(input:checked) { border-color: var(--h); background: var(--h-soft); color: var(--h-ink); }
/* The ticks only mean something under "Only these". */
form:has(input[name=module_access][value=all]:checked) .module-picks { opacity: 0.5; }
.inline-action { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }

/* ---- Mail editor ---------------------------------------------------------- */
.mail-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.mail-editor .card { margin: 0; }
.mail-editor textarea.code { min-height: 300px; font: 13px/1.6 var(--mono); }
.var-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.var-chip {
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text-2);
    font: 12.5px/1.3 var(--mono);
    cursor: pointer;
}
.var-chip:hover { border-color: var(--module); color: var(--module-ink); background: var(--module-soft); }
.var-chip:focus-visible { outline: 2px solid var(--module); outline-offset: 1px; }
.label-row .label-aside { color: var(--text-3); font-size: 12.5px; font-weight: 400; }

/* "Build the plain-text version from the HTML", and the box it hides. */
.check-panel {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-head);
    cursor: pointer;
}
.stack-fields label.check-panel { display: flex; margin: 0; font-weight: 400; }
.check-panel strong { display: block; font-weight: 600; }
.check-panel small { color: var(--text-2); font-size: 13px; }
.check-panel input { margin-top: 2px; }
.text-body { margin-top: 14px; }
.mail-content:has(#derive_text:checked) .text-body { display: none; }

/* Preview: Desktop / Mobile / Plain text. */
.preview-card .card-h { flex-wrap: wrap; }
.preview-stage { padding: 18px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.envelope {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 3px 22px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: var(--r-md) var(--r-md) 0 0;
    background: var(--surface);
    font-size: 13.5px;
}
.envelope dt { color: var(--text-3); }
.envelope dd { margin: 0; overflow: hidden; text-overflow: ellipsis; }
.envelope dd.subject { font-weight: 600; }
.preview-frame {
    border: 1px solid var(--line);
    border-radius: 0 0 var(--r-md) var(--r-md);
    background: var(--surface);
    overflow: hidden;
}
.preview-frame iframe { display: block; width: 100%; height: 540px; margin: 0 auto; border: 0; background: var(--surface); }
.preview-frame pre {
    display: none;
    margin: 0;
    padding: 18px 20px;
    min-height: 300px;
    white-space: pre-wrap;
    font: 13px/1.6 var(--mono);
    color: var(--text);
}
.preview-card:has(#pv-mobile:checked) .preview-frame iframe { width: 390px; max-width: 100%; border-inline: 1px solid var(--line); }
.preview-card:has(#pv-text:checked) .preview-frame iframe { display: none; }
.preview-card:has(#pv-text:checked) .preview-frame pre { display: block; }
.test-send { padding: 18px 20px 20px; }
.test-send .inline-field { display: flex; gap: 10px; }
.test-send .inline-field input { flex: 1; min-width: 0; }

/* "● Unsaved changes" beside the head's Save. */
.dirty-flag { display: none; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; }
.dirty-flag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.dirty-flag.is-dirty { display: inline-flex; }

@media (max-width: 1100px) {
    .mail-editor { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .test-send .inline-field { flex-direction: column; }
}
