/* ================================================================
   BASE RESET
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-family-sans);
  font-size: var(--font-body-size);
  line-height: var(--font-body-line-height);
  color: var(--color-text-default);
  background: #e8e8e8;
  height: 100vh;
  overflow: hidden;
}

/* ================================================================
   OUTLOOK WIREFRAME SHELL
   ================================================================ */

.outlook-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: #f3f3f3;
}

/* ── Top Ribbon (wireframe) ──────────────────────────────────── */

.outlook-ribbon {
  height: 48px;
  background: #0f6cbd;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  flex-shrink: 0;
}

.outlook-ribbon-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.outlook-ribbon-waffle {
  color: rgba(255,255,255,0.9);
  font-size: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: default;
}

.outlook-ribbon-logo {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.outlook-ribbon-logo-icon {
  width: 20px;
  height: 20px;
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.outlook-ribbon-search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  height: 30px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 7px;
  cursor: text;
}

.outlook-ribbon-search-icon {
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  flex-shrink: 0;
}

.outlook-ribbon-search-placeholder {
  color: rgba(255,255,255,0.75);
  font-size: 13px;
}

.outlook-ribbon-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.outlook-ribbon-icon {
  color: rgba(255,255,255,0.9);
  font-size: 16px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: default;
}

.outlook-ribbon-icon:hover { background: rgba(255,255,255,0.15); }

.outlook-ribbon-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #a8d0f5;
  color: #0f4a8a;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  cursor: default;
}

/* ── Main body row ────────────────────────────────────────────── */

.outlook-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Left nav sidebar (wireframe) ────────────────────────────── */

.outlook-sidebar {
  width: 200px;
  background: #f3f3f3;
  border-right: 1px solid #d1d1d1;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.outlook-sidebar-section {
  padding: 8px 0;
}

