:root,
[data-theme="dark"] {
  --bg: #0b0f14;
  --bg-elevated: #111820;
  --surface: rgba(22, 30, 40, 0.72);
  --surface-solid: #161e28;
  --surface-hover: rgba(32, 44, 58, 0.85);
  --sidebar-bg: rgba(8, 12, 18, 0.92);
  --sidebar-text: #8b9aab;
  --sidebar-hover: rgba(37, 211, 102, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8edf2;
  --muted: #7d8fa3;
  --accent: #2ee879;
  --accent-dark: #1aad5c;
  --accent-glow: rgba(46, 232, 121, 0.25);
  --accent-light: rgba(46, 232, 121, 0.1);
  --danger: #ff4d6d;
  --unread: #f0f4f8;
  --read: #7d8fa3;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 8px 32px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45), 0 24px 64px rgba(0, 0, 0, 0.3);
  --glass: blur(16px) saturate(1.4);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 272px;
  --list-w: 400px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #eef1f5;
  --bg-elevated: #f8f9fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-hover: rgba(240, 244, 248, 0.95);
  --sidebar-bg: rgba(17, 27, 33, 0.96);
  --sidebar-text: #aebac1;
  --sidebar-hover: rgba(37, 211, 102, 0.15);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #111b21;
  --muted: #667781;
  --accent: #25d366;
  --accent-dark: #128c7e;
  --accent-glow: rgba(37, 211, 102, 0.2);
  --accent-light: rgba(37, 211, 102, 0.12);
  --danger: #ea0038;
  --unread: #111b21;
  --read: #667781;
  --shadow: 0 1px 3px rgba(11, 20, 26, 0.08), 0 8px 24px rgba(11, 20, 26, 0.06);
  --shadow-lg: 0 4px 6px rgba(11, 20, 26, 0.04), 0 16px 48px rgba(11, 20, 26, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(46, 232, 121, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 90% 100%, rgba(46, 100, 232, 0.06), transparent);
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.85rem; }
.err { color: var(--danger); font-size: 0.875rem; margin-top: 0.5rem; }

/* Login */
.login-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(145deg, #060a0f 0%, #0d1a14 40%, #0b1220 100%);
}
.login-card {
  width: min(440px, 100%);
  background: rgba(22, 30, 40, 0.75);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}
[data-theme="light"] .login-card { background: var(--surface-solid); }
.brand-mark, .brand-logo {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.login-card h1 { margin: 1rem 0 0.5rem; font-size: 1.65rem; font-weight: 700; letter-spacing: -0.02em; }
.login-card label { display: block; margin: 1rem 0 0.35rem; font-size: 0.875rem; font-weight: 500; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border-strong);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--bg-elevated);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
[data-theme="light"] input, [data-theme="light"] textarea { background: var(--surface-solid); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
textarea { resize: vertical; min-height: 120px; }
button { font: inherit; cursor: pointer; border: 0; border-radius: var(--radius-sm); transition: transform 0.15s, box-shadow 0.2s, background 0.2s; }
.btn-primary {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.8rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 24px var(--accent-glow); }

/* Mail App Layout */
.mail-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--list-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.mail-sidebar {
  background: var(--sidebar-bg);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  z-index: 10;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.35rem 1.25rem;
}
.brand-info { display: flex; flex-direction: column; gap: 0.1rem; }
.brand-info strong { color: #fff; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.btn-compose {
  margin: 0 1rem 1rem;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-compose:hover { transform: translateY(-2px); }
.btn-new-folder {
  margin: 0 1rem 0.75rem;
  padding: 0.55rem 1rem;
  background: transparent;
  color: var(--sidebar-text);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  width: calc(100% - 2rem);
}
.btn-new-folder:hover { background: var(--sidebar-hover); color: #fff; border-color: var(--accent); }
.folder-list { flex: 1; overflow-y: auto; padding: 0 0.75rem; }
.folder-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  color: var(--sidebar-text);
  border-radius: var(--radius-sm);
  margin-bottom: 0.2rem;
  text-align: left;
  font-size: 0.92rem;
  transition: background 0.2s, color 0.2s;
}
.folder-item:hover { background: var(--sidebar-hover); color: #fff; }
.folder-item.active {
  background: var(--sidebar-hover);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid rgba(46, 232, 121, 0.2);
}
.folder-icon { opacity: 0.75; font-size: 1rem; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); }
.sidebar-link {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}
.sidebar-link:hover { background: var(--sidebar-hover); color: #fff; }

/* Message List */
.mail-list-pane {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.35rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
}
.list-header h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  font-size: 1.15rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--accent); border-color: var(--accent); }
.message-list { flex: 1; overflow-y: auto; }
.msg-item {
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.msg-item:hover { background: var(--surface-hover); }
.msg-item.active {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}
.msg-item.unread .msg-subject { font-weight: 700; color: var(--unread); }
.msg-from { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-subject { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.2rem; color: var(--read); }
.msg-item.unread .msg-subject { color: var(--unread); }
.msg-date { font-size: 0.78rem; color: var(--muted); }
.list-pagination {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-solid);
}
.list-pagination button {
  padding: 0.45rem 0.9rem;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.85rem;
  border: 1px solid var(--border);
}
.list-pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.list-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Detail Pane */
.mail-detail-pane {
  background: transparent;
  overflow-y: auto;
  position: relative;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
}
.empty-icon { font-size: 4.5rem; opacity: 0.25; margin-bottom: 1rem; }

.message-view, .compose-view, .settings-view {
  padding: 1.75rem 2rem;
  max-width: 920px;
}
.msg-header {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.msg-header h2 { font-size: 1.35rem; margin-bottom: 0.85rem; font-weight: 700; letter-spacing: -0.02em; }
.msg-meta { font-size: 0.875rem; color: var(--muted); line-height: 1.9; }
.msg-meta strong { color: var(--text); }
.msg-actions { display: flex; gap: 0.6rem; margin-top: 1.1rem; flex-wrap: wrap; align-items: center; }
.move-select { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--muted); }
.move-select select { width: auto; min-width: 8rem; padding: 0.35rem 0.5rem; font-size: 0.85rem; }
.msg-body {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  line-height: 1.75;
  word-break: break-word;
}
.msg-body iframe { width: 100%; border: none; min-height: 320px; border-radius: var(--radius-sm); }

/* Compose */
.compose-view .card, .settings-view .card {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.compose-view h2, .settings-view h2 { margin-bottom: 1.25rem; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.compose-view label, .settings-view label { display: block; margin: 0.85rem 0 0.35rem; font-size: 0.875rem; font-weight: 500; }
.compose-actions { display: flex; gap: 0.75rem; margin-top: 1.35rem; flex-wrap: wrap; }
.btn-send {
  padding: 0.75rem 1.6rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-send:hover { transform: translateY(-1px); }
.btn-cancel {
  padding: 0.75rem 1.6rem;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-cancel:hover { border-color: var(--border-strong); }
.btn-danger {
  padding: 0.55rem 1.1rem;
  background: var(--danger);
  color: #fff;
  font-size: 0.875rem;
}

/* Mail options checkboxes */
.mail-options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.mail-options-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-right: 0.25rem;
}
.option-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  margin: 0 !important;
  transition: border-color 0.2s, background 0.2s;
}
.option-chip:hover { border-color: var(--accent); background: var(--accent-light); }
.option-chip input { width: auto; accent-color: var(--accent); }
.theme-toggle-label {
  display: flex !important;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  margin: 0 !important;
}
.theme-toggle-label input { width: auto; accent-color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  backdrop-filter: var(--glass);
}
.toast.ok { background: linear-gradient(135deg, var(--accent-dark), var(--accent)); }
.toast.err { background: var(--danger); }

/* Responsive */
@media (max-width: 1100px) {
  .mail-app { grid-template-columns: var(--sidebar-w) 1fr; }
  .mail-list-pane { display: none; }
  .mail-app.show-list .mail-list-pane { display: flex; position: fixed; inset: 0; left: var(--sidebar-w); z-index: 20; }
  .mail-app.show-list .mail-detail-pane { display: none; }
}
.readonly { background: var(--bg-elevated); color: var(--muted); cursor: default; opacity: 0.85; }
.sig-preview {
  margin: 0.85rem 0;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.sig-preview pre { margin: 0.35rem 0 0; white-space: pre-wrap; font-family: inherit; }
.sig-preview-box {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.sig-preview-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; margin-bottom: 0.5rem; }

/* Quill Editor */
.compose-editor-wrap {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  margin-bottom: 0.5rem;
}
.compose-editor-wrap .ql-toolbar {
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
}
.compose-editor-wrap .ql-container {
  border: none;
  min-height: 240px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg-elevated);
  color: var(--text);
}
.compose-editor-wrap .ql-editor.ql-blank::before { color: var(--muted); font-style: normal; }
[data-theme="dark"] .ql-snow .ql-stroke { stroke: var(--muted); }
[data-theme="dark"] .ql-snow .ql-fill { fill: var(--muted); }
[data-theme="dark"] .ql-snow .ql-picker { color: var(--text); }
[data-theme="dark"] .ql-snow .ql-picker-options { background: var(--surface-solid); border-color: var(--border); }

.ai-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.6rem 0 0.85rem;
  align-items: center;
}
.ai-toolbar-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-right: 0.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.btn-ai {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(46, 232, 121, 0.25);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
}
.btn-ai:hover { background: rgba(46, 232, 121, 0.2); border-color: var(--accent); }
.btn-ai:disabled { opacity: 0.5; cursor: wait; }

/* AI Modal */
.ai-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}
.ai-modal-card {
  width: min(580px, 100%);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}
.ai-modal-card h3 { margin-bottom: 0.35rem; font-weight: 700; }
.ai-modal-body {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  line-height: 1.65;
  max-height: 300px;
  overflow-y: auto;
}
.ai-modal-body.loading { color: var(--muted); font-style: italic; }

.attach-list { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.attach-link { color: var(--accent); text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.attach-link:hover { text-decoration: underline; }
.attach-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
}
.attach-chip button { border: none; background: none; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--muted); }
.attach-chip button:hover { color: var(--danger); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 768px) {
  .mail-sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform 0.25s; z-index: 30; }
  .mail-sidebar.open { transform: translateX(0); }
  .mail-options-row { flex-direction: column; align-items: flex-start; }
}

/* Unread indicator */
.msg-item.unread .msg-from,
.msg-item.unread .msg-subject { font-weight: 700; color: var(--unread); }
.msg-unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3b82f6; flex-shrink: 0;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}
.msg-item:not(.unread) .msg-unread-dot { visibility: hidden; }

/* Message row layout */
.msg-row-top {
  display: flex; align-items: center; gap: 0.45rem;
  margin-bottom: 0.15rem;
}
.msg-row-top .msg-from { flex: 1; min-width: 0; margin-bottom: 0; }
.msg-row-top .msg-date { flex-shrink: 0; font-size: 0.78rem; color: var(--muted); }

/* Star & flag */
.msg-star, .msg-flag-btn {
  background: none; border: none; padding: 0; font-size: 0.95rem;
  line-height: 1; cursor: pointer; color: var(--muted); flex-shrink: 0;
}
.msg-star.active { color: #fbbf24; }
.msg-flag-btn { font-size: 0.85rem; }
.msg-flag-btn.imp-low { color: #6b9bd1; }
.msg-flag-btn.imp-high { color: #e6a817; }
.msg-flag-btn.imp-urgent { color: #ef4444; }
.msg-flag-btn.imp-normal { opacity: 0.25; }

/* Quick actions */
.msg-quick-actions {
  display: none; gap: 0.35rem; margin-top: 0.45rem;
}
.msg-item:hover .msg-quick-actions { display: flex; }
.msg-quick-actions button {
  padding: 0.2rem 0.5rem; font-size: 0.72rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 6px; color: var(--muted);
}
.msg-quick-actions button:hover { border-color: var(--accent); color: var(--accent); }

/* Search */
.list-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.search-input {
  width: 9rem; padding: 0.4rem 0.65rem; font-size: 0.82rem;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text);
}
.search-input:focus { width: 11rem; }

/* Unread badge on folder */
.folder-item { position: relative; }
.folder-badge {
  margin-left: auto; min-width: 1.25rem; height: 1.25rem;
  padding: 0 0.35rem; border-radius: 999px;
  background: #3b82f6; color: #fff; font-size: 0.7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Context menu */
.ctx-menu {
  position: fixed; z-index: 10001;
  min-width: 11rem; padding: 0.35rem 0;
  background: var(--surface-solid); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.ctx-menu button {
  display: block; width: 100%; text-align: left;
  padding: 0.55rem 1rem; background: none; color: var(--text);
  font-size: 0.875rem; border-radius: 0;
}
.ctx-menu button:hover { background: var(--surface-hover); }
.ctx-menu hr { border: none; border-top: 1px solid var(--border); margin: 0.25rem 0; }
.ctx-submenu { padding: 0.25rem 1rem 0.5rem; }
.ctx-submenu-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; margin-bottom: 0.25rem; }
.ctx-flag-row { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.ctx-flag-row button {
  width: auto; padding: 0.25rem 0.5rem; border-radius: 6px;
  border: 1px solid var(--border); font-size: 0.78rem;
}

/* Importance in detail view */
.importance-picker { display: inline-flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.importance-picker button {
  padding: 0.35rem 0.65rem; font-size: 0.78rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted);
}
.importance-picker button.active { border-color: currentColor; font-weight: 600; }
.importance-picker button.imp-low { color: #6b9bd1; }
.importance-picker button.imp-high { color: #e6a817; }
.importance-picker button.imp-urgent { color: #ef4444; }
.btn-star-detail {
  padding: 0.35rem 0.65rem; font-size: 1rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.btn-star-detail.active { color: #fbbf24; border-color: #fbbf24; }

/* Contacts */
.contacts-list { margin-top: 1rem; }
.contact-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border);
}
.contact-avatar {
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-info strong { display: block; font-size: 0.92rem; }
.contact-info span { font-size: 0.82rem; color: var(--muted); }
.contact-actions { display: flex; gap: 0.35rem; }
.contact-actions button {
  padding: 0.3rem 0.55rem; font-size: 0.78rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 6px; color: var(--muted);
}
.contact-actions button:hover { border-color: var(--accent); color: var(--accent); }
.contact-form { display: grid; gap: 0.5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* Compose autocomplete */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 50;
  max-height: 12rem; overflow-y: auto;
  background: var(--surface-solid); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.autocomplete-item {
  padding: 0.55rem 0.85rem; cursor: pointer; font-size: 0.875rem;
}
.autocomplete-item:hover, .autocomplete-item.active { background: var(--accent-light); }
.autocomplete-item small { color: var(--muted); margin-left: 0.35rem; }

.kbd-hint {
  font-size: 0.72rem; color: var(--muted); margin-top: 0.5rem;
}
