/* ==========================================================================
   Polices Canal
   ========================================================================== */

@font-face {
    font-family: 'Canal';
    src: url('fonts/canal-light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Canal';
    src: url('fonts/canal-light-italic.woff2') format('woff2');
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Canal';
    src: url('fonts/canal-demi.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Canal';
    src: url('fonts/canal-demi-italic.woff2') format('woff2');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Canal';
    src: url('fonts/canal-bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Canal';
    src: url('fonts/canal-bold-italic.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

/* Fonte de symboles : famille distincte, jamais dans la pile de texte. */
@font-face {
    font-family: 'CanalSymboles';
    src: url('fonts/canal-symboles.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

/* ==========================================================================
   Variables
   ========================================================================== */

:root {
    --bg:            #000000;
    --surface:       #141414;
    --surface-hi:    #1f1f1f;
    --border:        #2e2e2e;
    --text:          #ffffff;
    --text-muted:    #9a9a9a;
    --accent:        #ffffff;
    --rose:          #e71e6e;
    --danger:        #ff4d4f;
    --info:          #4da3ff;

    --font-brand:    'Canal', 'Futura', 'Avenir Next', 'Trebuchet MS', sans-serif;
    --font-symbol:   'CanalSymboles', sans-serif;
    --radius:        6px;
    --taskbar-h:     56px;
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-brand);
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
}

body.page-login,
body.page-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

h1 {
    margin: 0 0 8px;
    font-size: clamp(32px, 6vw, 52px);
    font-weight: 700;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.icon {
    font-family: var(--font-symbol);
    font-style: normal;
    line-height: 1;
}

.lead {
    margin: 0 0 24px;
    color: var(--text-muted);
    font-size: 16px;
}

/* ==========================================================================
   Carte
   ========================================================================== */

.card {
    width: 100%;
    max-width: 520px;
    padding: 56px 48px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}

/* ==========================================================================
   Formulaires
   ========================================================================== */

input[type="text"],
input[type="password"] {
    display: block;
    width: 100%;
    margin: 0 0 14px;
    padding: 14px 16px;
    background: var(--surface-hi);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
}

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

input::placeholder { color: #666; }

button {
    padding: 13px 24px;
    background: var(--rose);
    color: #fff;
    border: 0;
    border-radius: var(--radius);
    font-weight: 700;
    font-family: var(--font-brand);
    font-size: 15px;
    cursor: pointer;
    transition: opacity .15s ease;
}

button:hover { opacity: .85; }

button.link {
    background: none;
    color: var(--text-muted);
    font-weight: 400;
    text-decoration: underline;
    padding: 8px;
}

button.link:hover { color: var(--text); opacity: 1; }

form.secondary { margin-top: 20px; }

form.secondary-end {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: right;
}

/* ==========================================================================
   Alertes
   ========================================================================== */

.alert {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    text-align: left;
}

.alert-error { background: rgba(255, 77, 79, .12); border: 1px solid var(--danger); }
.alert-info  { background: rgba(77, 163, 255, .12); border: 1px solid var(--info); }

/* ==========================================================================
   Grille de services
   ========================================================================== */

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.service-grid form { margin: 0; }

.btn-service {
    width: 100%;
    padding: 22px 12px;
    background: var(--surface-hi);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 16px;
}

.btn-service:hover {
    background: var(--accent);
    color: #000;
    opacity: 1;
}

/* ==========================================================================
   Barre de tache
   ========================================================================== */

.taskbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--taskbar-h);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.taskbar form { margin: 0; display: inline-flex; }

.taskbar button {
    padding: 8px 14px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    font-size: 14px;
}

.taskbar button:hover { color: var(--text); background: var(--surface-hi); opacity: 1; }

.taskbar button.brand {
    color: var(--text);
    font-size: 17px;
    font-style: italic;
    text-transform: uppercase;
}

.taskbar button.is-active {
    color: #fff;
    background: var(--rose);
    font-weight: 700;
}

.taskbar-nav { display: flex; gap: 4px; flex: 1; }
.taskbar form.taskbar-end { margin-left: auto; }

/* ==========================================================================
   Zone de service
   ========================================================================== */

.content {
    position: relative;
    height: 100%;
    padding-top: var(--taskbar-h);
}

iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

#loader {
    position: absolute;
    inset: var(--taskbar-h) 0 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 17px;
}

.spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .spinner { animation: none; }
    * { transition: none !important; }
}

/* ==========================================================================
   Panneau de debug (lab uniquement)
   ========================================================================== */

.debug {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 45vh;
    overflow: auto;
    background: #0b0b0b;
    border-top: 2px solid var(--info);
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
    font-size: 12px;
    z-index: 2000;
}

.debug summary {
    padding: 8px 14px;
    background: var(--info);
    color: #000;
    font-weight: 700;
    cursor: pointer;
}

.debug pre {
    margin: 0;
    padding: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    color: #b9d9ff;
}