.outlook-sidebar-heading {
  font-size: 10px;
  font-weight: 600;
  color: #666;
  padding: 4px 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.outlook-folder {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  font-size: 12px;
  color: #333;
  cursor: default;
  border-radius: 2px;
  margin: 0 4px;
}

.outlook-folder:hover { background: #e5e5e5; }

.outlook-folder.active {
  background: #dce6f7;
  color: #0078d4;
  font-weight: 600;
}

.outlook-folder-icon {
  font-size: 13px;
  color: #666;
  width: 16px;
  text-align: center;
}

.outlook-folder.active .outlook-folder-icon { color: #0078d4; }

.outlook-folder-count {
  margin-left: auto;
  font-size: 10px;
  color: #666;
  font-weight: 600;
}

.outlook-folder.active .outlook-folder-count { color: #0078d4; }

/* ── Email list column (wireframe) ───────────────────────────── */

.outlook-email-list {
  width: 300px;
  background: #fff;
  border-right: 1px solid #d1d1d1;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.outlook-email-list-header {
  padding: 10px 14px 8px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.outlook-email-list-title {
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.outlook-email-list-actions {
  display: flex;
  gap: 6px;
  color: #666;
  font-size: 14px;
}

.outlook-email-list-filter {
  padding: 4px 14px 6px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}

.outlook-filter-chip {
  font-size: 11px;
  color: #666;
  padding: 2px 8px;
  border-radius: 12px;
  cursor: default;
}

.outlook-filter-chip.active {
  background: #dce6f7;
  color: #0078d4;
  font-weight: 600;
}

.outlook-email-items {
  flex: 1;
  overflow-y: auto;
}

.outlook-email-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  position: relative;
}

.outlook-email-item:hover { background: #f5f5f5; }

.outlook-email-item.selected {
  background: #dce6f7;
  border-left: 3px solid #0078d4;
}

.outlook-email-item.unread .outlook-email-sender { font-weight: 700; color: #111; }
.outlook-email-item.unread .outlook-email-subject { font-weight: 600; color: #111; }

.outlook-email-item.dummy { opacity: 0.5; cursor: default; }
.outlook-email-item.dummy:hover { background: transparent; }

.outlook-email-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.outlook-email-sender {
  font-size: 12px;
  color: #333;
  font-weight: 400;
}

.outlook-email-time {
  font-size: 10px;
  color: #888;
}

.outlook-email-subject {
  font-size: 12px;
  color: #444;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.outlook-email-preview {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── LawVu Tracked Badge — email list ────────────────────────── */

.outlook-tracked-badge {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  background: var(--brand-200);
  color: var(--brand-700);
  border: 1px solid var(--brand-700);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-family-sans);
  padding: 1px 6px;
  border-radius: var(--radius-md);
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

/* ── LawVu Tracked Badge — reading pane header ───────────────── */

.reading-tracked-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--brand-200);
  color: var(--brand-700);
  border: 1px solid var(--brand-700);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-family-sans);
  padding: 3px 6px 3px 9px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  flex-shrink: 0;
}

.reading-tracked-dismiss {
  background: transparent;
  border: none;
  color: var(--brand-700);
  opacity: 0.6;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 1px;
  display: flex;
  align-items: center;
  transition: opacity 0.15s;
}
.reading-tracked-dismiss:hover { opacity: 1; }

.outlook-unread-dot {
  width: 7px;
  height: 7px;
  background: #0078d4;
  border-radius: 50%;
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
}

/* ── Reading pane (wireframe) ────────────────────────────────── */

.outlook-reading-pane {
  flex: 1;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.outlook-reading-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}

.outlook-reading-subject {
  font-size: 18px;
  font-weight: 600;
  color: #111;
  margin-bottom: 10px;
  line-height: 1.3;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.outlook-reading-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.outlook-reading-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #bcd1e8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #1e3a5f;
  flex-shrink: 0;
}

.outlook-reading-sender-info { flex: 1; }

.outlook-reading-sender-name {
  font-size: 13px;
  font-weight: 600;
  color: #222;
}

.outlook-reading-sender-email {
  font-size: 11px;
  color: #888;
}

.outlook-reading-date {
  font-size: 11px;
  color: #888;
}

.outlook-reading-toolbar {
  padding: 6px 20px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.outlook-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  color: #333;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: default;
  background: transparent;
  font-family: var(--font-family-sans);
}

.outlook-toolbar-btn:hover {
  background: #f0f0f0;
  border-color: #d1d1d1;
}

.outlook-reading-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  color: #333;
  font-size: 13px;
  line-height: 1.6;
}

.outlook-reading-body p { margin-bottom: 12px; }

.outlook-reading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #aaa;
  gap: 12px;
}

.outlook-reading-placeholder-icon {
  font-size: 48px;
  opacity: 0.3;
}

.outlook-reading-placeholder-text {
  font-size: 13px;
  color: #999;
}

/* ================================================================
   ADD-IN TASK PANE
   ================================================================ */

.addin-pane {
  width: 320px;
  min-width: 320px;
  max-width: 500px;
  flex-shrink: 0;
  background: var(--color-surface-default);
  border-left: 1px solid #d1d1d1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  position: relative;
}

.addin-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: ew-resize;
  z-index: 10;
}

.addin-resize-handle:hover,
.addin-resize-handle--dragging {
  background: var(--brand-400);
  opacity: 0.5;
  transition: background 0.15s;
}

/* ── Brand Bar ───────────────────────────────────────────────── */

.brand-bar {
  background: var(--color-surface-brand);
  padding: var(--space-2) var(--space-6);
  height: 40px;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.brand-bar-logo {
  flex: 1;
  display: flex;
  align-items: center;
}

.brand-bar-logo svg {
  width: 40px;
  height: auto;
}

.brand-bar-create {
  background: var(--brand-700);
  color: var(--color-text-on-brand);
  border: none;
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-5);
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  line-height: var(--font-body-line-height);
  font-family: var(--font-family-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
  transition: background 0.15s;
}

.brand-bar-create:hover { background: var(--brand-800); }

.brand-create-wrap {
  position: relative;
}

.create-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-surface-default);
  border: 0.5px solid var(--color-border-divider);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 100;
  white-space: nowrap;
  overflow: hidden;
}

.create-menu-item {
  padding: var(--space-3) calc(var(--space-4) + 30px) var(--space-3) var(--space-4);
  font-size: var(--font-body-size);
  color: var(--color-text-default);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.create-menu-item:hover { background: var(--color-surface-hover); }

.create-menu-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-bar-overflow {
  background: transparent;
  border: none;
  color: var(--color-text-on-brand);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.15s, background 0.15s;
}

.brand-bar-overflow:hover { opacity: 1; background: rgba(255,255,255,0.15); }

/* overflow menu */
.overflow-menu {
  position: absolute;
  top: 44px;
  right: 8px;
  background: var(--color-surface-default);
  border: 0.5px solid var(--color-border-divider);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 100;
  min-width: 160px;
  overflow: hidden;
}

.overflow-menu-item {
  padding: var(--space-4) var(--space-6);
  font-size: var(--font-body-size);
  color: var(--color-text-default);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.overflow-menu-item:hover { background: var(--color-surface-hover); }

.overflow-menu-item.danger { color: var(--color-text-danger); }

/* ── Tracked Strip ───────────────────────────────────────────── */

.tracked-strip {
  background: var(--brand-200);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border-top: 1px solid var(--brand-300);
}

.tracked-strip--clickable {
  cursor: pointer;
}

.tracked-strip--clickable:hover .tracked-strip-name {
  text-decoration: underline;
}

.tracked-strip-badge {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--brand-700);
  color: var(--brand-700);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-family-sans);
  padding: 1px 6px;
  border-radius: var(--radius-md);
}

.tracked-strip-item-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-left: 6px;
}

.tracked-strip-name {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tracked-strip-chevron {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--brand-700);
  opacity: 0.6;
  margin-left: auto;
  transition: opacity 0.1s;
}

.tracked-strip--clickable:hover .tracked-strip-chevron {
  opacity: 1;
}

/* ── Confirmation Strip ──────────────────────────────────────── */

.confirmation-strip {
  background: var(--brand-200);
  border-bottom: 1px solid var(--brand-300);
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.confirmation-strip-text {
  flex: 1;
  font-size: var(--font-caption-size);
  color: var(--brand-800);
  font-weight: var(--font-body-weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.confirmation-undo {
  background: transparent;
  border: none;
  color: var(--color-text-link);
  font-size: var(--font-caption-size);
  font-weight: var(--font-body-weight-semibold);
  font-family: var(--font-family-sans);
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.confirmation-undo:hover { text-decoration: underline; }

.confirmation-matter-link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-weight: 600;
  color: var(--brand-800);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.confirmation-matter-link:hover {
  color: var(--brand-700);
}

/* ── Email Context Strip ─────────────────────────────────────── */

.email-context-strip {
  background: var(--color-surface-subtle);
  padding: var(--space-4) var(--space-6);
  flex-shrink: 0;
  border-bottom: 0.5px solid var(--color-border-divider);
}

.email-context-subject {
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: var(--font-body-line-height);
}

.email-context-sender {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  margin-top: var(--space-1);
  line-height: var(--font-caption-line-height);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Search Input ────────────────────────────────────────────── */

.search-wrap {
  padding: var(--space-4) var(--space-5);
  flex-shrink: 0;
}

.search-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 8px;
  color: var(--color-text-subtle);
  font-size: 13px;
  pointer-events: none;
  display: flex;
}

.search-input {
  width: 100%;
  height: 30px;
  padding: 0 28px 0 28px;
  border: 1px solid #d1d1d1;
  border-radius: var(--radius-sm);
  font-size: var(--font-body-size);
  font-family: var(--font-family-sans);
  color: var(--color-text-default);
  background: var(--color-surface-default);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  border-color: var(--color-border-input-active);
  box-shadow: 0 0 0 1px var(--color-border-input-active);
  outline: none;
}
.search-input:focus-visible { outline: none; }
.search-input::placeholder { color: var(--color-text-subtle); }

.search-clear {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--color-text-subtle);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.search-clear:hover { color: var(--color-text-default); }

/* ── Tab Bar ─────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  border-bottom: 0.5px solid var(--color-border-divider);
  flex-shrink: 0;
  padding: 0 0 0 var(--space-5);
  gap: 16px;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) 0;
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-subtle);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -0.5px;
  transition: color 0.15s;
  font-family: var(--font-family-sans);
  white-space: nowrap;
}

.tab-item:hover { color: var(--color-text-default); }

.tab-item.active {
  color: var(--color-text-default);
  border-bottom-color: var(--color-border-input-active);
}

.tab-item-icon {
  font-size: 14px;
  display: flex;
}

/* ── Result Meta Bar ─────────────────────────────────────────── */

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  flex-shrink: 0;
}

.result-count {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  line-height: var(--font-caption-line-height);
}

.sort-dropdown {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border: 0.5px solid var(--color-border-divider);
  border-radius: var(--radius-pill);
  font-size: var(--font-body-size);
  font-family: var(--font-family-sans);
  color: var(--color-text-default);
  background: var(--color-surface-default);
  cursor: default;
  font-weight: var(--font-body-weight-regular);
  text-transform: none;
}

.sort-dropdown-icon { font-size: 10px; color: var(--color-text-subtle); }

/* ── Hint Banner ─────────────────────────────────────────────── */

.hint-banner {
  margin: 0 var(--space-6) var(--space-3);
  background: var(--color-surface-hint);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  flex-shrink: 0;
}

.hint-banner-icon {
  font-size: 12px;
  color: var(--color-text-hint);
  margin-top: 1px;
  flex-shrink: 0;
}

.hint-banner-text {
  font-size: var(--font-caption-size);
  color: var(--color-text-hint);
  line-height: var(--font-caption-line-height);
}

.hint-banner-link {
  color: var(--color-text-link);
  text-decoration: none;
  cursor: pointer;
  font-weight: var(--font-body-weight-semibold);
}

.hint-banner-link:hover { text-decoration: underline; }

/* ── List Scroll Area ────────────────────────────────────────── */

.list-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.list-scroll::-webkit-scrollbar { width: 4px; }
.list-scroll::-webkit-scrollbar-thumb { background: var(--neutral-400); border-radius: 2px; }
.list-scroll::-webkit-scrollbar-track { background: transparent; }

/* ── Time Bucket Header ──────────────────────────────────────── */

.time-bucket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6) var(--space-2) var(--space-5);
  font-size: var(--font-caption-size);
  font-weight: var(--font-caption-weight);
  color: var(--color-text-subtle);
  line-height: var(--font-caption-line-height);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-label {
  padding: var(--space-2) var(--space-5) var(--space-1);
  font-size: var(--font-caption-size);
  font-weight: var(--font-caption-weight);
  color: var(--color-text-subtle);
  line-height: var(--font-caption-line-height);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Matter Row ──────────────────────────────────────────────── */

.matter-row {
  position: relative;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.matter-row:hover { background: var(--color-surface-hover); }
.matter-row:hover .matter-row-file-btn { opacity: 1; pointer-events: auto; }
.matter-row:focus-within .matter-row-file-btn { opacity: 1; pointer-events: auto; }
.matter-row.active-press { transform: scale(0.99); }

.matter-row.suggestion-variant {
  border: 0.5px solid var(--color-border-divider);
  border-radius: var(--radius-md);
  margin: 0 var(--space-5) var(--space-3);
  padding: var(--space-4) var(--space-5);
}

.matter-row.suggestion-variant:hover { background: var(--color-surface-hover); }

/* object type icon */
.matter-type-icon-wrap {
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* row content */
.matter-row-content { flex: 1; min-width: 0; }

.matter-row-title-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
  padding-right: 28px; /* room for file btn */
}

.matter-row-title {
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
  line-height: var(--font-body-line-height);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.matter-suggested-badge {
  flex-shrink: 0;
  background: var(--color-surface-info);
  color: var(--color-text-info);
  font-size: var(--font-caption-size);
  font-weight: var(--font-body-weight-semibold);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  line-height: 1.4;
  white-space: nowrap;
}

.matter-row-subtitle {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  line-height: var(--font-caption-line-height);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matter-row-reason {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.matter-row-reason-icon {
  font-size: 11px;
  color: var(--color-text-subtle);
  flex-shrink: 0;
}

.matter-row-reason-text {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  line-height: var(--font-caption-line-height);
}

/* file button */
.matter-row-file-btn {
  position: absolute;
  right: var(--space-5);
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s, background 0.1s, color 0.1s;
}

.matter-row-file-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-default);
}

/* ── Footer Action ───────────────────────────────────────────── */

.footer-action {
  padding: var(--space-4) var(--space-6);
  border-top: 0.5px solid var(--color-border-divider);
  flex-shrink: 0;
}

.footer-action-btn {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  font-family: var(--font-family-sans);
  padding: 0;
  transition: color 0.15s;
}

.footer-action-btn:hover { color: var(--color-text-link); }

.footer-action-icon { font-size: 13px; }

/* ── Skeleton Loading ────────────────────────────────────────── */

@keyframes shimmer {
  0%   { background-position: -300px 0; }
  100% { background-position: 300px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--neutral-300) 25%, var(--neutral-200) 50%, var(--neutral-300) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}

.skeleton-icon { width: 20px; height: 20px; flex-shrink: 0; border-radius: var(--radius-sm); }
.skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: var(--space-2); }
.skeleton-line { height: 10px; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-60 { width: 60%; }

/* ── Error States ────────────────────────────────────────────── */

.error-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  gap: var(--space-4);
  text-align: center;
}

.error-state-icon { font-size: 28px; color: var(--color-text-subtle); }
.error-state-title {
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
}
.error-state-message {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  line-height: 1.5;
  max-width: 220px;
}

.retry-btn {
  margin-top: var(--space-2);
  background: var(--color-surface-brand);
  color: var(--color-text-on-brand);
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  font-family: var(--font-family-sans);
  cursor: pointer;
}

.retry-btn:hover { background: var(--color-surface-brand-hover); }

/* ── Empty Search State ──────────────────────────────────────── */

.empty-search {
  flex: 1;
  padding: var(--space-8) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.empty-search-icon { font-size: 24px; color: var(--color-text-subtle); opacity: 0.5; }
.empty-search-title {
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
}
.empty-search-sub {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  line-height: 1.5;
}

/* ================================================================
   MATTER DETAIL VIEW
   ================================================================ */

.detail-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ── Detail Header ───────────────────────────────────────────── */

.detail-header {
  padding: var(--space-5) var(--space-6) var(--space-4);
  flex-shrink: 0;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: none;
  background: var(--neutral-200);
  color: var(--color-text-default);
  font-size: var(--font-body-size);
  font-family: var(--font-family-sans);
  cursor: pointer;
  border-radius: var(--radius-md);
  margin-left: calc(-1 * var(--space-4));
  margin-bottom: 16px;
  transition: background 0.15s;
}

.back-btn:hover {
  background: var(--neutral-300);
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.detail-title-main {
  flex: 1;
  min-width: 0;
}

.detail-title-text {
  display: inline;
  font-size: var(--font-heading-size);
  font-weight: var(--font-heading-weight);
  line-height: var(--font-heading-line-height);
  color: var(--color-text-default);
  word-break: break-word;
}

.detail-external-link {
  display: inline-flex;
  vertical-align: text-top;
  background: transparent;
  border: none;
  color: var(--color-text-subtle);
  cursor: pointer;
  font-size: 13px;
  padding: 1px var(--space-1);
  margin-left: var(--space-2);
  border-radius: var(--radius-sm);
  align-items: center;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  opacity: 0;
  pointer-events: none;
}

.detail-title-main:hover .detail-external-link {
  opacity: 1;
  pointer-events: auto;
}

.detail-external-link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-default);
}

/* ── Detail Tabs ─────────────────────────────────────────────── */

.detail-tabs {
  display: flex;
  border-bottom: 0.5px solid var(--color-border-divider);
  flex-shrink: 0;
  padding: 0 0 0 var(--space-5);
  gap: 16px;
}

.detail-tab {
  padding: var(--space-5) 0;
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-subtle);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -0.5px;
  transition: color 0.15s;
  font-family: var(--font-family-sans);
}

.detail-tab:hover { color: var(--color-text-default); }

.detail-tab.active {
  color: var(--color-text-default);
  border-bottom-color: var(--color-border-input-active);
}

/* ── Detail Scroll Area ──────────────────────────────────────── */

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 60px; /* clear sticky button */
  margin-right: 6px;
}

.detail-scroll::-webkit-scrollbar { width: 4px; }
.detail-scroll::-webkit-scrollbar-thumb { background: var(--neutral-400); border-radius: 2px; }

/* ── Status Update Card ──────────────────────────────────────── */

.status-update-card {
  padding: var(--space-5) var(--space-6);
  border-bottom: 0.5px solid var(--color-border-divider);
}

.status-update-label {
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
  margin-bottom: var(--space-2);
}

.status-update-meta {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  margin-bottom: var(--space-3);
  line-height: var(--font-caption-line-height);
}

.status-update-body {
  font-size: var(--font-body-size);
  color: var(--color-text-default);
  line-height: var(--font-body-line-height);
  margin-bottom: var(--space-4);
}

.status-update-add-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-hover);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
  font-family: var(--font-family-sans);
  cursor: pointer;
  transition: background 0.15s;
}
.status-update-add-btn:hover {
  background: var(--neutral-300);
}

/* ── Status Update Modal ─────────────────────────────────────── */

.su-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  padding: 0 8px;
  z-index: 200;
}

