/* LiO.2 — Maquette UX opticien
   Objectif : valider menus + parcours AVANT migration code.
   Style : gestion dense, moderne, marché optique (pas dashboard SaaS). */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');

:root {
  --ink: #142033;
  --muted: #5a6b7d;
  --navy: #1b3a5c;
  --navy-deep: #0f2438;
  --teal: #1a7a78;
  --teal-soft: #e6f4f3;
  --paper: #f5f6f8;
  --panel: #ffffff;
  --line: #c8d0da;
  --line-soft: #e2e7ed;
  --select: #f5d76e;
  --select-border: #d4b84a;
  --danger: #b42318;
  --ok: #1b7a45;
  --header: #163456;
  --rail: #d9dee6;
  --rail-btn: #eceff3;
  --yellow-bar: #f7e59a;
  --font: 'DM Sans', system-ui, sans-serif;
  --brand: 'Fraunces', Georgia, serif;
  --radius: 4px;
  --shadow: 0 1px 0 rgba(20,32,51,.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.35;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy); }

/* Embedded mode inside Jade iframe */
body.botp-embedded #botp-shell {
  height: 100%;
}
body.botp-embedded #botp-top {
  padding: 0 10px;
}

/* ========== SHELL ========== */
#mq-shell {
  display: grid;
  grid-template-rows: 40px 1fr 36px;
  height: 100vh;
}

#mq-top {
  background: var(--navy-deep);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  font-size: 12.5px;
}
#mq-top .brand {
  font-family: var(--brand);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .02em;
}
#mq-top .tagline { opacity: .75; font-size: 11px; }
#mq-top .center { flex: 1; text-align: center; font-weight: 500; }
#mq-top .right { opacity: .9; }

#mq-work {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 0;
}

/* Menu FrmMenuLIO — version claire métier */
#mq-menu {
  background: linear-gradient(180deg, #eef1f5 0%, #e4e9ef 100%);
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 8px 8px 16px;
}
#mq-menu .menu-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 8px 8px 6px;
}
.mq-acc {
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.mq-acc > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  background: linear-gradient(180deg, #f8f9fb, #ebf0f5);
  user-select: none;
}
.mq-acc > summary::-webkit-details-marker { display: none; }
.mq-acc > summary .ico {
  width: 22px; height: 22px; border-radius: 5px;
  background: var(--navy); color: #fff;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
}
.mq-acc > summary .chev { margin-left: auto; font-size: 10px; color: var(--muted); }
.mq-acc[open] > summary { border-bottom: 1px solid var(--line-soft); }
.mq-acc a, .mq-acc button.link {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px 7px 40px;
  border: 0; background: transparent;
  color: var(--ink); text-decoration: none;
  font-size: 12.5px; border-left: 3px solid transparent;
}
.mq-acc a:hover, .mq-acc button.link:hover { background: #e8eef6; }
.mq-acc a.active, .mq-acc button.link.active {
  background: #dce8f6;
  border-left-color: var(--teal);
  font-weight: 600;
}
.mq-acc.direct > summary { cursor: default; }
.mq-acc.direct > summary a {
  padding: 0; border: 0; background: none; font-weight: 600; color: inherit;
}

#mq-main {
  overflow: auto;
  background: var(--paper);
  min-width: 0;
}

#mq-bottom {
  background: #d7e3f0;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 4px;
  padding: 0 8px;
}
#mq-bottom button {
  border: 1px solid transparent;
  background: transparent;
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--navy);
}
#mq-bottom button:hover { background: rgba(255,255,255,.55); border-color: var(--line); }
#mq-bottom .spacer { flex: 1; }
#mq-bottom .hint { font-size: 11px; color: var(--muted); }

/* ========== ÉCRANS ========== */
.screen { display: none; height: 100%; }
.screen.active { display: flex; flex-direction: column; min-height: 100%; }

.screen-head {
  background: var(--header);
  color: #fff;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.screen-head .sub { font-weight: 400; opacity: .8; font-size: 12px; }
.screen-head .actions { margin-left: auto; display: flex; gap: 6px; }

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

/* Rail latéral écran (Client / Dossier) */
.rail {
  width: 148px;
  flex-shrink: 0;
  background: var(--rail);
  border-right: 1px solid var(--line);
  padding: 8px 6px;
  display: flex; flex-direction: column; gap: 4px;
}
.rail .grp {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 8px 6px 4px; font-weight: 600;
}
.rail button {
  width: 100%; text-align: left;
  border: 1px solid var(--line);
  background: var(--rail-btn);
  padding: 7px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
}
.rail button:hover { background: #fff; }
.rail button.on {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy-deep);
}
.rail .push { margin-top: auto; }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 10px; gap: 8px; overflow: auto; }

