/* 911 ALVIND - Responsive, high contrast, iOS-safe layout. */
:root {
    color-scheme: light;
    --bg: #0b1220;
    --panel: #151f31;
    --panel2: #202e43;
    --text: #f5f8fc;
    --muted: #9caec4;
    --line: #33445a;
    --accent: #5fa8ff;
    --danger: #e96069;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

button, input, textarea { font: inherit; }

button {
    cursor: pointer;
    border: 0;
    border-radius: 11px;
    padding: 11px 15px;
    font-weight: 650;
}

button:disabled { opacity: .55; cursor: wait; }
button.primary { background: var(--accent); color: #061326; }
button.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.danger { background: #61282e; color: #fff; border: 1px solid #a94950; }

input, textarea {
    width: 100%;
    background: #0e1727;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    outline: none;
}

input:focus, textarea:focus { border-color: var(--accent); }
label { display: block; margin: 12px 0 6px; color: var(--muted); }
h1, h2, h3, p { margin-top: 0; }
.brand { font-size: 22px; font-weight: 900; letter-spacing: .04em; }
.brand span { color: var(--accent); }
.muted, small { color: var(--muted); }
.error { color: #ff9ea5; margin: 12px 0 0; min-height: 20px; }

/* Login */
.login-wrap {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(100%, 410px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 30px;
}

.login-card h1 { margin: 22px 0 8px; }
.login-card p { color: var(--muted); }
.login-card button { width: 100%; margin-top: 20px; }

/* Portal shell */
.app-shell {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.topbar small { display: block; margin-top: 3px; }

.portal-tools {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 10px;
}

/* Chat */
.chat-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bubble {
    max-width: 87%;
    width: max-content;
    padding: 11px 13px;
    border-radius: 14px;
    background: var(--panel2);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    line-height: 1.45;
}

.bubble.mine { align-self: flex-end; background: #1b4776; }
.bubble .meta { font-size: 11px; color: #bacbe0; margin-top: 6px; }
.bubble.urgent { border: 1px solid var(--danger); }
.bubble a { color: #a9d2ff; }

/* Composer */
.composer {
    flex: none;
    background: var(--panel);
    border-top: 1px solid var(--line);
    padding: 10px 12px 8px;
}

.action-row { display: flex; gap: 8px; margin-bottom: 8px; }
.action-row button { flex: 1; font-size: 12px; padding: 10px 5px; }
.send-row { display: flex; align-items: end; gap: 8px; }
.send-row textarea { resize: none; max-height: 110px; min-height: 45px; }
.status { min-height: 17px; font-size: 12px; color: var(--muted); padding-top: 4px; }

/* Personal information modal */
dialog {
    width: min(94vw, 600px);
    max-height: 85dvh;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 15px;
    color: var(--text);
    padding: 20px;
}

dialog::backdrop { background: #000a; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.info-content { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.info-content a { color: var(--accent); }

/* Admin layout */
.admin-shell { display: flex; min-height: 100dvh; }

.sidebar {
    width: 220px;
    flex: none;
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 22px 14px;
}

.sidebar nav { display: grid; gap: 6px; margin-top: 30px; }
.nav { text-align: left; background: transparent; color: var(--muted); }
.nav.active, .nav:hover { background: var(--panel2); color: var(--text); }
.admin-main { flex: 1; min-width: 0; padding: 24px; max-width: 1300px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 15px; }

.row-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
}

.row-item:last-child { border-bottom: 0; }
.row-item button { flex: none; }
.badge-count { display: inline-block; border-radius: 20px; background: #b8434c; color: white; font-size: 12px; padding: 3px 9px; margin-left: 7px; }
.admin-chat { height: min(70dvh, 700px); display: flex; flex-direction: column; }
.admin-chat .chat-scroll { background: #0e1727; border-radius: 10px; }
.admin-chat .composer { border: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid textarea { min-height: 150px; resize: vertical; }
.inline-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table th, .log-table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.table-wrap { overflow: auto; }

/* Portal information is distinct from the independently scrolling conversation. */
.portal-info {
    flex: none;
    padding: 10px 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.portal-info button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 10px 14px;
}

.portal-info button span { font-size: 21px; color: var(--muted); }
.portal-chat { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; background: var(--bg); }
.portal-chat-title { flex: none; padding: 10px 16px 7px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .03em; border-bottom: 1px solid rgba(156, 174, 196, .12); }
.portal-chat .chat-scroll { min-height: 0; scrollbar-gutter: stable; }
.new-messages { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 2; background: var(--accent); color: #061326; box-shadow: 0 3px 14px #0008; white-space: nowrap; padding: 9px 15px; }
.new-messages[hidden] { display: none; }
.admin-chat { min-height: 0; }
.admin-chat .chat-scroll { min-height: 0; }
.admin-chat .new-messages { position: static; align-self: center; transform: none; margin-top: -42px; margin-bottom: 6px; z-index: 2; }

/* Responsive admin and compact mobile controls */
@media (max-width: 700px) {
    .admin-shell { display: block; }
    .sidebar { width: 100%; padding: 12px; }
    .sidebar .brand { font-size: 17px; }
    .sidebar nav { display: flex; overflow-x: auto; margin-top: 12px; gap: 4px; }
    .nav { white-space: nowrap; font-size: 13px; padding: 10px; }
    .admin-main { padding: 14px; }
    .admin-head { align-items: start; }
    .admin-head h1 { font-size: 22px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
    .action-row button { font-size: 11px; }
}

@media (max-width: 380px) {
    .action-row { flex-direction: column; }
    .action-row button { padding: 7px; }
    .topbar { padding: 9px 12px; }
}

/* ============================================================
   Light visual theme (portal and responsive admin)
   ============================================================ */
:root {
    color-scheme: light;
    --bg: #ffffff;
    --panel: #ffffff;
    --panel2: #f1f5fa;
    --text: #14223b;
    --muted: #66758b;
    --line: #e0e7f0;
    --accent: #246beb;
    --danger: #df303b;
}

button.primary {
    background: var(--accent);
    color: #ffffff;
}

button.danger {
    background: var(--danger);
    color: #ffffff;
    border: 1px solid #c62530;
}

input,
textarea {
    background: #ffffff;
    color: var(--text);
}

.error {
    color: #b92330;
}

.brand span {
    color: #16335d;
}

.login-wrap {
    background: linear-gradient(160deg, #ffffff 55%, #e9f2ff 100%);
}

.login-card {
    box-shadow: 0 12px 40px rgba(18, 43, 80, 0.08);
}

/* Use a real bounded grid track for the chat; only history scrolls. */
html:has(body[data-role="portal"][data-auth="1"]),
body[data-role="portal"][data-auth="1"] {
    height: 100%;
    overflow: hidden;
}

body[data-role="portal"][data-auth="1"] .app-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    background: #ffffff;
}

.topbar {
    background: #ffffff;
}

.portal-info {
    background: #f8faff;
    padding: 9px 14px;
}

.portal-info button {
    background: #eaf2ff;
    color: #194e9e;
    border-color: #d4e4ff;
}

.portal-info button span {
    color: #194e9e;
}

.portal-chat {
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
}

.portal-chat-title {
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.portal-chat .chat-scroll {
    flex: 1 1 0;
    min-height: 0;
    height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: auto;
    touch-action: pan-y;
    padding: 14px 16px 18px;
}

.chat-scroll > .bubble {
    flex: 0 0 auto;
}

.bubble {
    background: #eef2f7;
    color: #14223b;
    border-radius: 17px;
    box-shadow: 0 1px 2px rgba(22, 46, 84, 0.04);
}

.bubble.mine {
    background: #246beb;
    color: #ffffff;
}

.bubble .meta {
    color: #64748b;
}

.bubble.mine .meta,
.bubble.mine .muted {
    color: #e0ebff;
}

.bubble a {
    color: #155ac9;
}

.bubble.mine a {
    color: #ffffff;
    text-decoration: underline;
}

.bubble.urgent {
    border: 2px solid var(--danger);
}

.composer {
    min-height: 0;
    background: #ffffff;
    box-shadow: 0 -3px 18px rgba(22, 46, 84, 0.06);
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
}

.app-shell {
    padding-bottom: 0;
}

.action-row button {
    font-size: 13px;
    padding: 10px 8px;
}

.send-row textarea {
    min-width: 0;
    background: #f8faff;
}

.new-messages {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 3px 14px rgba(22, 46, 84, 0.18);
}

.admin-chat .chat-scroll {
    background: #f8faff;
}

@media (max-width: 700px) {
    .action-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .action-row button {
        padding: 9px 8px;
    }

    .topbar {
        padding: 10px 14px;
    }
}

/* 2026-10-15: approved illustrated, light mobile portal visual direction. */
.brand b { color: #df1020; }
.brand span { color: #10284d; }
.portal-login { text-align: center; border: 0; box-shadow: none; background: transparent; padding: 18px 12px; }
.portal-login .shield-logo { display: block; width: 94px; height: 110px; margin: 0 auto 12px; }
.portal-login .brand-large { font-size: clamp(32px, 9vw, 45px); letter-spacing: -.03em; }
.portal-login .login-tagline { font-size: 17px; margin: 4px 0 10px; }
.portal-login .login-illustration { display: block; width: 100%; max-height: 225px; object-fit: contain; margin: 8px auto; }
.portal-login .login-description { line-height: 1.5; max-width: 340px; margin: 12px auto 22px; }
.portal-login label { text-align: left; }
.portal-login button.primary { background: #1764e5; padding: 15px; }
body[data-role="portal"][data-auth="1"] .app-shell { grid-template-rows: auto minmax(0,1fr) auto; }
.topbar .brand { font-size: 22px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.user-avatar { display: grid; place-items: center; border-radius: 50%; background: #226af0; color: white; width: 37px; height: 37px; font-weight: 750; }
.menu-toggle { border: 0; background: transparent; color: #132a4d; font-size: 23px; padding: 5px 9px; }
.portal-menu { position: absolute; z-index: 20; right: 12px; top: calc(66px + env(safe-area-inset-top)); width: min(290px,calc(100% - 24px)); border-radius: 15px; background: white; box-shadow: 0 12px 35px #142f5240; border: 1px solid #dae5f2; padding: 12px; }
.portal-menu[hidden] { display: none; }
.portal-menu-greeting { color: #53627c; margin: 3px 4px 10px; }
.portal-menu button { display: block; width: 100%; margin: 5px 0; text-align: left; }
.portal-chat-title { text-align: center; font-weight: 600; background: #fafcff; }
.portal-chat .chat-scroll { padding: 12px 16px 20px; }
.bubble { background: #eef2f7; max-width: 86%; padding: 12px 14px; border-radius: 16px; box-shadow: none; }
.bubble.mine { background: #dcecff; color: #163253; }
.bubble .meta, .bubble.mine .meta { display: flex; justify-content: flex-end; align-items: center; gap: 5px; color: #687991; font-size: 11px; }
.receipt { display: inline-block; color: #6b7b90; font-size: 16px; letter-spacing: -4px; padding-right: 4px; font-weight: 750; }
.receipt.read { color: #1677ed; }
.bubble.mine a { color: #155ac9; }
.bubble.location-card { background: #e9f8e9; color: #183b26; min-width: min(270px, 78vw); }
.location-title { font-weight: 750; }
.map-preview { height: 70px; border-radius: 10px; margin: 9px 0; display: grid; place-items: center; background: repeating-linear-gradient(30deg,transparent 0 18px,#fff9 18px 23px,transparent 23px 49px),repeating-linear-gradient(125deg,#d6ecd6 0 19px,#f2f5ed 19px 30px,#d6ecd6 30px 49px); }
.map-pin { font-size: 27px; }
.location-link { font-size: 13px; font-weight: 600; }
.location-accuracy { color: #567565; font-size: 12px; margin-top: 6px; }
.action-row { display: grid; grid-template-columns: 1fr; gap: 7px; }
.action-row button { font-size: 14px; min-height: 42px; border-radius: 13px; }
.action-row .secondary { background: #e1edff; color: #1554b3; border: 0; }
.action-row button span { float: right; }
.send-row textarea { background: #fff; border-radius: 24px; min-height: 42px; max-height: 105px; }
.send-button { flex: none; border-radius: 50%; height: 46px; width: 46px; padding: 0; font-size: 22px; }
.composer { box-shadow: none; border-top: 1px solid #e5eaf1; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
.status:empty { min-height: 0; padding: 0; }
.admin-chat .bubble.mine { background: #dcecff; color: #163253; }
@media(max-height:650px) { .portal-login .shield-logo { height: 70px; width: 70px; } .portal-login .login-illustration { max-height: 130px; } }


/* 2026-10-15 approved refinement: compact actions, modal, small screens. */
body[data-role="portal"][data-auth="1"] .app-shell { grid-template-rows: auto auto minmax(0,1fr) auto; }
.portal-tools { background: #fff; padding: 8px 12px; gap: 8px; border-bottom: 1px solid #e2eaf5; }
.portal-tools button { font-size: 13px; padding: 10px 8px; }
.portal-tools .secondary { flex: 1; background: #e8f1ff; color: #184b96; border-color: #d6e7ff; }
.portal-tools .ghost { flex: none; color: #324c70; }
.connection-banner { background: #fff0d9; color: #6b4209; padding: 8px 12px; font-size: 13px; text-align: center; }
.connection-banner[hidden] { display: none; }
/* The banner is overlaid to avoid changing the chat's fixed grid rows. */
.connection-banner:not([hidden]) { position: absolute; top: 105px; left: 0; right: 0; z-index: 5; }
.portal-login .login-description { display: none; }
.portal-login .login-illustration { max-height: min(205px,25dvh); }
.portal-login .shield-logo { width: 76px; height: 85px; margin-bottom: 4px; }
.portal-login .login-tagline { margin-bottom: 4px; }
.portal-login { padding: 8px 10px; }
.portal-login label { margin-top: 8px; }
.portal-login .pin-visibility { width: auto; margin: 6px 0 0; padding: 4px 8px; font-size: 12px; display: block; margin-left: auto; background: transparent; color: #1958af; }
.portal-login button.primary { margin-top: 10px; }
.login-wrap { padding: 8px 16px; }
.date-separator { align-self: center; background: #edf2f8; border-radius: 18px; color: #536681; padding: 4px 12px; font-size: 12px; margin: 6px 0; flex: none; }
.urgent-modal-content p { color: #394b65; line-height: 1.5; }
#urgent-modal { border: 0; background: #fff; color: #162b4b; box-shadow: 0 15px 50px #10284d35; }
#urgent-modal .modal-head h2 { color: #a92b35; font-size: 20px; margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions .ghost { color: #354866; border-color: #d4dfed; }
.modal-actions .danger { background: #d92c38; }
@media (max-height: 650px) { .portal-login .login-illustration { max-height: 100px; } .portal-login .shield-logo { height: 56px; width: 56px; } }

/* October 2026: photo sharing and admin refinements */
.photo-control{display:inline-flex;align-items:center;justify-content:center;min-width:42px;min-height:42px;cursor:pointer;font-size:22px;border:1px solid var(--line);border-radius:12px;background:#eef5ff;flex-shrink:0}
.chat-photo{display:block;width:min(260px,100%);max-height:300px;object-fit:contain;border-radius:12px}
.photo-link{display:block;max-width:100%}
.photo-preview{display:block;max-width:100%;max-height:50dvh;object-fit:contain;margin:12px auto;border-radius:12px}
#photo-modal{width:min(440px,calc(100% - 24px))}
#photo-modal label{display:block;margin:12px 0}
#photo-modal textarea{width:100%;margin-top:6px}
#info-modal .modal-head h2{font-size:21px;line-height:1.25;margin:0}
#close-info{font-size:24px;line-height:1;padding:5px 11px;flex:none}
.home-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:14px}
.stat-box{border:1px solid var(--line);border-radius:12px;padding:14px;display:flex;flex-direction:column;gap:4px;text-align:center}
.stat-box strong{font-size:25px}.stat-box span{font-size:12px}
.home-message-body{flex:1;min-width:0}.home-message-body p{overflow-wrap:anywhere;margin:8px 0}.home-message-body .muted{font-size:12px}
.urgent-item{border-left:4px solid #d93042}.unread-item{background:#eef5ff}
@media (hover:hover){button:not(:disabled){transition:background-color .18s,border-color .18s,transform .18s}button.primary:hover{filter:brightness(.91)}button.secondary:hover,button.ghost:hover{background:#dbeafe;border-color:#80a9df;color:#123a69}button.danger:hover{filter:brightness(.85)}[data-page]:hover:not(.active){background:#e8f1ff}}
button:focus-visible,.photo-control:focus-within{outline:3px solid #2879e5;outline-offset:2px}
button:active:not(:disabled){transform:translateY(1px)}
@media(max-width:560px){.home-stats{gap:5px}.stat-box{padding:10px 4px}.row-item.home-message{align-items:flex-start}.home-message button{padding:8px}}

/* Photo selection and Safari-friendly preview dialog */
.admin-photo-dialog { width:min(92vw,480px); max-height:85dvh; overflow:auto; border:1px solid #dbe4f0; border-radius:16px; padding:20px; }
.admin-photo-dialog::backdrop { background:rgba(8,20,40,.55); }
.admin-photo-dialog .photo-preview { max-width:100%; max-height:48dvh; object-fit:contain; display:block; margin:12px auto; }
.admin-photo-dialog textarea { width:100%; box-sizing:border-box; }
.photo-control { cursor:pointer; touch-action:manipulation; flex-shrink:0; }

/* Upload progress and Safari-compatible preview */
.upload-progress{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:12px 0;color:var(--text);font-size:13px}
.upload-progress[hidden]{display:none!important}
.upload-progress progress{width:100%;height:9px;accent-color:#2563eb}
.upload-spinner{width:18px;height:18px;border:3px solid #cbd5e1;border-top-color:#2563eb;border-radius:50%;animation:upload-spin .8s linear infinite;flex:none}
@keyframes upload-spin{to{transform:rotate(360deg)}}
.photo-preview[hidden]{display:none!important}
.image-load-error{font-size:13px;color:#a32935;display:block;padding:12px}

/* Mobile photo dialogs: bounded image and persistent actions */
#photo-modal,.admin-photo-dialog{
 box-sizing:border-box;width:min(440px,calc(100vw - 28px));
 max-height:min(85dvh,720px);overflow-y:auto;overscroll-behavior:contain;
 padding:16px;border-radius:18px;
}
#photo-modal .photo-preview,.admin-photo-dialog .photo-preview{
 width:auto;max-width:100%;height:auto;max-height:220px;
 object-fit:contain;margin:10px auto;border-radius:12px;
}
#photo-modal .modal-head,.admin-photo-dialog h2{margin-bottom:8px}
#photo-modal label{margin:8px 0}
#photo-modal textarea,.admin-photo-dialog textarea{min-height:60px;max-height:100px}
#photo-modal .modal-actions,.admin-photo-dialog .modal-actions{
 position:sticky;bottom:-16px;z-index:2;background:#fff;
 padding:12px 0 16px;margin-top:8px;border-top:1px solid #e5eaf2;
}
#photo-modal .modal-actions button,.admin-photo-dialog .modal-actions button{min-height:44px}
@media(max-height:650px){
 #photo-modal .photo-preview,.admin-photo-dialog .photo-preview{max-height:140px}
}

/* Portal photo composer: fit small phones and keep send button visible. */
#photo-modal[open]{
 display:flex;flex-direction:column;gap:8px;
 width:min(440px,calc(100vw - 24px));
 max-height:min(82dvh,680px);
 max-height:min(82svh,680px);
 padding:16px;overflow:hidden;
}
#photo-modal .modal-head{flex:none;display:flex;align-items:center;justify-content:space-between;margin:0}
#photo-modal .modal-head h2{font-size:clamp(20px,5vw,26px);margin:0}
#photo-modal #cancel-photo{width:44px;height:44px;min-width:44px;padding:0;flex:none}
#photo-modal #photo-preview{
 display:block;flex:0 1 auto;min-height:0;max-width:100%;
 max-height:min(26dvh,190px);max-height:min(26svh,190px);
 object-fit:contain;margin:0 auto;
}
#photo-modal #photo-preview[hidden]{display:none}
#photo-modal #photo-preview-note{flex:none;margin:0}
#photo-modal label{flex:1 1 auto;min-height:0;overflow:auto;margin:0;font-size:15px}
#photo-modal #photo-caption{display:block;min-height:54px;max-height:84px;font-size:16px}
#photo-modal .upload-progress{flex:none;min-height:0}
#photo-modal .modal-actions{
 position:static;flex:none;display:flex;justify-content:flex-end;
 margin:0;padding:10px 0 0;background:#fff;border-top:1px solid #e5eaf2;
}
#photo-modal #send-photo{min-height:46px}
@media(max-height:650px){
 #photo-modal[open]{max-height:85dvh;max-height:85svh;padding:12px}
 #photo-modal #photo-preview{max-height:125px}
 #photo-modal #photo-caption{min-height:44px}
}

/* Family portal: compact attachment menu and 44px composer controls. */
body[data-role="portal"] .send-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    min-width: 0;
}
body[data-role="portal"] .send-row > textarea {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    font-size: 16px;
}
body[data-role="portal"] .send-row > .send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    border-radius: 50%;
    padding: 0;
    font-size: 20px;
}
.portal-attachment-control {
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
}
.portal-attachment-control .attachment-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid #d5e3f6;
    border-radius: 13px;
    background: #edf4ff;
    color: #194d91;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
}
.portal-attachment-control .attachment-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    z-index: 30;
    width: 168px;
    padding: 6px;
    border: 1px solid #d7e2f2;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 25px rgba(13, 38, 75, 0.17);
}
.portal-attachment-control .attachment-menu[hidden] { display: none; }
.portal-attachment-control .attachment-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #17365d;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}
.portal-attachment-control .attachment-menu button:hover,
.portal-attachment-control .attachment-menu button:focus-visible { background: #eaf2ff; }
.portal-attachment-control .attachment-toggle:focus-visible { outline: 3px solid #2879e5; outline-offset: 2px; }
body[data-role="portal"] #status:empty { display: none; }