.su-modal {
  background: var(--color-surface-default);
  width: 100%;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  max-height: 88%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

.su-modal-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6) var(--space-4);
  border-bottom: 0.5px solid var(--color-border-divider);
  flex-shrink: 0;
}

.su-modal-header-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.su-modal-header-text {
  flex: 1;
  min-width: 0;
}

.su-modal-title {
  font-size: var(--font-heading-size);
  font-weight: var(--font-heading-weight);
  color: var(--color-text-default);
  line-height: var(--font-heading-line-height);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.su-modal-subtitle {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  line-height: var(--font-caption-line-height);
  margin-top: 1px;
}

.su-modal-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--color-text-subtle);
  font-size: 16px;
  padding: 0;
}
.su-modal-close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-default);
}

.su-modal-history {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) 0;
  min-height: 0;
}

.su-update-item {
  padding: var(--space-3) var(--space-6);
}

.su-update-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.su-update-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-surface-avatar);
  color: var(--color-text-avatar);
  font-size: 9px;
  font-weight: var(--font-body-weight-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.su-update-author {
  font-size: var(--font-caption-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
}

.su-update-date {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  margin-left: var(--space-1);
}

.su-update-body {
  font-size: var(--font-body-size);
  color: var(--color-text-default);
  line-height: var(--font-body-line-height);
  padding-left: calc(24px + var(--space-3));
}

.su-modal-input-section {
  border-top: 0.5px solid var(--color-border-divider);
  padding: var(--space-5) var(--space-6);
  flex-shrink: 0;
}

.su-modal-input-label {
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
  margin-bottom: var(--space-3);
}

.su-modal-textarea {
  width: 100%;
  min-height: 80px;
  resize: none;
  border: 1px solid #d1d1d1;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-body-size);
  font-family: var(--font-family-sans);
  color: var(--color-text-default);
  line-height: var(--font-body-line-height);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.su-modal-textarea:focus {
  border-color: var(--color-border-input-active);
  box-shadow: 0 0 0 1px var(--color-border-input-active);
}
.su-modal-textarea:focus-visible { outline: none; }
.su-modal-textarea::placeholder {
  color: var(--color-text-disabled);
}

.su-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.su-btn-cancel {
  padding: var(--space-3) var(--space-6);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
  font-family: var(--font-family-sans);
  cursor: pointer;
  transition: background 0.15s;
}
.su-btn-cancel:hover {
  background: var(--color-surface-hover);
}

.su-btn-post {
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  font-family: var(--font-family-sans);
  cursor: pointer;
  background: var(--color-surface-brand);
  color: var(--color-text-on-brand);
  transition: background 0.15s, opacity 0.15s;
}
.su-btn-post:disabled {
  opacity: 0.4;
  cursor: default;
}
.su-btn-post:not(:disabled):hover {
  background: var(--color-surface-brand-hover);
}

/* ── Property Section ────────────────────────────────────────── */

.property-section-header {
  background: var(--color-surface-subtle);
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
  border-bottom: 0.5px solid var(--color-border-divider);
}

.property-row {
  display: flex;
  align-items: flex-start;
  padding: var(--space-3) var(--space-6);
  border-bottom: 0.5px solid var(--color-border-divider);
  gap: var(--space-4);
}

.property-label {
  width: 96px;
  flex-shrink: 0;
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
  line-height: var(--font-body-line-height);
}

.property-value {
  flex: 1;
  min-width: 0;
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-regular);
  color: var(--color-text-default);
  line-height: var(--font-body-line-height);
  word-break: break-word;
}

.property-value.subtle { color: var(--color-text-subtle); }

/* person value */
.person-value {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Status Pill ─────────────────────────────────────────────── */

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--font-caption-size);
  font-weight: var(--font-body-weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
}

.status-pill.active {
  background: var(--color-surface-status-active);
  color: var(--color-text-status-active);
}

.status-pill.closed {
  background: var(--neutral-300);
  color: var(--neutral-700);
}

.status-pill.pending {
  background: var(--warning-300);
  color: var(--warning-800);
}

/* ── Avatar ──────────────────────────────────────────────────── */

.avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface-avatar);
  color: var(--color-text-avatar);
  font-size: 9px;
  font-weight: var(--font-body-weight-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Files Tab ───────────────────────────────────────────────── */

.files-search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-bottom: 0.5px solid var(--color-border-divider);
  flex-shrink: 0;
}

.files-search-bar .search-wrap {
  flex: 1;
  padding: 0;
}

.add-file-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--neutral-200);
  color: var(--color-text-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.add-file-btn:hover {
  background: var(--neutral-300);
  color: var(--color-text-default);
}

/* ── Files path bar (breadcrumb) ─────────────────────────────── */

.files-path-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-3);
  border-bottom: 0.5px solid var(--color-border-divider);
  background: var(--color-surface-subtle);
  flex-shrink: 0;
  min-height: 30px;
}

