:root {
  --bg: #0d050a;
  --panel: rgba(34, 10, 25, 0.72);
  --cyan: #ff5fa8;
  --cyan-dim: rgba(255, 95, 168, 0.35);
  --text: #ffe9f3;
  --muted: #b98aa2;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 800px at 50% -10%, #2a0f22 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}
header {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--cyan-dim);
  background: linear-gradient(180deg, rgba(255,95,168,0.06), transparent);
}
#face {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 18px var(--cyan-dim), inset 0 0 12px var(--cyan-dim);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }
h1 { font-size: 18px; letter-spacing: 6px; color: var(--cyan); font-weight: 600; }
#status { margin-left: auto; font-size: 12px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
main {
  flex: 1; overflow-y: auto;
  padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
  max-width: 860px; width: 100%; margin: 0 auto;
}
.msg {
  padding: 10px 14px; border-radius: 10px; max-width: 80%;
  white-space: pre-wrap; line-height: 1.45; font-size: 15px;
}
.msg.user {
  align-self: flex-end;
  background: rgba(255, 95, 168, 0.12);
  border: 1px solid var(--cyan-dim);
}
.msg.assistant {
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid rgba(255, 179, 214, 0.22);
}
.msg .who {
  font-size: 10px; letter-spacing: 2px; color: var(--muted);
  display: block; margin-bottom: 4px; text-transform: uppercase;
}
footer {
  display: flex; gap: 10px;
  padding: 16px 22px 22px;
  max-width: 860px; width: 100%; margin: 0 auto;
}
#input {
  flex: 1; padding: 12px 14px;
  background: rgba(24, 8, 17, 0.9);
  border: 1px solid var(--cyan-dim);
  border-radius: 10px;
  color: var(--text); font-size: 15px; outline: none;
}
#input:focus { border-color: var(--cyan); box-shadow: 0 0 12px var(--cyan-dim); }
#send {
  padding: 12px 22px; border-radius: 10px; border: 1px solid var(--cyan);
  background: rgba(255, 95, 168, 0.15); color: var(--cyan);
  font-size: 15px; letter-spacing: 2px; cursor: pointer;
}
#send:disabled { opacity: 0.4; cursor: default; }
#voice {
  padding: 12px 18px; border-radius: 10px;
  border: 1px solid var(--cyan-dim);
  background: transparent; color: var(--muted);
  font-size: 13px; letter-spacing: 2px; cursor: pointer;
}
#voice.on {
  border-color: var(--cyan); color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-dim);
  animation: pulse 1.5s ease-in-out infinite;
}
.badge {
  display: inline-block; margin-left: 6px; padding: 0 5px;
  font-size: 9px; letter-spacing: 1px;
  color: var(--cyan); border: 1px solid var(--cyan-dim); border-radius: 3px;
}
/* ---- Edit affordance on the latest user bubble ---- */
.msg.user { position: relative; }
.editbtn {
  position: absolute; top: -10px; right: -10px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--cyan-dim);
  background: rgba(24, 8, 17, 0.95); color: var(--cyan);
  font-size: 14px; line-height: 1; cursor: pointer; opacity: 0.8;
}
.editbtn:hover, .editbtn:active { opacity: 1; box-shadow: 0 0 10px var(--cyan-dim); }

/* ---- Edit modal ---- */
.modal-ov {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(14, 3, 9, 0.7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  width: min(92vw, 460px); padding: 18px;
  background: var(--panel); border: 1px solid var(--cyan-dim); border-radius: 14px;
  box-shadow: 0 0 40px rgba(255, 95, 168, 0.15);
  display: flex; flex-direction: column; gap: 12px;
}
.modal-title { font-size: 11px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.modal-ta {
  width: 100%; min-height: 96px; resize: vertical;
  padding: 12px 14px; background: rgba(24, 8, 17, 0.9);
  border: 1px solid var(--cyan-dim); border-radius: 10px;
  color: var(--text); font-size: 15px; line-height: 1.45; outline: none; font-family: inherit;
}
.modal-ta:focus { border-color: var(--cyan); box-shadow: 0 0 12px var(--cyan-dim); }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; }
.modal-btns button {
  padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--cyan-dim); background: transparent; color: var(--muted);
  font-size: 13px; letter-spacing: 2px; cursor: pointer;
}
.modal-btns button.primary { border-color: var(--cyan); background: rgba(255, 95, 168, 0.15); color: var(--cyan); }

