/* ════════════════════════════════════════════════
   ClawdBot Mail — iOS 18 Mail (pixel-perfect)
   ════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────── */
:root {
  --bg:          #f2f2f7;
  --bg-card:     #ffffff;
  --label:       #000000;
  --label-2:     rgba(60,60,67,0.6);
  --label-3:     rgba(60,60,67,0.3);
  --sep:         rgba(60,60,67,0.29);
  --sep-opaque:  #c6c6c8;
  --fill-3:      rgba(118,118,128,0.12);
  --fill-2:      rgba(118,118,128,0.20);

  --blue:        #007aff;
  --red:         #ff3b30;
  --orange:      #ff9500;
  --green:       #34c759;

  --nav-h:       65px;
  --toolbar-h:   64px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
button {
  background: none; border: none; cursor: pointer;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}
ul { list-style: none; }
textarea, input { font-family: var(--font); }

/* ── App shell ──────────────────────────────────── */
#app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ── Views ──────────────────────────────────────── */
.ios-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}
.ios-view.hidden { display: none !important; }

@media (min-width: 1024px) {
  #view-list   { flex: 0 0 var(--sidebar-w, 375px); border-right: none; }
  #view-detail { flex: 1; min-width: 0; }
  .ios-view.hidden { display: flex !important; }
  #resize-handle {
    flex: 0 0 5px;
    cursor: col-resize;
    background: var(--sep-opaque);
    position: relative;
    transition: background 0.15s;
    -webkit-user-select: none;
    user-select: none;
  }
  #resize-handle:hover,
  #resize-handle.dragging {
    background: #007aff;
  }
  #resize-handle::after {
    content: "";
    position: absolute;
    inset: 0 -6px;
  }
}
@media (max-width: 1023px) {
  #resize-handle { display: none; }
}

/* ════════════════════════════════════════════════
   NAV BAR
   ════════════════════════════════════════════════ */
.ios-navbar {
  background: rgba(242,242,247,0.82);
  backdrop-filter: blur(28px) saturate(190%) brightness(1.06);
  -webkit-backdrop-filter: blur(28px) saturate(190%) brightness(1.06);
  border-bottom: 0.5px solid var(--sep);
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: env(safe-area-inset-top, 0px);
  flex-shrink: 0;
}
.ios-navbar-inner {
  display: flex;
  align-items: center;
  height: var(--nav-h);
  padding: 0 16px;
  gap: 8px;
}
.ios-nav-left {
  color: var(--blue);
  font-size: 17px;
  flex: 0 0 auto;
  min-width: 48px;
}
.ios-nav-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.18s;
}
.ios-nav-title.visible { opacity: 1; }
.ios-mailboxes-btn {
  display: flex; align-items: center; gap: 4px;
  color: var(--blue); background: none; border: none;
  font-size: 17px; font-weight: 400;
  padding: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ios-nav-right {
  color: var(--blue);
  font-size: 17px;
  flex: 0 0 auto;
  min-width: 48px;
  text-align: right;
}

/* Detail nav */
.ios-navbar-detail .ios-navbar-inner { justify-content: space-between; align-items: center; }
.ios-back-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18), 0 0 0 0.5px rgba(0,0,0,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.ios-detail-nav-title {
  flex: 1; text-align: center;
  font-size: 17px; font-weight: 700; color: #1c1c1e;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 10px;
}
.ios-nav-arrows-pill {
  display: flex; align-items: center;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18), 0 0 0 0.5px rgba(0,0,0,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 26px;
  padding: 9px 10px;
  gap: 2px; flex-shrink: 0;
}
.ios-arrow-divider { display: none; }
.ios-arrow-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 28px;
  -webkit-tap-highlight-color: transparent;
}

/* ════════════════════════════════════════════════
   LIST VIEW: SCROLL CONTAINER + LARGE TITLE
   ════════════════════════════════════════════════ */
.ios-list-scroll {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ios-large-title-wrap {
  background: var(--bg);
  padding: 4px 16px 6px;
  flex-shrink: 0;
}
.ios-large-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.37px;
  color: var(--label);
  line-height: 1.18;
}