.files-path-back {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--color-text-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.files-path-back:hover {
  background: var(--color-border-divider);
  color: var(--color-text-default);
}

.files-path-crumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
  min-width: 0;
  flex: 1;
}

.files-crumb-seg {
  background: transparent;
  border: none;
  font-size: var(--font-caption-size);
  font-family: var(--font-family-sans);
  color: var(--color-text-subtle);
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  transition: color 0.15s;
}

.files-crumb-seg:hover { color: var(--color-text-link); }

.files-crumb-folder-icon {
  color: var(--brand-500);
  font-size: 12px;
  margin-right: 4px;
  flex-shrink: 0;
}

.files-crumb-seg.current {
  display: flex;
  align-items: center;
  color: var(--color-text-default);
  font-weight: var(--font-body-weight-semibold);
  cursor: default;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.files-crumb-sep {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  user-select: none;
  padding: 0 var(--space-2);
}

/* ── File Tree ───────────────────────────────────────────────── */

.file-tree { flex: 1; }

.file-tree-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5);
  min-height: 32px;
}

.file-tree-item.folder-row {
  cursor: pointer;
}

.file-tree-item.folder-row:hover {
  background: var(--color-surface-hover);
}

/* Reveal action buttons on folder row hover */
.file-tree-item.folder-row:hover .folder-row-actions,
.file-tree-item.folder-row:focus-within .folder-row-actions {
  opacity: 1;
  pointer-events: auto;
}