/* ---- Login ---- */
body.login-body {
  justify-content: center;
  align-items: center;
}
#login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 44px 40px;
  background: var(--panel);
  border: 1px solid var(--cyan-dim);
  border-radius: 14px;
  box-shadow: 0 0 40px rgba(255, 95, 168, 0.12);
  width: min(92vw, 380px);
}
#login-card h1 { margin-top: 4px; }
#login-sub {
  font-size: 12px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase;
}
#login-form {
  display: flex; flex-direction: column; gap: 12px; width: 100%; margin-top: 8px;
}
#login-form input {
  padding: 12px 14px;
  background: rgba(24, 8, 17, 0.9);
  border: 1px solid var(--cyan-dim);
  border-radius: 10px;
  color: var(--text); font-size: 15px; outline: none;
}
#login-form input:focus { border-color: var(--cyan); box-shadow: 0 0 12px var(--cyan-dim); }
#login-form button {
  padding: 12px 22px; border-radius: 10px; border: 1px solid var(--cyan);
  background: rgba(255, 95, 168, 0.15); color: var(--cyan);
  font-size: 15px; letter-spacing: 2px; cursor: pointer;
}
#login-form button:disabled { opacity: 0.4; cursor: default; }
#login-error { color: #ff7a90; font-size: 13px; min-height: 16px; text-align: center; }
#logout {
  margin-left: 14px;
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--cyan-dim);
  background: transparent; color: var(--muted);
  font-size: 11px; letter-spacing: 2px; cursor: pointer;
}
#logout:hover { border-color: var(--cyan); color: var(--cyan); }

/* ---- Attachments ---- */
#attach {
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--cyan-dim); background: transparent; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#attach:hover { border-color: var(--cyan); color: var(--cyan); }
#tray {
  display: flex; gap: 8px; flex-wrap: wrap;
  max-width: 860px; width: 100%; margin: 0 auto; padding: 0 22px;
}
#tray[hidden] { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 260px;
  padding: 6px 8px; border: 1px solid var(--cyan-dim); border-radius: 10px;
  background: var(--panel); font-size: 12px; color: var(--text);
}
.chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.chip.busy { opacity: 0.6; }
.chip.bad { border-color: #ff7a90; }
.msg .files { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.msg .files a { text-decoration: none; color: inherit; }
.msg .files img { display: block; max-width: 180px; max-height: 140px; border-radius: 8px; border: 1px solid var(--cyan-dim); }
body.dragging::after {
  content: "Drop to attach";
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(14, 3, 9, 0.78); color: var(--cyan);
  font-size: 22px; letter-spacing: 3px; border: 2px dashed var(--cyan);
}

/* ---- Approval cards ---- */
#approvals {
  display: flex; flex-direction: column; gap: 10px;
  max-width: 860px; width: 100%; margin: 0 auto; padding: 0 22px 10px;
}
#approvals[hidden] { display: none; }
.approval {
  padding: 14px 16px; border-radius: 12px;
  border: 1px solid #ffb02e; background: rgba(60, 30, 4, 0.55);
  box-shadow: 0 0 22px rgba(255, 176, 46, 0.18);
}
.ap-head { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #ffb02e; margin-bottom: 6px; }
.ap-what { font-size: 15px; line-height: 1.4; color: var(--text); word-break: break-word; }
.ap-detail { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.ap-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.ap-btns button {
  padding: 9px 18px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--cyan-dim); background: transparent; color: var(--muted);
  font-size: 13px; letter-spacing: 2px;
}
.ap-btns button.primary { border-color: var(--cyan); background: rgba(255, 95, 168, 0.18); color: var(--cyan); }
.ap-btns button:disabled { opacity: 0.4; cursor: default; }
