:root {
  color-scheme: light;
  --ink: #16262e;
  --navy: #102f3d;
  --navy-2: #174656;
  --teal: #16778a;
  --teal-dark: #0e5d6d;
  --seafoam: #e8f5f4;
  --canvas: #f2f5f5;
  --paper: #ffffff;
  --border: #dbe4e5;
  --muted: #687b82;
  --shadow: 0 18px 50px rgba(20, 48, 58, .09);
  --surface-soft: #f8faf9;
  --surface-hover: #f7fbfb;
  --field: #fbfcfc;
  --copy-strong: #52676e;
  --own-message: #e2f3f1;
  --own-message-border: #b8d9d8;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6eff1;
  --navy: #081e28;
  --navy-2: #1b5363;
  --teal: #35a6b8;
  --teal-dark: #8ed5df;
  --seafoam: #19383e;
  --canvas: #0d171c;
  --paper: #132127;
  --border: #2a4047;
  --muted: #9bafb5;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  --surface-soft: #16262c;
  --surface-hover: #1a3037;
  --field: #101c21;
  --copy-strong: #b3c4c8;
  --own-message: #174044;
  --own-message-border: #2d7378;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
a { color: var(--teal-dark); text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
button, input, textarea, select { font: inherit; }

.site-header { display: flex; align-items: center; gap: 1rem; height: 64px; padding: 0 max(1.25rem, calc((100% - 1440px) / 2)); color: white; background: var(--navy); border-bottom: 1px solid rgba(255,255,255,.08); }
.site-header a { color: white; }
.site-header > span { margin-left: auto; color: #c9dadd; font-size: .9rem; }
.site-header form { margin: 0; }
.brand { font-size: 1.25rem; font-weight: 800; letter-spacing: -.035em; }
.theme-toggle { width: 34px; height: 34px; padding: 0; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; color: #d8e7e9; background: rgba(255,255,255,.06); font-size: 1rem; }
.theme-toggle:hover { color: white; background: rgba(255,255,255,.14); }
.brand + .theme-toggle { margin-left: auto; }
.container { width: min(1440px, calc(100% - 2rem)); margin: 1.5rem auto; }

.button, input[type=submit], button, .compact-button { display: inline-flex; align-items: center; justify-content: center; padding: .62rem 1rem; border: 0; border-radius: .5rem; color: white; background: var(--teal); cursor: pointer; font-weight: 700; }
.button:hover, input[type=submit]:hover, button:hover, .compact-button:hover { color: white; background: var(--teal-dark); }
.compact-button { padding: .4rem .7rem; font-size: .82rem; }
.link-button { padding: 0; color: white; background: transparent; font-weight: 600; }
.link-button:hover { background: transparent; }

.confirm-dialog { width: min(460px, calc(100vw - 2rem)); max-width: none; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: .85rem; color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(4, 20, 26, .28); }
.confirm-dialog::backdrop { background: rgba(4, 15, 20, .62); backdrop-filter: blur(3px); }
.confirm-dialog-card { background: var(--paper); }
.confirm-dialog-copy { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: .9rem; padding: 1.35rem 1.4rem 1.2rem; }
.confirm-dialog-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: var(--teal-dark); background: var(--seafoam); }
.confirm-dialog-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.confirm-dialog h2 { margin: .12rem 0 .35rem; font-size: 1.15rem; letter-spacing: -.025em; }
.confirm-dialog p { margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.55; }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: .55rem; padding: .85rem 1.4rem; border-top: 1px solid var(--border); background: var(--surface-soft); }
.confirm-dialog-cancel, .confirm-dialog-confirm { min-width: 92px; }
.confirm-dialog-cancel { color: var(--copy-strong); background: var(--paper); border: 1px solid var(--border); }
.confirm-dialog-cancel:hover { color: var(--ink); background: var(--surface-hover); }
.confirm-dialog[data-kind="danger"] .confirm-dialog-icon { color: #b84f58; background: #fdecef; }
.confirm-dialog[data-kind="danger"] .confirm-dialog-confirm { background: #b84f58; }
.confirm-dialog[data-kind="danger"] .confirm-dialog-confirm:hover { background: #9e3d46; }
html[data-theme="dark"] .confirm-dialog[data-kind="danger"] .confirm-dialog-icon { color: #f0a4aa; background: #452529; }

@media (prefers-reduced-motion: no-preference) {
  .confirm-dialog[open] { animation: confirm-dialog-in .16s ease-out; }
  .confirm-dialog[open]::backdrop { animation: confirm-backdrop-in .16s ease-out; }
  @keyframes confirm-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
  @keyframes confirm-backdrop-in { from { opacity: 0; } }
}

.workspace { position: relative; display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: calc(100vh - 112px); overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); }
.workspace-sidebar { min-width: 0; padding: 1.2rem; background: var(--surface-soft); border-right: 1px solid var(--border); }
.workspace-main { min-width: 0; background: var(--paper); }
.mobile-drawer-trigger, .mobile-drawer-backdrop, .mobile-drawer-close { display: none; }
.mobile-button-label { display: none; }
.sidebar-topline { display: flex; justify-content: space-between; align-items: center; min-height: 32px; margin-bottom: 1.25rem; }
.back-link { color: var(--muted); font-size: .85rem; font-weight: 700; }
.back-link:hover { color: var(--teal-dark); }
.mobile-settings-link { display: none; }
.eyebrow, .sidebar-label { display: block; color: var(--muted); font-size: .69rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }

.fleet-identity { display: flex; align-items: center; gap: .8rem; margin: .3rem 0 1.5rem; }
.fleet-identity h1 { margin: .1rem 0 0; font-size: 1.1rem; letter-spacing: -.02em; }
.fleet-mark { display: grid; flex: 0 0 42px; height: 42px; place-items: center; border-radius: 12px; color: white; background: linear-gradient(145deg, var(--teal), var(--navy)); font-size: 1.1rem; font-weight: 800; }
.sidebar-nav { display: grid; gap: .25rem; margin-bottom: 1.5rem; }
.nav-item { display: flex; justify-content: space-between; padding: .62rem .75rem; border-radius: .5rem; color: var(--muted); font-size: .9rem; font-weight: 700; }
.nav-item strong { font-size: .78rem; }
.nav-unread-count { display: grid; min-width: 20px; height: 20px; padding: 0 5px; place-items: center; border-radius: 10px; color: white; background: var(--teal); line-height: 1; }
.nav-unread-count[hidden] { display: none; }
.nav-item.active { color: var(--teal-dark); background: var(--seafoam); }
.folder-section { margin: -.35rem 0 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.folder-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: .35rem; }
.folder-create-menu { position: relative; }
.folder-create-menu > summary { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: var(--muted); cursor: pointer; font-weight: 800; list-style: none; }
.folder-create-menu > summary::-webkit-details-marker { display: none; }
.folder-create-menu > summary:hover { color: var(--teal-dark); background: var(--seafoam); }
.folder-create-form { position: absolute; z-index: 8; top: 30px; right: 0; width: 230px; padding: .75rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--paper); box-shadow: var(--shadow); }
.folder-create-form label { margin: 0 0 .35rem !important; color: var(--muted); font-size: .66rem; text-transform: uppercase; }
.folder-create-form input[type=text] { padding: .48rem; font-size: .75rem; }
.folder-create-form input[type=submit] { width: 100%; margin-top: .45rem; padding: .45rem; font-size: .7rem; }
.folder-list { display: grid; gap: .12rem; }
.folder-row { position: relative; display: block; border: 1px solid transparent; border-radius: .45rem; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.folder-link { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: .5rem; padding: .47rem .6rem; color: var(--muted); font-size: .78rem; font-weight: 700; }
.folder-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-link strong { color: var(--muted); font-size: .66rem; }
.folder-row:hover, .folder-row.active { background: var(--seafoam); }
.folder-row.active .folder-link { color: var(--teal-dark); }
.folder-row.drop-target { border-color: var(--teal); background: var(--seafoam); transform: translateX(3px); }
.folder-row.drop-error { border-color: #c76168; }
.folder-row form { position: absolute; top: 50%; right: .25rem; margin: 0; transform: translateY(-50%); }
.folder-delete { width: 24px; height: 24px; padding: 0; color: var(--muted); background: transparent; font-size: .85rem; opacity: 0; }
.folder-row:hover .folder-delete, .folder-delete:focus-visible { opacity: 1; }
.folder-row:has(.folder-delete):hover .folder-link strong { opacity: 0; }
.folder-delete:hover { color: #c76168; background: transparent; }
.folder-hint { margin: .45rem .55rem 0; color: var(--muted); font-size: .62rem; line-height: 1.35; }
.swipe-conversation[draggable="true"] { cursor: grab; }
.swipe-conversation.dragging { opacity: .45; cursor: grabbing; }
.folder-drag-preview { position: fixed; z-index: 9999; top: -1000px; left: -1000px; display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: .55rem; width: 230px; padding: .55rem .65rem; overflow: hidden; border: 1px solid var(--border); border-radius: .55rem; color: var(--ink); background: var(--paper); box-shadow: 0 10px 25px rgba(10,30,38,.22); pointer-events: none; }
.folder-drag-preview > span:first-child { display: grid; width: 28px; height: 28px; place-items: center; border-radius: .4rem; color: white; background: var(--teal); font-size: .78rem; }
.folder-drag-preview > span:last-child, .folder-drag-preview strong, .folder-drag-preview small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-drag-preview strong { font-size: .74rem; }
.folder-drag-preview small { color: var(--muted); font-size: .6rem; }
.vessel-list { padding-top: 1rem; border-top: 1px solid var(--border); }
.space-switcher { margin-top: .55rem; }
.sidebar-note, .external-access-note p { color: var(--muted); font-size: .75rem; }
.external-access-note { margin-top: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--paper); }
.external-access-note p { margin: .65rem 0 0; }
.vessel-filter-reset { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .55rem; padding: .45rem .55rem; border-radius: .45rem; color: var(--muted); font-size: .76rem; font-weight: 750; }
.vessel-filter-reset strong { font-size: .66rem; }
.vessel-filter-reset:hover, .vessel-filter-reset.active { color: var(--teal-dark); background: var(--seafoam); }
.vessel-row { display: flex; align-items: flex-start; gap: .65rem; margin-top: .2rem; padding: .55rem; border-radius: .5rem; color: inherit; font-size: .84rem; }
.vessel-row:hover, .vessel-row.active { background: var(--seafoam); }
.vessel-row.active { box-shadow: inset 3px 0 var(--teal); }
.vessel-row strong, .vessel-row small { display: block; }
.vessel-row small { margin-top: .05rem; color: var(--muted); font-size: .73rem; }
.status-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: .4rem; border-radius: 50%; background: #a8b4b6; box-shadow: 0 0 0 3px #e8eded; }
.status-dot.online { background: #39a98d; box-shadow: 0 0 0 3px #dcf2eb; }
.presence-label { color: var(--muted); font-size: inherit; }
.presence-label.online { color: #23876f; }

.inbox { padding: 0 1.8rem 1.8rem; }
.inbox-header { display: flex; justify-content: space-between; align-items: center; min-height: 106px; border-bottom: 1px solid var(--border); }
.inbox-header h2 { margin: .15rem 0 0; font-size: 1.7rem; letter-spacing: -.04em; }
.active-filter-summary { margin: .25rem 0 0; color: var(--teal-dark); font-size: .75rem; font-weight: 750; }
.conversation-type-filters { display: flex; gap: .35rem; padding-top: 1rem; overflow-x: auto; }
.conversation-type-filter { flex: 0 0 auto; padding: .42rem .68rem; border: 1px solid var(--border); border-radius: 99px; color: var(--muted); background: var(--field); font-size: .72rem; font-weight: 750; }
.conversation-type-filter:hover { color: var(--teal-dark); border-color: #a9cdd1; background: var(--seafoam); }
.conversation-type-filter.active { color: white; border-color: var(--teal); background: var(--teal); }
.conversation-type-filter.internal.active { color: var(--teal-dark); border-color: #a9cdd1; background: var(--seafoam); }
.conversation-type-filter.direct.active { color: #69508a; border-color: #cdbde4; background: #f1eafd; }
.conversation-type-filter.external.active { color: #7c5724; border-color: #ead09e; background: #fff3dd; }
.inbox-toolbar { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 0; }
.search-field { display: flex; flex: 1; align-items: center; gap: .5rem; padding: 0 .8rem; border: 1px solid var(--border); border-radius: .55rem; color: var(--muted); background: var(--surface-soft); }
.search-field:focus-within { border-color: #87b9c1; box-shadow: 0 0 0 3px rgba(22,119,138,.09); }
.search-field input { width: 100%; padding: .58rem 0; border: 0; outline: 0; background: transparent; }
.inbox-count { flex: 0 0 auto; color: var(--muted); font-size: .8rem; }
.inbox-list { border: 1px solid var(--border); border-radius: .7rem; overflow: hidden; }
.swipe-conversation { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); touch-action: pan-y; }
.swipe-conversation:last-child { border-bottom: 0; }
.swipe-delete-action { position: absolute; z-index: 0; top: 0; right: 0; bottom: 0; display: grid; width: 92px; place-items: stretch; background: #b84f58; }
.swipe-delete-action form { display: grid; margin: 0; }
.swipe-delete-button { display: grid; gap: .12rem; height: 100%; padding: .55rem; place-content: center; color: #fff; background: transparent; border-radius: 0; font-size: .68rem; text-align: center; }
.swipe-delete-button:hover { background: #9e3d46; }
.swipe-delete-button span { font-size: 1.25rem; font-weight: 400; line-height: .8; }
.swipe-delete-button strong { font-size: .66rem; }
.inbox-item { position: relative; z-index: 1; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: .85rem; align-items: center; padding: 1rem; color: inherit; background: var(--paper); transition: background .15s ease, transform .18s ease; }
.inbox-item.swiping { transition: none; }
.inbox-item:hover { background: var(--surface-hover); }
.inbox-item.active { background: var(--seafoam); box-shadow: inset 3px 0 var(--teal); }
.thread-avatar { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: var(--teal-dark); background: var(--seafoam); font-weight: 800; }
.envelope-avatar { position: relative; }
.envelope-avatar.unread { color: white; background: var(--teal); }
.envelope-icon { width: 21px; height: 21px; overflow: visible; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.unread-badge { position: absolute; top: -7px; right: -7px; display: grid; min-width: 20px; height: 20px; padding: 0 5px; place-items: center; border: 2px solid white; border-radius: 10px; color: white; background: #d45050; box-shadow: 0 2px 6px rgba(22,38,46,.18); font-size: .61rem; font-weight: 850; line-height: 1; }
.unread-title { font-weight: 850; }
.thread-content, .thread-line, .thread-context, .thread-preview { display: block; min-width: 0; }
.thread-line { display: flex; justify-content: space-between; gap: 1rem; }
.thread-line strong { overflow: hidden; font-size: .94rem; text-overflow: ellipsis; white-space: nowrap; }
.thread-line time { flex: 0 0 auto; color: var(--muted); font-size: .7rem; }
.thread-context { margin: .08rem 0 .12rem; color: var(--teal-dark); font-size: .7rem; font-weight: 700; }
.thread-preview { overflow: hidden; color: var(--muted); font-size: .79rem; text-overflow: ellipsis; white-space: nowrap; }
.thread-preview b { color: var(--copy-strong); }
.visibility-badge { display: inline-flex; align-items: center; padding: .2rem .45rem; border-radius: 99px; color: #345e65; background: #eef4f4; font-size: .62rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.visibility-badge.external { color: #7c5724; background: #fff3dd; }
.visibility-badge.direct { color: #69508a; background: #f1eafd; }
.empty-state { padding: 5rem 1rem; text-align: center; color: var(--muted); }
.empty-state > span, .empty-thread > span { display: inline-grid; width: 42px; height: 42px; margin-bottom: .8rem; place-items: center; border-radius: 50%; color: var(--teal); background: var(--seafoam); }
.empty-state h3 { margin-bottom: .3rem; color: var(--ink); }
.empty-filter { padding: 1.5rem; color: var(--muted); text-align: center; }
[data-unread-only="true"] .swipe-conversation[data-unread="false"] { display: none; }

.sent-filter-tabs { display: flex; gap: .35rem; padding-top: 1rem; }
.sent-description { margin: .15rem 0 0; color: var(--muted); font-size: .72rem; }
.sent-filter-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .48rem .7rem; border: 1px solid var(--border); border-radius: .5rem; color: var(--muted); background: var(--field); font-size: .76rem; font-weight: 750; }
.sent-filter-tab strong { display: grid; min-width: 19px; height: 19px; padding: 0 .3rem; place-items: center; border-radius: 10px; color: var(--muted); background: #eaf0f0; font-size: .64rem; }
.sent-filter-tab.active { color: var(--teal-dark); border-color: #a9cdd1; background: var(--seafoam); }
.sent-filter-tab.active strong { color: white; background: var(--teal); }
.sent-list { overflow: hidden; border: 1px solid var(--border); border-radius: .7rem; }
.sent-item { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: start; gap: .85rem; padding: 1rem; color: inherit; background: var(--paper); border-bottom: 1px solid var(--border); }
.sent-item:last-child { border-bottom: 0; }
.sent-item:hover { background: var(--surface-hover); }
.sent-avatar { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: var(--teal-dark); background: var(--seafoam); font-size: 1.05rem; font-weight: 850; }
.sent-content, .sent-heading, .sent-recipients, .sent-preview, .sent-meta { display: block; min-width: 0; }
.sent-heading { display: flex; justify-content: space-between; gap: 1rem; }
.sent-heading strong { overflow: hidden; font-size: .94rem; text-overflow: ellipsis; white-space: nowrap; }
.sent-heading time { flex: 0 0 auto; color: var(--muted); font-size: .7rem; }
.sent-recipients { overflow: hidden; margin-top: .2rem; color: var(--copy-strong); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.sent-preview { overflow: hidden; margin-top: .18rem; color: var(--muted); font-size: .79rem; text-overflow: ellipsis; white-space: nowrap; }
.sent-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-top: .45rem; }
.sent-meta .message-status { margin-top: 0; }
.reply-state { color: var(--muted); font-size: .62rem; font-weight: 700; }
.reply-state::before { margin-right: .25rem; content: "·"; }
.reply-state.replied { color: #3d7d6a; }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 1rem; color: var(--muted); font-size: .75rem; }
.pagination a { font-weight: 750; }
.pagination a:last-child { justify-self: end; }

.conversation-workspace { grid-template-columns: 348px minmax(0, 1fr); height: calc(100vh - 112px); min-height: 620px; }
.thread-sidebar { display: flex; min-height: 0; flex-direction: column; padding: 1rem; overflow: hidden; }
.thread-sidebar .sidebar-topline { margin-bottom: .8rem; }
.thread-sidebar-navigation, .thread-back-link, .thread-inbox-link { display: flex; align-items: center; gap: .45rem; }
.back-arrow { display: inline-block; animation: back-arrow-nudge 4.8s ease-in-out 1.2s infinite; }
.thread-back-link:hover .back-arrow, .thread-back-link:focus-visible .back-arrow,
.mobile-back:hover .back-arrow, .mobile-back:focus-visible .back-arrow { animation: none; transform: translateX(-3px); }
@keyframes back-arrow-nudge {
  0%, 72%, 82%, 92%, 100% { transform: translateX(0); }
  77%, 87% { transform: translateX(-3px); }
}
.thread-sidebar-navigation { min-width: 0; gap: .8rem; }
.thread-sidebar-navigation .nav-unread-count { min-width: 18px; height: 18px; font-size: .62rem; }
.compact-search { flex: 0 0 auto; margin-bottom: .8rem; }
.compact-list { flex: 1; overflow-y: auto; border: 0; border-radius: 0; }
.compact-list .swipe-conversation { border-bottom: 0; border-radius: .45rem; }
.compact-list .inbox-item { grid-template-columns: 36px minmax(0, 1fr); padding: .85rem .7rem; border-radius: .45rem; border: 0; }
.compact-list .thread-avatar { width: 36px; height: 36px; border-radius: 10px; font-size: .8rem; }
.compact-list .visibility-badge, .compact-list .thread-context { display: none; }
.conversation-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }
.conversation-header { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 96px; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); }
.conversation-title-line { display: flex; align-items: center; gap: .65rem; }
.conversation-heading h1 { margin: 0; font-size: 1.3rem; letter-spacing: -.025em; }
.conversation-heading p { margin: .25rem 0 0; color: var(--muted); font-size: .78rem; }
.participant-menu { position: relative; }
.participant-menu summary { display: flex; align-items: center; gap: .5rem; color: var(--muted); cursor: pointer; font-size: .76rem; font-weight: 700; list-style: none; }
.participant-menu summary::-webkit-details-marker { display: none; }
.participant-stack { display: grid; min-width: 32px; height: 32px; padding: 0 .4rem; place-items: center; border-radius: 16px; color: white; background: var(--navy-2); font-size: .65rem; letter-spacing: -.08em; }
.participant-popover { position: absolute; z-index: 5; top: 42px; right: 0; width: 300px; padding: 1rem; border: 1px solid var(--border); border-radius: .7rem; background: var(--paper); box-shadow: var(--shadow); }
.person-row { display: flex; align-items: center; gap: .55rem; padding: .65rem 0; border-bottom: 1px solid var(--border); font-size: .8rem; }
.person-row-copy { min-width: 0; margin-right: auto; }
.person-row-copy strong, .person-row-copy small { display: block; }
.person-row-copy small { margin-top: .1rem; color: var(--muted); font-size: .65rem; }
.person-avatar, .message-avatar { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--teal-dark); background: var(--seafoam); font-size: .78rem; font-weight: 800; }
.text-button { padding: 0; color: #a4494f; background: transparent; font-size: .7rem; }
.text-button:hover { color: #7f282f; background: transparent; }
.inline-form { display: flex; gap: .45rem; margin-top: .8rem; }
.inline-form select { min-width: 0; }
.thread-folder-form { margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.thread-folder-form label { margin: 0 0 .3rem !important; color: var(--muted); font-size: .64rem; letter-spacing: .05em; text-transform: uppercase; }
.thread-folder-form > div { display: flex; gap: .4rem; }
.thread-folder-form select { min-width: 0; padding: .45rem; font-size: .7rem; }
.thread-folder-form input[type=submit] { padding: .45rem .65rem; font-size: .68rem; }
.thread-folder-form small { display: block; margin-top: .3rem; color: var(--muted); font-size: .6rem; }
.thread-danger-zone { margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.thread-delete-button { width: 100%; padding: .5rem .65rem; color: #a4494f; background: transparent; border: 1px solid color-mix(in srgb, #a4494f 42%, transparent); font-size: .7rem; }
.thread-delete-button:hover { color: #fff; background: #a4494f; }
html[data-theme="dark"] .thread-delete-button { color: #f0a4aa; border-color: #774047; }
html[data-theme="dark"] .thread-delete-button:hover { color: #fff; background: #9e3d46; }
.mobile-back { display: none; }

.message-scroll { min-height: 0; padding: 0 1.5rem; overflow-y: auto; background: var(--field); }
.thread-opening { display: flex; align-items: center; gap: .7rem; margin: 1.3rem 0; color: var(--muted); font-size: .68rem; text-align: center; }
.thread-opening::before, .thread-opening::after { height: 1px; flex: 1; content: ""; background: var(--border); }
.messages { display: grid; gap: .35rem; }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: .75rem; padding: .8rem 0; }
.message-content { min-width: 0; }
.message header { display: flex; align-items: baseline; gap: .7rem; }
.message header strong { font-size: .84rem; }
.message time { color: var(--muted); font-size: .66rem; }
.message-body { display: inline-block; max-width: min(680px, 90%); margin-top: .28rem; padding: .72rem .9rem; border: 1px solid var(--border); border-radius: .25rem .8rem .8rem .8rem; background: var(--paper); box-shadow: 0 2px 7px rgba(20,48,58,.035); font-size: .88rem; }
.message-body p { margin: 0; }
.message.own-message { grid-template-columns: minmax(0, 1fr); padding-left: 3rem; }
.message.own-message .message-avatar { display: none; }
.message.own-message .message-content { display: grid; justify-items: end; }
.message.own-message header { justify-content: flex-end; }
.message.own-message header strong { display: none; }
.message.own-message .message-body { border-radius: .8rem .25rem .8rem .8rem; border-color: var(--own-message-border); background: var(--own-message); }
.message.own-message .attachment-list { justify-content: flex-end; }
.message.own-message .attachment-card { border-color: var(--own-message-border); background: var(--surface-soft); }
.message-status { margin-top: .28rem; color: var(--muted); font-size: .62rem; font-weight: 700; }
.message-status.delivered, .message-status.read { color: var(--teal); }
.attachment-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.attachment-card { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--paper); font-size: .75rem; }
.attachment-card > span:first-child { font-size: 1rem; }
.attachment-card strong, .attachment-card small { display: block; }
.attachment-card small { color: var(--muted); }
.attachment-scan-state { max-width: min(440px, 100%); cursor: default; }
.attachment-scan-state > span:first-child { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: var(--teal-dark); background: var(--seafoam); font-weight: 900; }
.attachment-scan-state.infected > span:first-child, .attachment-scan-state.failed > span:first-child { color: #a43d46; background: #fdecef; }
.attachment-scan-state small { line-height: 1.35; }
html[data-theme="dark"] .attachment-scan-state.infected > span:first-child, html[data-theme="dark"] .attachment-scan-state.failed > span:first-child { color: #f0a4aa; background: #452529; }
.image-attachment { max-width: min(460px, 100%); overflow: hidden; border: 1px solid var(--border); border-radius: .7rem; background: var(--paper); }
.image-attachment-link { display: block; color: var(--ink); }
.image-attachment-thumbnail { display: block; width: 100%; max-height: 320px; object-fit: contain; background: var(--surface-soft); }
.image-attachment-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .55rem .7rem; }
.image-attachment-meta strong { min-width: 0; overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.image-attachment-meta small { flex: 0 0 auto; color: var(--muted); font-size: .62rem; }
.image-preview-dialog { width: min(1180px, calc(100vw - 2rem)); max-width: none; max-height: calc(100dvh - 2rem); padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: .85rem; color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(4,20,26,.45); }
.image-preview-dialog::backdrop { background: rgba(4,15,20,.78); backdrop-filter: blur(3px); }
.image-preview-card { display: flex; max-height: calc(100dvh - 2rem); flex-direction: column; }
.image-preview-card header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .85rem; border-bottom: 1px solid var(--border); }
.image-preview-card header strong { min-width: 0; overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.image-preview-card header button { width: 34px; height: 34px; padding: 0; color: var(--muted); background: transparent; font-size: 1.4rem; }
.image-preview-card header button:hover { color: var(--ink); background: var(--seafoam); }
.image-preview-card > img { display: block; min-height: 0; max-width: 100%; max-height: calc(100dvh - 130px); margin: auto; object-fit: contain; background: #071116; }
.image-preview-card footer { flex: 0 0 auto; padding: .65rem .85rem; border-top: 1px solid var(--border); text-align: right; }
.image-preview-download { font-size: .72rem; font-weight: 750; }
.pdf-attachment-card { min-width: min(340px, 100%); }
.pdf-attachment-card .pdf-attachment-icon { display: grid; width: 38px; height: 42px; place-items: center; border-radius: .3rem; color: #a43d46; background: #fdecef; font-size: .58rem; font-weight: 900; letter-spacing: .04em; }
.pdf-preview-dialog { width: min(1180px, calc(100vw - 2rem)); max-width: none; height: min(900px, calc(100dvh - 2rem)); max-height: none; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: .85rem; color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(4,20,26,.45); }
.pdf-preview-dialog::backdrop { background: rgba(4,15,20,.78); backdrop-filter: blur(3px); }
.pdf-preview-card { display: grid; height: 100%; grid-template-rows: auto minmax(0, 1fr) auto; }
.pdf-preview-card header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .85rem; border-bottom: 1px solid var(--border); }
.pdf-preview-card header strong { min-width: 0; overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.pdf-preview-card header button { width: 34px; height: 34px; padding: 0; color: var(--muted); background: transparent; font-size: 1.4rem; }
.pdf-preview-card header button:hover { color: var(--ink); background: var(--seafoam); }
.pdf-preview-card iframe { width: 100%; height: 100%; border: 0; background: var(--surface-soft); }
.pdf-preview-card footer { display: flex; justify-content: flex-end; gap: 1rem; padding: .65rem .85rem; border-top: 1px solid var(--border); font-size: .72rem; font-weight: 750; }
.pdf-preview-download { font-weight: 750; }
html[data-theme="dark"] .pdf-attachment-card .pdf-attachment-icon { color: #f0a4aa; background: #452529; }
.empty-thread { padding: 4rem 1rem; color: var(--muted); text-align: center; }

.composer { padding: 1rem 1.5rem 1.2rem; border-top: 1px solid var(--border); background: var(--paper); }
.composer textarea { width: 100%; resize: vertical; padding: .8rem; border: 1px solid var(--border); border-radius: .6rem; outline: none; background: var(--field); }
.composer textarea:focus { border-color: #87b9c1; box-shadow: 0 0 0 3px rgba(22,119,138,.09); }
.composer-actions { display: flex; align-items: center; gap: .8rem; margin-top: .65rem; }
.attachment-button { color: var(--teal-dark); cursor: pointer; font-size: .78rem; font-weight: 700; }
.attachment-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.emoji-picker { position: relative; }
.emoji-picker > summary { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; cursor: pointer; font-size: 1.3rem; line-height: 1; list-style: none; }
.emoji-picker > summary::-webkit-details-marker { display: none; }
.emoji-picker > summary:hover, .emoji-picker > summary:focus-visible, .emoji-picker[open] > summary { background: var(--seafoam); }
.emoji-picker-menu { position: absolute; z-index: 12; bottom: calc(100% + .55rem); left: -.55rem; display: grid; grid-template-columns: repeat(5, 38px); gap: .3rem; width: max-content; padding: .55rem; border: 1px solid var(--border); border-radius: .7rem; background: var(--paper); box-shadow: var(--shadow); }
.emoji-picker-menu button { width: 38px; height: 38px; padding: 0; color: inherit; background: transparent; font-size: 1.15rem; }
.emoji-picker-menu button:hover, .emoji-picker-menu button:focus-visible { background: var(--seafoam); transform: scale(1.08); }
.selected-files { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .65rem; }
.selected-files[hidden] { display: none; }
.selected-file { display: inline-flex; align-items: baseline; gap: .4rem; max-width: 260px; padding: .38rem .55rem; border: 1px solid #b8d4d8; border-radius: .45rem; color: var(--teal-dark); background: var(--seafoam); font-size: .72rem; }
.selected-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file small { flex: 0 0 auto; color: var(--muted); }
.clear-files { padding: .2rem .4rem; color: var(--muted); background: transparent; font-size: .68rem; }
.clear-files:hover { color: #8b1d27; background: transparent; }
.composer-hint { margin-left: auto; color: var(--muted); font-size: .68rem; }
.composer input[type=submit] { padding: .55rem .9rem; }

.compose-page { width: min(900px, 100%); margin: 0 auto; }
.compose-page-header { display: grid; grid-template-columns: 110px 1fr; align-items: end; margin: 1.5rem 0 1rem; }
.compose-page-header h1 { margin: .1rem 0 0; font-size: 1.55rem; letter-spacing: -.035em; }
.compose-window { overflow: hidden; border: 1px solid var(--border); border-radius: .8rem; background: var(--paper); box-shadow: var(--shadow); }
.compose-errors { padding: .8rem 1rem; color: #8b1d27; background: #fdecef; font-size: .82rem; }
.compose-errors strong { display: block; }
.compose-row, .recipient-picker { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: center; min-height: 58px; padding: .65rem 1.15rem; border-bottom: 1px solid var(--border); }
.compose-label { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.person-token { display: grid; grid-template-columns: 32px auto 1fr; align-items: center; gap: .55rem; font-size: .8rem; }
.person-token > span { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: white; background: var(--navy-2); font-weight: 800; }
.person-token small { color: var(--muted); }
.delivery-options { display: flex; gap: .55rem; }
.delivery-option { display: flex; flex: 1; align-items: center; gap: .55rem; min-height: 46px; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: .55rem; cursor: pointer; }
.delivery-option:has(input:checked) { border-color: #77acb6; background: var(--seafoam); box-shadow: inset 0 0 0 1px #77acb6; }
.delivery-option input { accent-color: var(--teal); }
.delivery-option strong, .delivery-option small, .recipient-option strong, .recipient-option small { display: block; }
.delivery-option strong { font-size: .8rem; }
.delivery-option small, .recipient-option small { color: var(--muted); font-size: .68rem; }
.recipient-picker { align-items: start; background: var(--field); }
.recipient-picker[hidden] { display: none; }
.recipient-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .45rem; }
.recipient-option { display: grid; grid-template-columns: auto 32px minmax(0, 1fr); align-items: center; gap: .5rem; padding: .5rem; border: 1px solid var(--border); border-radius: .5rem; cursor: pointer; background: var(--paper); }
.recipient-option:has(input:checked) { border-color: #77acb6; background: var(--seafoam); }
.recipient-option strong { overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.context-select { width: auto; min-width: 220px; border: 0; color: var(--ink); background: var(--surface-soft); font-size: .82rem; font-weight: 700; }
.subject-row { padding: .3rem 1.15rem; border-bottom: 1px solid var(--border); }
.subject-row input { padding: .85rem 0; border: 0; outline: 0; font-size: 1.08rem; font-weight: 750; }
.subject-row input::placeholder { color: #87969b; }
.editor-row textarea { display: block; min-height: 280px; padding: 1.15rem; resize: vertical; border: 0; border-radius: 0; outline: 0; line-height: 1.65; }
.compose-footer { display: flex; align-items: center; gap: .8rem; padding: .8rem 1.15rem; border-top: 1px solid var(--border); background: var(--field); }
.compose-selected-files { margin: 0; padding: .7rem 1.15rem; border-top: 1px solid var(--border); background: var(--field); }
.compose-spacer { flex: 1; }
.discard-button { color: var(--muted); font-size: .78rem; font-weight: 700; }

.address-compose-page { width: min(1320px, 100%); }
.address-compose { display: grid; grid-template-columns: minmax(0, 1fr) 370px; }
.address-compose-errors { grid-column: 1 / -1; }
.address-editor { min-width: 0; border-right: 1px solid var(--border); }
.address-to-field { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; min-height: 38px; }
.address-to-field > input { flex: 1; min-width: 160px; padding: .45rem .15rem; border: 0; outline: 0; }
.mobile-recipient-button, .mobile-address-done, .mobile-address-backdrop { display: none; }
.address-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .4rem; border: 1px solid #b8d4d8; border-radius: .45rem; color: var(--teal-dark); background: var(--seafoam); font-size: .72rem; font-weight: 750; }
.address-chip b { display: grid; width: 19px; height: 19px; place-items: center; border-radius: .3rem; color: white; background: var(--teal); font-size: .48rem; }
.address-chip small { color: #5c777d; font-size: .58rem; }
.address-chip button { padding: 0; border: 0; color: #6b858b; background: transparent; font-size: .85rem; line-height: 1; }
.address-chip button:hover { color: var(--teal-dark); background: transparent; }
.address-context { display: flex; flex-wrap: wrap; gap: .45rem; }
.address-context span { padding: .3rem .5rem; border-radius: .4rem; color: #526b72; background: #f2f6f6; font-size: .7rem; font-weight: 700; }
.address-context .vessel { color: #315f70; background: var(--seafoam); }
.address-context .external { color: #7c5724; background: #fff3dd; text-transform: uppercase; }
.address-book-panel { min-width: 0; display: flex; flex-direction: column; background: var(--surface-soft); }
.address-book-header { padding: 1rem; border-bottom: 1px solid var(--border); }
.address-book-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.address-book-header h2 { margin: 0 0 .2rem; font-size: .95rem; }
.address-book-header p { margin: 0 0 .65rem; color: var(--muted); font-size: .65rem; }
.address-book-panel .address-search { display: flex; align-items: center; gap: .45rem; margin: 0; padding: 0 .65rem; border: 1px solid var(--border); border-radius: .5rem; color: var(--muted); background: var(--paper); font-weight: 400; }
.address-search:focus-within { border-color: #87b9c1; box-shadow: 0 0 0 3px rgba(22,119,138,.09); }
.address-search input { width: 100%; padding: .55rem 0; border: 0; outline: 0; background: transparent; font-size: .75rem; }
.address-book-list { height: 510px; padding: .45rem .6rem 1rem; overflow-y: auto; }
.address-group > header { display: flex; justify-content: space-between; padding: .7rem .4rem .28rem; color: var(--muted); font-size: .56rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.address-book-panel .address-contact { position: relative; width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) 20px; align-items: center; gap: .55rem; margin: 0; padding: .45rem; border-radius: .5rem; color: var(--ink); background: transparent; font-weight: 400; cursor: pointer; }
.address-book-panel .address-contact:hover { background: var(--paper); box-shadow: 0 2px 10px rgba(20,48,58,.06); }
.address-book-panel .address-contact:has(input:checked) { background: var(--seafoam); }
.address-book-panel .address-contact.disabled { opacity: .48; cursor: not-allowed; }
.address-contact-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.address-contact-input:focus-visible ~ .address-contact-icon { outline: 3px solid rgba(22,119,138,.22); outline-offset: 2px; }
.address-contact-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: .55rem; color: var(--teal-dark); background: #e7f0f1; font-size: .68rem; font-weight: 850; }
.address-contact.team .address-contact-icon { color: #675487; background: #f0eafa; }
.address-contact.vessel .address-contact-icon { color: #375f79; background: #e7f0f7; }
.address-contact.person .address-contact-icon { color: #306b5e; background: #e7f5ef; }
.address-contact.external .address-contact-icon { color: #8a6228; background: #fff1d9; }
.address-contact-copy { min-width: 0; }
.address-contact-copy strong, .address-contact-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.address-contact-copy strong { font-size: .74rem; }
.address-contact-copy small { color: var(--muted); font-size: .62rem; }
.address-contact-check { display: grid; width: 18px; height: 18px; place-items: center; border: 1px solid #b8c8cb; border-radius: 50%; color: transparent; font-size: .58rem; }
.address-contact:has(input:checked) .address-contact-check { border-color: var(--teal); color: white; background: var(--teal); }
.address-no-results { padding: 1.2rem .5rem; color: var(--muted); font-size: .7rem; text-align: center; }
.address-summary { min-height: 66px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .7rem; margin-top: auto; padding: .7rem 1rem; border-top: 1px solid var(--border); background: var(--paper); }
.address-summary strong, .address-summary span { display: block; }
.address-summary strong { color: var(--teal-dark); font-size: .74rem; }
.address-summary div > span { max-width: 245px; overflow: hidden; color: var(--muted); font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.address-summary .address-thread-kind { padding: .25rem .45rem; border-radius: 99px; color: #345e65; background: var(--seafoam); font-size: .55rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.address-summary .address-thread-kind.external { color: #7c5724; background: #fff3dd; }
.address-summary .address-thread-kind.direct { color: #69508a; background: #f1eafd; }
.address-compose input[type=submit]:disabled { cursor: not-allowed; opacity: .45; }
.address-editor .subject-row input { padding: .85rem 0; border: 0; border-radius: 0; }
.address-editor .editor-row textarea { border: 0; border-radius: 0; }

.fleet-settings-page { width: min(1100px, 100%); margin: 1.5rem auto 3rem; }
.fleet-settings-header { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: start; gap: 1rem; padding: 1.2rem 0 1.5rem; border-bottom: 1px solid var(--border); }
.fleet-settings-header h1 { margin: .15rem 0 .2rem; font-size: 1.7rem; letter-spacing: -.04em; }
.fleet-settings-header p { margin: 0; color: var(--muted); font-size: .82rem; }
.admin-badge { padding: .3rem .55rem; border-radius: 99px; color: var(--teal-dark); background: var(--seafoam); font-size: .62rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.admin-summary { display: grid; grid-template-columns: repeat(5, 1fr); margin: 1.2rem 0; overflow: hidden; border: 1px solid var(--border); border-radius: .7rem; background: var(--paper); box-shadow: var(--shadow); }
.admin-tab { display: block; padding: 1rem 1.2rem; border-right: 1px solid var(--border); border-radius: 0; color: var(--ink); background: var(--paper); text-align: left; }
.admin-tab:last-child { border-right: 0; }
.admin-tab:hover, .admin-tab:focus-visible { color: var(--teal-dark); background: var(--surface-hover); }
.admin-tab[aria-selected="true"] { color: var(--teal-dark); background: var(--seafoam); box-shadow: inset 0 -3px var(--teal); }
.admin-summary strong, .admin-summary span { display: block; }
.admin-summary strong { font-size: 1.35rem; }
.admin-summary span { color: var(--muted); font-size: .7rem; }
.admin-tab-panels { min-height: 420px; }
.admin-tab-panels > [hidden] { display: none; }
.admin-section { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: .7rem; background: var(--paper); }
.admin-section > header { display: flex; align-items: center; justify-content: space-between; gap: .7rem; min-height: 76px; padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.admin-section h2 { margin: .1rem 0 0; font-size: 1rem; }
.coming-next { padding: .25rem .45rem; border-radius: 99px; color: var(--muted); background: #f1f4f4; font-size: .55rem; font-weight: 800; text-transform: uppercase; }
.admin-list { padding: .2rem 1rem; }
.admin-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: .65rem; min-height: 65px; border-bottom: 1px solid var(--border); }
.admin-row:last-child { border-bottom: 0; }
.admin-row strong, .admin-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-row strong { font-size: .78rem; }
.admin-row small { color: var(--muted); font-size: .65rem; }
.admin-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: .55rem; color: #375f79; background: #e7f0f7; font-size: .68rem; font-weight: 850; }
.admin-icon.team { color: #675487; background: #f0eafa; }
.admin-icon.external { color: #8a6228; background: #fff1d9; }
.admin-icon.support { color: #675487; background: #f0eafa; }
.role-badge, .admin-detail { color: var(--muted); font-size: .62rem; }
.role-badge { padding: .2rem .4rem; border-radius: 99px; color: var(--teal-dark); background: var(--seafoam); font-weight: 800; }
.admin-person-entry { border-bottom: 1px solid var(--border); }
.admin-person-entry:last-child { border-bottom: 0; }
.admin-person-entry .admin-row { border-bottom: 0; }
.admin-person-entry.suspended { background: var(--surface-soft); }
.admin-person-entry.suspended .person-avatar { color: var(--muted); background: #e8eded; }
.admin-person-entry.suspended .admin-icon { filter: grayscale(1); opacity: .65; }
.role-badge.suspended { color: #7d464c; background: #f8e7e9; }
.admin-row small.member-assignment { margin-top: .15rem; color: #496b73; white-space: normal; }
.member-management { padding-right: .2rem; }
.member-management-forms { display: flex; align-items: end; gap: .55rem; }
.member-role-form { display: flex; align-items: end; gap: .45rem; }
.member-role-form label { min-width: 130px; margin: 0; }
.member-role-form label > span { display: block; margin-bottom: .2rem; color: var(--muted); font-size: .58rem; letter-spacing: .04em; text-transform: uppercase; }
.member-role-form select, .member-role-form input, .member-access-form input { padding: .48rem .55rem; font-size: .68rem; }
.member-access-form { margin-left: auto; }
.external-access-form { width: max-content; margin-left: 0; }
.external-details-form { display: flex; align-items: end; gap: .45rem; margin-bottom: .55rem; }
.external-details-form label { min-width: 220px; margin: 0; }
.external-details-form label > span { display: block; margin-bottom: .2rem; color: var(--muted); font-size: .58rem; letter-spacing: .04em; text-transform: uppercase; }
.external-details-form input { padding: .48rem .55rem; font-size: .68rem; }
.danger-button { color: #8b1d27; background: #f8e7e9; }
.danger-button:hover { background: #f2d6da; }
.member-management-note { margin: .45rem .2rem 0 0; color: var(--muted); font-size: .6rem; }
.member-management-note.warning { color: #8a6228; }
.admin-create-panel { padding: .9rem 1rem; border-bottom: 1px solid var(--border); background: var(--field); }
.admin-create-panel > strong { display: block; margin-bottom: .55rem; font-size: .76rem; }
.admin-create-panel > small { display: block; margin-top: .5rem; color: var(--muted); font-size: .62rem; }
.admin-vessel-form { display: grid; grid-template-columns: 1.2fr .8fr 1fr auto; align-items: end; gap: .55rem; }
.admin-vessel-form label { margin: 0; font-weight: 700; }
.admin-vessel-form label > span { display: block; margin-bottom: .2rem; color: var(--muted); font-size: .58rem; letter-spacing: .04em; text-transform: uppercase; }
.admin-vessel-form input, .admin-vessel-form select { min-width: 0; padding: .48rem .55rem; font-size: .7rem; }
.admin-vessel-form input[type=submit] { padding: .55rem .7rem; font-size: .68rem; }
.admin-vessel-entry { border-bottom: 1px solid var(--border); }
.admin-vessel-entry:last-child { border-bottom: 0; }
.admin-vessel-entry .admin-row { border-bottom: 0; }
.admin-edit-panel { padding: 0 0 .65rem 44px; }
.admin-edit-panel summary { width: max-content; color: var(--teal-dark); cursor: pointer; font-size: .63rem; font-weight: 750; }
.admin-edit-panel[open] summary { margin-bottom: .55rem; }
.storage-dashboard { display: grid; grid-template-columns: 230px minmax(0, 1fr); align-items: center; border-bottom: 1px solid var(--border); }
.storage-chart { display: grid; justify-items: center; gap: .5rem; margin: 0; padding: 1.2rem; border-right: 1px solid var(--border); }
.storage-chart figcaption { color: var(--muted); font-size: .68rem; font-weight: 700; }
.storage-donut { position: relative; width: 150px; height: 150px; }
.storage-donut svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.storage-donut circle { fill: none; stroke-width: 13; }
.storage-donut-track { stroke: var(--border); }
.storage-donut-used { stroke: var(--teal); stroke-linecap: round; }
.storage-donut > span { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.storage-donut > span strong, .storage-donut > span small { display: block; }
.storage-donut > span strong { font-size: 1.35rem; }
.storage-donut > span small { color: var(--muted); font-size: .65rem; font-weight: 700; text-transform: uppercase; }
.storage-overview { display: grid; grid-template-columns: repeat(2, 1fr); }
.storage-overview > div { padding: 1.2rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.storage-overview > div:nth-child(even) { border-right: 0; }
.storage-overview > div:nth-last-child(-n+2) { border-bottom: 0; }
.storage-overview strong, .storage-overview span { display: block; }
.storage-overview strong { font-size: 1.25rem; }
.storage-overview span { color: var(--muted); font-size: .68rem; }
.storage-meter, .storage-policy, .storage-usage-list { padding: 1rem; border-bottom: 1px solid var(--border); }
.storage-meter p, .storage-policy p, .storage-empty { margin: .55rem 0 0; color: var(--muted); font-size: .7rem; }
.storage-policy > strong { font-size: .78rem; }
.attachment-scan-overview { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.attachment-scan-overview span { padding: .4rem .55rem; border: 1px solid var(--border); border-radius: .45rem; color: var(--muted); background: var(--surface-soft); font-size: .65rem; }
.attachment-scan-overview strong { color: var(--ink); }
.storage-user-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 58px; border-bottom: 1px solid var(--border); }
.storage-user-row:last-child { border-bottom: 0; }
.storage-user-row span strong, .storage-user-row span small { display: block; }
.storage-user-row span strong { font-size: .76rem; }
.storage-user-row span small { color: var(--muted); font-size: .64rem; }
.storage-user-row > strong { color: var(--muted); font-size: .72rem; }
.admin-vessel-form.edit { padding-right: .2rem; }
.admin-team-form { display: grid; gap: .55rem; }
.admin-team-name { margin: 0; font-weight: 700; }
.admin-team-name > span, .admin-member-picker legend { display: block; margin-bottom: .2rem; color: var(--muted); font-size: .58rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.admin-team-name input { padding: .48rem .55rem; font-size: .7rem; }
.admin-member-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; margin: 0; padding: 0; border: 0; }
.admin-member-picker legend { padding: 0; }
.admin-member-picker label { display: flex; align-items: center; gap: .4rem; min-width: 0; margin: 0; padding: .4rem; border: 1px solid var(--border); border-radius: .4rem; background: var(--paper); cursor: pointer; font-weight: 400; }
.admin-member-picker label:has(input:checked) { border-color: #77acb6; background: var(--seafoam); }
.admin-member-picker input { flex: 0 0 auto; accent-color: var(--teal); }
.admin-member-picker span, .admin-member-picker strong, .admin-member-picker small { display: block; min-width: 0; }
.admin-member-picker strong, .admin-member-picker small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-member-picker strong { font-size: .68rem; }
.admin-member-picker small { color: var(--muted); font-size: .58rem; }
.admin-team-form input[type=submit] { width: max-content; padding: .5rem .7rem; font-size: .68rem; }
.admin-team-entry { border-bottom: 1px solid var(--border); }
.admin-team-entry:last-child { border-bottom: 0; }
.admin-team-entry .admin-row { border-bottom: 0; }
.admin-invitation-form { display: grid; grid-template-columns: .8fr 1.2fr .7fr auto; align-items: end; gap: .55rem; }
.admin-invitation-form.external { grid-template-columns: .8fr .9fr 1.2fr auto; }
.admin-invitation-form label { margin: 0; font-weight: 700; }
.admin-invitation-form label > span { display: block; margin-bottom: .2rem; color: var(--muted); font-size: .58rem; letter-spacing: .04em; text-transform: uppercase; }
.admin-invitation-form input, .admin-invitation-form select { min-width: 0; padding: .48rem .55rem; font-size: .7rem; }
.admin-invitation-form input[type=submit] { padding: .55rem .7rem; font-size: .68rem; }
.admin-invitations { padding: .75rem 1rem; border-top: 1px solid var(--border); background: var(--field); }
.admin-invitation-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .65rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.admin-invitation-row:last-child { border-bottom: 0; }
.admin-invitation-row strong, .admin-invitation-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-invitation-row strong { font-size: .7rem; }
.admin-invitation-row small { color: var(--muted); font-size: .58rem; }
.invitation-status { text-align: right; }
.invitation-status > span { display: inline-block; padding: .18rem .38rem; border-radius: 99px; color: var(--teal-dark); background: var(--seafoam); font-size: .55rem; font-weight: 800; }
.invitation-status > span.expired { color: #8b1d27; background: #fdecef; }
.invitation-status > span.accepted { color: #3d674c; background: #e7f7ed; }
.invitation-page { width: min(520px, calc(100% - 2rem)); margin: 3rem auto; padding: 1.5rem; border: 1px solid var(--border); border-radius: .8rem; background: var(--paper); box-shadow: var(--shadow); }
.invitation-page > .fleet-mark { margin-bottom: 1rem; }
.invitation-page h1 { margin: .2rem 0 .4rem; font-size: 1.6rem; letter-spacing: -.04em; }
.invitation-page > p { color: var(--muted); font-size: .82rem; }
.invitation-form { display: grid; gap: .7rem; margin-top: 1.2rem; }
.invitation-form label { margin: 0; font-size: .7rem; }
.invitation-form input { margin-top: .25rem; }
.invitation-form input:disabled { color: var(--muted); background: #f4f7f7; }
.invitation-form input[type=submit] { width: max-content; margin-top: .25rem; }
.invitation-existing-account { display: flex; align-items: center; gap: .65rem; margin: 1rem 0; padding: .8rem; border: 1px solid var(--border); border-radius: .55rem; background: var(--field); }
.invitation-existing-account strong, .invitation-existing-account small { display: block; }
.invitation-existing-account small { color: var(--muted); font-size: .7rem; }
.support-compose-menu { position: relative; }
.support-compose-menu summary { list-style: none; }
.support-compose-menu summary::-webkit-details-marker { display: none; }
.support-compose-menu > div { position: absolute; z-index: 5; top: calc(100% + .4rem); right: 0; display: grid; min-width: 220px; overflow: hidden; border: 1px solid var(--border); border-radius: .55rem; background: var(--paper); box-shadow: var(--shadow); }
.support-compose-menu > div a { padding: .65rem .8rem; border-bottom: 1px solid var(--border); font-size: .75rem; font-weight: 700; }
.support-compose-menu > div a:last-child { border-bottom: 0; }
.support-compose-menu > div a:hover { background: var(--seafoam); }

.card, .list-item { display: block; padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--paper); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.card h2 { margin-top: 0; }
.list { display: grid; gap: .6rem; }
.list-item { display: flex; justify-content: space-between; color: inherit; }
.form, .narrow { max-width: 600px; }
.narrow { margin: 4rem auto; }
label:not(.search-field, .attachment-button, .checkbox) { display: block; margin-top: .8rem; font-weight: 700; }
input[type=text], input[type=email], input[type=password], textarea, select { width: 100%; padding: .6rem; border: 1px solid var(--border); border-radius: .35rem; color: var(--ink); background: var(--paper); }
fieldset { margin: 1rem 0; border: 1px solid var(--border); }
.checkbox { display: block; }
.muted { color: var(--muted); }
.flash { padding: .7rem 1rem; margin-bottom: 1rem; border-radius: .4rem; transition: opacity .2s ease, transform .2s ease; }
.flash.flash-leaving { opacity: 0; transform: translateY(-5px); }
.notice { background: #e7f7ed; }
.alert, .errors { padding: .6rem; color: #8b1d27; background: #fdecef; }

html[data-theme="dark"] .visibility-badge { color: #b9d9dd; background: #243a40; }
html[data-theme="dark"] .visibility-badge.external,
html[data-theme="dark"] .address-context .external,
html[data-theme="dark"] .address-summary .address-thread-kind.external { color: #f1c77f; background: #49391f; }
html[data-theme="dark"] .visibility-badge.direct,
html[data-theme="dark"] .address-summary .address-thread-kind.direct { color: #cfb9ef; background: #372d49; }
html[data-theme="dark"] .conversation-type-filter.direct.active { color: #cfb9ef; border-color: #5b4975; background: #372d49; }
html[data-theme="dark"] .conversation-type-filter.external.active { color: #f1c77f; border-color: #6f562f; background: #49391f; }
html[data-theme="dark"] .address-contact-icon,
html[data-theme="dark"] .admin-icon { filter: brightness(.78) saturate(.85); }
html[data-theme="dark"] .notice { color: #b8e2c5; background: #183726; }
html[data-theme="dark"] .alert,
html[data-theme="dark"] .errors,
html[data-theme="dark"] .compose-errors { color: #f0b0b5; background: #452529; }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #71878d; }

@media (max-width: 860px) {
  .container { width: calc(100% - 1rem); margin: .5rem auto; }
  .workspace { min-height: calc(100vh - 76px); border-radius: 10px; }
  .fleet-workspace { grid-template-columns: 230px minmax(0, 1fr); }
  .conversation-workspace { display: block; height: calc(100vh - 76px); min-height: 560px; }
  .thread-sidebar { display: none; }
  .conversation-panel { height: 100%; }
  .mobile-back { display: inline-block; position: absolute; top: .45rem; left: 1rem; color: var(--muted); font-size: .7rem; font-weight: 700; }
  .conversation-header { padding-top: 1.6rem; }
  .address-compose { grid-template-columns: minmax(0, 1fr) 330px; }
}

@media (prefers-reduced-motion: reduce) {
  .back-arrow { animation: none; }
}

@media (max-width: 620px) {
  .site-header { height: 56px; }
  .site-header > span { display: none; }
  .container { width: 100%; margin: 0; }
  .workspace { min-height: calc(100vh - 56px); border: 0; border-radius: 0; }
  .fleet-workspace { display: block; }
  .unified-workspace { display: block; }
  .fleet-sidebar, .unified-sidebar { position: fixed; z-index: 41; top: 56px; bottom: 0; left: 0; width: min(330px, 88vw); padding: 1rem; overflow-x: hidden; overflow-y: auto; visibility: hidden; border-right: 1px solid var(--border); border-bottom: 0; background: var(--surface-soft); box-shadow: 18px 0 55px rgba(4, 20, 26, .28); transform: translateX(-105%); transition: transform .2s ease, visibility 0s linear .2s; }
  .fleet-sidebar.open, .unified-sidebar.open { visibility: visible; transform: translateX(0); transition: transform .2s ease; }
  .fleet-sidebar .sidebar-topline, .unified-sidebar .sidebar-topline { padding-right: 2.5rem; }
  .mobile-drawer-trigger { position: absolute; z-index: 5; top: .85rem; left: .75rem; display: grid; width: 38px; height: 38px; padding: 0; place-items: center; border: 1px solid var(--border); border-radius: 10px; color: var(--teal-dark); background: var(--surface-soft); font-size: 1.05rem; line-height: 1; }
  .mobile-drawer-trigger:hover { color: var(--teal-dark); background: var(--seafoam); }
  .mobile-drawer-backdrop { position: fixed; z-index: 40; inset: 56px 0 0; display: block; padding: 0; visibility: hidden; border: 0; border-radius: 0; background: rgba(4, 15, 20, .52); opacity: 0; pointer-events: none; transition: opacity .2s ease, visibility 0s linear .2s; }
  .mobile-drawer-backdrop:hover { background: rgba(4, 15, 20, .52); }
  .mobile-drawer-backdrop.open { visibility: visible; opacity: 1; pointer-events: auto; transition: opacity .2s ease; }
  .mobile-drawer-close { position: absolute; z-index: 1; top: .7rem; right: .7rem; display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 1px solid var(--border); border-radius: 50%; color: var(--muted); background: var(--paper); font-size: 1.2rem; line-height: 1; }
  .mobile-drawer-close:hover { color: var(--ink); background: var(--seafoam); }
  body.mobile-drawer-open { overflow: hidden; }
  .mobile-settings-link { display: none; }
  .fleet-identity { margin-bottom: .25rem; }
  .inbox { padding: 0 .75rem 1rem; }
  .inbox-header { min-height: 86px; padding-left: 3.15rem; }
  .inbox-header h2 { font-size: 1.4rem; }
  .inbox-item { grid-template-columns: 38px minmax(0, 1fr); padding: .85rem .65rem; }
  .sent-item { grid-template-columns: 38px minmax(0, 1fr); padding: .85rem .65rem; }
  .sent-avatar { width: 38px; height: 38px; }
  .sent-item > .visibility-badge { display: none; }
  .sent-heading { display: block; }
  .sent-heading time { display: block; margin-top: .05rem; }
  .sent-filter-tabs { overflow-x: auto; }
  .thread-avatar { width: 38px; height: 38px; }
  .inbox-item > .visibility-badge { display: none; }
  .conversation-header { align-items: flex-start; padding: 1.7rem .9rem .75rem; }
  .conversation-title-line { flex-wrap: wrap; gap: .35rem; }
  .conversation-heading h1 { font-size: 1.05rem; }
  .participant-menu summary { font-size: 0; }
  .participant-popover { position: fixed; top: 58px; right: .5rem; width: min(300px, calc(100vw - 1rem)); }
  .message-scroll { padding: 0 .85rem; }
  .message-body { max-width: 100%; }
  .message.own-message { padding-left: 2.5rem; }
  .member-management-forms, .member-role-form { align-items: stretch; flex-direction: column; }
  .member-role-form label { width: 100%; }
  .member-access-form { margin-left: 0; }
  .member-access-form input { width: 100%; }
  .composer { padding: .75rem; }
  .composer-hint { display: none; }
  .composer-actions { gap: .5rem; }
  .composer input[type=submit] { margin-left: auto; }
  .compose-page { padding: .75rem; }
  .compose-page-header { display: block; margin: .5rem 0 .75rem; }
  .compose-page-header .back-link { display: inline-block; margin-bottom: .65rem; }
  .compose-row, .recipient-picker { grid-template-columns: 1fr; gap: .5rem; }
  .delivery-options { display: grid; }
  .person-token { grid-template-columns: 32px minmax(0, auto); }
  .person-token small { display: none; }
  .recipient-list { grid-template-columns: 1fr; }
  .context-select { width: 100%; }
  .compose-footer { flex-wrap: wrap; }
  .address-compose-page { padding: .75rem; }
  .address-compose { display: block; }
  .address-editor { border-right: 0; }
  .address-to-field > input { display: none; }
  .mobile-recipient-button { display: inline-flex; justify-content: flex-start; width: 100%; padding: .5rem 0; color: var(--teal-dark); background: transparent; font-size: .78rem; }
  .mobile-recipient-button:hover { color: var(--teal-dark); background: transparent; }
  .mobile-address-backdrop { position: fixed; z-index: 19; inset: 56px 0 0; width: 100%; padding: 0; border: 0; border-radius: 0; background: rgba(16,47,61,.34); }
  .mobile-address-backdrop:hover { background: rgba(16,47,61,.34); }
  .mobile-address-backdrop.mobile-open { display: block; }
  .address-book-panel { position: fixed; z-index: 20; inset: auto 0 0; display: flex; height: min(88dvh, 760px); overflow: hidden; visibility: hidden; border: 1px solid var(--border); border-width: 1px 0 0; border-radius: 1rem 1rem 0 0; background: var(--surface-soft); box-shadow: 0 -20px 60px rgba(16,47,61,.25); pointer-events: none; transform: translateY(100%); transition: transform .22s ease, visibility .22s; }
  .address-book-panel.mobile-open { visibility: visible; pointer-events: auto; transform: translateY(0); }
  .address-book-title::before { position: absolute; top: .45rem; left: 50%; width: 36px; height: 4px; border-radius: 2px; content: ""; background: #c6d2d4; transform: translateX(-50%); }
  .address-book-header { position: relative; padding-top: 1.25rem; }
  .mobile-address-done { display: inline-flex; padding: .45rem .75rem; font-size: .72rem; }
  .address-book-list { flex: 1; height: auto; }
  body.recipient-picker-open { overflow: hidden; }
  .fleet-settings-page { margin: 0; padding: .75rem; }
  .fleet-settings-header { grid-template-columns: 1fr auto; }
  .fleet-settings-header > .back-link { grid-column: 1 / -1; }
  .admin-summary { grid-template-columns: repeat(2, 1fr); }
  .admin-tab:nth-child(2) { border-right: 0; }
  .admin-tab:nth-child(-n+4) { border-bottom: 1px solid var(--border); }
  .admin-tab:nth-child(4) { border-right: 0; }
  .admin-row { grid-template-columns: 34px minmax(0, 1fr); }
  .admin-row > :last-child { grid-column: 2; justify-self: start; margin-top: -.65rem; margin-bottom: .55rem; }
  .admin-vessel-form { grid-template-columns: 1fr; }
  .admin-edit-panel { padding-left: 0; }
  .admin-vessel-form.edit { padding-right: 0; }
  .admin-member-picker { grid-template-columns: 1fr; }
  .admin-invitation-form { grid-template-columns: 1fr; }
  .admin-invitation-form.external { grid-template-columns: 1fr; }
  .external-details-form { align-items: stretch; flex-direction: column; }
  .external-details-form label { min-width: 0; }
  .admin-invitation-row { grid-template-columns: 1fr auto; }
  .admin-invitation-row > a { grid-column: 1 / -1; }
  .storage-overview { grid-template-columns: 1fr; }
  .storage-dashboard { grid-template-columns: 1fr; }
  .storage-chart { border-right: 0; border-bottom: 1px solid var(--border); }
  .storage-overview > div, .storage-overview > div:nth-child(even), .storage-overview > div:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--border); }
  .storage-overview > div:last-child { border-bottom: 0; }
}

@media (max-width: 400px) {
  .full-button-label { display: none; }
  .mobile-button-label { display: inline; }
}
