:root {
  --bg: #0e0f13;
  --surface: #181a21;
  --surface-2: #21242e;
  --border: #2c303b;
  --text: #e8eaf0;
  --muted: #8b90a0;
  --accent: #7c5cff;
  --accent-2: #00d4a0;
  --danger: #ff5c7c;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

.screen { min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .85rem; }
.error { color: var(--danger); font-size: .85rem; margin-top: .5rem; }

/* --- LOGIN --- */
#login { align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 360px; text-align: center; padding: 2rem 1.5rem; }
.logo { font-size: 3rem; margin-bottom: .5rem; }
.login-card h1 { font-size: 1.4rem; letter-spacing: .04em; }
.login-card p { margin-bottom: 1.5rem; }
.login-card input { margin-bottom: 1rem; }

/* --- TOPBAR --- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-top));
  padding-top: max(1rem, env(safe-area-inset-top));
  background: rgba(14,15,19,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; letter-spacing: .12em; font-size: .95rem; }

/* --- COMPOSER --- */
.composer { padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.input-row { display: flex; gap: .5rem; }
.input-row input { flex: 1; }

input {
  width: 100%; padding: .9rem 1rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 1rem; outline: none; transition: border-color .15s;
}
input:focus { border-color: var(--accent); }

button { font-size: 1rem; font-weight: 600; cursor: pointer; border: none; border-radius: var(--radius); transition: transform .08s, opacity .15s; }
button:active { transform: scale(.97); }

.primary { padding: .95rem 1rem; background: var(--accent); color: #fff; }
.primary:disabled { opacity: .5; cursor: default; }
.primary-soft { padding: .7rem 1rem; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.ghost { padding: .7rem .9rem; background: transparent; color: var(--muted); border: 1px solid var(--border); }

.status { font-size: .9rem; padding: .25rem 0; }
.status.work { color: var(--accent-2); }
.status.err { color: var(--danger); }

/* --- HISTORIQUE / CARTES --- */
.history { padding: 0 1.25rem 2rem; display: flex; flex-direction: column; gap: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem;
}
.transcript.fresh { border-color: var(--accent); animation: pop .4s ease; }
@keyframes pop { from { transform: scale(.98); opacity: .6; } to { transform: scale(1); opacity: 1; } }

.t-head { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.t-meta { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.t-title { font-size: 1rem; line-height: 1.3; word-break: break-word; }
.t-del { padding: .35rem .55rem; font-size: .9rem; }

.t-summary {
  margin: .75rem 0; padding: .75rem .9rem;
  background: var(--surface-2); border-left: 3px solid var(--accent-2);
  border-radius: 8px; font-size: .9rem; color: #c9cdd9; line-height: 1.5;
}
.t-text {
  margin: .75rem 0; white-space: pre-wrap; word-break: break-word;
  font-family: inherit; font-size: .95rem; line-height: 1.6; color: #d2d6e0;
  max-height: 9.5rem; overflow: hidden; position: relative;
}
.t-text.expanded { max-height: none; }
.t-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.copy { flex: 1; }
.copy.done { background: var(--accent-2); color: #06241c; }
.open { display: inline-flex; align-items: center; text-decoration: none; }