/* Search bar (inside scroll, not in navbar) */
.ios-search-wrap {
  position: relative;
  padding: 6px 16px 8px;
  flex-shrink: 0;
  background: var(--bg);
}
.ios-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.ios-search-input {
  width: 100%;
  height: 36px;
  background: var(--fill-3);
  border: none;
  border-radius: 10px;
  padding: 0 10px 0 32px;
  font-size: 17px;
  color: var(--label);
  outline: none;
  -webkit-appearance: none;
}
.ios-search-input::placeholder { color: #8e8e93; }
.ios-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.ios-search-empty {
  list-style: none;
  padding: 36px 24px;
  color: var(--label-2);
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

/* ════════════════════════════════════════════════
   CONVERSATION LIST
   ════════════════════════════════════════════════ */
.ios-folder-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 0 8px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border-bottom: 0.5px solid var(--sep);
  position: relative;
}
.ios-folder-tabs::-webkit-scrollbar { display: none; }
.ios-folder-tabs-wrap {
  position: relative;
  flex-shrink: 0;
}
.ios-folder-tabs-wrap::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 28px;
  background: linear-gradient(to right, transparent, var(--bg));
  pointer-events: none;
  z-index: 1;
}
.ios-folder-tab {
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: #007aff;
  background: rgba(118,118,128,.12);
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .18s, color .18s;
  white-space: nowrap;
}
.ios-folder-tab.active {
  background: #007aff;
  color: #fff;
}
.ios-folder-tab:active { opacity: .75; }

.ios-conv-list {
  flex: 1;
  width: 100%;
  background: var(--bg-card);
  border-top: 0.5px solid var(--sep);
}

/* Section headers — subtle iOS style */
.section-header {
  padding: 20px 16px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #8e8e93;
  background: var(--bg);
  border-bottom: 0.5px solid var(--sep);
}
.section-header.section-action { color: var(--red); }
.section-header.section-truth  { color: var(--blue); }
.section-header + .conv-item { margin-top: 0; }