/* Composants gestion */
.fieldset {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 8px 10px 10px;
}
.fieldset > legend {
  font-size: 11px; font-weight: 700; color: var(--navy);
  padding: 0 4px;
}
.grid-form {
  display: grid;
  gap: 6px 12px;
}
.grid-form.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-form.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-form.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.field > span { font-size: 11px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea {
  border: 1px solid #8a97a8;
  background: #fff;
  padding: 4px 6px;
  border-radius: 2px;
  min-height: 26px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(26,122,120,.35);
  border-color: var(--teal);
}
.field input.ro { background: #fff8d6; }
.checks { display: flex; flex-direction: column; gap: 4px; padding-top: 16px; }
.checks label { display: flex; gap: 6px; align-items: center; font-size: 12px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.btn {
  border: 1px solid var(--navy-deep);
  background: var(--navy);
  color: #fff;
  padding: 5px 12px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 12px;
}
.btn:hover { background: var(--navy-deep); }
.btn.ghost {
  background: #eef2f6;
  color: var(--ink);
  border-color: var(--line);
  font-weight: 500;
}
.btn.teal { background: var(--teal); border-color: #146361; }
.btn.warn { background: var(--yellow-bar); color: var(--ink); border-color: var(--select-border); }

.table-wrap {
  border: 1px solid var(--line);
  background: #fff;
  overflow: auto;
  flex: 1;
  min-height: 180px;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.data th {
  position: sticky; top: 0;
  background: var(--navy);
  color: #fff;
  text-align: left;
  padding: 5px 8px;
  font-weight: 600;
  white-space: nowrap;
}
table.data td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
table.data tr:nth-child(even) td { background: #f7f9fb; }
table.data tr:hover td { background: #e8f2fc; cursor: pointer; }
table.data tr.selected td {
  background: var(--select) !important;
  outline: 1px solid var(--select-border);
}

.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.tabs button {
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #e8ecf1;
  padding: 6px 12px;
  border-radius: 4px 4px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.tabs button.on {
  background: #fff;
  color: var(--navy);
  position: relative;
  top: 1px;
}
.tab-panel {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
  display: none;
}
.tab-panel.on { display: block; }

.corr-table input {
  width: 64px;
  text-align: right;
  border: 1px solid #8a97a8;
  padding: 3px 4px;
}
.corr-table th, .corr-table td { padding: 3px 6px; font-size: 12px; }
.corr-table th { background: #eef2f6; color: var(--ink); font-weight: 600; }

.footer-bar {
  flex-shrink: 0;
  background: var(--yellow-bar);
  border-top: 2px solid var(--select-border);
  padding: 8px 12px;
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  font-weight: 600;
  font-size: 13px;
}
.footer-bar .part {
  background: #fff3b0;
  border: 1px solid var(--select-border);
  padding: 4px 10px;
  border-radius: 3px;
}
.footer-bar .spacer { flex: 1; }

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.split-2-1 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 10px; }

.card-soft {
  border: 1px solid var(--line);
  background: #fafbfc;
  padding: 8px;
  border-radius: var(--radius);
  font-size: 12px;
}
.card-soft h4 { margin: 0 0 6px; font-size: 12px; color: var(--navy); }

.badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--teal-soft);
  color: var(--teal);
  border-radius: 3px;
}
.badge.ok { background: #e6f6ec; color: var(--ok); border-color: #b7dfc4; }
.badge.warn { background: #fff4e5; color: #9a6700; border-color: #f0d9a8; }

/* Hub validation */
.hub {
  padding: 28px 32px 48px;
  max-width: 1100px;
}
.hub h1 {
  font-family: var(--brand);
  font-size: 28px;
  margin: 0 0 6px;
  color: var(--navy-deep);
}
.hub .lead { color: var(--muted); font-size: 14px; margin: 0 0 22px; max-width: 62ch; }
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 18px 0 28px;
}
.hub-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.hub-card:hover { border-color: var(--teal); transform: translateY(-1px); }
.hub-card .id { font-size: 10px; font-weight: 700; color: var(--teal); letter-spacing: .04em; }
.hub-card h3 { margin: 4px 0 6px; font-size: 14px; }
.hub-card p { margin: 0; font-size: 12px; color: var(--muted); }
.principles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.principles article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.principles h3 { margin: 0 0 8px; font-size: 13px; color: var(--navy); }
.principles ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.principles li { margin-bottom: 4px; }

.modal-back {
  position: fixed; inset: 0; background: rgba(15,36,56,.45);
  display: none; align-items: center; justify-content: center; z-index: 60;
  padding: 20px;
}
.modal-back.on { display: flex; }
.modal {
  width: min(720px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(15,36,56,.25);
  max-height: 90vh; overflow: auto;
}
.modal-head {
  background: var(--header);
  color: #fff;
  padding: 8px 12px;
  display: flex; align-items: center;
  font-weight: 600;
}
.modal-head button { margin-left: auto; background: transparent; border: 0; color: #fff; font-size: 16px; }
.modal-body { padding: 12px; }

.note {
  font-size: 11px; color: var(--muted);
  padding: 6px 8px; background: #eef4fa; border: 1px dashed var(--line);
  border-radius: 3px;
}

@media (max-width: 960px) {
  #mq-work { grid-template-columns: 1fr; }
  #mq-menu { display: none; }
  .split-2, .split-2-1, .principles, .grid-form.cols-3, .grid-form.cols-4 { grid-template-columns: 1fr; }
  .rail { width: 120px; }
}
