* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, system-ui, sans-serif;
  background: #0f1115; color: #e8e8ea; height: 100vh;
}
body.centered { display: flex; align-items: center; justify-content: center; }

.card {
  background: #1b1e26; padding: 28px; border-radius: 12px;
  width: 320px; display: flex; flex-direction: column; gap: 12px;
}
.card h1, .card h2 { font-size: 18px; }
input, button {
  font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid #333947;
}
input { background: #11141b; color: #e8e8ea; }
button { background: #3b82f6; color: #fff; border: none; cursor: pointer; }
button:hover { background: #2f6fd6; }
.error { color: #f87171; font-size: 14px; }

/* Admin */
.admin { max-width: 720px; margin: 0 auto; padding: 24px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.new-chat { width: 100%; margin-bottom: 20px; }
.chat-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.chat-list li {
  background: #1b1e26; padding: 12px; border-radius: 10px;
  display: flex; align-items: center; gap: 10px;
}
.chat-list .open { color: #e8e8ea; font-weight: 600; text-decoration: none; flex: 1; }
.chat-list .meta { color: #8b91a0; font-size: 13px; }
.chat-list button { padding: 6px 10px; font-size: 13px; background: #333947; }
.chat-list .delete { background: #7f1d1d; }

/* Chat */
.chat { display: flex; flex-direction: column; height: 100vh; max-width: 760px; margin: 0 auto; }
.chat-head {
  padding: 14px 18px; background: #1b1e26;
  display: flex; justify-content: space-between; align-items: center;
}
.chat-title { font-weight: 600; }
.back { color: #8b91a0; text-decoration: none; font-size: 14px; }
.messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 75%; padding: 9px 13px; border-radius: 14px; word-wrap: break-word; }
.msg.mine { align-self: flex-end; background: #3b82f6; }
.msg.theirs { align-self: flex-start; background: #262a35; }
.msg .sender { font-size: 11px; opacity: 0.7; margin-bottom: 3px; }
.msg img, .msg video { max-width: 100%; border-radius: 8px; display: block; }
.msg audio { max-width: 100%; display: block; margin-top: 2px; }
.msg a.file {
  color: inherit; text-decoration: underline; display: inline-block; padding: 4px 0;
}
.msg .time { font-size: 10px; opacity: 0.6; margin-top: 3px; }

.composer { display: flex; gap: 8px; padding: 12px; background: #1b1e26; }
.composer .attach {
  display: flex; align-items: center; justify-content: center;
  width: 42px; border-radius: 8px; background: #333947; cursor: pointer; font-size: 20px;
}
.composer input[type=text] { flex: 1; }

.upload-bar { padding: 8px 12px; background: #1b1e26; display: flex; gap: 10px; align-items: center; }
.upload-bar[hidden] { display: none; }
.upload-progress { flex: 1; height: 6px; background: #333947; border-radius: 3px; overflow: hidden; }
.upload-fill { height: 100%; width: 0; background: #3b82f6; transition: width 0.2s; }
#uploadLabel { font-size: 12px; color: #8b91a0; }

.record-bar { padding: 8px 12px; background: #1b1e26; display: flex; gap: 10px; align-items: center; }
.record-bar[hidden] { display: none; }
.record-state { flex: 1; font-size: 13px; color: #8b91a0; }
.record-state.live { color: #f87171; }
.record-preview { flex: 1; height: 34px; }
.record-bar button { padding: 6px 12px; font-size: 13px; }
.record-bar #recordCancel { background: #333947; }
.composer .mic {
  width: 42px; border-radius: 8px; border: 1px solid #333947;
  background: #333947; color: #fff; cursor: pointer; font-size: 18px;
  user-select: none; touch-action: none;
}
.composer .mic.recording { background: #7f1d1d; }