/* Email row */
.conv-item {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-bottom: 0.5px solid var(--sep);
  position: relative;
  overflow: hidden;
  min-height: 76px;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.conv-item:active { background: #d1d1d6; }
.conv-item.priority-action { border-left: 3px solid var(--red); }

/* Unread dot column */
.conv-dot-col {
  width: 24px;
  display: flex;
  align-items: flex-start;
  padding-top: 18px;
  padding-left: 8px;
  flex-shrink: 0;
}
.conv-unread-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
}

/* Avatar */
.conv-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, #8e8e93 0%, #636366 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.5px;
  user-select: none;
  margin-right: 10px;
}
/* ACTION priority: blue tint avatar */
.priority-action .conv-avatar {
  background: linear-gradient(145deg, #5ac8fa 0%, #007aff 100%);
}

/* Body — block (not flex-column) so text-overflow: ellipsis works on iOS Safari */
.conv-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 14px 28px 14px 0; /* room for chevron */
  padding-right: max(28px, calc(16px + env(safe-area-inset-right, 0px))); /* safe area override */
}
.conv-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}
.conv-from {
  font-size: 15px;
  font-weight: 600;
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
/* Read state: lighter weight */
.conv-item.read .conv-from { font-weight: 400; }
.conv-time {
  font-size: 14px;
  color: var(--label-2);
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 400;
}
.conv-subject {
  font-size: 15px;
  font-weight: 400;
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  /* iOS Safari: explicit max-width avoids flex-item padding-right bug */
  max-width: calc(100vw - 102px); /* 24 dot + 40 avatar + 10 margin + 28 chevron = 102 */
}
.conv-snippet {
  font-size: 13px;
  color: var(--label-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  max-width: calc(100vw - 102px);
}
/* Desktop: list pane is fixed 375px, not full viewport */
@media (min-width: 1024px) {
  .conv-subject, .conv-snippet {
    max-width: calc(375px - 102px); /* = 273px */
  }
}

/* Chevron */
.conv-item::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='12' viewBox='0 0 7 12'%3E%3Cpath d='M1 1l5 5-5 5' stroke='%23C8C7CC' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Swipe hints */
.swipe-hint {
  position: absolute;
  top: 0; height: 100%;
  display: flex; align-items: center;
  padding: 0 22px;
  font-size: 14px; font-weight: 600;
  color: #fff; opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.1s;
}
.swipe-hint.archive { right: 0; background: var(--orange); border-radius: 0 2px 2px 0; }
.swipe-hint.trash   { right: 0; background: var(--red);    border-radius: 0 2px 2px 0; }
.swipe-hint.read    { left: 0;  background: var(--blue);   border-radius: 2px 0 0 2px; }
.conv-item.swiping-left-far .swipe-hint.trash   { opacity: 1; }
.conv-item.swiping-left     .swipe-hint.archive { opacity: 1; }
.conv-item.swiping-right    .swipe-hint.read    { opacity: 1; }

/* Inbox tag */
.conv-inbox-tag { font-size: 12px; color: #8e8e93; font-weight: 400; }

/* List footer */
.ios-list-footer {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--label-2);
  background: var(--bg);
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════
   CLAWDBOT STRIP (collapsible at bottom of list)
   ════════════════════════════════════════════════ */
.ios-clawdbot-strip {
  flex-shrink: 0;
  width: 100%;
  overflow: hidden;
  background: var(--bg-card);
  border-top: 0.5px solid var(--sep-opaque);
}
.ios-clawdbot-strip-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #8e8e93;
  user-select: none;
}
.ios-work-status {
  margin-left: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e8f7ed;
  color: #248a3d;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.ios-work-status.busy {
  background: #fff4ce;
  color: #8a6500;
}
.ios-clawdbot-body {
  display: none;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  border-top: 0.5px solid var(--sep);
}
.ios-clawdbot-body.open { display: flex; }
.ios-chat-messages {
  overflow-y: auto;
  padding: 8px 12px;
  -webkit-overflow-scrolling: touch;
  min-height: 40px;
  max-height: 140px;
}
.ios-chat-form {
  padding: 8px 12px;
  padding-right: max(12px, calc(8px + env(safe-area-inset-right, 0px)));
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
}
.ios-chat-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--fill-3);
  border-radius: 22px;
  padding: 4px 4px 4px 14px;
}
.ios-chat-input {
  flex: 1; border: none; background: transparent;
  font-size: 16px; color: var(--label); outline: none;
  min-height: 28px; line-height: 28px;
}
.ios-chat-input::placeholder { color: #8e8e93; }
.ios-chat-send { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex-shrink: 0; }

.chat-bubble-row { display: flex; margin-bottom: 5px; }
.chat-bubble-row.user { justify-content: flex-end; }
.chat-bubble-row.bot  { justify-content: flex-start; }
.chat-bubble {
  max-width: 80%; padding: 8px 12px; border-radius: 18px;
  font-size: 15px; line-height: 1.4; word-break: break-word;
}
.chat-bubble.user { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.bot  { background: #e5e5ea; color: var(--label); border-bottom-left-radius: 4px; }

/* ════════════════════════════════════════════════
   DETAIL VIEW
   ════════════════════════════════════════════════ */
.ios-thread-wrap {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

/* Subject headline */
.ios-detail-subject {
  padding: 14px 16px 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--label);
  background: var(--bg-card);
  border-bottom: 0.5px solid var(--sep);
  flex-shrink: 0;
  line-height: 1.25;
}

/* Inbox tag inside subject */
.conv-inbox-tag {
  font-size: 12px; color: #8e8e93; font-weight: 400;
  display: inline-block; margin-top: 3px;
}

/* Empty state */
.detail-empty {
  padding: 48px 24px;
  text-align: center;
  color: #8e8e93;
  font-size: 15px;
}

/* Thread cards container */
.thread-cards {
  flex: 1;
  padding-bottom: 80px;
}

/* ── Email Card ────────────────────────────────── */
.email-card {
  background: var(--bg-card);
  border-bottom: 0.5px solid var(--sep);
  margin-top: 8px;
}
.email-card:first-child { margin-top: 0; }

.email-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 14px 10px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.email-card-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #8e8e93, #636366);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; color: #fff;
  flex-shrink: 0; letter-spacing: -0.3px;
  user-select: none;
}
.email-card-avatar.outbound {
  background: linear-gradient(145deg, #5ac8fa, #007aff);
}

.email-card-info { flex: 1; min-width: 0; }
.email-card-from-row {
  display: flex; align-items: baseline;
  justify-content: space-between; gap: 4px;
}
.email-card-from {
  font-size: 15px; font-weight: 600; color: var(--label);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.email-card-time {
  font-size: 13px; color: var(--label-2);
  flex-shrink: 0; white-space: nowrap;
}
.email-card-meta {
  font-size: 13px; color: var(--label-2);
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.email-card-snippet {
  font-size: 13px; color: var(--label-2);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.email-card:not(.collapsed) .email-card-snippet { display: none; }

/* Expand/collapse chevron */
.email-card-chevron {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-top: 7px;
  transition: transform 0.2s;
}
.email-card.collapsed .email-card-chevron { transform: rotate(-90deg); }

/* Card body */
.email-card-body {
  transition: max-height 0.25s ease;
}
.email-card.collapsed .email-card-body { display: none; }
.email-card-body-inner {
  padding: 0 16px 16px;
  font-size: 15px; line-height: 1.55;
  color: var(--label);
  white-space: pre-wrap;
  word-break: break-word;
}
.email-card-body-inner.has-iframe {
  padding: 0;
  white-space: normal;
}
.email-card-body iframe {
  display: block; width: 100%;
  border: none; background: #fff;
  min-height: 80px;
}
.email-attachment-list {
  padding: 8px 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.email-attachment-chip {
  display: flex; align-items: center; gap: 14px;
  background: rgba(120,120,128,0.12);
  border-radius: 16px;
  padding: 14px 14px;
}
.email-att-icon {
  width: 62px; height: 74px;
  flex-shrink: 0;
  position: relative;
}
.email-att-icon svg { display: block; width: 100%; height: 100%; }
.email-att-info { flex: 1; min-width: 0; }
.email-att-name {
  font-size: 15px; font-weight: 600; color: var(--label);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.3;
}
.email-att-size { font-size: 13px; color: var(--secondary-label); margin-top: 3px; }
.email-att-dl {
  width: 38px; height: 38px; border-radius: 50%;
  background: #007aff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
}
.email-att-dl svg { display: block; width: 20px; height: 20px; }
.email-att-preview {
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  margin-top: -4px;
}

/* ── Bottom Toolbar ─────────────────────────────── */
.ios-bottom-toolbar {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: calc(var(--toolbar-h) + env(safe-area-inset-bottom, 0px));
  background: rgba(242,242,247,0.82);
  backdrop-filter: blur(28px) saturate(190%) brightness(1.06);
  -webkit-backdrop-filter: blur(28px) saturate(190%) brightness(1.06);
  border-top: 0.5px solid var(--sep);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.ios-toolbar-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  width: 56px; height: 58px;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.ios-toolbar-btn:active { background: var(--fill-3); }
.ios-toolbar-btn img { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; }
.toolbar-label {
  font-size: 10px;
  font-weight: 400;
  color: #007aff;
  letter-spacing: -0.1px;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Navbar compose button ─────────────────────── */
.ios-compose-btn {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 36px;
  padding: 4px;
}

/* ── Message count badge ───────────────────────── */
.conv-msg-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--label-2);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Indented separator (iOS Mail style) ─────── */
.conv-item {
  border-bottom: none;
}
.conv-item::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 70px;
  right: 0;
  height: 0.5px;
  background: var(--sep);
  pointer-events: none;
}
.ios-conv-list { border-top: 0.5px solid var(--sep); }

/* ════════════════════════════════════════════════
   ACTION SHEET
   ════════════════════════════════════════════════ */
.ios-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  z-index: 200;
}
.ios-sheet-backdrop.hidden { display: none; }

.ios-action-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(40px) saturate(180%) brightness(1.08);
  -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.08);
  border-radius: 28px 28px 0 0;
  z-index: 201;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  transform: translateY(0);
  transition: transform 0.32s cubic-bezier(0.32,0.72,0,1);
  box-shadow:
    0 -1px 0 rgba(255,255,255,0.9) inset,
    0 -2px 0 rgba(0,0,0,0.04),
    0 -32px 80px rgba(255,255,255,0.55),
    0 -12px 48px rgba(255,255,255,0.35),
    0 -8px 32px rgba(0,0,0,0.12);
}
.ios-action-sheet.hidden { transform: translateY(110%); pointer-events: none; }

.ios-sheet-handle {
  width: 36px; height: 5px; background: #c7c7cc;
  border-radius: 3px; margin: 10px auto 4px;
}

.ios-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 14px;
  border-bottom: 0.5px solid var(--sep);
}
.ios-sheet-sender-wrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ios-sheet-avatar {
  width: 48px; height: 48px; border-radius: 11px;
  background: #3c3c43;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; color: #fff; flex-shrink: 0;
  letter-spacing: -0.5px;
}
.ios-sheet-sender-info { display: flex; flex-direction: column; min-width: 0; }
.ios-sheet-sender-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-sheet-sender-preview { font-size: 13px; color: #8e8e93; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-sheet-x { flex-shrink: 0; margin-left: 10px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; padding: 0; -webkit-appearance: none; appearance: none; cursor: pointer; overflow: visible; }

.ios-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; }
.ios-action-cell {
  display: flex; flex-direction: column; align-items: flex-start;
  justify-content: space-between;
  background: rgba(242,242,247,0.85); border-radius: 14px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  padding: 14px 14px 12px;
  min-height: 90px;
  font-size: 15px; font-weight: 400; color: var(--label);
  -webkit-tap-highlight-color: transparent;
}
.ios-action-cell:active { opacity: 0.65; }
.ios-action-cell span { font-size: 14px; font-weight: 500; }

.ios-action-list { border-top: 0.5px solid var(--sep); margin: 0; }
.ios-action-list-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 16px 16px;
  font-size: 17px; color: var(--label);
  border-bottom: 0.5px solid var(--sep);
  -webkit-tap-highlight-color: transparent;
}
.ios-action-list-item:last-child { border-bottom: none; }
.ios-action-list-item:active { opacity: 0.5; }

/* ════════════════════════════════════════════════
   COMPOSE MODAL
   ════════════════════════════════════════════════ */
.ios-compose-modal {
  position: fixed; inset: 0;
  width: 100%;
  max-width: 100vw;
  height: var(--compose-viewport-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  overflow-x: clip;
  overscroll-behavior: none;
  background: #fff; z-index: 300;
  display: flex; flex-direction: column;
  transform: translateY(0);
  transition: transform 0.32s cubic-bezier(0.32,0.72,0,1);
}
.ios-compose-modal.hidden { transform: translateY(105%); pointer-events: none; }
.ios-compose-modal.keyboard-open { transition: none; }

.ios-compose-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 10px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 0.5px solid var(--sep); flex-shrink: 0;
}
.ios-compose-cancel { display: flex; align-items: center; justify-content: center; background: transparent; border: none; padding: 0; -webkit-appearance: none; appearance: none; cursor: pointer; overflow: visible; }
.ios-compose-title {
  font-size: 16px; font-weight: 600; color: var(--label);
  flex: 1; text-align: center; padding: 0 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ios-compose-send-btn { display: flex; align-items: center; justify-content: center; background: transparent; border: none; padding: 0; -webkit-appearance: none; appearance: none; cursor: pointer; overflow: visible; }

.ios-compose-nav,
.ios-compose-fields,
.clawdbot-intent-box,
.ceo-analysis-panel,
.ios-compose-body,
.ios-compose-toolbar-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.ios-compose-fields { flex-shrink: 0; border-bottom: 0.5px solid var(--sep); }
.ios-compose-field-row {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--sep); min-height: 44px;
  min-width: 0;
  overflow: hidden;
}
.ios-compose-field-row:last-child { border-bottom: none; }
.ios-compose-field-label { font-size: 15px; color: var(--label); white-space: nowrap; flex-shrink: 0; }
.ios-compose-field-input {
  flex: 1; min-width: 0; width: 100%; border: none; outline: none;
  font-size: 16px; font-family: var(--font); color: var(--blue); background: transparent;
}
.ios-compose-field-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  color: #8e8e93;
}

.clawdbot-intent-box {
  position: relative;
  z-index: 4;
  flex-shrink: 0;
  padding: 12px 16px 10px;
  background: #f2f2f7;
  border-top: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.clawdbot-intent-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.clawdbot-intent-header strong {
  font-size: 17px;
}
.clawdbot-intent-header button {
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: 600 15px/1 var(--font);
}
.clawdbot-questions-text {
  margin: 0 0 8px;
  max-height: 5.6em;
  overflow-y: auto;
  font-size: 14px;
  color: #3c3c43;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.clawdbot-intent-controls {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.clawdbot-intent-input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  max-height: 104px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #c7c7cc;
  font-size: 16px;
  line-height: 1.35;
  outline: none;
  resize: none;
  background: #fff;
  color: var(--label);
}
.clawdbot-intent-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0,122,255,0.12);
}
.clawdbot-intent-submit {
  align-self: flex-end;
  min-height: 44px;
  padding: 8px 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.ceo-analysis-panel {
  flex-shrink: 0;
  max-height: 38vh;
  overflow-y: auto;
  padding: 10px 16px 12px;
  border-top: 0.5px solid var(--sep);
  border-bottom: 0.5px solid var(--sep);
  background: #f7f7fa;
  color: var(--label);
  overflow-x: hidden;
}
.ceo-analysis-panel * {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.ceo-analysis-panel[hidden] { display: none; }
.ceo-analysis-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 14px;
}
.ceo-confidence {
  padding: 3px 7px; border-radius: 6px;
  font-size: 12px; font-weight: 600; background: #e5e5ea; color: #636366;
}
.ceo-confidence.high { background: #dff5e6; color: #18733a; }
.ceo-confidence.medium { background: #fff1c7; color: #765500; }
.ceo-confidence.low { background: #ffe2df; color: #9b2c24; }
.ceo-source-strip {
  display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px;
}
.ceo-source-strip span {
  padding: 3px 7px; border-radius: 6px;
  background: #e9e9ef; color: #48484a; font-size: 12px;
}
.ceo-analysis-summary {
  margin: 9px 0 0; font-size: 13px; line-height: 1.4; color: #3c3c43;
}
.ceo-analysis-summary:empty { display: none; }
.ceo-claim-checks {
  display: grid; gap: 5px; margin-top: 9px; font-size: 12px;
}
.ceo-claim-check {
  display: flex; flex-direction: column; gap: 1px;
  padding: 6px 8px; border-left: 3px solid #18733a; background: #fff;
}
.ceo-claim-check.unverified { border-left-color: #9b2c24; }
.ceo-claim-check span { font-size: 13px; }
.ceo-claim-check small { color: #636366; line-height: 1.3; }
.ceo-analysis-details {
  display: grid; gap: 7px; margin-top: 8px;
}
.ceo-analysis-list { font-size: 12px; line-height: 1.35; }
.ceo-analysis-list strong { display: block; margin-bottom: 2px; }
.ceo-analysis-list ul { margin: 0; padding-left: 18px; }
.ceo-analysis-list.attention strong { color: #765500; }
.ceo-analysis-list.risk strong { color: #9b2c24; }
.ceo-file-suggestions {
  display: grid; gap: 5px; margin-top: 9px; font-size: 12px;
}
.ceo-file-suggestion {
  display: flex; flex-direction: column; gap: 1px;
  padding: 6px 8px; border-left: 3px solid #007aff; background: #fff;
}
.ceo-file-name {
  font-size: 13px; color: #0056b3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ceo-file-suggestion small { color: #636366; line-height: 1.3; }

.ios-compose-body {
  flex: 1; min-height: 0; border: none; outline: none;
  padding: 14px 16px;
  font-size: 16px; font-family: var(--font);
  color: var(--label); resize: none; line-height: 1.5; background: #fff;
}

.detail-load-error {
  margin: 22px 16px;
  padding: 20px;
  border-radius: 16px;
  background: #fff;
  color: #555;
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
}

.detail-retry-button {
  display: block;
  margin: 16px auto 0;
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: #0788f5;
  color: #fff;
  font: inherit;
  font-weight: 600;
}

.compose-draft-heading,
.compose-thread-preview {
  width: 100%;
  min-width: 0;
}
.compose-draft-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 4px;
  background: #fff;
}
.compose-draft-heading[hidden],
.compose-thread-preview[hidden] { display: none; }
.compose-draft-heading strong { font-size: 16px; color: var(--label); }
.compose-draft-heading span { font-size: 12px; color: var(--label-2); }
.compose-thread-preview {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px max(18px, env(safe-area-inset-bottom));
  border-top: 8px solid #f2f2f7;
  background: #f2f2f7;
  overscroll-behavior: contain;
}
.compose-thread-preview h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.compose-thread-messages { display: grid; gap: 10px; }
.compose-thread-message {
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.compose-thread-message-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 13px;
}
.compose-thread-message-header time { color: var(--label-2); white-space: nowrap; }
.compose-thread-message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #3c3c43;
  font-size: 14px;
  line-height: 1.45;
}
.compose-thread-empty { color: var(--label-2); font-size: 14px; }
.ios-compose-modal.draft-focused .ceo-analysis-panel { display: none !important; }
.ios-compose-modal.draft-focused .ios-compose-body {
  flex: 0 0 auto;
  min-height: 190px;
  height: min(34vh, 300px);
  max-height: 36vh;
  font-size: 17px;
  line-height: 1.5;
}

.compose-work-sheet {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f2f2f7;
  overflow: hidden;
}
.compose-work-sheet.hidden { display: none; }
.compose-work-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(64px, 1fr) auto minmax(96px, 1fr);
  align-items: center;
  gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 14px 10px;
  border-bottom: 0.5px solid var(--sep);
  background: rgba(255,255,255,0.96);
}
.compose-work-header > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.compose-work-header strong { font-size: 17px; }
.compose-work-header small { font-size: 11px; color: var(--label-2); }
.compose-work-close,
.compose-work-done {
  min-height: 36px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: 500 15px/1.2 var(--font);
}
.compose-work-close { text-align: left; }
.compose-work-done { text-align: right; }
.compose-work-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  overscroll-behavior: contain;
}
.compose-work-bubble {
  width: fit-content;
  max-width: 88%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 15px;
  font-size: 15px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.compose-work-bubble.bot {
  margin-right: auto;
  border-bottom-left-radius: 5px;
  background: #fff;
  color: var(--label);
}
.compose-work-bubble.user {
  margin-left: auto;
  border-bottom-right-radius: 5px;
  background: var(--blue);
  color: #fff;
}
.compose-work-quick-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  border-top: 0.5px solid var(--sep);
  background: #fff;
}
.compose-work-quick-actions button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #c7c7cc;
  border-radius: 18px;
  background: #fff;
  color: var(--blue);
  font: 500 14px/1 var(--font);
}
.compose-work-form {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  background: #fff;
  border-top: 0.5px solid var(--sep);
}
.compose-work-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  max-height: 120px;
  resize: none;
  padding: 10px 12px;
  border: 1px solid #c7c7cc;
  border-radius: 14px;
  outline: none;
  background: #f7f7fa;
  color: var(--label);
  font: 400 16px/1.35 var(--font);
}
.compose-work-form textarea:focus {
  border-color: var(--blue);
  background: #fff;
}
.compose-work-form button {
  min-width: 72px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font: 600 14px/1 var(--font);
}
.compose-work-form button:disabled { opacity: 0.55; }

.ios-compose-toolbar-wrap {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px max(8px, env(safe-area-inset-bottom)); background: #fff;
  border-top: 0.5px solid var(--sep);
}

@media (max-width: 767px) {
  .ios-compose-modal.intent-focused .ios-compose-nav,
  .ios-compose-modal.intent-focused .ios-compose-fields,
  .ios-compose-modal.intent-focused .ceo-analysis-panel,
  .ios-compose-modal.intent-focused .compose-attachments-list,
  .ios-compose-modal.intent-focused .ios-compose-body,
  .ios-compose-modal.intent-focused .ios-compose-toolbar-wrap {
    display: none !important;
  }
  .ios-compose-modal.intent-focused .clawdbot-intent-box {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 0;
    padding: max(14px, env(safe-area-inset-top)) 16px
      max(14px, env(safe-area-inset-bottom));
    overflow: hidden;
    border: 0;
  }
  .ios-compose-modal.intent-focused .clawdbot-intent-header {
    display: flex;
    flex: 0 0 auto;
  }
  .ios-compose-modal.intent-focused .clawdbot-questions-text {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
    margin-bottom: 12px;
    padding: 4px 2px;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.45;
  }
  .ios-compose-modal.intent-focused .clawdbot-intent-controls {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    gap: 10px;
  }
  .ios-compose-modal.intent-focused .clawdbot-intent-input {
    width: 100%;
    min-height: 76px;
    max-height: 132px;
  }
  .ios-compose-modal.intent-focused .clawdbot-intent-submit {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
  }
}
.ios-compose-send-bottom {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: #007aff; border-radius: 50%; border: none;
  cursor: pointer; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.ios-compose-send-bottom:active { opacity: 0.75; }
.ios-compose-toolbar {
  display: flex; align-items: center; gap: 4px;
  background: rgba(235,235,240,0.98);
  border-radius: 22px; padding: 6px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.ios-compose-tool {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 34px; border-radius: 8px;
}
#btn-clawdbot-compose {
  width: auto;
  min-width: 66px;
  gap: 4px;
  padding: 0 8px;
  color: #007aff;
  font: 600 14px/1 var(--font);
}
#btn-clawdbot-compose::after { content: "Work"; }
#btn-clawdbot-compose img { width: 18px; height: 18px; }
.compose-draft-toggle {
  width: auto;
  min-width: 76px;
  padding: 0 9px;
  color: #007aff;
  font: 600 13px/1 var(--font);
}
.compose-draft-toggle[aria-pressed="true"] {
  background: #007aff;
  color: #fff;
}
.ios-compose-tool:active { background: var(--fill-2); }
.ios-tool-aa {
  font-size: 16px; font-weight: 500; color: #3c3c43;
  font-family: var(--font); letter-spacing: -0.3px;
}
@media (max-width: 430px) {
  .ios-compose-toolbar { padding-inline: 9px; gap: 2px; }
  #btn-tool-at { display: none; }
  .compose-draft-toggle { min-width: 72px; padding-inline: 7px; }
}
/* ── Contact autocomplete dropdown ── */
.compose-autocomplete {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #fff;
  border: 1px solid #e0e0e5;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 999;
  max-height: 200px;
  overflow-y: auto;
}
.compose-autocomplete.hidden { display: none; }
.autocomplete-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f2f2f7;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:active { background: #f2f2f7; }
.autocomplete-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #007aff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.autocomplete-info { display: flex; flex-direction: column; }
.autocomplete-name { font-size: 14px; font-weight: 500; color: #1c1c1e; }
.autocomplete-email { font-size: 12px; color: #8e8e93; }
/* ── Contact picker "+" button ── */
.compose-contact-btn {
  background: none; border: none; padding: 0 6px;
  font-size: 22px; color: #007aff; cursor: pointer;
  line-height: 1; flex-shrink: 0;
}

/* ── Glass button reset (iOS Safari) ─── */
#btn-close-compose,
#btn-close-sheet,
#btn-send-compose {
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 0 !important;
  margin: 0 !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  overflow: visible !important;
}

/* ── Contact Picker Modal ───────────────────────── */
.contact-picker-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  display: flex; align-items: flex-end;
}
.contact-picker-overlay.hidden { display: none; }
.contact-picker-sheet {
  width: 100%;
  background: #f2f2f7;
  border-radius: 18px 18px 0 0;
  height: 65vh;
  max-height: 65vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.contact-picker-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px;
}
.contact-picker-title { font-size: 16px; font-weight: 600; color: #1c1c1e; }
.contact-picker-close {
  background: none; border: none;
  font-size: 15px; color: #007aff; cursor: pointer; padding: 0;
}
.contact-picker-search-wrap { padding: 0 12px 10px; }
.contact-picker-search {
  width: 100%; box-sizing: border-box;
  padding: 9px 14px; border-radius: 10px;
  border: none; background: #fff;
  font-size: 15px; color: #1c1c1e;
  outline: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.contact-picker-list {
  overflow-y: auto; flex: 1;
  padding: 0 12px 20px;
}
.contact-picker-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  background: #fff; border-radius: 12px;
  margin-bottom: 6px; cursor: pointer;
}
.contact-picker-item:active { opacity: 0.7; }
.contact-picker-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #007aff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.contact-picker-info { display: flex; flex-direction: column; min-width: 0; }
.contact-picker-name { font-size: 14px; font-weight: 500; color: #1c1c1e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-picker-email { font-size: 12px; color: #8e8e93; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-picker-empty { text-align: center; color: #8e8e93; font-size: 14px; padding: 30px 0; }

/* ── Attachment chips ─────────────────────────────── */
.compose-attachments-list {
  display: none; flex-wrap: wrap; gap: 6px;
  padding: 8px 16px; border-top: 0.5px solid var(--sep); background: #fff;
}
.attachment-chip {
  display: flex; align-items: center; gap: 4px;
  background: #f2f2f7; border-radius: 8px;
  padding: 4px 8px; max-width: 200px;
}
.attachment-chip-name {
  font-size: 13px; color: var(--label);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attachment-chip-remove {
  background: none; border: none; padding: 0 0 0 2px;
  font-size: 16px; line-height: 1; color: #8e8e93; cursor: pointer; flex-shrink: 0;
}

/* ── Folder Picker Sheet ──────────────────────────── */
.folder-picker-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 9999;
}
.folder-picker-panel {
  width: 100%; max-width: 480px; background: #fff;
  border-radius: 16px 16px 0 0; padding: 0 0 34px;
  overflow: hidden;
}
.folder-picker-header {
  font-size: 13px; color: #8e8e93; font-weight: 600;
  text-align: center; padding: 16px 0 8px; letter-spacing: .3px;
  text-transform: uppercase;
}
.folder-picker-item {
  display: block; width: 100%; background: none; border: none;
  border-top: 1px solid rgba(0,0,0,0.08); padding: 16px 20px;
  font-size: 17px; color: #007aff; text-align: left; cursor: pointer;
}
.folder-picker-item.active { font-weight: 700; color: #007aff; }
.folder-picker-item:active { background: rgba(0,122,255,0.08); }