.file-tree-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-tree-icon.folder { color: var(--brand-500); }
.file-tree-icon.docx   { color: #2b579a; }
.file-tree-icon.xlsx   { color: #217346; }
.file-tree-icon.pdf    { color: #c0392b; }
.file-tree-icon.other  { color: var(--color-text-subtle); }

.file-tree-name {
  flex: 1;
  font-size: var(--font-body-size);
  color: var(--color-text-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  line-height: var(--font-body-line-height);
}

.file-name-subtle { color: var(--color-text-default); }

/* File row hover + attach button */
.file-tree-item.file-row:hover { background: var(--color-surface-hover); }

.file-row-highlight {
  background: var(--brand-200) !important;
}

.file-row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-width 0.15s ease, opacity 0.1s;
}

.file-tree-item.file-row:hover .file-row-actions,
.file-tree-item.file-row:focus-within .file-row-actions {
  max-width: 80px;
  opacity: 1;
  pointer-events: auto;
}

.file-row-action-btn,
.file-row-attach-btn {
  flex-shrink: 0;
  height: 24px;
  min-width: 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  padding: 0 4px;
  transition: background 0.1s, color 0.1s;
}

.file-row-action-btn:hover,
.file-row-attach-btn:hover {
  background: var(--neutral-300);
  color: var(--color-text-default);
}


/* Folder row action button group — hidden until hover */
.folder-row-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
}

/* Individual icon buttons inside folder row */
.file-tree-action-btn,
.folder-ellipsis-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.1s, color 0.1s;
}

.file-tree-action-btn:hover,
.folder-ellipsis-btn:hover {
  background: var(--neutral-300);
  color: var(--color-text-default);
}

/* Folder action dropdown menu */
.folder-action-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 500;
  background: var(--color-surface-default);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  min-width: 140px;
  padding: 4px;
  pointer-events: auto;
}

