
:root { --navy:#0b2545; --navy-light:#13355e; --gold:#c9a227; --gold-light:#e5c65c; --bg:#f4f6f9; --card:#fff; --text:#1c2b3a; --muted:#647184; --danger:#b3261e; --border:#e3e7ee; --border-strong:#d7dde5; --radius:10px; }
body.dark { --bg:#0d1522; --card:#182338; --text:#e7ecf5; --muted:#93a1b8; --border:#2a374d; --border-strong:#344259; --danger:#ff6b60; }
* { box-sizing:border-box; }
/* NOTE: `color` is deliberately NOT transitioned. Dark mode works by redefining --text on
   body.dark, and with a transition on `color` the browser keeps serving the pre-toggle value
   for anything that INHERITS its colour from body — chat message text most visibly. The result
   was #1c2b3a text on a #0d1522 background (1.27:1, unreadable) after toggling dark mode, which
   corrected itself on reload and so looked like a phantom. Background still fades. */
body { margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif; background:var(--bg); color:var(--text); transition:background .25s ease; }
.preview-banner { background:var(--gold); color:var(--navy); font-size:12.5px; font-weight:700; text-align:center; padding:7px 10px; letter-spacing:0.2px; }
.preview-banner button { margin-left:10px; background:var(--navy); color:#fff; border:none; border-radius:6px; padding:3px 9px; font-size:11px; font-weight:700; cursor:pointer; }
#app { min-height:100vh; }
.login-wrap { min-height:calc(100vh - 34px); display:flex; align-items:center; justify-content:center; background:radial-gradient(circle at 18% 22%, rgba(201,162,39,0.14) 0%, transparent 42%), radial-gradient(circle at 84% 78%, rgba(201,162,39,0.10) 0%, transparent 45%), linear-gradient(160deg,var(--navy) 0%,var(--navy-light) 55%,#1c4a7a 100%); padding:30px 16px; }
.login-card { background:var(--card); width:560px; max-width:94vw; border-radius:18px; padding:44px 36px 38px; box-shadow:0 30px 80px rgba(0,0,0,0.45); text-align:center; animation:modalPop .4s cubic-bezier(.2,.8,.3,1.2); border-top:4px solid var(--gold); }
.brand-mark-row { display:flex; align-items:center; justify-content:center; margin-bottom:14px; }
.brand-logo-img { height:280px; width:auto; max-width:100%; }
.brand-logo-badge { display:inline-flex; align-items:center; background:#fff; border-radius:10px; padding:8px 16px; }
.brand-logo-badge img { height:78px; width:auto; display:block; }
.login-card h1 { font-size:21px; margin:6px 0 6px; color:var(--navy); font-weight:800; letter-spacing:0.2px; }
.login-card p.sub { color:var(--muted); font-size:13px; margin-bottom:26px; line-height:1.55; }
.remember-row { display:flex; align-items:center; gap:8px; margin:-6px 0 20px; font-size:13px; color:var(--muted); text-align:left; }
.remember-row input { width:auto; margin:0; }
.remember-row label { display:flex; align-items:center; gap:8px; cursor:pointer; }
.field { text-align:left; margin-bottom:14px; }
.field label { display:block; font-size:12px; font-weight:600; color:var(--muted); margin-bottom:4px; }
.field input, .field select, .field textarea { width:100%; padding:10px 12px; border:1px solid var(--border-strong); border-radius:8px; font-size:14px; font-family:inherit; background:var(--card); color:var(--text); transition:border-color .15s ease; }
.field input:focus, .field select:focus, .field textarea:focus { outline:none; border-color:var(--gold); }
.field textarea { resize:vertical; min-height:70px; }
.btn { display:inline-block; border:none; border-radius:8px; padding:10px 18px; font-size:14px; font-weight:600; cursor:pointer; transition:background .15s ease, transform .08s ease, box-shadow .15s ease; }
.btn:active { transform:scale(.96); }
.btn-primary { background:var(--navy); color:#fff; width:100%; }
.btn-primary:hover { background:var(--navy-light); }
.btn-gold { background:var(--gold); color:var(--navy); }
.btn-gold:hover { background:var(--gold-light); box-shadow:0 4px 14px rgba(201,162,39,0.4); }
.btn-outline { background:transparent; border:1px solid var(--border-strong); color:var(--text); }
.btn-outline:hover { border-color:var(--navy); }
body.dark .btn-outline:hover { border-color:var(--text); }
.btn-danger { background:#fdeceb; color:var(--danger); }
.btn-danger:hover { background:#fbdbd9; }
.btn-sm { padding:6px 10px; font-size:12.5px; }
.error-msg { background:#fdeceb; color:var(--danger); border-radius:8px; padding:8px 10px; font-size:13px; margin-bottom:14px; }
.hint-box { margin-top:18px; font-size:11.5px; color:var(--muted); background:var(--bg); border-radius:8px; padding:10px; text-align:left; line-height:1.5; }
.site-header { position:fixed; top:0; left:0; right:0; z-index:50; box-shadow:0 2px 10px rgba(0,0,0,0.15); }
.topbar { background:var(--navy); color:#fff; display:flex; align-items:center; justify-content:space-between; padding:12px 24px; min-height:110px; flex-wrap:wrap; gap:8px; }
.topbar .brand { display:flex; align-items:center; gap:10px; }
.topbar .brand-name { font-weight:700; letter-spacing:0.5px; font-size:13px; }
.topbar .social-links { display:flex; gap:8px; margin-left:6px; }
.topbar .social-links a { color:rgba(255,255,255,0.75); text-decoration:none; font-size:12px; border:1px solid rgba(255,255,255,0.25); border-radius:20px; padding:3px 9px; transition:all .15s ease; }
.topbar .social-links a:hover { color:var(--navy); background:var(--gold); border-color:var(--gold); }
.topbar .user-info { display:flex; align-items:center; gap:10px; font-size:13px; flex-wrap:wrap; }
.topbar .user-info .avatar-mini { width:28px; height:28px; border-radius:50%; background:var(--gold); color:var(--navy); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; overflow:hidden; position:relative; flex-shrink:0; }
.topbar .user-info .avatar-mini img { width:100%; height:100%; object-fit:cover; }
.topbar .btn-outline { color:#fff; border-color:rgba(255,255,255,0.55); }
.topbar .btn-outline:hover { color:#fff; border-color:#fff; background:rgba(255,255,255,0.1); }
.status-dot { width:9px; height:9px; border-radius:50%; display:inline-block; flex-shrink:0; box-shadow:0 0 0 2px var(--card); }
.status-dot.online { background:#2fbf6e; }
.status-dot.offline { background:#c94b3f; }
.topbar .role-badge { background:var(--gold); color:var(--navy); font-size:10.5px; font-weight:700; padding:2px 8px; border-radius:20px; text-transform:uppercase; }
.tabs { display:flex; gap:4px; background:var(--card); border-bottom:1px solid var(--border); padding:0 20px; flex-wrap:wrap; }
.tab-btn { border:none; background:transparent; padding:14px 16px; font-size:13.5px; font-weight:600; color:var(--muted); cursor:pointer; border-bottom:3px solid transparent; transition:color .15s ease, border-color .15s ease; }
.tab-btn:hover { color:var(--navy); }
body.dark .tab-btn:hover { color:var(--gold-light); }
.tab-btn.active { color:var(--navy); border-bottom-color:var(--gold); }
body.dark .tab-btn.active { color:#fff; }
.content { padding:24px; max-width:1100px; margin:0 auto; animation:fadeSlideIn .35s ease; }
@keyframes fadeSlideIn { from{opacity:0; transform:translateY(8px);} to{opacity:1; transform:translateY(0);} }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes modalPop { from{opacity:0; transform:scale(.95) translateY(10px);} to{opacity:1; transform:scale(1) translateY(0);} }
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; flex-wrap:wrap; gap:10px; }
.section-header h2 { margin:0; font-size:20px; color:var(--navy); }
body.dark .section-header h2 { color:#fff; }
.section-header p.desc { margin:2px 0 0; font-size:13px; color:var(--muted); }
.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:16px; }
.card { background:var(--card); border-radius:var(--radius); border:1px solid var(--border); overflow:hidden; display:flex; flex-direction:column; transition:transform .18s ease, box-shadow .18s ease; cursor:pointer; }
.card:hover { transform:translateY(-3px); box-shadow:0 12px 26px rgba(11,37,69,0.14); }
.card-media { height:110px; background:linear-gradient(135deg,var(--navy),var(--navy-light)); display:flex; align-items:center; justify-content:center; color:rgba(255,255,255,0.85); font-size:13px; letter-spacing:1px; position:relative; text-align:center; padding:0 10px; overflow:hidden; }
.card-media img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.card-media .media-caption { position:relative; z-index:1; background:rgba(11,37,69,0.7); padding:3px 9px; border-radius:12px; font-size:11px; }
.pocket-badge { position:absolute; top:10px; right:10px; background:var(--gold); color:var(--navy); font-size:10px; font-weight:800; padding:3px 8px; border-radius:20px; letter-spacing:0.5px; z-index:2; }
.featured-star { position:absolute; top:9px; left:9px; z-index:2; background:rgba(255,255,255,0.92); color:var(--gold); border:none; border-radius:50%; width:28px; height:28px; font-size:15px; cursor:default; display:flex; align-items:center; justify-content:center; box-shadow:0 2px 6px rgba(0,0,0,0.25); }
.featured-star.clickable { cursor:pointer; }
.featured-star.clickable:hover { transform:scale(1.12); }
.featured-star.is-off { color:#c7ccd4; }
.card-body { padding:14px 16px; flex:1; display:flex; flex-direction:column; gap:6px; }
.card-title { font-weight:700; font-size:15.5px; color:var(--navy); }
body.dark .card-title { color:#fff; }
.card-sub { font-size:12.5px; color:var(--muted); }
.card-price { font-weight:700; color:var(--navy); font-size:15px; margin-top:2px; }
body.dark .card-price { color:var(--gold-light); }
.card-desc { font-size:12.5px; color:var(--muted); line-height:1.4; margin:4px 0; flex:1; }
.card-footer { display:flex; align-items:center; justify-content:space-between; margin-top:6px; font-size:11.5px; color:var(--muted); }
.card-link { font-size:12px; font-weight:700; color:var(--navy); text-decoration:none; }
body.dark .card-link { color:var(--gold-light); }
.card-link:hover { text-decoration:underline; }
.card-actions { display:flex; gap:6px; padding:0 16px 14px; flex-wrap:wrap; }
.empty-state { text-align:center; padding:50px 20px; color:var(--muted); background:var(--card); border-radius:var(--radius); border:1px dashed var(--border-strong); }
.doc-group { margin-bottom:22px; }
.doc-group h3 { font-size:13px; text-transform:uppercase; letter-spacing:0.5px; color:var(--muted); margin-bottom:8px; }
.doc-row { display:flex; align-items:center; justify-content:space-between; background:var(--card); border:1px solid var(--border); border-radius:8px; padding:12px 14px; margin-bottom:8px; gap:12px; flex-wrap:wrap; }
.doc-row .doc-title { font-weight:600; font-size:14px; color:var(--text); }
.doc-row .doc-desc { font-size:12px; color:var(--muted); margin-top:2px; }
.doc-row.is-hidden { opacity:0.55; }
.sort-select { padding:8px 12px; border:1px solid var(--border-strong); border-radius:8px; font-size:13px; background:var(--card); color:var(--text); }
.search-input-wrap { max-width:320px; margin-bottom:16px; }
.search-input-wrap input { width:100%; padding:10px 12px; border:1px solid var(--border-strong); border-radius:8px; font-size:14px; background:var(--card); color:var(--text); }
table.admin-table { width:100%; border-collapse:collapse; background:var(--card); border-radius:var(--radius); overflow:hidden; }
/* overflow-wrap:anywhere so a long email or URL breaks instead of widening the whole table and
   forcing the page to scroll sideways. */
table.admin-table th, table.admin-table td { text-align:left; padding:10px 12px; font-size:13.5px; border-bottom:1px solid var(--border); overflow-wrap:anywhere; }
table.admin-table th { background:var(--bg); color:var(--muted); font-size:11.5px; text-transform:uppercase; letter-spacing:0.4px; }
.pill { padding:2px 8px; border-radius:20px; font-size:11px; font-weight:700; }
.pill-admin { background:#fdf2d0; color:#7a5b00; }
.pill-lead { background:#dcf3ee; color:#0d6b5c; }
.pill-broker { background:#e4ecf7; color:var(--navy); }
.pill-active { background:#e3f5e9; color:#1e7c43; }
.pill-inactive { background:#f1f1f1; color:#777; }
.pill-closing { background:#efe3fb; color:#5b21b6; }
.modal-backdrop { position:fixed; inset:0; background:rgba(11,37,69,0.55); display:flex; align-items:flex-start; justify-content:center; padding:40px 16px; overflow-y:auto; z-index:50; animation:fadeIn .2s ease; }
.modal { background:var(--card); color:var(--text); border-radius:var(--radius); width:560px; max-width:100%; padding:24px; box-shadow:0 20px 60px rgba(0,0,0,0.3); animation:modalPop .25s cubic-bezier(.2,.8,.3,1.2); }
.modal h3 { margin-top:0; color:var(--navy); }
body.dark .modal h3 { color:#fff; }
.modal-close { float:right; background:none; border:none; font-size:18px; cursor:pointer; color:var(--muted); }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.photo-hint { font-size:12px; color:var(--muted); margin:6px 0; }
.photo-strip { display:flex; flex-wrap:wrap; gap:8px; }
.photo-strip:empty { display:none; }
.photo-thumb { position:relative; width:84px; height:64px; border-radius:6px; overflow:hidden; border:1px solid var(--border-strong); cursor:grab; background:var(--border); flex:0 0 auto; }
.photo-thumb img { width:100%; height:100%; object-fit:cover; display:block; pointer-events:none; }
.photo-thumb.is-cover, .photo-thumb.is-active { border-color:var(--navy); box-shadow:0 0 0 2px var(--navy); }
.photo-thumb:active { cursor:grabbing; }
.photo-cover-badge { position:absolute; left:0; bottom:0; background:var(--navy); color:#fff; font-size:9px; font-weight:700; letter-spacing:0.4px; padding:1px 5px; border-top-right-radius:4px; }
.photo-remove { position:absolute; top:2px; right:2px; width:18px; height:18px; line-height:16px; text-align:center; border:none; border-radius:50%; background:rgba(0,0,0,0.6); color:#fff; font-size:13px; cursor:pointer; padding:0; }
.photo-remove:hover { background:rgba(200,0,0,0.85); }
.view-strip { margin-bottom:14px; }
.view-strip .photo-thumb { cursor:pointer; }
.checkbox-list { max-height:140px; overflow-y:auto; border:1px solid var(--border-strong); border-radius:8px; padding:8px; }
.checkbox-list label { display:flex; align-items:center; gap:8px; font-size:13px; padding:4px 2px; }
.modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
.toast { position:fixed; bottom:20px; right:20px; background:var(--navy); color:#fff; padding:10px 16px; border-radius:8px; font-size:13px; box-shadow:0 8px 24px rgba(0,0,0,0.25); z-index:100; animation:toastIn .25s ease; }
@keyframes toastIn { from{opacity:0; transform:translateY(10px);} to{opacity:1; transform:translateY(0);} }
.muted-link { background:none; border:none; color:var(--muted); font-size:12.5px; cursor:pointer; text-decoration:underline; padding:0; }
/* Height is capped to what the window can actually show. At a flat 520px the panel could end
   up taller than the space left under the header on a laptop screen, which put the message
   box — the one part you always need — below the fold with nothing left to scroll. It still
   prefers 520px whenever there is room, so nothing changes on a large display. */
.chat-wrap { display:flex; flex-direction:column; height:min(520px, calc(100vh - 300px)); min-height:200px; background:var(--card); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.chat-room-tabs { display:flex; gap:6px; padding:10px 14px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.chat-room-btn { border:1px solid var(--border-strong); background:var(--card); color:var(--text); padding:6px 12px; border-radius:20px; font-size:12.5px; font-weight:600; cursor:pointer; }
.chat-room-btn.active { background:var(--navy); color:#fff; border-color:var(--navy); }
/* min-height:0 is load-bearing. A flex item defaults to min-height:auto, which means this list
   refuses to shrink below the height of its own content. Inside a fixed-height, overflow:hidden
   panel that means every message you send pushes the composer further down until it is clipped
   off the bottom edge and simply vanishes — which reads as "the text box disappeared" and can't
   be scrolled back into view, because it isn't below the fold, it's outside the box. With
   min-height:0 the list shrinks to its share and scrolls itself via overflow-y. */
.chat-messages { flex:1 1 0; min-height:0; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:10px; }
.chat-msg { max-width:75%; background:var(--bg); border-radius:10px; padding:8px 12px; font-size:13.5px; align-self:flex-start; }
.chat-msg.mine { align-self:flex-end; background:var(--navy); color:#fff; }
.chat-msg img.chat-img { max-width:100%; border-radius:8px; margin-top:6px; display:block; }
.chat-msg .chat-meta { font-size:10.5px; color:var(--muted); margin-bottom:2px; }
.chat-msg.mine .chat-meta { color:rgba(255,255,255,0.7); }
/* flex-shrink:0 — the composer is the one thing that must never be squashed or pushed out,
   however long the conversation gets. */
.chat-input-row { display:flex; gap:8px; padding:12px; border-top:1px solid var(--border); align-items:center; flex-shrink:0; }
.chat-input-row input[type=text] { flex:1; padding:10px 12px; border:1px solid var(--border-strong); border-radius:8px; font-size:14px; background:var(--card); color:var(--text); }
.chat-input-row label.attach-btn { border:1px solid var(--border-strong); border-radius:8px; padding:9px 10px; font-size:13px; cursor:pointer; color:var(--muted); }
.contact-card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:16px; display:flex; gap:14px; align-items:flex-start; }
.contact-avatar { width:44px; height:44px; border-radius:50%; background:var(--navy); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:15px; flex-shrink:0; overflow:hidden; position:relative; }
.contact-avatar img { width:100%; height:100%; object-fit:cover; }
.contact-avatar .status-dot { position:absolute; bottom:-1px; right:-1px; }
.contact-info .name { font-weight:700; color:var(--navy); font-size:15px; display:flex; align-items:center; gap:6px; }
body.dark .contact-info .name { color:#fff; }
.contact-info .role-line { margin:4px 0 8px; display:flex; gap:6px; flex-wrap:wrap; }
.contact-info .line { font-size:13px; color:var(--text); margin:2px 0; }
.contact-info a { color:var(--navy); text-decoration:none; }
body.dark .contact-info a { color:var(--gold-light); }
.contact-info a:hover { text-decoration:underline; }
.contact-info .msg-link { font-size:12px; margin-top:6px; }
.photo-preview img { max-width:180px; border-radius:8px; display:block; margin-top:8px; border:1px solid var(--border); }
.avatar-upload-preview { width:84px; height:84px; border-radius:50%; overflow:hidden; background:var(--navy); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:24px; margin-bottom:10px; }
.avatar-upload-preview img { width:100%; height:100%; object-fit:cover; }
.toggle-row { display:flex; align-items:center; justify-content:space-between; padding:12px 0; border-bottom:1px solid var(--border); gap:12px; }
.toggle-row:last-child { border-bottom:none; }
.toggle-row .toggle-label { font-size:14px; font-weight:600; }
.toggle-row .toggle-desc { font-size:12px; color:var(--muted); margin-top:2px; }
.switch { position:relative; display:inline-block; width:42px; height:24px; flex-shrink:0; }
.switch input { opacity:0; width:0; height:0; }
.switch .slider { position:absolute; cursor:pointer; inset:0; background:#c7ccd4; border-radius:24px; transition:.2s; }
.switch .slider:before { position:absolute; content:""; height:18px; width:18px; left:3px; bottom:3px; background:#fff; border-radius:50%; transition:.2s; }
.switch input:checked + .slider { background:var(--navy); }
.switch input:checked + .slider:before { transform:translateX(18px); }
.settings-card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px; margin-bottom:18px; }
.settings-card h3 { margin:0 0 4px; font-size:15px; color:var(--navy); }
body.dark .settings-card h3 { color:#fff; }
.dash-hero { background:linear-gradient(135deg,var(--navy),var(--navy-light)); color:#fff; border-radius:var(--radius); padding:26px 28px; margin-bottom:22px; position:relative; overflow:hidden; }
.dash-hero h2 { margin:0 0 6px; font-size:22px; }
.dash-hero p { margin:0; opacity:0.85; font-size:13.5px; }
.dash-hero .quick-links { display:flex; gap:10px; margin-top:16px; flex-wrap:wrap; }
.dash-hero .quick-links a { background:rgba(255,255,255,0.14); color:#fff; text-decoration:none; font-size:12.5px; font-weight:600; padding:7px 13px; border-radius:20px; transition:background .15s ease; }
.dash-hero .quick-links a:hover { background:var(--gold); color:var(--navy); }
.dash-hero-meta { display:flex; gap:14px; margin-top:18px; flex-wrap:wrap; }
.meta-chip { background:rgba(255,255,255,0.14); border-radius:12px; padding:10px 16px; min-width:130px; }
.meta-chip .meta-label { font-size:10px; text-transform:uppercase; letter-spacing:0.5px; opacity:0.8; }
.meta-chip .meta-value { font-size:20px; font-weight:700; margin-top:2px; }
.meta-chip .meta-sub { font-size:11px; opacity:0.8; margin-top:2px; }
.dash-section { margin-bottom:26px; }
.dash-section h3 { font-size:15px; color:var(--navy); margin-bottom:10px; }
body.dark .dash-section h3 { color:#fff; }
.event-row { display:flex; gap:14px; align-items:flex-start; background:var(--card); border:1px solid var(--border); border-radius:8px; padding:12px 14px; margin-bottom:8px; }
.event-date-badge { background:var(--navy); color:#fff; border-radius:8px; text-align:center; padding:6px 10px; min-width:56px; flex-shrink:0; }
.event-date-badge .mon { font-size:10px; text-transform:uppercase; letter-spacing:0.5px; }
.event-date-badge .day { font-size:17px; font-weight:700; line-height:1.1; }
.event-body { flex:1; }
.event-title { font-weight:700; font-size:14px; color:var(--text); }
.event-notes { font-size:12.5px; color:var(--muted); margin-top:2px; }
.conv-list { display:flex; flex-direction:column; gap:4px; }
.conv-item { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:8px; cursor:pointer; border:1px solid transparent; }
.conv-item:hover { background:var(--bg); }
.conv-item.active { background:var(--bg); border-color:var(--border-strong); }
.conv-item .name { font-weight:600; font-size:13.5px; }
.conv-item .preview { font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:170px; }
.messages-layout { display:grid; grid-template-columns:230px 1fr; gap:16px; height:560px; }
.messages-sidebar { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:10px; overflow-y:auto; }
.messages-sidebar h4 { font-size:11px; text-transform:uppercase; letter-spacing:0.5px; color:var(--muted); margin:6px 8px; }
@media (max-width:760px) { .messages-layout { grid-template-columns:1fr; height:auto; } .messages-sidebar { max-height:220px; } }
@media (max-width:560px) { .form-row { grid-template-columns:1fr; } .content { padding:16px; } .messages-layout { grid-template-columns:1fr; } }
.closing-desk { --navy:#0f3b3e; --navy-light:#155457; --gold:#c98a27; --gold-light:#e0a94f; }
.closing-desk .closing-banner { background:linear-gradient(135deg,var(--navy),var(--navy-light)); color:#fff; border-radius:var(--radius); padding:18px 22px; margin-bottom:20px; font-size:13px; }
.closing-desk .closing-banner strong { display:block; font-size:18px; margin-bottom:4px; }
.closing-subnav { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:20px; }
.closing-task-row { display:flex; align-items:flex-start; gap:12px; background:var(--card); border:1px solid var(--border); border-radius:8px; padding:12px 14px; margin-bottom:8px; }
.closing-task-row.done { opacity:0.55; }
.closing-task-row.done .task-title { text-decoration:line-through; }
.closing-task-row input[type=checkbox] { width:18px; height:18px; margin-top:2px; flex-shrink:0; }
.task-title { font-weight:700; font-size:14px; }
.task-meta { font-size:11.5px; color:var(--muted); margin-top:2px; }
.task-notes { font-size:12.5px; color:var(--muted); margin-top:4px; }
.stage-pill { padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; background:#e4ecf7; color:var(--navy); }

/* ---- Nautical theme: fonts, wave decorations, motion ---- */
.login-card h1, .dash-hero h2, .topbar .brand-name, .section-header h2, .modal h3, .card-title, .closing-desk .closing-banner strong { font-family:'Playfair Display',Georgia,serif; letter-spacing:0.3px; }

.login-wrap { position:relative; overflow:hidden; }
.login-wrap::before, .login-wrap::after { content:""; position:absolute; left:-10%; width:120%; height:150px; background-repeat:repeat-x; pointer-events:none; z-index:0; }
.login-wrap::before { bottom:-28px; background-size:600px 150px; opacity:0.55; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 140' preserveAspectRatio='none'%3E%3Cpath d='M0,70 C100,110 200,20 300,55 C400,90 500,30 600,65 L600,140 L0,140 Z' fill='white' fill-opacity='0.10'/%3E%3C/svg%3E"); animation:waveDriftSlow 20s linear infinite; }
.login-wrap::after { bottom:-46px; background-size:600px 150px; opacity:0.35; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 140' preserveAspectRatio='none'%3E%3Cpath d='M0,90 C120,50 220,120 340,80 C460,45 540,110 600,85 L600,140 L0,140 Z' fill='white' fill-opacity='0.16'/%3E%3C/svg%3E"); animation:waveDriftSlow 14s linear infinite reverse; }
.login-card { position:relative; z-index:1; }
@keyframes waveDriftSlow { from { background-position-x:0; } to { background-position-x:600px; } }

.topbar { position:relative; }
.topbar::after { content:""; position:absolute; left:0; right:0; bottom:-1px; height:9px; background-repeat:repeat-x; background-size:300px 9px; opacity:0.85; pointer-events:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 10' preserveAspectRatio='none'%3E%3Cpath d='M0,5 C25,0 50,10 75,5 C100,0 125,10 150,5 C175,0 200,10 225,5 C250,0 275,10 300,5 L300,10 L0,10 Z' fill='rgb(201,162,39)' fill-opacity='0.9'/%3E%3C/svg%3E"); animation:waveDriftSlow 10s linear infinite; }

.dash-hero::after { content:""; position:absolute; left:0; right:0; bottom:0; height:30px; background-repeat:repeat-x; background-size:400px 30px; opacity:0.5; pointer-events:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 34' preserveAspectRatio='none'%3E%3Cpath d='M0,17 C50,34 100,0 150,15 C200,30 250,4 300,18 C350,30 380,10 400,17 L400,34 L0,34 Z' fill='white' fill-opacity='0.14'/%3E%3C/svg%3E"); animation:waveDriftSlow 16s linear infinite; }

@keyframes floatChip { 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-4px); } }
.meta-chip { animation:floatChip 4.2s ease-in-out infinite; }
.meta-chip:nth-of-type(2) { animation-delay:.7s; }

@keyframes pulseGlow { 0%,100%{ box-shadow:0 2px 6px rgba(0,0,0,0.25); } 50%{ box-shadow:0 0 0 7px rgba(201,162,39,0.22),0 2px 6px rgba(0,0,0,0.25); } }
.featured-star:not(.is-off) { animation:pulseGlow 2.6s ease-in-out infinite; }

.btn-primary, .btn-gold { position:relative; overflow:hidden; }
.btn-primary::after, .btn-gold::after { content:""; position:absolute; top:0; left:-60%; width:40%; height:100%; background:linear-gradient(120deg, transparent, rgba(255,255,255,0.5), transparent); transform:skewX(-20deg); transition:left .55s ease; pointer-events:none; }
.btn-primary:hover::after, .btn-gold:hover::after { left:130%; }

.card-media { background-size:220% 220%; animation:gradientDrift 9s ease infinite; }
@keyframes gradientDrift { 0%{ background-position:0% 50%; } 50%{ background-position:100% 50%; } 100%{ background-position:0% 50%; } }
.card:hover { transform:translateY(-3px) rotate(-0.25deg); }

.tab-btn { position:relative; }
.tab-btn::after { content:""; position:absolute; left:14px; right:14px; bottom:-1px; height:3px; background:var(--gold); border-radius:2px 2px 0 0; transform:scaleX(0); transform-origin:center; transition:transform .2s ease, background .2s ease; }
.tab-btn:hover::after { transform:scaleX(0.55); background:var(--gold-light); }
.tab-btn.active { border-bottom-color:transparent; }
.tab-btn.active::after { transform:scaleX(1); }

@keyframes pulseDot { 0%,100%{ box-shadow:0 0 0 2px var(--card),0 0 0 2px rgba(47,191,110,0.0); } 50%{ box-shadow:0 0 0 2px var(--card),0 0 0 5px rgba(47,191,110,0.35); } }
.status-dot.online { animation:pulseDot 2.6s ease-in-out infinite; }

/* ---- Mobile phone layout ---- */
@media (max-width:640px) {
  .preview-banner { font-size:11px; padding:6px 8px; }
  .login-wrap { padding:20px 12px; min-height:calc(100vh - 30px); }
  .login-card { padding:30px 18px 24px; border-radius:14px; }
  .brand-logo-img { height:150px; }
  .login-card h1 { font-size:18px; }
  .login-card p.sub { font-size:12.5px; margin-bottom:20px; }
  .hint-box { font-size:11px; }
  .topbar { flex-direction:column; align-items:flex-start; padding:12px 14px; min-height:auto; gap:8px; box-shadow:none; }
  .topbar .brand { flex-wrap:wrap; row-gap:6px; }
  .brand-logo-badge img { height:46px; }
  .topbar .brand-name { font-size:12px; }
  .topbar .social-links { display:none; }
  .topbar .user-info { width:100%; justify-content:space-between; font-size:12.5px; }
  .tabs { flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; padding:0 10px; scrollbar-width:thin; }
  .tabs::-webkit-scrollbar { height:4px; }
  .tab-btn { flex:0 0 auto; padding:12px 12px; font-size:12px; white-space:nowrap; }
  .content { padding:14px; }
  .dash-hero { padding:20px 16px; }
  .dash-hero h2 { font-size:19px; }
  .dash-hero-meta { gap:10px; }
  .meta-chip { min-width:0; flex:1 1 130px; padding:9px 12px; }
  .grid { grid-template-columns:1fr; gap:12px; }
  /* white-space:nowrap used to be here. It guaranteed sideways scrolling on every table in the
     portal: one long email address or boat name and the whole table grew wider than the window,
     pushing the columns you actually wanted off the right-hand edge. Wrapping keeps the table
     inside the window; overflow-x stays as a last resort for genuinely extreme content. */
  table.admin-table { display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .contact-card { flex-direction:column; }
  .messages-layout { grid-template-columns:1fr; height:auto; }
  .messages-sidebar { max-height:170px; }
  .chat-wrap { height:min(440px, calc(100vh - 240px)); }
  .modal-backdrop { padding:18px 8px; }
  .modal { padding:18px; border-radius:12px; }
  .closing-subnav { flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .section-header { align-items:flex-start; }
  .card-actions { gap:6px; }
  .btn-sm { padding:7px 11px; }
  /* Stacked, not a sideways-scrolling board. Swiping a kanban left and right on a narrow window
     means the stage you want is always the one off screen; one column per row scrolls the way
     the rest of the page already does. */
  .crm-kanban { grid-template-columns:1fr; padding-bottom:8px; }
}

/* auto-fit so the board stays balanced regardless of how many stages are shown */
.crm-kanban { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:14px; align-items:start; }
.crm-kanban-col { background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); padding:10px; min-height:80px; }
.crm-kanban-col-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.crm-kanban-count { font-size:11.5px; color:var(--muted); font-weight:700; }
.crm-kanban-card { background:var(--card); border:1px solid var(--border); border-radius:8px; padding:10px 12px; margin-bottom:8px; cursor:grab; transition:transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
.crm-kanban-card:hover { transform:translateY(-2px); box-shadow:0 8px 18px rgba(11,37,69,0.12); }
.crm-kanban-card.dragging { opacity:0.4; cursor:grabbing; }
.crm-kanban-col.drag-over { outline:2px dashed var(--gold); outline-offset:-2px; background:rgba(197,160,89,0.08); }
.crm-kanban-card-name { font-weight:700; font-size:13.5px; color:var(--navy); }
body.dark .crm-kanban-card-name { color:#fff; }
.crm-kanban-card-sub { font-size:11.5px; color:var(--muted); margin-top:2px; }
.crm-kanban-card-foot { font-size:10.5px; color:var(--muted); margin-top:6px; padding-top:6px; border-top:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; gap:6px; }
.crm-kanban-card-move { font-size:10px; padding:2px 4px; border:1px solid var(--border-strong); border-radius:6px; background:var(--card); color:var(--text); max-width:90px; }
.crm-kanban-empty { font-size:11.5px; color:var(--muted); text-align:center; padding:14px 0; }
.crm-search-input { padding:8px 12px; border:1px solid var(--border-strong); border-radius:8px; font-size:13px; background:var(--card); color:var(--text); min-width:200px; }

/* Scrollable log/table area with a sticky header row. */
.log-scroll { max-height:420px; overflow-y:auto; border:1px solid var(--border); border-radius:var(--radius); }
.log-scroll .admin-table { margin:0; }
.log-scroll .admin-table thead th { position:sticky; top:0; background:var(--card); z-index:2; box-shadow:0 1px 0 var(--border); }

/* "Online Now" quick-view panel */
.online-now-list { display:flex; flex-wrap:wrap; gap:8px; }
.online-now-chip { display:flex; align-items:center; gap:8px; background:var(--bg); border:1px solid var(--border); border-radius:999px; padding:5px 12px 5px 6px; font-size:12.5px; font-weight:600; }
.online-now-chip .who { display:flex; flex-direction:column; line-height:1.25; }
.online-now-chip .who small { font-weight:400; font-size:10.5px; color:var(--muted); }
.online-now-empty { font-size:12.5px; color:var(--muted); padding:6px 0; }

/* Note under the CRM board explaining where the "Active" (parked) clients went */
.crm-parked-note { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-top:14px; padding:10px 14px; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); font-size:12.5px; color:var(--muted); }

/* Unread count badge on the Messages / Team Chat tabs */
.tab-btn { position:relative; }
.tab-badge { display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; padding:0 5px; margin-left:6px; border-radius:999px; background:var(--danger); color:#fff; font-size:10.5px; font-weight:800; line-height:1; vertical-align:middle; }

/* Emoji picker for message inputs */
.emoji-btn { border:1px solid var(--border-strong); border-radius:8px; background:var(--card); padding:8px 10px; font-size:15px; line-height:1; cursor:pointer; }
.emoji-btn:hover { border-color:var(--gold); }
.emoji-pop { position:fixed; z-index:400; width:296px; height:220px; overflow-y:auto; background:var(--card); border:1px solid var(--border-strong); border-radius:12px; box-shadow:0 14px 34px rgba(11,37,69,0.22); padding:8px; display:grid; grid-template-columns:repeat(8,1fr); gap:2px; }
.emoji-cell { border:none; background:transparent; font-size:19px; line-height:1; padding:5px 0; border-radius:6px; cursor:pointer; }
.emoji-cell:hover { background:var(--bg); }

/* Clearly readable online/offline label on contact cards */
.status-chip { display:inline-flex; align-items:center; gap:5px; margin-left:8px; padding:2px 9px 2px 7px; border-radius:999px; font-size:10.5px; font-weight:700; letter-spacing:0.2px; text-transform:uppercase; vertical-align:middle; border:1px solid var(--border); }
.status-chip.is-online { background:rgba(34,153,84,0.12); color:#1e8449; border-color:rgba(34,153,84,0.35); }
.status-chip.is-offline { background:var(--bg); color:var(--muted); }
body.dark .status-chip.is-online { color:#5ed99a; }

/* Plain-English boat search */
.boat-search { position:relative; margin:0 0 16px; }
.boat-search input { width:100%; padding:13px 15px; border:1px solid var(--border-strong); border-radius:10px; font-size:14.5px; background:var(--card); color:var(--text); }
.boat-search input:focus { outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(197,160,89,0.15); }
.boat-search-clear { position:absolute; right:10px; top:9px; border:1px solid var(--border-strong); background:var(--card); color:var(--muted); border-radius:8px; padding:5px 10px; font-size:12px; cursor:pointer; }
.boat-search-hint { font-size:11.5px; color:var(--muted); margin-top:5px; padding-left:2px; }
.boat-search-summary { display:flex; align-items:center; gap:10px; margin-bottom:12px; padding:8px 13px; background:var(--bg); border:1px solid var(--border); border-radius:8px; font-size:12.5px; color:var(--muted); }

/* ---- DARK MODE CONTRAST CORRECTIONS ----
   body.dark swaps the colour variables, which handles most of the UI. These components are
   the exceptions: each pins a LIGHT background in its base rule, so the dark theme puts light
   text on a light surface and the control becomes unreadable. Measured before the fix:
   .btn-danger 2.44:1, .featured-star 2.42:1, .featured-star.is-off 1.61:1 — all below the 4.5:1
   minimum for body text. Each therefore needs an explicit dark pairing rather than a variable.
   If you add a component with a hardcoded light background, give it a body.dark rule here. */
body.dark .btn-danger { background:rgba(255,107,96,0.16); color:#ff9d95; }
body.dark .btn-danger:hover { background:rgba(255,107,96,0.26); }
body.dark .featured-star { background:rgba(24,35,56,0.92); color:var(--gold-light); box-shadow:0 2px 6px rgba(0,0,0,0.5); }
body.dark .featured-star.is-off { color:#8a94a8; }
body.dark .emoji-btn { color:var(--text); }
body.dark .pill-admin { background:rgba(201,162,39,0.22); color:var(--gold-light); }
body.dark .pill-inactive { background:rgba(255,255,255,0.10); color:var(--muted); }
/* The off state is deliberately quiet, but 1.61:1 was invisible rather than quiet. */
.featured-star.is-off { color:#98a1ad; }
