:root{font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color-scheme:dark;background:#101318;color:#eef2f7}*{box-sizing:border-box}body{margin:0;background:#101318}a{color:#9bc4ff;text-decoration:none}.wrap{max-width:1080px;margin:auto;padding:20px}.card{background:#181d24;border:1px solid #2a323d;border-radius:16px;padding:20px;margin:16px 0;box-shadow:0 8px 30px #0003}.narrow{max-width:460px;margin:9vh auto}h1,h2{margin-top:0}label{display:block;margin:14px 0;color:#cbd5e1}input,textarea,select{width:100%;margin-top:6px;padding:12px;border-radius:10px;border:1px solid #394454;background:#0f141a;color:#fff;font:inherit}button,.button{display:inline-block;padding:10px 14px;border:0;border-radius:10px;background:#4f8cff;color:white;font-weight:650;cursor:pointer}.wide{width:100%;margin-top:10px}.secondary{background:#303946}.danger{background:#ad3944}.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.top{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:16px}.muted{color:#94a3b8}.small{font-size:.86rem}.error{background:#511f26;border:1px solid #8d3743;padding:12px;border-radius:10px;margin:12px 0}.messages{min-height:55vh;display:flex;flex-direction:column;gap:10px;padding:8px}.msg{max-width:75%;padding:10px 12px;border-radius:14px;background:#26303b}.msg.mine{margin-left:auto;background:#284d7b}.msg small{display:block;color:#a8b3c0;margin-top:5px;font-size:.72rem}.composer{display:grid;grid-template-columns:1fr auto;gap:8px;position:sticky;bottom:0;background:#101318;padding:10px 0}.composer textarea{margin:0}.centre{text-align:center}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:14px}.grid .card{margin:0}table{width:100%;border-collapse:collapse;font-size:.92rem}th,td{text-align:left;border-bottom:1px solid #2a323d;padding:9px;vertical-align:top}.check{display:flex;gap:8px;align-items:center}.check input{width:auto;margin:0}.inviteout{margin-top:12px}.inviteout input{font-size:.8rem}.modal{position:fixed;inset:0;background:#000c;display:flex;align-items:center;justify-content:center;padding:20px;z-index:10}.modal .card{margin:0}video{width:100%;max-height:260px;border-radius:12px;margin:10px 0}@media(max-width:650px){.wrap{padding:12px}.msg{max-width:90%}table{font-size:.8rem}.composer{grid-template-columns:1fr}.grid{grid-template-columns:1fr}}
.user-list{display:flex;flex-direction:column;gap:12px}
.user-card{border:1px solid #2a323d;border-radius:12px;padding:14px;background:#141920}
.user-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.status-pill{font-size:.78rem;background:#26303b;padding:5px 8px;border-radius:999px;white-space:nowrap}
.user-meta{display:flex;gap:14px;flex-wrap:wrap;margin:12px 0;color:#94a3b8;font-size:.86rem}
.user-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.user-actions form{margin:0}
.user-actions .button,.user-actions button{width:auto;white-space:nowrap}
@media(max-width:650px){
  .user-head{flex-direction:column}
  .user-actions{display:grid;grid-template-columns:1fr 1fr}
  .user-actions .button,.user-actions button{width:100%;text-align:center}
}

.chat-image{display:block;max-width:min(100%,460px);max-height:520px;object-fit:contain;border-radius:12px;margin-top:8px;background:#0b0f14}
.media-composer{grid-template-columns:minmax(0,1fr) auto;align-items:end}
.compose-main{min-width:0}
.compose-tools{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-top:7px}
.file-button{position:relative;overflow:hidden;cursor:pointer}
.file-button input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%;margin:0}
.emoji-panel{display:flex;gap:5px;flex-wrap:wrap;background:#181d24;border:1px solid #303946;border-radius:10px;padding:8px;margin-top:7px}
.emoji-panel button{background:#252d37;padding:6px 8px;font-size:1.15rem}
.send-button{height:44px}
@media(max-width:650px){
 .media-composer{grid-template-columns:1fr}
 .send-button{width:100%}
 .chat-image{max-width:100%;max-height:420px}
}

.install-help{margin-top:16px;border-top:1px solid #2a323d;padding-top:12px}
.install-help details{background:#141920;border:1px solid #2a323d;border-radius:10px;padding:10px 12px}
.install-help summary{cursor:pointer;font-weight:650}
.install-help-body{margin-top:10px;color:#cbd5e1}
.install-help-body p{margin:10px 0 5px}
.install-help-body ol{margin:6px 0 12px 20px;padding:0}
.install-help-body li{margin:4px 0}

/* v6.4 mobile sizing: make the installed PWA feel like a native phone app */
html,body{min-height:100%;-webkit-text-size-adjust:100%}
button,.button,input,textarea,select{font-size:16px}
button,.button{min-height:44px}
input,select{min-height:46px}
textarea{font-size:16px;line-height:1.35}

@media(max-width:700px){
  html{font-size:18px}
  body{min-height:100dvh}
  .wrap{
    width:100%;
    max-width:none;
    min-height:100dvh;
    margin:0;
    padding:12px;
  }
  .card{
    border-radius:14px;
    padding:16px;
  }
  .narrow{
    width:100%;
    max-width:none;
    margin:2vh 0;
  }
  h1{font-size:1.65rem}
  h2{font-size:1.35rem}
  .top{
    position:sticky;
    top:0;
    z-index:4;
    background:#101318;
    padding:8px 0 10px;
    margin-bottom:8px;
  }
  .messages{
    min-height:calc(100dvh - 235px);
    padding:4px 0 10px;
    gap:10px;
  }
  .msg{
    max-width:92%;
    padding:12px 14px;
    border-radius:16px;
    font-size:1rem;
  }
  .msg small{font-size:.72rem}
  .media-composer{
    position:sticky;
    bottom:0;
    z-index:5;
    background:#101318;
    margin:0 -12px;
    padding:10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top:1px solid #252d37;
    grid-template-columns:1fr;
  }
  .media-composer textarea{
    min-height:54px;
    max-height:130px;
    font-size:18px;
    border-radius:14px;
    padding:12px;
  }
  .compose-tools{gap:8px}
  .compose-tools .button,.compose-tools button{
    min-height:46px;
    padding:10px 13px;
  }
  .send-button{
    width:100%;
    height:48px;
    font-size:1rem;
  }
  .emoji-panel button{
    min-width:44px;
    min-height:44px;
    font-size:1.25rem;
  }
  .install-help summary{font-size:1rem}
  .install-help-body{font-size:.95rem}
}

@media(min-width:701px) and (max-width:1000px){
  .wrap{max-width:900px}
}


/* v6.5: Android/touchscreen layout.
   Some installed PWAs report a wider CSS viewport than expected. Targeting
   a coarse pointer makes the phone layout apply even in that case. */
[hidden]{display:none !important}

@media (hover:none) and (pointer:coarse) {
  html{font-size:21px}
  body{min-height:100dvh;line-height:1.4}

  .wrap{
    width:100%;
    max-width:none;
    min-height:100dvh;
    margin:0;
    padding:16px;
  }

  .top{
    position:sticky;
    top:0;
    z-index:10;
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:12px;
    background:#101318;
    padding:10px 0 12px;
    margin-bottom:8px;
  }

  .top > div:first-child strong{font-size:1.18rem}
  .top .muted{font-size:.84rem}

  .top .row{
    width:100%;
    display:flex;
    gap:10px;
    align-items:stretch;
  }

  .top .row > button,
  .top .row > form{
    flex:1 1 auto;
  }

  .top .row > form button,
  .top .row > button{
    width:100%;
    min-height:52px;
    padding:11px 12px;
    font-size:16px;
  }

  .messages{
    min-height:calc(100dvh - 330px);
    padding:8px 0 16px;
    gap:12px;
  }

  .msg{
    max-width:88%;
    padding:14px 16px;
    border-radius:18px;
    font-size:20px;
    line-height:1.35;
  }

  .msg small{
    font-size:13px;
    margin-top:7px;
  }

  .media-composer{
    position:sticky;
    bottom:0;
    z-index:12;
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
    margin:0 -16px;
    padding:12px 16px calc(14px + env(safe-area-inset-bottom));
    background:#101318;
    border-top:1px solid #252d37;
  }

  .media-composer textarea{
    width:100%;
    min-height:64px;
    max-height:160px;
    padding:14px;
    border-radius:15px;
    font-size:20px;
    line-height:1.35;
  }

  .compose-tools{
    display:flex;
    gap:9px;
    flex-wrap:wrap;
    align-items:center;
  }

  .compose-tools .button,
  .compose-tools button{
    min-height:50px;
    padding:11px 15px;
    font-size:17px;
  }

  .send-button{
    width:100%;
    min-height:54px;
    height:auto;
    font-size:19px;
    border-radius:13px;
  }

  .emoji-panel{
    gap:8px;
    padding:10px;
    border-radius:13px;
  }

  .emoji-panel[hidden]{display:none !important}

  .emoji-panel button{
    min-width:48px;
    min-height:48px;
    padding:6px;
    font-size:1.35rem;
  }

  .chat-image{
    max-width:100%;
    max-height:58dvh;
    border-radius:14px;
  }

  input,select{
    min-height:52px;
    font-size:18px;
  }

  button,.button{
    min-height:48px;
  }

  .card{
    padding:18px;
    border-radius:16px;
  }

  .narrow{
    width:100%;
    max-width:none;
    margin:1vh 0;
  }
}

@media (hover:none) and (pointer:coarse) and (max-height:700px) {
  .messages{min-height:40dvh}
}


/* v6.8 — hard mobile sizing + cache-busted stylesheet.
   The previous phone screenshot showed desktop-scale text. These rules
   deliberately use large absolute sizes and apply up to 1100px as well as
   touch/coarse-pointer devices. */
@media (max-width:1100px), (hover:none) and (pointer:coarse) {
  html{
    font-size:22px !important;
    -webkit-text-size-adjust:100% !important;
    text-size-adjust:100% !important;
  }

  body{
    font-size:20px !important;
    line-height:1.45 !important;
  }

  .wrap{
    width:100% !important;
    max-width:none !important;
    min-height:100dvh !important;
    margin:0 !important;
    padding:14px !important;
  }

  .top{
    position:sticky !important;
    top:0 !important;
    z-index:20 !important;
    display:flex !important;
    flex-direction:column !important;
    align-items:stretch !important;
    gap:10px !important;
    padding:10px 0 12px !important;
    margin:0 0 8px !important;
    background:#101318 !important;
  }

  .top > div:first-child strong{
    font-size:24px !important;
    line-height:1.2 !important;
  }

  .top .muted{
    font-size:16px !important;
  }

  .top .row{
    display:grid !important;
    grid-template-columns:1fr 1fr 0.8fr !important;
    gap:8px !important;
    width:100% !important;
  }

  .top .row > button,
  .top .row > form,
  .top .row > form button{
    width:100% !important;
    min-width:0 !important;
  }

  .top .row button{
    min-height:52px !important;
    padding:9px 8px !important;
    font-size:16px !important;
    line-height:1.15 !important;
  }

  .messages{
    min-height:calc(100dvh - 345px) !important;
    padding:8px 0 14px !important;
    gap:12px !important;
  }

  .msg{
    max-width:90% !important;
    padding:14px 16px !important;
    border-radius:18px !important;
    font-size:21px !important;
    line-height:1.35 !important;
  }

  .msg small{
    display:block !important;
    margin-top:6px !important;
    font-size:13px !important;
    line-height:1.2 !important;
  }

  .media-composer{
    position:sticky !important;
    bottom:0 !important;
    z-index:25 !important;
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:9px !important;
    margin:0 -14px !important;
    padding:11px 14px calc(12px + env(safe-area-inset-bottom)) !important;
    background:#101318 !important;
    border-top:1px solid #2a323d !important;
  }

  .compose-main{
    width:100% !important;
    min-width:0 !important;
  }

  .media-composer textarea{
    box-sizing:border-box !important;
    width:100% !important;
    min-height:66px !important;
    max-height:150px !important;
    padding:14px !important;
    border-radius:14px !important;
    font-size:21px !important;
    line-height:1.3 !important;
  }

  .compose-tools{
    display:grid !important;
    grid-template-columns:auto 1fr 1fr !important;
    gap:8px !important;
    width:100% !important;
    margin-top:8px !important;
  }

  .compose-tools .button,
  .compose-tools button{
    min-height:50px !important;
    padding:10px 12px !important;
    font-size:17px !important;
    line-height:1.1 !important;
  }

  .send-button{
    width:100% !important;
    min-height:54px !important;
    height:auto !important;
    padding:10px 14px !important;
    border-radius:13px !important;
    font-size:20px !important;
    font-weight:700 !important;
  }

  .emoji-panel{
    gap:7px !important;
    padding:9px !important;
    margin-top:8px !important;
  }

  .emoji-panel[hidden]{
    display:none !important;
  }

  .emoji-panel button{
    min-width:48px !important;
    min-height:48px !important;
    padding:5px !important;
    font-size:26px !important;
  }

  .chat-image{
    max-width:100% !important;
    max-height:58dvh !important;
  }

  input,select,textarea{
    font-size:20px !important;
  }

  input,select{
    min-height:52px !important;
    padding:10px 12px !important;
  }

  button,.button{
    min-height:48px !important;
  }

  .card{
    padding:18px !important;
    border-radius:16px !important;
  }

  .narrow{
    width:100% !important;
    max-width:none !important;
    margin:1vh 0 !important;
  }

  h1{font-size:30px !important}
  h2{font-size:25px !important}
  .small{font-size:14px !important}
}

@media (max-width:430px) {
  .top .row{
    grid-template-columns:1fr 1fr !important;
  }
  .top .row > form{
    grid-column:1 / -1 !important;
  }
}


/* v6.9 — conversation viewport.
   Header and composer stay visible; only the message history scrolls.
   Short conversations sit just above the composer instead of at the top
   of a mostly-empty phone screen. */
@media (max-width:1100px), (hover:none) and (pointer:coarse) {
  html,body{
    height:100% !important;
    overflow:hidden !important;
  }

  .wrap{
    height:100dvh !important;
    min-height:0 !important;
    display:flex !important;
    flex-direction:column !important;
    overflow:hidden !important;
    padding-top:max(10px, env(safe-area-inset-top)) !important;
    padding-bottom:0 !important;
  }

  .top{
    position:relative !important;
    top:auto !important;
    flex:0 0 auto !important;
  }

  .messages{
    flex:1 1 auto !important;
    min-height:0 !important;
    height:auto !important;
    overflow-y:auto !important;
    overscroll-behavior:contain !important;
    -webkit-overflow-scrolling:touch !important;
    scroll-behavior:auto !important;
    padding:10px 0 12px !important;
  }

  /* With only a few messages, keep them beside the composer at the bottom. */
  .messages > :first-child{
    margin-top:auto !important;
  }

  .media-composer{
    position:relative !important;
    bottom:auto !important;
    flex:0 0 auto !important;
    margin:0 -14px !important;
  }
}

/* The login/admin card pages should remain normally scrollable. */
body:has(.card.narrow) {
  overflow:auto;
}