.folder-action-menu.open { display: block; }

.folder-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  font-size: var(--font-body-size);
  font-family: var(--font-family-sans);
  color: var(--color-text-default);
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 0.1s;
}

.folder-menu-item:hover { background: var(--color-surface-hover); }

.folder-menu-item-danger { color: var(--danger-600, #c0392b); }
.folder-menu-item-danger:hover { background: #fff0f0; }

/* Inline rename input */
.file-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.file-input-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.file-input-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  padding: 0;
  transition: background 0.1s, color 0.1s;
}

.file-input-cancel { color: var(--danger-500); }
.file-input-cancel:hover { background: var(--danger-200); }
.file-input-confirm { color: var(--brand-600); }
.file-input-confirm:hover { background: var(--brand-200); }

.file-tree-rename-input {
  flex: 1;
  font-size: var(--font-body-size);
  font-family: var(--font-family-sans);
  color: var(--color-text-default);
  border: 1px solid var(--color-border-input-active);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  background: var(--color-surface-default);
  outline: none;
  min-width: 0;
  height: 22px;
  box-shadow: 0 0 0 1px var(--color-border-input-active);
}
.file-tree-rename-input:focus-visible { outline: none; }

/* Inline new folder input */
.file-tree-new-input-row {
  background: var(--color-surface-selected);
}

.file-tree-new-input {
  flex: 1;
  height: 22px;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border-input-active);
  border-radius: var(--radius-sm);
  font-size: var(--font-body-size);
  font-family: var(--font-family-sans);
  color: var(--color-text-default);
  background: var(--color-surface-default);
  outline: none;
  min-width: 0;
  box-shadow: 0 0 0 1px var(--color-border-input-active);
}
.file-tree-new-input:focus-visible { outline: none; }

.file-item-name {
  font-size: var(--font-body-size);
  color: var(--color-text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── File Email Button (sticky) ──────────────────────────────── */

.file-email-btn-wrap {
  position: sticky;
  bottom: 0;
  background: var(--color-surface-default);
  padding: var(--space-4) var(--space-6) var(--space-5);
  border-top: 0.5px solid var(--color-border-divider);
  flex-shrink: 0;
  display: flex;
  justify-content: flex-start;
}

.file-email-btn {
  background: var(--color-surface-brand);
  color: var(--color-text-on-brand);
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  font-family: var(--font-family-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  transition: background 0.15s;
}

.file-email-btn:hover { background: var(--color-surface-brand-hover); }

.file-email-btn:disabled {
  background: var(--color-surface-subtle);
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

/* spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-brand {
  width: 12px;
  height: 12px;
  border: 2px solid var(--brand-300);
  border-top-color: var(--brand-700);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
  margin-left: 6px; /* 6px gap + 6px margin = 12px from pill */
}

/* ── Settings View ───────────────────────────────────────────── */

.settings-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-6) var(--space-6);
  overflow-y: auto;
}

.settings-back-btn {
  align-self: flex-start;
  margin-left: calc(-1 * var(--space-4));
  margin-bottom: var(--space-6);
}

.settings-heading {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-default);
  margin: 0 0 var(--space-5);
  line-height: 1.2;
}

.settings-divider {
  border-top: 1px solid var(--color-border-divider);
  margin-bottom: var(--space-6);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.settings-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-1);
}

.settings-pref-title {
  font-size: var(--font-body-size);
  font-weight: 600;
  color: var(--color-text-default);
}

.settings-pref-desc {
  font-size: var(--font-body-size);
  color: var(--color-text-default);
  line-height: 1.5;
  margin: 0;
}

.settings-radio-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  padding: var(--space-1) 0;
}

.settings-radio-row input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #bbb;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.15s;
  position: relative;
}

.settings-radio-row input[type="radio"]:checked {
  border-color: var(--brand-600);
  background: var(--brand-600);
  box-shadow: inset 0 0 0 3px #fff;
}

.settings-radio-label {
  font-size: var(--font-body-size);
  color: var(--color-text-default);
  line-height: 1.4;
}

/* ── Coming Soon Placeholder ─────────────────────────────────── */

.coming-soon-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  gap: var(--space-4);
  text-align: center;
}

.coming-soon-icon { font-size: 28px; opacity: 0.3; }
.coming-soon-title {
  font-size: var(--font-body-size);
  font-weight: var(--font-body-weight-semibold);
  color: var(--color-text-default);
}
.coming-soon-sub {
  font-size: var(--font-caption-size);
  color: var(--color-text-subtle);
  line-height: 1.5;
}

/* ── Detail Skeleton ─────────────────────────────────────────── */

.detail-skeleton {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ── Focus Rings ─────────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--color-border-input-active);
  outline-offset: 1px;
}

button:focus-visible {
  outline: 2px solid var(--color-border-input-active);
  outline-offset: 1px;
}

/* ── Matter Preview Card ─────────────────────────────────────── */

.matter-preview-card {
  position: fixed;
  z-index: 9000;
  width: 268px;
  background: #fff;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,0.14), 0 1px 4px rgba(0,0,0,0.08);
  padding: 12px 14px 10px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.matter-preview-card.visible {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

/* Caret pointing down (card is above the row) */
.matter-preview-card[data-caret="down"]::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: var(--caret-offset, 50%);
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid #fff;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.08));
}
.matter-preview-card[data-caret="down"]::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: var(--caret-offset, 50%);
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--color-border-default);
}

