:root {
  --bg: #03060d;
  --bg2: #071021;
  --glass: rgba(12, 24, 44, .55);
  --glass-hi: rgba(20, 40, 70, .6);
  --line: rgba(110, 200, 255, .14);
  --line-hi: rgba(110, 220, 255, .38);
  --text: #e6f3ff;
  --muted: #7f9bb8;
  --cyan: #4fd8ff;
  --cyan2: #2a9dff;
  --violet: #9d7bff;
  --ok: #3ee6a6;
  --warn: #ffc857;
  --bad: #ff5d73;
  --r: 16px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); overflow: hidden; }
body { overscroll-behavior: none; }
button, input, textarea { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); min-height: 1.2em; }

#bg { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 50% 38%, rgba(42, 157, 255, .13), transparent 60%),
    radial-gradient(800px 500px at 85% 110%, rgba(157, 123, 255, .10), transparent 60%),
    linear-gradient(var(--bg), var(--bg2));
}
#bg::after { content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%); }

.glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(14px) saturate(130%); -webkit-backdrop-filter: blur(14px) saturate(130%);
  box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 10px 40px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04); }

.btn { background: rgba(79, 216, 255, .08); border: 1px solid var(--line-hi); border-radius: 10px; padding: 8px 14px; cursor: pointer; transition: .2s; }
.btn:hover { background: rgba(79, 216, 255, .16); }
.btn.primary { background: linear-gradient(135deg, var(--cyan2), var(--cyan)); color: #001223; border: 0; font-weight: 600; }
.btn.danger { border-color: rgba(255, 93, 115, .5); color: var(--bad); }
.icon-btn { background: none; border: 0; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; color: var(--muted); border-radius: 10px; flex: none; }
.icon-btn:hover { color: var(--cyan); background: rgba(79,216,255,.08); }
.icon-btn svg { width: 22px; height: 22px; }

/* Connexion */
.login { position: fixed; inset: 0; display: grid; place-items: center; z-index: 5; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 32px 26px; text-align: center; }
.login-card h1 { letter-spacing: .5em; font-weight: 300; margin: 18px 0 6px; padding-left: .5em; }
.login-card input { width: 100%; margin: 14px 0; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-hi); background: rgba(0,0,0,.35); outline: none; }
.login-card .btn { width: 100%; padding: 12px; }
.login-orb { width: 90px; height: 90px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #c9f4ff 0, var(--cyan) 18%, rgba(42,157,255,.35) 45%, transparent 70%);
  box-shadow: 0 0 60px rgba(79,216,255,.45); animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.08); filter: brightness(1.2); } }

/* Mise en page */
main { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; padding: calc(10px + var(--safe-t)) 16px 0; }
.top { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 16px; padding: 4px 4px 10px; }
.brand { display: flex; align-items: center; gap: 10px; letter-spacing: .35em; font-size: 13px; }
.brand b { font-weight: 600; }
.brand .muted { letter-spacing: 0; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 10px currentColor; }
.dot.ok { background: var(--ok); color: var(--ok); }
.dot.warn { background: var(--warn); color: var(--warn); }
.dot.bad { background: var(--bad); color: var(--bad); }
.clock { text-align: center; font-family: var(--mono); }
#time { font-size: 30px; font-weight: 200; letter-spacing: .08em; line-height: 1; text-shadow: 0 0 18px rgba(79,216,255,.4); }
#date { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; margin-top: 4px; }
.weather { justify-self: end; display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); cursor: pointer; }
#w-icon { font-size: 20px; }
#w-temp { font-size: 20px; }
#w-place { font-size: 11px; }
.top-quota { position: relative; width: 44px; height: 44px; }
.top-quota svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.top-quota span { position: absolute; inset: 0; display: grid; place-items: center; font: 10px var(--mono); }
.track { stroke: rgba(110, 200, 255, .12); stroke-width: 3; }
.arc { stroke: var(--cyan); stroke-width: 3; stroke-dasharray: 0 999; transition: stroke-dasharray 1s ease; filter: drop-shadow(0 0 4px rgba(79,216,255,.7)); }
.arc.alt { stroke: var(--violet); filter: drop-shadow(0 0 4px rgba(157,123,255,.7)); }
.arc.warn { stroke: var(--warn); } .arc.bad { stroke: var(--bad); }

.grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(260px, 330px) 1fr minmax(260px, 330px); gap: 16px; padding-bottom: 16px; }
.col { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; scrollbar-width: none; padding-bottom: 8px; }
.col::-webkit-scrollbar { display: none; }
.card { padding: 14px 14px 12px; }
.card h2 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--cyan); }
.count { font-family: var(--mono); color: var(--text); background: rgba(79,216,255,.12); border-radius: 20px; padding: 1px 8px; letter-spacing: 0; }
.list { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); font-size: 13px; padding: 4px 0; }

.task { border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px; background: rgba(0,0,0,.18); cursor: pointer; position: relative; overflow: hidden; }
.task.running { border-color: var(--line-hi); }
.task.running::before { content: ""; position: absolute; left: 0; top: 0; height: 2px; width: 40%; background: linear-gradient(90deg, transparent, var(--cyan), transparent); animation: scan 1.8s linear infinite; }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.task .t-head { display: flex; gap: 8px; align-items: baseline; }
.task .t-id { font: 11px var(--mono); color: var(--cyan); flex: none; }
.task .t-title { font-size: 13.5px; }
.task .t-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.task .t-steps { margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; color: #bcd6ee; }
.task .t-steps li { padding-left: 14px; position: relative; margin: 3px 0; }
.task .t-steps li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.task .t-more { display: none; font-size: 12px; color: #bcd6ee; margin-top: 8px; white-space: pre-wrap; }
.task.open .t-more { display: block; }
.badge { font: 10px var(--mono); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line-hi); color: var(--muted); }
.badge.auto { color: var(--violet); border-color: rgba(157,123,255,.5); }
.st-done { color: var(--ok); } .st-failed { color: var(--bad); } .st-stopped, .st-undone { color: var(--muted); } .st-pending { color: var(--warn); }
.evo { font-size: 13px; border-left: 2px solid var(--line-hi); padding: 2px 0 2px 10px; }
.evo small { display: block; color: var(--muted); font-size: 11px; }
.evo.obsolete { opacity: .5; text-decoration: line-through; }
.auto-line { margin-top: 10px; font-size: 11.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }

/* Centre */
.center { min-height: 0; display: flex; flex-direction: column; align-items: center; }
.orb-wrap { position: relative; width: min(46vh, 100%); aspect-ratio: 1; flex: none; margin-top: -6px; }
#orb { width: 100%; height: 100%; display: block; cursor: pointer; }
.orb-state { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; font: 11px var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--cyan); opacity: .8; }
.transcript { flex: 1; min-height: 60px; width: min(760px, 100%); overflow-y: auto; padding: 4px 6px 10px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: none;
  mask-image: linear-gradient(transparent, #000 40px); -webkit-mask-image: linear-gradient(transparent, #000 40px); }
.transcript::-webkit-scrollbar { display: none; }
.msg { max-width: 88%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, rgba(42,157,255,.28), rgba(79,216,255,.18)); border: 1px solid rgba(79,216,255,.35); }
.msg.bryony { align-self: flex-start; background: rgba(10, 22, 40, .7); border: 1px solid var(--line); }
.msg.notice { align-self: center; max-width: 96%; font-size: 12.5px; color: #bcd6ee; background: rgba(157,123,255,.08); border: 1px dashed rgba(157,123,255,.35); }
.msg .when { display: block; font: 10px var(--mono); color: var(--muted); margin-top: 4px; }
.msg.thinking { color: var(--muted); font-style: italic; }
.composer { width: min(760px, 100%); display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 22px; }
.composer textarea { flex: 1; resize: none; background: none; border: 0; outline: none; padding: 9px 6px; max-height: 140px; font-size: 16px; }
.mic { width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer; flex: none; display: grid; place-items: center; color: #001223;
  background: radial-gradient(circle at 35% 30%, #d9f7ff, var(--cyan) 45%, var(--cyan2)); box-shadow: 0 0 22px rgba(79,216,255,.55); transition: transform .15s; }
.mic svg { width: 24px; height: 24px; stroke-width: 2; }
.mic:active { transform: scale(.94); }
.mic.rec { background: radial-gradient(circle at 35% 30%, #ffe0e5, var(--bad) 50%, #c81e3a); box-shadow: 0 0 0 0 rgba(255,93,115,.6); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,93,115,.55); } 100% { box-shadow: 0 0 0 22px rgba(255,93,115,0); } }
.hint { font-size: 11.5px; padding: 6px 0 calc(4px + var(--safe-b)); text-align: center; }

/* Jauges */
.gauge-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.gauge { position: relative; text-align: center; }
.gauge svg { width: 100%; max-width: 130px; transform: rotate(-90deg); }
.gauge .track, .gauge .arc { stroke-width: 7; }
.g-val { position: absolute; top: 0; left: 0; right: 0; aspect-ratio: 1; max-width: 130px; margin: auto; display: grid; place-content: center; }
.g-val b { font: 300 26px var(--mono); }
.g-val span { font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.g-sub { font-size: 11px; }
.kv { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 0; border-top: 1px solid var(--line); }
.kv b { font: 500 12.5px var(--mono); }
.health { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-bottom: 10px; }
.h { font-size: 12px; display: flex; gap: 6px; align-items: center; min-width: 0; }
.h i { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.h.attention i { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.h.panne i { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.h span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar { display: grid; grid-template-columns: 60px 1fr 54px; gap: 8px; align-items: center; font-size: 12px; }
.bar i { height: 5px; border-radius: 4px; background: rgba(110,200,255,.12); overflow: hidden; }
.bar em { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan2), var(--cyan)); transition: width 1s; }
.bar b { font: 11px var(--mono); text-align: right; }
.feed { display: flex; flex-direction: column; gap: 8px; font-size: 12px; max-height: 340px; overflow-y: auto; scrollbar-width: none; }
.feed div { border-left: 2px solid rgba(157,123,255,.5); padding-left: 8px; color: #bcd6ee; white-space: pre-wrap; }
.feed time { display: block; font: 10px var(--mono); color: var(--muted); }

/* Boutons flottants */
.stop { position: fixed; right: 16px; bottom: calc(16px + var(--safe-b)); z-index: 3; border: 1px solid rgba(255,93,115,.55); color: var(--bad); background: rgba(40, 6, 14, .6);
  border-radius: 10px; font: 600 11px var(--mono); letter-spacing: .2em; padding: 8px 12px; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.settings-btn { position: fixed; left: 16px; bottom: calc(14px + var(--safe-b)); z-index: 3; }
.tabs { display: none; }

/* Superpositions */
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(2, 5, 12, .92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.overlay-bar { position: absolute; top: calc(10px + var(--safe-t)); left: 16px; right: 16px; display: flex; gap: 10px; align-items: center; z-index: 2; }
.overlay-bar b { letter-spacing: .2em; text-transform: uppercase; font-size: 12px; color: var(--cyan); margin-right: auto; }
.overlay-bar input { background: rgba(0,0,0,.4); border: 1px solid var(--line-hi); border-radius: 10px; padding: 7px 12px; outline: none; width: min(260px, 40vw); }
#map-svg { width: 100%; height: 100%; display: block; cursor: grab; }
#map-svg .link { stroke: rgba(79,216,255,.28); stroke-width: 1.2; fill: none; }
#map-svg .node circle { stroke-width: 1.5; cursor: pointer; transition: r .2s; }
#map-svg .node text { font: 12px var(--sans); fill: #d6ebff; stroke: none; paint-order: stroke; cursor: pointer; }
#map-svg .node.hit text { fill: var(--warn); font-weight: 700; }
.detail { position: absolute; right: 16px; bottom: calc(16px + var(--safe-b)); width: min(520px, calc(100% - 32px)); max-height: 70%; overflow: auto; padding: 14px 16px; z-index: 3; }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.detail #d-info { margin: 6px 0 10px; white-space: pre-wrap; font-size: 13px; }
.doc { white-space: pre-wrap; font: 12px/1.5 var(--mono); color: #cfe3f7; background: rgba(0,0,0,.3); border-radius: 10px; padding: 12px; margin-top: 10px; }
.sheet { display: grid; place-items: center; padding: 16px; }
.sheet-card { width: min(520px, 100%); max-height: 88vh; overflow: auto; padding: 18px; }
.sheet-card h3 { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--cyan); margin: 18px 0 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input:not([type]) , .row input[id="s-city"] { flex: 1; background: rgba(0,0,0,.35); border: 1px solid var(--line-hi); border-radius: 10px; padding: 8px 12px; outline: none; }
.voices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.voice { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.voice.on { border-color: var(--cyan); box-shadow: 0 0 12px rgba(79,216,255,.3); }
.toast { position: fixed; left: 50%; top: calc(14px + var(--safe-t)); transform: translateX(-50%); z-index: 20; padding: 10px 16px; border-radius: 12px; background: rgba(10,22,40,.92); border: 1px solid var(--line-hi); font-size: 13px; max-width: calc(100% - 32px); }

/* Téléphone */
@media (max-width: 900px) {
  main { padding: calc(6px + var(--safe-t)) 12px 0; }
  .top { grid-template-columns: auto 1fr auto auto; gap: 10px; padding-bottom: 4px; }
  .brand { letter-spacing: .2em; font-size: 12px; }
  .brand .muted { display: none; }
  .clock { text-align: right; }
  #time { font-size: 22px; }
  #date { display: none; }
  .weather { gap: 4px; }
  #w-place { display: none; }
  #w-temp, #w-icon { font-size: 16px; }
  .top-quota, .top-quota svg { width: 36px; height: 36px; }
  .grid { display: block; position: relative; padding-bottom: 0; }
  .col, .center { position: absolute; inset: 0; padding-bottom: calc(76px + var(--safe-b)); }
  .col { display: none; overflow-y: auto; }
  body[data-tab="work"] .col.left, body[data-tab="system"] .col.right { display: flex; }
  body[data-tab="work"] .center, body[data-tab="system"] .center { display: none; }
  .orb-wrap { width: min(62vw, 34vh); margin-top: 0; }
  .transcript { width: 100%; }
  .composer { width: 100%; }
  .hint { display: none; }
  .tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; justify-content: space-around; padding: 6px 4px calc(6px + var(--safe-b));
    background: rgba(4, 9, 18, .88); border-top: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .tabs button { background: none; border: 0; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; padding: 4px 8px; }
  .tabs button svg { width: 22px; height: 22px; }
  .tabs button.active { color: var(--cyan); }
  .stop { bottom: auto; top: auto; right: 12px; bottom: calc(150px + var(--safe-b)); padding: 6px 9px; font-size: 10px; opacity: .85; }
  body[data-tab="work"] .stop, body[data-tab="system"] .stop { bottom: calc(80px + var(--safe-b)); }
  .settings-btn { display: none; }
  .center { padding-bottom: calc(70px + var(--safe-b)); }
  .detail { left: 12px; right: 12px; width: auto; max-height: 60%; bottom: calc(12px + var(--safe-b)); }
  .overlay-bar input { width: 34vw; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.free-keys { display: flex; flex-direction: column; gap: 10px; }
.free-key { border-top: 1px solid var(--line); padding-top: 8px; font-size: 13px; }
.free-key .row { margin-top: 6px; }
.free-key input { flex: 1; min-width: 0; background: rgba(0,0,0,.35); border: 1px solid var(--line-hi); border-radius: 10px; padding: 8px 12px; outline: none; }
.free-key a { color: var(--cyan); }
.free-key .st { float: right; font: 11px var(--mono); }
.free-key .st.ok { color: var(--ok, #5be3a1); }
#free-gauges .bar { grid-template-columns: 92px 1fr 70px; }
