/*
    L'habillage de l'application.

    Il reprend le parti du logiciel de bureau : une feuille claire, une encre sombre et
    froide, un bleu de cotation pour ce qui appelle l'action, et rien qui brille. Le plan
    occupe toute la place qu'on lui laisse ; le reste se range autour.
*/

:root {
    --encre: #242b33;
    --encre-douce: #6b7682;
    --feuille: #ffffff;
    --fond: #f4f6f8;
    --trait: #dce1e6;
    --bleu: #186ba0;
    --bleu-fonce: #12557f;
    --orange: #e0662b;
    --vert: #129353;
    --rouge: #b03a2b;
    --or: #b5841f;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--fond);
    color: var(--encre);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

/* La racine de Blazor porte la hauteur de la page jusqu'a la mise en page. */
#app { height: 100%; }

.app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ----- L'en-tete ----- */

.bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 52px;
    background: var(--feuille);
    border-bottom: 1px solid var(--trait);
    flex: 0 0 auto;
}

.bar-spacer { flex: 1 1 auto; }

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--encre);
}

.brand-mark { color: var(--bleu); font-size: 20px; line-height: 1; }
.brand-name { font-weight: 600; letter-spacing: 0.01em; }

.who { color: var(--encre-douce); }

.lang, select {
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--trait);
    border-radius: 5px;
    background: var(--feuille);
    color: var(--encre);
    font: inherit;
}

.content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* ----- Les feuilles de contenu ----- */

.sheet {
    max-width: 480px;
    margin: 40px auto;
    padding: 28px 32px;
    background: var(--feuille);
    border: 1px solid var(--trait);
    border-radius: 8px;
}

.sheet.wide { max-width: 900px; }
.sheet.pad, .pad { padding: 24px; }

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 16px; margin: 28px 0 10px; font-weight: 600; color: var(--encre-douce); }
h3 { font-size: 15px; margin: 22px 0 8px; font-weight: 600; color: var(--encre-douce); }

.lead { color: var(--encre-douce); margin: 6px 0 18px; }
.aside { margin-top: 18px; color: var(--encre-douce); }
.note { color: var(--encre-douce); font-size: 13px; margin: 6px 0 0; }

label {
    display: block;
    margin: 14px 0;
}

label > span {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: var(--encre-douce);
}

label.check { display: flex; align-items: center; gap: 8px; }
label.check > span { margin: 0; font-size: 15px; color: var(--encre); }

input[type=text], input[type=email], input[type=password] {
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--trait);
    border-radius: 5px;
    font: inherit;
    color: var(--encre);
    background: var(--feuille);
}

input:focus, select:focus, button:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 1px;
}

/* ----- Les boutons ----- */

.btn {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--trait);
    border-radius: 5px;
    background: var(--feuille);
    color: var(--encre);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover { background: var(--fond); }

.btn-main {
    background: var(--bleu);
    border-color: var(--bleu);
    color: #fff;
}

.btn-main:hover { background: var(--bleu-fonce); }
.btn-main:disabled { opacity: 0.55; cursor: default; }

.btn-quiet { border-color: transparent; color: var(--bleu); }
.btn-quiet:hover { background: var(--fond); }
.btn-quiet.danger { color: var(--rouge); }

.link {
    border: 0;
    background: none;
    padding: 0;
    color: var(--bleu);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.tag {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--fond);
    color: var(--encre-douce);
    font-size: 13px;
}

/* ----- Les messages ----- */

.error { color: var(--rouge); margin: 10px 0; }

.banner {
    margin: 0;
    padding: 8px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--trait);
}

.banner.good { background: #eef7f1; color: var(--vert); }
.banner.bad { background: #fbeeec; color: var(--rouge); }
.banner.warn { background: #fdf6e6; color: var(--or); }
.banner .link { margin-left: 10px; }

.page-message { max-width: 480px; margin: 60px auto; text-align: center; }

/* ----- La liste des plans ----- */

.plans { list-style: none; margin: 0; padding: 0; }

.plan {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--trait);
}

.plan-open {
    flex: 1 1 auto;
    min-width: 0;
    text-decoration: none;
    color: var(--encre);
}

.plan-name { display: block; font-weight: 600; }
.plan-meta { display: block; font-size: 13px; color: var(--encre-douce); }
.plan-lock { display: block; font-size: 13px; color: var(--orange); }
.plan-acts { display: flex; gap: 4px; flex: 0 0 auto; }

/* ----- Le partage ----- */

.modal-veil {
    position: fixed;
    inset: 0;
    background: rgba(36, 43, 51, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 20;
}

.modal {
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow: auto;
    padding: 24px 28px;
    background: var(--feuille);
    border-radius: 8px;
}

.modal h2 { margin-top: 0; color: var(--encre); font-size: 18px; }
.modal-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.share-add { display: flex; gap: 8px; margin: 14px 0; }
.share-add input { flex: 1 1 auto; }

.shares { list-style: none; margin: 0; padding: 0; }

.shares li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--trait);
}

.share-who { flex: 1 1 auto; min-width: 0; }
.share-role { color: var(--encre-douce); font-size: 13px; }
.pending { color: var(--or); font-size: 12px; font-style: normal; margin-left: 6px; }

.fresh-link {
    padding: 10px 12px;
    background: var(--fond);
    border-radius: 6px;
    margin: 10px 0;
}

.fresh-link code { word-break: break-all; font-size: 13px; }

/* ----- L'editeur ----- */

.editor {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 46px;
    background: var(--feuille);
    border-bottom: 1px solid var(--trait);
    flex: 0 0 auto;
}

.editor-name { font-weight: 600; }

.lock-state { font-size: 13px; }
.lock-state.mine { color: var(--vert); }
.lock-state.other { color: var(--orange); }
.lock-state.free { color: var(--encre-douce); }

.plan-surface {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    background: var(--feuille);
    cursor: grab;
    touch-action: none;
}

.plan-surface:active { cursor: grabbing; }
.plan-surface canvas { display: block; width: 100%; height: 100%; }

/* ----- Le chargement ----- */

.boot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: var(--encre-douce);
}