/* Caret pointing up (card is below the row) */
.matter-preview-card[data-caret="up"]::after {
  content: '';
  position: absolute;
  top: -7px;
  left: var(--caret-offset, 50%);
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid #fff;
}
.matter-preview-card[data-caret="up"]::before {
  content: '';
  position: absolute;
  top: -8px;
  left: var(--caret-offset, 50%);
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--color-border-default);
}

.mpc-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.mpc-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.mpc-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-default);
  line-height: 1.3;
  white-space: normal;
}

.mpc-avatar {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-surface-avatar-bg, #d0e8ff);
  color: var(--color-text-avatar, #0055a5);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.3px;
}

.mpc-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.mpc-status-pill {
  font-size: var(--font-caption-size);
  font-weight: var(--font-body-weight-semibold);
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-status-active);
  color: var(--color-text-status-active);
  text-transform: uppercase;
  line-height: 1.4;
}

.mpc-type {
  font-size: 11px;
  color: var(--color-text-subtle);
}

.mpc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--color-border-divider);
  padding-top: 8px;
}

.mpc-ref {
  font-size: 11px;
  color: var(--color-text-muted, var(--color-text-subtle));
  font-variant-numeric: tabular-nums;
}

.mpc-actions {
  display: flex;
  gap: 2px;
}

.mpc-action-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-subtle);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
}

.mpc-action-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-default);
}

/* ── Custom Tooltip ──────────────────────────────────────────── */

.custom-tooltip {
  position: fixed;
  z-index: 9999;
  background: #2d3748;
  color: #fff;
  font-size: 11px;
  font-family: var(--font-family-sans);
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.custom-tooltip.visible {
  opacity: 1;
}

/* Caret pointing down */
.custom-tooltip[data-caret="down"]::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: var(--caret-offset, 50%);
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #2d3748;
}

/* Caret pointing up */
.custom-tooltip[data-caret="up"]::after {
  content: '';
  position: absolute;
  top: -5px;
  left: var(--caret-offset, 50%);
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid #2d3748;
}

/* ── New Email Button (ribbon) ───────────────────────────────── */

.new-email-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: #fff;
  color: #0f6cbd;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family-sans);
  cursor: pointer;
  margin-left: 8px;
  white-space: nowrap;
  transition: background 0.15s;
}

.new-email-btn:hover { background: rgba(255,255,255,0.85); }
.new-email-btn i { font-size: 14px; }

/* ── Compose Pane ─────────────────────────────────────────────── */

.compose-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
}

.compose-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}

.compose-title {
  font-size: 16px;
  font-weight: 600;
  color: #222;
}

.compose-chrome-btns {
  display: flex;
  gap: 4px;
}

.compose-chrome-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: #666;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.compose-chrome-btn:hover { background: #f0f0f0; color: #222; }

.compose-fields {
  flex-shrink: 0;
  border-bottom: 1px solid #e5e5e5;
}

.compose-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #f0f0f0;
  padding: 0 20px;
  min-height: 40px;
}

.compose-row:last-child { border-bottom: none; }

.compose-row-label {
  font-size: 13px;
  color: #888;
  width: 60px;
  flex-shrink: 0;
}

.compose-row-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: var(--font-family-sans);
  color: #222;
  padding: 10px 0;
  background: transparent;
}

.compose-row-side {
  background: transparent;
  border: none;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 3px;
  font-family: var(--font-family-sans);
  transition: background 0.15s;
}

.compose-row-side:hover { background: #f0f0f0; color: #444; }

.compose-body-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.compose-body-textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 13px;
  font-family: var(--font-family-sans);
  color: #333;
  line-height: 1.6;
  padding: 16px 20px;
  background: transparent;
}

.compose-actions {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid #e5e5e5;
  gap: 2px;
  flex-shrink: 0;
}

.compose-send-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  background: #0f6cbd;
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family-sans);
  cursor: pointer;
  transition: background 0.15s;
}

.compose-send-btn:hover { background: #0e5fa3; }

.compose-actions-divider {
  width: 1px;
  height: 20px;
  background: #d1d1d1;
  margin: 0 6px;
  flex-shrink: 0;
}

.compose-action-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: #555;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.compose-action-btn:hover { background: #f0f0f0; color: #222; }

.compose-discard-btn { margin-left: auto; }

/* ── Compose Attachments ──────────────────────────────────────── */

.compose-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 20px;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}

.compose-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f3f3f3;
  border: 1px solid #d1d1d1;
  border-radius: 4px;
  padding: 3px 4px 3px 8px;
  font-size: 12px;
  color: #333;
  max-width: 220px;
}

.compose-attachment-icon {
  flex-shrink: 0;
  font-size: 12px;
  display: flex;
}

