:root{
  --bg:#0b0f14;
  --card:#121926;
  --muted:#93a4b8;
  --text:#e8eef7;
  --line:#223047;
  --accent:#4aa3ff;
  --danger:#ff5d5d;
  --ok:#29d391;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}
a{color:inherit}
.wrap{max-width:1060px;margin:0 auto;padding:18px}
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  gap:14px;padding:14px 16px;border:1px solid var(--line);
  border-radius:14px;background:rgba(18,25,38,.75);backdrop-filter: blur(8px);
}
.brand{display:flex;align-items:center;gap:10px}
.brand img{width:36px;height:36px;border-radius:10px}
.brand .title{font-weight:900;letter-spacing:.2px}
.badge{font-size:12px;color:var(--muted)}
.btn{
  border:1px solid var(--line);
  background:transparent;color:var(--text);
  padding:10px 12px;border-radius:12px;
  cursor:pointer;font-weight:700;
}
.btn.primary{background:var(--accent);border-color:transparent;color:#06111f}
.btn.danger{background:var(--danger);border-color:transparent;color:#1b0606}
.btn:disabled{opacity:.55;cursor:not-allowed}
.grid{display:grid;grid-template-columns:1.35fr .65fr;gap:14px;margin-top:14px}
@media (max-width: 900px){.grid{grid-template-columns:1fr}}
.card{
  border:1px solid var(--line);
  background:var(--card);
  border-radius:16px;
  padding:14px;
}
.h2{margin:0 0 10px 0;font-size:18px}
.muted{color:var(--muted);font-size:13px;line-height:1.4}
.field{display:flex;flex-direction:column;gap:6px;margin:10px 0}
.field label{font-size:12px;color:var(--muted)}
.field input, .field select, .field textarea{
  background:#0f1623;border:1px solid var(--line);
  color:var(--text);padding:10px 12px;border-radius:12px;
  outline:none;
}
.hr{height:1px;background:var(--line);margin:12px 0}
.list{display:flex;flex-direction:column;gap:10px}
.item{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:10px 12px;border:1px solid var(--line);border-radius:14px;
  background:#0f1623;
}
.item .name{font-weight:800}
.pills{display:flex;gap:6px;flex-wrap:wrap}
.pill{font-size:11px;border:1px solid var(--line);padding:4px 8px;border-radius:999px;color:var(--muted)}
.kbd{font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:12px; padding:4px 8px; border:1px solid var(--line); border-radius:10px; background:#0f1623}
.toast{
  position:fixed;left:50%;bottom:18px;transform:translateX(-50%);
  background:#0f1623;border:1px solid var(--line);
  padding:10px 12px;border-radius:14px;min-width:260px;
  display:none;z-index:9999;
}
.toast.show{display:block}
.toast .t{font-weight:800;margin-bottom:4px}
.toast .m{font-size:13px;color:var(--muted)}
.chat{
  display:flex;flex-direction:column;gap:10px;
  max-height:60vh;overflow:auto;padding-right:4px;
}
.msg{
  border:1px solid var(--line);background:#0f1623;border-radius:14px;
  padding:10px 12px;
}
.msg .meta{display:flex;justify-content:space-between;gap:10px;color:var(--muted);font-size:12px}
.msg .text{margin-top:6px;white-space:pre-wrap}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .btn {
    width: 100%;
  }
}
@media (max-width: 600px) {
  textarea {
    min-height: 120px;
  }
}
/* -----------------------------
   CoachLink mobile chat upgrade
   Safe: layout-only, no JS changes
------------------------------ */
:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }

.page{
  min-height: 100dvh; /* mobile browser address bar friendly */
}

.chatShell{
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 140px); /* topbar + padding */
}

.chatHeader{
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(15,22,35,.65);
}

.chatScroll{
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
}

.composer{
  border-top: 1px solid var(--line);
  padding: 10px;
  padding-bottom: calc(10px + var(--safe-bottom));
  background: #0f1623;
}

.composer textarea{
  width: 100%;
  resize: none;
  min-height: 44px;
}

.composerRow{
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.fileBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.fileBtn input{ display:none; }

.tiny{ font-size: 12px; }

@media (max-width: 600px){
  .wrap{ padding: 12px; }
  .chatShell{ height: calc(100dvh - 150px); }
  .btn{ padding: 12px 14px; }
}
/* --- Chat bubbles (WhatsApp/iMessage style) --- */
.chatScroll{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.msg{
  max-width: 86%;
  width: fit-content;
  border-radius: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #0f1623;
}

.msg.mine{
  align-self: flex-end;
  background: rgba(74,163,255,.16);
  border-color: rgba(74,163,255,.35);
}

.msg.other{
  align-self: flex-start;
}

.msg .meta{
  display:flex;
  justify-content:space-between;
  gap:10px;
  color: var(--muted);
  font-size: 11px;
}

.msg .text{
  margin-top: 6px;
  white-space: pre-wrap;
  line-height: 1.3;
}

.msg .attach{
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.msg .attach a{
  text-decoration: underline;
}
/* --- iOS Safari: prevent auto-zoom on input --- */
input,
textarea {
  font-size: 16px; /* MUST be 16px or more */
}
/* --- Fix white box + half-screen issue on iOS --- */
html, body {
  height: 100%;
  overflow: hidden;
}

.page {
  height: 100dvh;
  background: var(--bg);
}

.chatShell {
  background: var(--card);
}

.composer textarea {
  background: #0f1623;
  color: var(--text);
  border: 1px solid var(--line);
}
/* ==============================
   iPhone Safari FIX: no zoom + no white textarea
   Put this at the VERY BOTTOM of css/styles.css
============================== */

/* Prevent Safari from resizing text unexpectedly */
html {
  -webkit-text-size-adjust: 100%;
}

/* Force iOS to stop zooming form fields */
#msgText,
input,
textarea,
select,
button {
  font-size: 16px !important;      /* the key: MUST be >= 16 and must win */
  line-height: 1.25 !important;
}

/* Stop iOS default white “form control” styling on focus */
#msgText,
textarea {
  -webkit-appearance: none !important;
  appearance: none !important;
  background-color: #0f1623 !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  caret-color: var(--text) !important;
}

/* Keep it dark even when focused */
#msgText:focus,
textarea:focus {
  outline: none !important;
  background-color: #0f1623 !important;
  color: var(--text) !important;
}
/* ===== iPhone Safari: stop zoom + stop white textarea ===== */
html { -webkit-text-size-adjust: 100%; }

#msgText{
  font-size: 16px !important;          /* stops Safari auto-zoom */
  line-height: 1.25 !important;

  -webkit-appearance: none !important; /* stops iOS white control styling */
  appearance: none !important;

  background-color: #0f1623 !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  caret-color: var(--text) !important;
}

#msgText:focus{
  outline: none !important;
  background-color: #0f1623 !important;
  color: var(--text) !important;
}

