/* pis_app.css — shared styles for dashboard.html and pre_install_survey.html */
:root {
    --essilor-blue: #004a99;
    --blue-dark: #003366;
    --blue-light: #eef4ff;
    --bg: #f4f7f9;
    --text: #333;
    --muted: #666;
    --border-color: #d1d9e0;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.1);
    --danger: #c62828;
    --ok: #2e7d32;
}

* { box-sizing: border-box; }

body {
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.4;
    font-size: 14px;
}

/* ---------- Top bar ---------- */
.topbar {
    background: #fff;
    border-bottom: 3px solid var(--essilor-blue);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--essilor-blue); }
.topbar .brand img { height: 28px; width: auto; }
.topbar .who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar .who strong { color: var(--text); }
.help-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--essilor-blue); color: #fff; text-decoration: none;
    font-size: 20px; font-weight: 800; line-height: 1; flex: none;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.help-btn:hover { filter: brightness(1.15); }
.help-btn:focus-visible { outline: 3px solid #90caf9; outline-offset: 2px; }
@media print { .help-btn { display: none; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 4px; font-size: 13px; font-weight: 700;
    border: 1px solid var(--essilor-blue); background: var(--essilor-blue); color: #fff;
    cursor: pointer; text-decoration: none; transition: background 0.15s, opacity 0.15s;
    font-family: inherit;
}
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--essilor-blue); }
.btn-outline:hover { background: var(--blue-light); }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fdecea; }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-ok:hover { background: #1b5e20; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-link { background: none; border: none; color: var(--essilor-blue); padding: 0; font-weight: 600; cursor: pointer; font-size: 13px; }
.btn-link:hover { text-decoration: underline; background: none; }

/* ---------- Status badges ---------- */
.status-badge {
    display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap;
}
.st-draft     { background: #eceff1; color: #455a64; }
.st-prep      { background: #e3f2fd; color: #0d47a1; }
.st-customer  { background: #fff3e0; color: #e65100; }
.st-review    { background: #ede7f6; color: #4527a0; }
.st-approved  { background: #e8f5e9; color: #1b5e20; }
.st-cancelled { background: #fbe9e7; color: #b71c1c; }

/* ---------- Messages ---------- */
.alert {
    border-radius: 4px; padding: 10px 14px; font-size: 13px; margin: 0 0 12px;
    border: 1px solid #b8d4fe; background: #eef4ff; color: #003366;
}
.alert-error { border-color: #f5c2c0; background: #fdecea; color: #8a1c14; }
.alert-ok { border-color: #b7dfb9; background: #edf7ee; color: #1b5e20; }
.alert-warn { border-color: #ffe082; background: #fffde7; color: #6d4c41; }

.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    background: #263238; color: #fff; padding: 10px 18px; border-radius: 4px;
    font-size: 13px; z-index: 1000; box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    max-width: calc(100% - 32px); opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 900;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
    background: #fff; border-radius: 6px; max-width: 480px; width: 100%; padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.modal h3 { margin: 0 0 8px; font-size: 16px; color: var(--essilor-blue); }
.modal p { margin: 0 0 12px; font-size: 13px; color: #444; }
.modal textarea { width: 100%; min-height: 90px; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 4px; font: inherit; font-size: 13px; resize: vertical; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- Generic form controls ---------- */
.field-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.text-input {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 4px;
    font-size: 14px; height: 40px; font-family: inherit;
}
.text-input:focus { border-color: var(--essilor-blue); outline: none; box-shadow: 0 0 0 2px rgba(0,74,153,0.12); }

.spinner {
    width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; display: inline-block; animation: pis-spin 0.7s linear infinite;
}
@keyframes pis-spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }