/* FleetInbox — light, airy, tab-based (Superhuman-inspired)
   ink #1F2430 · soft #7A8194 · bg #FFFFFF · wash #F6F7FA · line #ECEEF3
   chips: pastel fills with deep text, one hue per category. */

:root {
  --ink: #1F2430;
  --soft: #7A8194;
  --bg: #FFFFFF;
  --wash: #F6F7FA;
  --line: #ECEEF3;
  --accent: #6E56CF;           /* selection violet */
  --accent-wash: #F4F1FE;
  --danger: #C4442A;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { font-family: var(--body); color: var(--ink); background: var(--bg);
  font-size: 14px; line-height: 1.5; }
kbd { font-family: var(--mono); font-size: 10px; padding: 1px 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  background: #fff; color: var(--soft); }

body { background: #EEF0F4; }   /* the desk */

/* ---------------- shell: sidebar + paper ---------------- */
.shell { display: flex; height: calc(100vh - 34px); gap: 0;
  overflow: hidden; }

.side { width: 348px; flex: none; padding: 22px 14px 14px 18px;
  display: flex; flex-direction: column; height: 100%;
  overflow-y: auto; }
.wordmark { font-family: var(--mono); font-weight: 500; font-size: 14px;
  letter-spacing: .16em; padding: 0 10px 20px; color: #3A4152; }
.wordmark span { color: var(--accent); }

.menu { display: flex; flex-direction: column; gap: 2px; }
.menu-item { display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 9px; text-decoration: none;
  color: #4A5164; font-weight: 500; font-size: 14px; }
.menu-item:hover { background: #E4E7EE; color: var(--ink); }
.menu-item.active { background: #fff; color: var(--accent); font-weight: 700;
  box-shadow: 0 1px 4px rgba(31,36,48,.08); }
.menu-name { flex: 1; }
.menu-count { font-family: var(--mono); font-size: 11px; color: var(--soft); }
.menu-item.active .menu-count { color: var(--accent); font-weight: 600; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: #B9BFCB; }
.d-reply      { background: #D9482B; }
.d-vessel_ops { background: #159A93; }
.d-vetting    { background: #D9A21B; }
.d-technical  { background: #5C7396; }
.d-commercial { background: #B0509A; }
.d-admin      { background: #A2925B; }
.d-newsletter { background: #9AA3AB; }
.d-other      { background: #C2C8CF; }
.d-done       { background: transparent; border: 1.5px solid #9AA3AB; }

.side-foot { margin-top: auto; padding: 14px 12px 0;
  border-top: 1px solid #DDE1E9; display: flex; flex-direction: column;
  gap: 8px; }
.side-link, .as-link { font-size: 12.5px; color: var(--soft);
  text-decoration: none; background: none; border: none; cursor: pointer;
  font-family: var(--body); padding: 0; text-align: left; }
.side-link:hover, .as-link:hover { color: var(--ink); }

/* ---------------- paper (the mail card) ---------------- */
.paper { flex: 1; min-width: 0; background: var(--bg);
  border: 1px solid #E2E5EC; border-radius: 16px 0 0 0;
  box-shadow: 0 2px 16px rgba(31,36,48,.06);
  margin: 14px 0 0 0; padding: 14px 26px 40px;
  overflow-y: auto; height: calc(100% - 14px); }
.paper-head { display: flex; align-items: center; gap: 14px;
  padding: 2px 2px 12px; border-bottom: 1px solid var(--line); }
.searchbox input { font: 13.5px var(--body); padding: 8px 14px; width: 280px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--wash); }
.searchbox input:focus { outline: 2px solid var(--accent); background: #fff; }
.sync-health { font-size: 12px; color: var(--soft); margin-left: auto; }
.sync-health.stale { color: var(--danger); font-weight: 600; }
.deck-status { display: none; }

/* ---------------- rows ---------------- */
.threadlist { list-style: none; }
.row { display: grid;
  grid-template-columns: 160px 152px minmax(0, 1fr) auto 82px;
  gap: 14px; align-items: center; padding: 13px 12px;
  border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.row:hover { background: var(--wash); }
.row:focus, .row.cursor { outline: none; background: var(--accent-wash);
  box-shadow: inset 3px 0 0 var(--accent); }
.row.removing { opacity: 0; transform: translateX(24px);
  transition: opacity .16s ease, transform .16s ease; }

.row-sender { font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.row.hi .row-sender { color: var(--ink); }
.row-main { display: flex; gap: 8px; min-width: 0; align-items: baseline; }
.row-subject { font-weight: 600; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; flex-shrink: 1; }
.row.hi .row-subject { color: #16181f; }
.row-preview { color: var(--soft); font-weight: 400; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex-shrink: 4; min-width: 0; }
.row-time { font-family: var(--mono); font-size: 11px; color: var(--soft);
  text-align: right; }
.row-badges { display: flex; gap: 6px; align-items: center; }
.flagmark { color: var(--danger); }

/* chips — pastel fill, deep text */
.chip { font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; white-space: nowrap; }
.c-vessel_ops { background: #E0F2F1; color: #0B5E5A; }
.c-vetting    { background: #FBF0D9; color: #8A6410; }
.c-technical  { background: #E4E9F2; color: #3B4C66; }
.c-commercial { background: #F6E4F0; color: #7B2E62; }
.c-admin      { background: #F0EDE0; color: #6E6238; }
.c-newsletter { background: #EEF0F1; color: #667077; }
.c-other      { background: #EEF0F1; color: #667077; }
.c-vessel     { background: #EDF6FF; color: #1D5C96;
  font-family: var(--mono); font-weight: 500; font-size: 10.5px; }
.c-draft      { background: #E5F5EC; color: #196A3E; }
.c-high       { background: #FBE7E1; color: #A33517; }

.empty { text-align: center; padding: 100px 20px; color: var(--soft); }
.empty-mark { font-size: 30px; margin-bottom: 12px; color: var(--line); }
.empty code { font-family: var(--mono); font-size: 12px;
  background: var(--wash); padding: 2px 6px; border-radius: 4px; }

/* ---------------- thread page ---------------- */
.deck-head { display: flex; align-items: flex-start; gap: 14px;
  padding: 18px 2px 12px; border-bottom: 1px solid var(--line); }
.deck-head h1 { font-size: 19px; font-weight: 700; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 10px; }
.deck-meta { font-size: 12px; color: var(--soft); }
.thread-head { justify-content: space-between; }
.crumb { font-size: 12px; color: var(--soft); text-decoration: none;
  display: block; margin-bottom: 6px; }
.crumb:hover { color: var(--ink); }
.head-actions { display: flex; gap: 8px; flex: none; align-items: center; }
.mono { font-family: var(--mono); font-size: 11px; }
.pennant { display: none; }   /* legacy element in thread header */

.summary { border: 1px solid var(--line); background: var(--wash);
  border-radius: 10px; margin: 14px 0; padding: 14px 18px; }
.summary.hidden { display: none; }
.summary-label { font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--soft); margin-bottom: 8px;
  display: flex; justify-content: space-between; }
.summary pre, .msg-body { font-family: var(--body); white-space: pre-wrap;
  word-wrap: break-word; font-size: 13.5px; }
.lessons { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.messages { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.msg { border: 1px solid var(--line); border-radius: 10px; background: #fff;
  padding: 13px 18px; }
.msg.mine { background: var(--accent-wash); border-color: #E2DAF8; }
.msg-head { display: flex; justify-content: space-between; font-size: 12px;
  color: var(--soft); margin-bottom: 8px; }
.msg-from { font-weight: 600; color: var(--ink); }

.draftpane { border: 1.5px solid var(--accent); border-radius: 10px;
  background: #fff; padding: 13px 18px; margin-top: 20px; }
#draft-text { width: 100%; min-height: 170px; border: none; resize: vertical;
  font-family: var(--body); font-size: 13.5px; line-height: 1.55;
  background: transparent; }
#draft-text:focus { outline: none; }
.draft-actions { display: flex; gap: 8px; align-items: center;
  border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
.draft-note { font-size: 11px; color: var(--soft); margin-left: auto; }

.btn, select.btn { font-family: var(--body); font-size: 13px; font-weight: 600;
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); cursor: pointer;
  display: inline-flex; gap: 7px; align-items: center; }
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--accent); border-color: var(--accent);
  color: #fff; }
.btn.primary:hover { background: #5B45B8; }
.btn.wide { width: 100%; justify-content: center; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- keybar & help ---------------- */
.keybar { position: fixed; bottom: 0; left: 0; right: 0; height: 34px;
  display: flex; gap: 20px; align-items: center; justify-content: center;
  border-top: 1px solid var(--line); background: var(--wash);
  font-size: 14px; color: var(--ink); }
.move-hint { display: none; color: var(--danger); font-weight: 700; }
body.move-armed .keybar span { display: none; }
body.move-armed .keybar .move-hint { display: inline; }

.help-overlay { position: fixed; inset: 0; background: rgba(31,36,48,.4);
  display: grid; place-items: center; z-index: 50; cursor: pointer; }
.help-overlay.hidden { display: none; }
.help-card { background: #fff; border-radius: 14px; padding: 28px 32px;
  max-width: 640px; width: 92%; cursor: default;
  box-shadow: 0 20px 60px rgba(31,36,48,.25); }
.help-title { font-weight: 700; font-size: 15px; margin-bottom: 16px; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.help-cols p { margin: 7px 0; font-size: 13px; }
.help-sub { font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--soft); margin-bottom: 8px; }
.help-foot { font-size: 11px; color: var(--soft);
  border-top: 1px solid var(--line); margin-top: 18px; padding-top: 10px; }

/* ---------------- login ---------------- */
.login-body { display: grid; place-items: center; min-height: 100vh;
  background: var(--wash); }
.login-card { width: 320px; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; padding: 30px; display: flex; flex-direction: column;
  gap: 14px; box-shadow: 0 10px 40px rgba(31,36,48,.08); }
.login-card .wordmark { text-align: center; padding-bottom: 8px;
  font-size: 18px; }
.login-card label { font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--soft); display: flex;
  flex-direction: column; gap: 5px; }
.login-card input { font: 14px var(--body); padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--wash); }
.login-card input:focus { outline: 2px solid var(--accent); background: #fff; }
.login-err { color: var(--danger); font-size: 12.5px; }

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .shell { height: auto; overflow: visible; flex-direction: column; }
  .side { width: 100%; height: auto; overflow: visible;
    padding: 10px 10px 4px; }
  .paper { height: auto; overflow: visible; }
  .menu { flex-direction: row; overflow-x: auto; scrollbar-width: none;
    gap: 4px; padding-bottom: 6px; }
  .menu::-webkit-scrollbar { display: none; }
  .menu-item { white-space: nowrap; padding: 6px 10px; }
  .menu-count { display: none; }
  .wordmark { padding-bottom: 8px; }
  .side-foot { display: none; }
  .paper { border-radius: 12px 12px 0 0; margin: 0; padding: 10px 10px 70px; }
  .searchbox { flex: 1; }
  .searchbox input { width: 100%; }
  .row { grid-template-columns: minmax(0,1fr) 74px; grid-template-areas:
    "main time" "badges badges"; gap: 4px 10px; }
  .row-sender, .chip.c-vessel { display: none; }
  .row-main { grid-area: main; flex-direction: column; gap: 1px; }
  .row-badges { grid-area: badges; }
  .row-time { grid-area: time; }
  .keybar { display: none; }
  .help-cols { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .row, .tab, .btn { transition: background .12s ease, color .12s ease; }
}

.att-line { font-size: 12px; color: var(--soft); margin: -4px 0 8px;
  padding: 4px 8px; background: var(--wash); border-radius: 6px;
  display: inline-block; }

.notice { background: #EAF6E7; color: #3E7031; border-radius: 8px;
  padding: 9px 14px; margin: 12px 0; font-size: 13px; }
.hint { font-size: 12.5px; color: var(--soft); margin: 6px 0 12px; }
.cat-list { list-style: none; display: flex; flex-direction: column;
  gap: 6px; margin: 10px 0 18px; }
.cat-list li { display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-weight: 500; }
.cat-tag { font-size: 11px; color: var(--soft); margin-left: auto; }
.inlineform { margin-left: auto; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { color: var(--danger); border-color: #F0C9BF; }
.btn.danger:hover { background: #FBE7E1; }
.addform { display: flex; gap: 8px; }
.addform input[type=text] { flex: 1; max-width: 320px;
  font: 13.5px var(--body); padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--wash); }
.addform input[type=text]:focus { outline: 2px solid var(--accent);
  background: #fff; }

/* topic chip (editable) — fixed column, never stretches the row */
.row-badges .chip, .row-badges .c-topic { align-self: center; }
.c-topic { background: #2E3A50; color: #fff; font-weight: 600; cursor: pointer;
  line-height: 1.4; max-height: 22px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.c-topic:hover { background: #3D4A63; }
/* the chip that sits in the row's dedicated chip column */
.row > .chip { justify-self: start; max-width: 152px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.row > .c-topic { font-size: 11px; padding: 3px 10px; }
.c-topic.empty { background: transparent; color: #C3C8D2;
  border: 1px dashed #DDE1E9; font-weight: 500; font-size: 10.5px;
  padding: 2px 7px; line-height: 1.3; max-height: 20px; visibility: hidden; }
.row:hover .c-topic.empty, .row.cursor .c-topic.empty { visibility: visible; }
.head-actions .c-topic.empty { visibility: visible; }
/* topic chip on the right side (mixed views) can be wider */
.row-badges .c-topic { max-width: 150px; }

/* snippets page */
.snipform { display: flex; flex-direction: column; gap: 8px; }
.snipform input[type=text] { font: 13.5px var(--body); padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--wash);
  max-width: 420px; }
.snipform textarea { font: 13.5px var(--body); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--wash);
  resize: vertical; line-height: 1.55; }
.snipform input:focus, .snipform textarea:focus { outline: 2px solid var(--accent);
  background: #fff; }
.snip-actions { display: flex; gap: 8px; }
.snip-del { margin-top: 8px; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { color: var(--danger); border-color: #F0C9BF; }
.btn.danger:hover { background: #FBE7E1; }
.notice { background: #EAF6E7; color: #3E7031; border-radius: 8px;
  padding: 9px 14px; margin: 12px 0 4px; font-size: 13px; }

.btn.tiny { padding: 1px 8px; font-size: 10.5px; margin-right: 8px; }
.btn.danger-ghost { color: var(--danger); }
.ask-row { display: flex; gap: 8px; align-items: center; }
.ask-row input[type=text] { flex: 1; font: 13.5px var(--body); padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--wash); }
.ask-row input[type=text]:focus { outline: 2px solid var(--accent); background:#fff; }
.ask-ctx { font-size: 12px; color: var(--soft); white-space: nowrap; }
#ask-answer { margin-top: 10px; }
#ask-answer.hidden { display: none; }

.compose-btn { display: block; margin: 0 14px 14px; text-align: center;
  background: var(--accent); color: #fff; border: none; font-weight: 600; }
.compose-btn:hover { background: #5B45B8; color: #fff; }
.compose-form { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.compose-form input[type=text] { font: 13.5px var(--body); padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--wash); }
.compose-form textarea { font: 13.5px var(--body); padding: 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--wash);
  min-height: 260px; resize: vertical; line-height: 1.55; }
.compose-form input:focus, .compose-form textarea:focus {
  outline: 2px solid var(--accent); background: #fff; }
.notice.ok { background: #EAF6E7; color: #3E7031; }

.chase-opt { display: flex; align-items: center; gap: 6px; }
.days-input { width: 58px; font: 13px var(--body); padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--wash); }

.learn-src { color: var(--soft); font-size: 10.5px; }

.btn.primary-ghost { color: var(--accent); border-color: #D8D1F2; }
.btn.primary-ghost:hover { background: #F1EEFB; }

.inline-forgive { display: inline; margin-left: 8px; }

.btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.on:hover { background: #5B45B8; }

/* ---------------- Folder tree (matches old menu-item look) ---------------- */
.menu { justify-content: flex-start; }
.folder-sep { font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--soft); padding: 12px 12px 4px; }
.folder-tree { overflow-y: auto; }
.folder-node { }
.folder-children { padding-left: 12px; }      /* indent children */
/* row keeps the .menu-item styling; just make room for the + on the right */
.menu-item.folder-item { justify-content: flex-start; gap: 8px; }
.folder-open { flex: 1; min-width: 0; text-decoration: none; color: inherit;
  display: flex; align-items: center; }
.folder-open .menu-name { overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 14px; }
.folder-plus { flex: 0 0 auto; width: 18px; height: 18px; line-height: 16px;
  text-align: center; border: 1px solid var(--line); border-radius: 5px;
  color: var(--soft); font-size: 13px; cursor: pointer; user-select: none;
  background: #fff; }
.folder-plus:hover { color: var(--ink); border-color: var(--soft); }

/* ---------------- Read / unread ---------------- */
/* Unread threads render bold (like Outlook); read = normal weight. */
.row.unread .row-sender,
.row.unread .row-subject { font-weight: 700; color: var(--ink); }
.row:not(.unread) .row-sender,
.row:not(.unread) .row-subject { font-weight: 400; }

/* sort dropdown + delete button */
.sort-box { margin-left:14px; font-size:12px; color:var(--soft); }
.sort-box select { font-size:12px; padding:2px 6px; border:1px solid var(--line);
  border-radius:6px; margin-left:4px; }
.btn.danger { color:var(--danger); }
.btn.danger:hover { background:#FDECE8; border-color:var(--danger); }

.sort-bar { display:flex; justify-content:flex-end; padding:6px 12px 0;
  align-items:center; }