.boot-sheet {
    width: 180px;
    height: 128px;
    background: var(--feuille);
    border: 1px solid var(--trait);
    background-image:
        linear-gradient(var(--trait) 1px, transparent 1px),
        linear-gradient(90deg, var(--trait) 1px, transparent 1px);
    background-size: 16px 16px;
}

.boot p { margin-top: 14px; letter-spacing: 0.08em; }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 16px;
    background: #fdf6e6;
    border-top: 1px solid var(--or);
    z-index: 1000;
}

#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ----- La barre d'outils du plan ----- */

.tool-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 12px;
    background: var(--fond);
    border-bottom: 1px solid var(--trait);
    flex: 0 0 auto;
}

.tool {
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--trait);
    border-radius: 4px;
    background: var(--feuille);
    color: var(--encre);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.tool:hover { background: #eef2f5; }

/* L'outil arme se voit : c'est lui qui recoit le prochain clic dans le plan. */
.tool.on {
    background: var(--bleu);
    border-color: var(--bleu);
    color: #fff;
}

/* Un outil qui trace vise un point : le curseur devient une croix. */
.plan-surface.drawing { cursor: crosshair; }
.plan-surface:focus { outline: none; }

/* ----- La ligne d'etat : coordonnees, accrochage, conseil de l'outil ----- */

.status-bar {
    flex: 0 0 auto;
    padding: 4px 12px;
    min-height: 26px;
    background: var(--feuille);
    border-top: 1px solid var(--trait);
    color: var(--encre-douce);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ----- Le panneau lateral : composition et proprietes ----- */

.editor-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.side {
    flex: 0 0 272px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--feuille);
    border-right: 1px solid var(--trait);
}

.side-tabs { display: flex; border-bottom: 1px solid var(--trait); }

.side-tab {
    flex: 1 1 0;
    height: 34px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--encre-douce);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.side-tab:hover { background: var(--fond); }
.side-tab.on { color: var(--bleu); border-bottom-color: var(--bleu); font-weight: 600; }

.side-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px 14px 18px; }
.side-body h3 { margin: 16px 0 6px; font-size: 13px; }
.side-body .lead { margin: 4px 0 10px; font-size: 13px; }

/* Les champs du panneau : une etiquette au-dessus, serree. */
.grid label { margin: 8px 0; }
.grid label > span { margin-bottom: 3px; font-size: 12px; }
.grid input[type=text], .grid select { height: 30px; font-size: 13px; width: 100%; }
.grid label.check { flex-direction: row; align-items: center; }
.grid label.check > span { font-size: 13px; }

.acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.acts .btn { height: 28px; padding: 0 8px; font-size: 12.5px; }

/* Les listes du panneau : etages, toitures, facades, baies d'un mur. */
.picks { list-style: none; margin: 4px 0; padding: 0; }

.picks li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 4px;
}

.picks li.on { background: #eaf1f6; }
.picks li.on .link { font-weight: 600; text-decoration: none; }
.pick-meta { color: var(--encre-douce); font-size: 12px; }

.options { display: flex; flex-direction: column; gap: 2px; }
.options label.check { margin: 2px 0; }
.options label.check > span { font-size: 13px; }

/* ----- Les reglages de l'outil, dans sa barre ----- */

.tool-sep {
    width: 1px;
    align-self: stretch;
    margin: 2px 6px;
    background: var(--trait);
}

.tool-lbl { color: var(--encre-douce); font-size: 12.5px; align-self: center; }

.tool-num {
    width: 62px;
    height: 30px;
    padding: 0 6px;
    border: 1px solid var(--trait);
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
}

.tool-num.wide { width: 96px; }

/* La sortie par compte.prophetix.com est un formulaire : il se tient dans la barre comme un bouton. */
form.inline { display: inline; margin: 0; }
a.who { text-decoration: none; }
a.who:hover { text-decoration: underline; }

/* ----- La fenetre du poste dans la page ----- */

.editor.desk { overflow: hidden; }
.editor.desk .editor-bar { height: 40px; }
.desk-host { flex: 1 1 auto; min-height: 0; position: relative; display: flex; }
.desk-host > .wpf-root { flex: 1 1 auto; }

.ask-veil {
    position: fixed; inset: 0; z-index: 2100;
    background: rgba(20, 28, 36, 0.28);
    display: flex; align-items: center; justify-content: center;
}
.ask {
    background: var(--feuille);
    border-radius: 8px;
    padding: 18px 20px;
    width: min(420px, calc(100vw - 32px));
    box-shadow: 0 16px 48px rgba(10, 20, 30, 0.3);
}
.ask-title { margin: 0 0 10px; font-weight: 600; }
.ask input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--trait); border-radius: 5px; font: inherit; }
.ask-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