.compose-attachment-icon.docx { color: #2b579a; }
.compose-attachment-icon.xlsx { color: #217346; }
.compose-attachment-icon.pdf  { color: #c0392b; }
.compose-attachment-icon.other { color: var(--color-text-subtle); }

.compose-attachment-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-family-sans);
}

.compose-attachment-remove {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 2px;
  padding: 0;
  transition: background 0.1s, color 0.1s;
}

.compose-attachment-remove:hover {
  background: #ddd;
  color: #333;
}

/* Loading state chip */
.compose-attachment-chip.loading {
  background: #f8f8f8;
  color: #888;
  cursor: default;
  gap: 7px;
}

.compose-attach-spinner {
  width: 11px;
  height: 11px;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-top-color: #0078d4;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── Attachment Preview Modal ─────────────────────────────────── */

.attachment-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

.attachment-preview-modal {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 1200px;
  height: 82vh;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  overflow: hidden;
}

.attachment-preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}

.attachment-preview-header-icon {
  font-size: 18px;
  flex-shrink: 0;
  display: flex;
}
.attachment-preview-header-icon.docx { color: #2b579a; }
.attachment-preview-header-icon.xlsx { color: #217346; }
.attachment-preview-header-icon.pdf  { color: #c0392b; }
.attachment-preview-header-icon.other { color: #888; }

.attachment-preview-filename {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-preview-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.attachment-preview-close:hover { background: #f0f0f0; color: #222; }

.attachment-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  background: #f0f0f0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 0;
}

.attachment-preview-body.preview-loading-body {
  align-items: center;
}

.preview-loader-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-spinner {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

.attachment-preview-footer {
  border-top: 1px solid #e5e5e5;
  padding: 10px 16px;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.attachment-preview-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: transparent;
  border: 1px solid #d1d1d1;
  border-radius: 3px;
  font-size: 12px;
  color: #444;
  cursor: pointer;
  font-family: var(--font-family-sans);
  transition: background 0.15s;
}
.attachment-preview-open-btn:hover { background: #f0f0f0; }

/* ── Mock File Preview Content ────────────────────────────────── */

.preview-doc {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 1px;
  padding: 52px 60px;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 210 / 297;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.preview-line {
  height: 8px;
  background: #e8e8e8;
  border-radius: 2px;
  margin-bottom: 10px;
}
.preview-line.short { width: 42%; }
.preview-line-gap { height: 14px; }

.preview-spreadsheet {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 2px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.preview-sheet-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid #e0e0e0;
}
.preview-sheet-row:last-child { border-bottom: none; }
.preview-sheet-row.header { background: #217346; }

.preview-cell {
  height: 26px;
  border-right: 1px solid #e0e0e0;
  background: #fff;
}
.preview-cell:last-child { border-right: none; }
.preview-cell.header {
  height: 28px;
  background: rgba(255,255,255,0.15);
  border-right-color: rgba(255,255,255,0.2);
}

.preview-generic {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 14px;
  width: 100%;
}
.preview-generic-icon { font-size: 52px; color: #bbb; }
.preview-generic-name { font-size: 13px; color: #777; text-align: center; }

/* ── Create Matter Form ──────────────────────────────────────── */

.create-matter-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.create-matter-scroll {
  flex: 1;
  overflow-y: auto;
}

.create-matter-form {
  padding: var(--space-5) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* Field groups */
.cm-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cm-field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
}

.cm-label {
  font-size: var(--font-body-size);
  font-weight: 600;
  color: var(--color-text-default);
  line-height: 1.3;
}

.cm-required::after {
  content: ' *';
  color: #d92b2b;
}

/* Inputs & selects */
.cm-input,
.cm-select {
  width: 100%;
  height: 30px;
  padding: 0 var(--space-4);
  border: 1px solid #d1d1d1;
  border-radius: var(--radius-md);
  font-size: var(--font-body-size);
  font-family: var(--font-family-sans);
  color: var(--color-text-default);
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cm-input:focus,
.cm-select:focus {
  border-color: var(--color-border-input-active);
  box-shadow: 0 0 0 1px var(--color-border-input-active);
}

.cm-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%23666' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.cm-input--date {
  padding: 0 var(--space-4);
  cursor: pointer;
}

/* Checkbox */
.cm-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--font-body-size);
  color: var(--color-text-default);
  user-select: none;
}

.cm-checkbox {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--brand-600);
  flex-shrink: 0;
}

/* Section headers */
.cm-section-header {
  margin: var(--space-2) calc(-1 * var(--space-6));
  padding: var(--space-3) var(--space-6);
  background: var(--neutral-100);
  border-top: 0.5px solid var(--color-border-divider);
  border-bottom: 0.5px solid var(--color-border-divider);
  font-size: var(--font-body-size);
  font-weight: 400;
  color: var(--color-text-subtle);
}

/* Meta fields block */
.cm-meta-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin: 0 calc(-1 * var(--space-6));
  padding: 0 var(--space-6);
}

/* Loading state */
.cm-meta-loading {
  display: flex;
  justify-content: center;
  padding: var(--space-6) 0;
}

.cm-spinner {
  width: 16px;
  height: 16px;
}

/* Rich text editor (mock) */
.cm-richtext {
  border: 1px solid #d1d1d1;
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cm-richtext:focus-within {
  border-color: var(--color-border-input-active);
  box-shadow: 0 0 0 1px var(--color-border-input-active);
}

.cm-richtext-toolbar {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid #e8e8e8;
  background: var(--neutral-100);
  flex-wrap: wrap;
}

.cm-rt-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  min-width: 24px;
  padding: 0 var(--space-2);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-family-sans);
  color: var(--color-text-subtle);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.cm-rt-btn:hover {
  background: var(--neutral-200);
  color: var(--color-text-default);
}

.cm-rt-italic em  { font-style: italic; }
.cm-rt-strike s   { text-decoration: line-through; }

.cm-rt-heading {
  font-size: 11px;
  padding: 0 var(--space-3);
}

.cm-rt-sep {
  width: 1px;
  height: 16px;
  background: #d1d1d1;
  margin: 0 var(--space-1);
  flex-shrink: 0;
}

.cm-richtext-body {
  min-height: 100px;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-body-size);
  color: var(--color-text-default);
  outline: none;
  line-height: 1.5;
}

.cm-richtext-body:empty::before {
  content: '';
  display: block;
}

/* Submit wrapper (tooltip target for disabled state) */
.cm-submit-wrap {
  display: block;
  width: 100%;
}

/* Footer */
.create-matter-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 0.5px solid var(--color-border-divider);
  flex-shrink: 0;
  background: #fff;
}

.create-matter-submit {
  width: 100%;
  height: 30px;
  background: var(--color-surface-brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-body-size);
  font-weight: 600;
  font-family: var(--font-family-sans);
  cursor: pointer;
  transition: background 0.15s;
}

.create-matter-submit:hover:not(:disabled) {
  background: var(--color-surface-brand-hover);
}

.create-matter-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Create matter heading */
.cm-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-default);
  line-height: 1.3;
  word-break: break-word;
}

/* ── Utility ─────────────────────────────────────────────────── */

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
