/* =====================================================
   HERMES DESIGN SYSTEM — v2.0
   Black/White Brand · shadcn/ui Minimal · Dark Mode
   ===================================================== */
:root {
  /* ── Brand Accent (single source — change here to rebrand) ── */
  --brand: #FF7A00;
  --brand-light: #FFB36B;
  --brand-lighter: #fff0e2;
  --brand-foreground: #1F2429;
  --brand-rgb: 255, 122, 0;

  /* ── Grayscale Color Palette (zinc scale) ── */
  --background: #fafafa;
  --foreground: #1F2429;

  --card: #ffffff;
  --card-foreground: #1F2429;
  --card-rgb: 255, 255, 255;

  --popover: #ffffff;
  --popover-foreground: #0a0a0a;

  --primary: #FF7A00;
  --primary-foreground: #1F2429;

  --secondary: #f4f4f5;        /* zinc-100 */
  --secondary-foreground: #18181b;

  --muted: #f4f4f5;
  --muted-foreground: #71717a; /* zinc-500 */

  --accent: #f4f4f5;
  --accent-foreground: #18181b;

  --destructive: #ef4444;
  --destructive-foreground: #fef2f2;

  --border: #D9DDE2;
  --input: #D9DDE2;
  --ring: #8C4100;

  /* ── Semantic Colors ── */
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --danger-color: var(--destructive);
  --info-color: #3b82f6;

  /* ── Spacing Scale (4px grid) ── */
  --space-0: 0;
  --space-0-5: 0.125rem;  /* 2px */
  --space-1: 0.25rem;     /* 4px */
  --space-1-5: 0.375rem;  /* 6px */
  --space-2: 0.5rem;      /* 8px */
  --space-2-5: 0.625rem;  /* 10px */
  --space-3: 0.75rem;     /* 12px */
  --space-4: 1rem;        /* 16px */
  --space-5: 1.25rem;     /* 20px */
  --space-6: 1.5rem;      /* 24px */
  --space-8: 2rem;        /* 32px */
  --space-10: 2.5rem;     /* 40px */
  --space-12: 3rem;       /* 48px */

  /* ── Border Radius Scale ── */
  --radius-sm: 0.375rem;  /* 6px  */
  --radius-md: 0.5rem;    /* 8px  */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.25rem;  /* 20px */
  --radius-full: 9999px;

  /* ── Typography Scale ── */
  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg: 1.125rem;    /* 18px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 2rem;       /* 32px */

  /* ── Shadows — Light Mode ── */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 2px 4px 0 rgb(0 0 0 / 0.06), 0 1px 2px 0 rgb(0 0 0 / 0.03);
  --shadow-lg: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
  --shadow-xl: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);

  /* ── LEGACY aliases — point to canonical tokens (for chat-styles.css compat) ── */
  --primary-color: var(--foreground);
  --secondary-color: var(--muted-foreground);
  --accent-color: var(--brand);
  --surface-color: var(--background);
  --surface-elevated: var(--card);
  --bg-primary: var(--background);
  --bg-secondary: var(--card);
  --text-primary: var(--card-foreground);
  --text-color: var(--foreground);
  --text-secondary: var(--muted-foreground);
  --text-muted: var(--muted-foreground);
  --text-tertiary: #a1a1aa;
  --border-color: var(--border);
  --border-accent: #d4d4d8;

  /* Responsive interface scale.
     Keeps Hermes comfortable on desktop, high-DPI displays, browser zoom and
     mobile WebViews without forcing fixed pixel-heavy layouts. */
  --hermes-ui-scale: clamp(0.92rem, 0.82rem + 0.28vw, 1rem);
  --hermes-touch-target: clamp(2.25rem, 2.05rem + 0.75vw, 2.75rem);
  --hermes-page-gutter: clamp(0.75rem, 0.45rem + 1.2vw, 1.5rem);
}

html {
  font-size: var(--hermes-ui-scale);
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* ── Dark Mode ── */
html.dark {
  --background: #171B1F;
  --foreground: #fafafa;

  --card: #1F2429;
  --card-foreground: #fafafa;
  --card-rgb: 31, 36, 41;

  --popover: #18181b;
  --popover-foreground: #fafafa;

  --primary: #FF7A00;
  --primary-foreground: #1F2429;

  --secondary: #27272a;         /* zinc-800 */
  --secondary-foreground: #fafafa;

  --muted: #27272a;
  --muted-foreground: #a1a1aa;  /* zinc-400 */

  --accent: #27272a;
  --accent-foreground: #fafafa;

  --destructive: #f87171;       /* red-400 (brighter on dark) */
  --destructive-foreground: #450a0a;

  --border: #41484F;
  --input: #41484F;
  --ring: #FF7A00;

  --brand: #FF7A00;
  --brand-light: #FFB36B;
  --brand-lighter: #34302B;
  --brand-foreground: #1F2429;
  --brand-rgb: 255, 122, 0;

  --success-color: #34d399;
  --warning-color: #fbbf24;
  --info-color: #60a5fa;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 2px 4px 0 rgb(0 0 0 / 0.35), 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow-lg: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -1px rgb(0 0 0 / 0.25);
  --shadow-xl: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -2px rgb(0 0 0 / 0.3);

  /* Legacy overrides for dark */
  --primary-color: var(--foreground);
  --accent-color: var(--brand);
  --text-tertiary: #71717a;
  --border-accent: #3f3f46;     /* zinc-700 */
}

/* Native carets cannot tile when a component changes its background. */
html.dark select {
  color-scheme: dark;
  background-image: none;
}

/* Theme icon CSS toggling (dark mode shows moon, light shows sun) */
html.dark .theme-icon-light { display: none !important; }
html.dark .theme-icon-dark  { display: block !important; }

/* Settings use the same semantic surfaces in both themes. Several legacy
   panels still contain inline light-mode colors, so the scoped rules below
   deliberately take precedence without affecting the rest of the app. */
.settings-container {
  color: var(--foreground);
}

.settings-container [hidden],
.settings-tab-button[hidden] {
  display: none !important;
}

.settings-tabs {
  gap: 0.25rem !important;
  border-bottom: 1px solid var(--border) !important;
}

.settings-tab-button {
  min-height: 2.5rem;
  padding: 0.625rem 0.8rem !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: transparent !important;
  color: var(--muted-foreground) !important;
  font: inherit;
}

.settings-tab-button:hover {
  background: var(--muted) !important;
  color: var(--foreground) !important;
}

.settings-tab-button.active {
  border-bottom-color: var(--foreground) !important;
  color: var(--foreground) !important;
  font-weight: 650 !important;
}

.settings-container input:not([type='checkbox']):not([type='radio']):not([type='file']),
.settings-container select,
.settings-container textarea {
  border-color: var(--input);
  background-color: var(--card);
  color: var(--foreground);
}

.settings-container input::placeholder,
.settings-container textarea::placeholder,
.settings-container .help-text {
  color: var(--muted-foreground);
}

.settings-container input[type='checkbox'],
.settings-container input[type='radio'] {
  accent-color: var(--foreground);
}

.settings-container .alert,
.settings-container [id$='-status-banner'] {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground) !important;
  box-shadow: var(--shadow-sm);
}

.settings-container .alert-info {
  border-left: 4px solid var(--info-color) !important;
  background: color-mix(in srgb, var(--info-color) 12%, var(--card)) !important;
}

.settings-container [id$='-status-banner'][data-state='info'] {
  border-left: 4px solid var(--info-color) !important;
  background: color-mix(in srgb, var(--info-color) 10%, var(--card)) !important;
}

.settings-container [id$='-status-banner'][data-state='success'] {
  border-left: 4px solid var(--success-color) !important;
  background: color-mix(in srgb, var(--success-color) 10%, var(--card)) !important;
}

.settings-container [id$='-status-banner'][data-state='warning'] {
  border-left: 4px solid var(--warning-color) !important;
  background: color-mix(in srgb, var(--warning-color) 11%, var(--card)) !important;
}

.settings-container [id$='-status-banner'][data-state='error'] {
  border-left: 4px solid var(--destructive) !important;
  background: color-mix(in srgb, var(--destructive) 10%, var(--card)) !important;
}

.settings-container [id$='-status-banner'] span,
.settings-container [id$='-status-banner'] strong {
  color: inherit !important;
}

/* Global notifications are neutral surfaces with a semantic accent. This
   avoids white-on-yellow/green contrast failures and supports either theme. */
.notification-region {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100050;
  display: grid;
  width: min(24rem, calc(100vw - 2rem));
  gap: 0.5rem;
  pointer-events: none;
}

.notification {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-height: 2.75rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--info-color);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--info-color) 8%, var(--card));
  color: var(--foreground);
  box-shadow: var(--shadow-xl);
  font-size: var(--text-sm);
  line-height: 1.45;
  pointer-events: auto;
  animation: slideIn 0.2s ease-out;
}

.notification::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.3rem;
  flex: 0 0 auto;
  border-radius: var(--radius-full);
  background: var(--info-color);
}

.notification.success {
  border-left-color: var(--success-color);
  background: color-mix(in srgb, var(--success-color) 9%, var(--card));
}
.notification.success::before { background: var(--success-color); }
.notification.warning {
  border-left-color: var(--warning-color);
  background: color-mix(in srgb, var(--warning-color) 10%, var(--card));
}
.notification.warning::before { background: var(--warning-color); }
.notification.error {
  border-left-color: var(--destructive);
  background: color-mix(in srgb, var(--destructive) 9%, var(--card));
}
.notification.error::before { background: var(--destructive); }

/* Smooth dark mode transitions for all surfaces */
html.dark *,
html.dark *::before,
html.dark *::after {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.6;
  color: var(--foreground);
  background-color: var(--background);
  font-size: 0.9375rem;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: color 0.3s ease, background-color 0.3s ease;
}

[hidden] {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 var(--hermes-page-gutter);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

main.container {
  padding: 0;
  max-width: none;
  overflow: hidden;
}

/* The workspace scrolls its content panel, not the document behind it. */
body:has(> main > .dashboard) {
  height: 100dvh;
  overflow: hidden;
}

body:has(> main > .dashboard) > header {
  flex-shrink: 0;
}

/* Modern Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

h1 { font-size: 2.25rem; font-weight: 700; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* ── Global Form Fields — shadcn/ui style ─────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="search"],
input[type="url"],
input[type="datetime-local"],
textarea,
select,
.form-control {
  width: 100%;
  padding: var(--space-2) var(--space-3);        /* 8px 12px */
  min-height: var(--hermes-touch-target);
  font-family: inherit;
  font-size: var(--text-sm);                     /* 14px */
  line-height: 1.5;
  color: var(--foreground);
  background-color: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);               /* 8px */
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease,
              box-shadow 0.15s ease,
              background-color 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
}

/* Focus ring — brand-tinted */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus,
.form-control:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
  background-color: var(--card);
}

/* Placeholder styling */
input::placeholder,
textarea::placeholder,
.form-control::placeholder {
  color: var(--muted-foreground);
  opacity: 0.7;
}

/* Disabled / read-only state */
input:disabled,
textarea:disabled,
select:disabled,
.form-control:disabled,
input:read-only:not([type="checkbox"]):not([type="radio"]),
textarea:read-only {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: var(--muted);
}

/* Textarea — preserve resize handle */
textarea {
  resize: vertical;
  min-height: 72px;
}

/* Select — caret arrow */
select,
select.form-control {
  padding-right: var(--space-3);
  -webkit-appearance: auto;
  appearance: auto;
  background-image: none;
  cursor: pointer;
}

/* Auto-width selects (pagination, filters inline) keep natural width */
select.auto-w,
.pagination-settings select,
.filter-select {
  width: auto;
}

/* Form group — label + input pattern */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
  margin-bottom: var(--space-4);
}

/* Desktop release/update status */
.desktop-update-card {
  max-width: 760px;
}

.desktop-update-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--primary-color) 5%, var(--card));
}

.desktop-update-label,
.desktop-update-checked,
.desktop-update-note {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.desktop-update-label {
  display: block;
  margin-bottom: 0.25rem;
}

.desktop-update-badge {
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border-color);
  background: var(--background);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.desktop-update-badge[data-phase="ready"],
.desktop-update-badge[data-phase="up-to-date"] {
  color: #10b981;
  border-color: color-mix(in srgb, #10b981 45%, transparent);
}

.desktop-update-badge[data-phase="checking"],
.desktop-update-badge[data-phase="downloading"],
.desktop-update-badge[data-phase="blocked"] {
  color: #f59e0b;
  border-color: color-mix(in srgb, #f59e0b 45%, transparent);
}

.desktop-update-badge[data-phase="error"] {
  color: #ef4444;
  border-color: color-mix(in srgb, #ef4444 45%, transparent);
}

.desktop-update-message {
  margin: 1rem 0 0.35rem;
}

.desktop-update-checked,
.desktop-update-note {
  margin: 0.35rem 0 0;
}

.desktop-update-blockers {
  margin-top: 0.8rem;
  padding: 0.7rem 0.85rem;
  border-left: 3px solid #f59e0b;
  border-radius: 0.35rem;
  background: color-mix(in srgb, #f59e0b 10%, transparent);
  color: var(--foreground);
  font-size: 0.86rem;
}

.desktop-update-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.form-group label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--foreground);
}

/* Application header; content headings must not create competing overlays. */
body > header {
  background-color: rgba(var(--card-rgb), 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  padding: var(--space-2) 0;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 300;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

header > .container {
  max-width: none;
  padding-right: 12px;
  padding-left: 12px;
}

.logo {
  font-size: var(--text-xl);
  font-weight: 700;
  gap: 0.65rem;
  letter-spacing: 0;
  color: var(--brand);
  display: flex;
  align-items: center;
}

.logo #header-logo-img {
  width: auto;
  min-width: 52px;
  max-width: 156px;
  height: 42px;
  object-fit: contain;
  border: 1px solid color-mix(in srgb, var(--foreground) 22%, var(--border));
  outline: 1px solid color-mix(in srgb, var(--background) 70%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
  padding: 4px 10px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.logo.has-logo {
  flex: 0 0 auto;
  line-height: 0;
}

.firm-brand-mark,
.firm-branding-preview-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.9rem;
  font-weight: 700;
}

.firm-brand-name {
  max-width: min(32vw, 320px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.firm-branding-editor {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.firm-branding-preview {
  display: grid;
  place-items: center;
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  overflow: hidden;
}

.firm-branding-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.firm-branding-preview-mark {
  width: 40px;
  height: 40px;
}

.firm-branding-controls {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.firm-branding-controls > span,
.firm-branding-controls small,
.firm-branding-readonly {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.firm-branding-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.firm-branding-readonly {
  margin: -0.5rem 0 1rem;
}

.firm-team-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.firm-team-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--surface-color);
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.firm-team-empty {
  border: 1px dashed var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
  background: var(--surface-color);
}

.firm-team-create h4 {
  margin: 0 0 0.35rem;
}

.firm-team-create p {
  margin: 0 0 1rem;
  color: var(--text-secondary);
}

.firm-team-create-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.firm-team-create-row input {
  max-width: 360px;
}

.firm-team-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 0.9rem;
}

.firm-team-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.firm-team-table th,
.firm-team-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
}

.firm-team-table th {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--background);
}

.firm-team-table tr:last-child td {
  border-bottom: 0;
}

.firm-member-cell {
  display: grid;
  gap: 0.2rem;
}

.firm-member-cell span,
.firm-team-muted,
.firm-invite-row span {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.firm-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.13);
  color: #475569;
  font-weight: 700;
  font-size: 0.74rem;
}

.firm-role-badge.admin {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.firm-team-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.firm-team-invites {
  margin-top: 1rem;
}

.firm-team-invites h4 {
  margin: 0 0 0.6rem;
}

.firm-invite-list {
  display: grid;
  gap: 0.55rem;
}

.firm-invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: var(--surface-color);
}

.firm-invite-row > div {
  display: grid;
  gap: 0.15rem;
}

.firm-permission-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
}

.firm-permission-modal {
  width: min(760px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 1.1rem;
  background: var(--card);
  color: var(--text-color);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.firm-permission-modal-header,
.firm-permission-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border-color);
}

.firm-permission-modal-header h3 {
  margin: 0;
}

.firm-permission-modal-header p {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.firm-permission-close {
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.3rem;
}

.firm-permission-modal-body {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.1rem;
}

.firm-permission-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: 0.8rem;
  background: var(--surface-color);
}

.firm-permission-mode-switch button {
  min-height: 2.35rem;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  cursor: pointer;
}

.firm-permission-mode-switch button.active {
  background: var(--card);
  color: var(--text-color);
  box-shadow: var(--shadow-sm);
}

.firm-permission-field {
  display: grid;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.86rem;
}

.firm-permission-section {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 0.9rem;
}

.firm-permission-section-title {
  display: grid;
  gap: 0.2rem;
}

.firm-permission-section-title span,
.firm-permission-admin-note {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.firm-permission-admin-note {
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.firm-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.55rem;
}

.firm-permission-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: 0.7rem;
  cursor: pointer;
}

.firm-permission-option input {
  width: auto;
}

.firm-permission-modal-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--border-color);
  border-bottom: 0;
}

.firm-logo-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(5px);
  animation: modal-fade-in 0.18s ease;
}

.firm-logo-editor-dialog {
  width: min(640px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.firm-logo-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.firm-logo-editor-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.firm-logo-editor-header p {
  margin: 0.3rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.82rem;
}

.firm-logo-editor-close {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.firm-logo-editor-close:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.firm-logo-editor-body {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem;
}

.firm-logo-crop-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 10 / 3;
  overflow: hidden;
  border-radius: 6px;
  background-color: #e5e7eb;
  background-image:
    linear-gradient(45deg, #d1d5db 25%, transparent 25%),
    linear-gradient(-45deg, #d1d5db 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d1d5db 75%),
    linear-gradient(-45deg, transparent 75%, #d1d5db 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.firm-logo-crop-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.firm-logo-crop-frame canvas.dragging {
  cursor: grabbing;
}

.firm-logo-crop-border {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45);
  border-radius: 6px;
}

.firm-logo-zoom-control {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 0.85rem;
  color: var(--foreground);
  font-size: 0.82rem;
  font-weight: 600;
}

.firm-logo-zoom-control input {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.firm-logo-center-button {
  min-height: 34px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  cursor: pointer;
}

.firm-logo-center-button:hover {
  background: var(--secondary);
}

.firm-logo-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.logo [hidden],
.firm-branding-editor [hidden],
.firm-branding-readonly[hidden] {
  display: none;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.workspace-header-start { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
.workspace-header-start .logo { min-width: 0; max-width: 240px; }
.workspace-header-start .firm-brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.workspace-page-title { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--muted-foreground); }
body > header .navbar { gap: 20px; min-height: 40px; }
body > header .nav-actions { flex-shrink: 0; }
#workspace-menu-toggle { display: inline-flex; flex-shrink: 0; width: 44px; height: 44px; touch-action: manipulation; }
html.workspace-native-titlebar { --workspace-titlebar-height: 48px; --workspace-titlebar-control: 36px; }
html.workspace-native-titlebar body > header { height: var(--workspace-titlebar-height); padding: 0; border-bottom: 0; background: var(--card); box-shadow: inset 0 -1px var(--border); backdrop-filter: none; -webkit-backdrop-filter: none; transition: none; }
html.workspace-native-titlebar body > header > .container { box-sizing: border-box; height: 100%; width: min(env(titlebar-area-width, calc(100% - 148px)), calc(100% - 148px)); max-width: none; margin-left: env(titlebar-area-x, 0px); margin-right: 0; padding-inline: 12px; }
html.workspace-native-titlebar body > header .navbar { height: 100%; min-height: 0; gap: 16px; -webkit-app-region: drag; app-region: drag; user-select: none; }
html.workspace-native-titlebar body > header button,
html.workspace-native-titlebar body > header a,
html.workspace-native-titlebar body > header .nav-actions { -webkit-app-region: no-drag; app-region: no-drag; }
html.workspace-native-titlebar .workspace-header-start { gap: 12px; }
html.workspace-native-titlebar #workspace-menu-toggle,
html.workspace-native-titlebar body > header .nav-text-btn { box-sizing: border-box; height: var(--workspace-titlebar-control); min-height: var(--workspace-titlebar-control); border-radius: 6px; }
html.workspace-native-titlebar #workspace-menu-toggle { width: var(--workspace-titlebar-control); padding: 0; }
html.workspace-native-titlebar .product-lockup { height: var(--workspace-titlebar-control); width: 120px; flex-basis: 120px; }
html.workspace-native-titlebar .logo #header-logo-img { box-sizing: border-box; height: var(--workspace-titlebar-control); min-width: 0; max-width: 140px; padding: 4px 8px; outline: none; box-shadow: none; }
html.workspace-native-titlebar .firm-brand-mark { width: var(--workspace-titlebar-control); height: var(--workspace-titlebar-control); border-radius: 6px; }
html.workspace-native-titlebar body > header .nav-actions { padding-left: 12px; border-left: 1px solid var(--border); }
html.workspace-native-titlebar .cd-onlyoffice-overlay { top: 48px; }
html.workspace-native-titlebar .notification-region { top: 64px; }
html.workspace-native-titlebar .cd-modal-overlay { top: 48px; }
@media (min-width: 769px) {
    body.workspace-navigation-collapsed .dashboard-sidebar { display: none; }
}
@media (max-width: 640px) {
    body > header .navbar { gap: 10px; }
    .workspace-header-start { flex: 0 1 164px; overflow: hidden; gap: 8px; }
    .workspace-header-start .logo { max-width: 100%; flex: 1; }
    .workspace-header-start .product-lockup { max-width: 100%; flex-shrink: 1; }
    .workspace-header-start .firm-brand-name { font-size: 14px; }
    .workspace-header-start .logo #header-logo-img { min-width: 0; max-width: 128px; height: 36px; }
    .workspace-page-title { display: block; }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s ease;
}

#notif-bell-btn {
  position: relative;
}

.nav-icon-btn:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.nav-icon-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Text buttons with icons used by compact header actions. */
.nav-text-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 36px;
  padding: 0 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--brand);
  background: transparent;
  color: var(--brand);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.nav-text-btn:hover {
  background: var(--brand);
  color: var(--brand-foreground);
}
.nav-text-btn svg {
  flex-shrink: 0;
}
/* Reuse loading states */
.nav-text-btn.nav-icon-btn--loading svg {
  animation: nav-btn-spin 0.8s linear infinite;
}
.nav-text-btn.nav-icon-btn--loading {
  opacity: 0.6;
  pointer-events: none;
}

body.hermes-no-court-automation #eproc-check-btn {
  display: none !important;
}

body.hermes-access-pending .sidebar-menu li,
body.hermes-access-pending #eproc-check-btn,
body.hermes-access-pending #settings-btn,
body.hermes-access-pending .agent-fab,
body.hermes-access-pending .agent-panel,
body.hermes-access-pending .dashboard-main {
  display: none !important;
}

body.hermes-no-chat .agent-fab,
body.hermes-no-chat .agent-panel {
  display: none !important;
}

/* Loading spinner on nav button (eProc check) */
@keyframes nav-btn-spin {
  to { transform: rotate(360deg); }
}
.nav-icon-btn--loading svg {
  animation: nav-btn-spin 0.8s linear infinite;
}
.nav-icon-btn--loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Account dropdown */
.nav-dropdown-wrapper {
  position: relative;
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  overflow: hidden;
  animation: dropdownFadeIn 0.12s ease;
}

.nav-dropdown.open {
  display: block;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.nav-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
}

.nav-dropdown-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.nav-dropdown-user {
  flex: 1;
  min-width: 0;
}

.nav-dropdown-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-dropdown-email {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-dropdown-divider {
  height: 1px;
  background: var(--border);
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.1s ease;
  font-family: inherit;
}

.nav-dropdown-item:hover {
  background: var(--secondary);
  color: var(--text-primary);
}

.nav-dropdown-danger {
  color: var(--destructive);
}

.nav-dropdown-danger:hover {
  background: rgba(239,68,68,.08);
  color: var(--destructive);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.5rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.nav-links a:hover {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.nav-links a#logout-btn {
    color: var(--danger-color);
}

.nav-links a#logout-btn:hover {
    background-color: var(--destructive-foreground);
    color: var(--danger-color);
}

.nav-links svg {
  opacity: 0.8;
}

/* Asymmetrical Dashboard Layout */
.dashboard {
  display: flex;
  flex: 1;
  margin: 0;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.dashboard-sidebar {
  background: var(--card);
  border-radius: 0;
  border-right: 1px solid var(--border);
  box-shadow: none;
  padding: var(--space-3);
  width: 216px;
  min-width: 216px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dashboard-sidebar h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.dashboard-main {
  flex: 1;
  --workspace-page-block: 24px;
  --workspace-page-inline: 32px;
  padding: var(--workspace-page-block) var(--workspace-page-inline);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  min-width: 0;
  background: var(--background);
  scrollbar-width: thin;
  scrollbar-color: var(--muted-foreground) var(--background);
  overscroll-behavior: contain;
}

.dashboard-main.chat-active {
  padding: 0;
  overflow: hidden;
}

.dashboard-main.criar-doc-active {
  padding: 0;
  overflow: hidden;
  gap: 0;
}

.dashboard-main.np-active {
  padding: 0;
  overflow: hidden;
  gap: 0;
}

/* Grouped workspace navigation */
.dashboard-sidebar { display: flex; flex-direction: column; overflow: visible; min-height: 0; }
.sidebar-groups { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--muted-foreground) var(--card); overscroll-behavior: contain; }
.sidebar-group + .sidebar-group { margin-top: 20px; }
.sidebar-group-title { font-size: 12px; font-weight: 600; color: var(--muted-foreground); margin: 4px 12px 8px; }
.sidebar-group:not(:has(li:not([hidden]) > a:not([hidden]):not([aria-hidden="true"]))) { display: none; }
.sidebar-footer { flex-shrink: 0; position: relative; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); background: var(--card); }
.sidebar-footer .nav-icon-btn { display: flex; width: 100%; height: auto; min-height: 44px; justify-content: flex-start; gap: 12px; padding: 10px 12px; border: 0; border-radius: 6px; background: transparent; font-size: 14px; text-align: left; }
.sidebar-footer .nav-icon-btn:hover { background: var(--workspace-accent-soft); color: var(--workspace-accent); }
.sidebar-footer .nav-icon-btn[hidden] { display: none !important; }
.sidebar-footer .nav-icon-btn svg { flex-shrink: 0; }
.theme-switch-track { width: 30px; height: 18px; flex: 0 0 30px; margin-left: auto; border-radius: 10px; background: var(--muted-foreground); padding: 3px; }
.theme-switch-track::before { content: ''; display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--card); }
.theme-switch-track { transition: background-color 150ms ease; }
.theme-switch-track::before { transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1); }
#workspace-menu-toggle, #workspace-menu-close { transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease; }
#workspace-menu-toggle svg, #workspace-menu-close svg, .sidebar-menu a svg, .sidebar-footer .nav-icon-btn > svg { transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1); }
#workspace-menu-toggle[aria-expanded="false"] svg { transform: rotate(180deg); }
#workspace-menu-toggle[aria-expanded="false"]:active svg { transform: rotate(180deg) scale(.9); }
#workspace-menu-toggle:active svg, #workspace-menu-close:active svg { transform: scale(.9); }
.sidebar-menu a:active svg, .sidebar-footer .nav-icon-btn:active > svg { transform: scale(.92); }
.sidebar-menu a, .sidebar-footer .nav-icon-btn { transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease; }
#eproc-check-btn { position: relative; transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease; }
#eproc-check-btn.nav-icon-btn--loading { opacity: 1; background: var(--workspace-accent-soft); }
#eproc-check-btn.nav-icon-btn--loading > svg { animation: nav-btn-spin 1s linear infinite; transform-origin: center; }
#eproc-check-btn[data-check-state="success"] { color: var(--success-color); border-color: var(--success-color); }
#eproc-check-btn[data-check-state="attention"] { color: var(--warning-color); border-color: var(--warning-color); }
#eproc-check-btn[data-check-state="error"] { color: var(--destructive); border-color: var(--destructive); }
:where(html[data-motion-reduced="true"]) {
    #eproc-check-btn.nav-icon-btn--loading > svg { animation: none; }
    .theme-switch-track, .theme-switch-track::before, #workspace-menu-toggle svg, #workspace-menu-close svg,
    .sidebar-menu a svg, .sidebar-footer .nav-icon-btn > svg { transition: none; }
}
#theme-toggle[aria-checked="true"] .theme-switch-track { background: var(--workspace-accent); }
#theme-toggle[aria-checked="true"] .theme-switch-track::before { transform: translateX(12px); }
.sidebar-footer .nav-dropdown { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; width: 100%; max-height: calc(100dvh - 140px); overflow-y: auto; }
.sidebar-footer .nav-dropdown-name, .sidebar-footer .nav-dropdown-email { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
.sidebar-footer .nav-dropdown-header { padding: 12px; align-items: flex-start; }
.sidebar-drawer-heading { display: none; align-items: center; justify-content: space-between; flex-shrink: 0; margin-bottom: 12px; }
.sidebar-drawer-heading h2 { font-size: 14px; margin: 0 12px; }
#workspace-menu-close { width: 44px; height: 44px; flex-shrink: 0; touch-action: manipulation; }
#workspace-menu-close .sidebar-dismiss-icon, #workspace-navigation-overlay { display: none; }

/* Modern Sidebar Menu */
.sidebar-menu {
  list-style: none;
}

.sidebar-menu li {
  margin-bottom: 0.25rem;
}

.sidebar-menu li[hidden],
.sidebar-menu a[hidden],
.sidebar-menu a[aria-hidden="true"] {
  display: none !important;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--muted-foreground);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background-color 0.15s ease, color 0.15s ease;
  font-weight: 500;
  font-size: 14px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-menu a span {
  width: auto;
  opacity: 1;
  white-space: normal;
}

.sidebar-menu a:hover {
  background-color: var(--brand-lighter);
  color: var(--brand);
  transform: translateX(0);
}

.sidebar-menu a:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.sidebar-menu a.active {
  background: var(--workspace-accent-soft);
  color: var(--workspace-accent);
  box-shadow: none;
}

.sidebar-menu svg {
  width: 18px;
  height: 18px;
  min-width: 18px;
  opacity: 0.9;
}

/* Modern Card Design */
.card {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-8);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.card-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-body {
  padding: 2rem;
}

/* Modern Dashboard Overview - Asymmetrical Grid */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.dashboard-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.dashboard-overview {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  margin-bottom: 0;
  transition: opacity 0.15s ease;
}

.dashboard-overview.collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-20px);
  margin-bottom: 0;
  overflow: hidden;
}

.overview-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  min-height: auto;
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.overview-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--info-color));
}

.overview-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Billing Stats Container */
.billing-stats-container {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.billing-stat-card {
  flex: 1;
  min-width: 200px;
  text-align: center;
  padding: var(--space-6);
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.billing-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--info-color));
}

.billing-stat-card:hover {
  background: var(--background);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
  line-height: 1;
  display: block;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  line-height: 1.2;
}

#billing-content {
  --finance-compact-gap: 0.7rem;
}

.finance-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: var(--finance-compact-gap);
}

.finance-page-head h1 {
  margin: 0;
  color: var(--text-secondary, #64748b);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.finance-page-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.finance-period-select {
  min-width: 145px;
}

.finance-custom-period {
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: -0.25rem 0 var(--finance-compact-gap);
}

.finance-custom-period input {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.55rem;
  background: var(--background);
  color: var(--text-primary);
}

.finance-overview-panel {
  display: block;
}

.finance-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--finance-compact-gap);
  margin-bottom: var(--finance-compact-gap);
}

.finance-kpi-card {
  min-width: 0;
  padding: 0.85rem 1rem;
  text-align: left;
}

.finance-kpi-card .stat-number {
  font-size: clamp(1.05rem, 0.85rem + 0.55vw, 1.35rem);
}

.finance-kpi-card .stat-label {
  font-size: 0.68rem;
}

.finance-kpi-sub {
  margin-top: 0.2rem;
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.2;
}

.finance-kpi-warning::before {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.finance-chart-card {
  display: grid;
  grid-template-columns: minmax(170px, 0.24fr) 1fr;
  align-items: stretch;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  margin-bottom: var(--finance-compact-gap);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.finance-chart-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
}

.finance-chart-head strong {
  color: var(--text-primary);
  font-size: 0.9rem;
}

.finance-chart-head span {
  color: var(--text-secondary);
  font-size: 0.74rem;
}

.finance-overview-chart {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  min-height: 72px;
}

.finance-chart-bucket {
  flex: 1;
  min-width: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
}

.finance-chart-bars {
  height: 54px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}

.finance-bar {
  width: min(8px, 42%);
  min-height: 3px;
  border-radius: 999px 999px 0 0;
}

.finance-bar.receita { background: #22c55e; }
.finance-bar.despesa { background: #ef4444; }

.finance-chart-bucket small {
  color: var(--text-secondary);
  font-size: 0.62rem;
}

.finance-tab-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 var(--finance-compact-gap);
}

.finance-tabs {
  margin: 0;
}

.finance-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.finance-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.finance-toolbar input,
.finance-toolbar select,
.finance-toolbar button {
  height: 36px;
}

.finance-toolbar input:first-child {
  flex: 1 1 320px;
  min-width: 220px;
}

.finance-toolbar .filter-select,
.finance-toolbar input:not(:first-child) {
  flex: 0 1 155px;
  min-width: 125px;
}

.finance-toolbar button {
  flex: 0 0 38px;
}

.finance-table-wrap {
  max-height: calc(100vh - 405px);
  min-height: min(430px, calc(100vh - 420px));
  overflow: auto;
}

.finance-table-wrap .table th,
.finance-table-wrap .table td {
  padding-top: 0.52rem;
  padding-bottom: 0.52rem;
}

.finance-secondary-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.finance-secondary-kpis > div,
.finance-summary-explain > div {
  padding: 0.72rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.finance-secondary-kpis strong,
.finance-secondary-kpis span,
.finance-secondary-kpis small,
.finance-summary-explain span {
  display: block;
}

.finance-secondary-kpis strong {
  color: var(--text-primary);
  font-size: 1rem;
}

.finance-secondary-kpis span {
  margin-top: 0.15rem;
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 700;
}

.finance-secondary-kpis small,
.finance-summary-explain span {
  margin-top: 0.1rem;
  color: var(--text-secondary);
  font-size: 0.68rem;
}

.finance-summary-explain {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.finance-summary-explain h4 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.finance-attachments-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 48px));
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
}

.finance-attachments-head,
.finance-attachments-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.finance-attachments-actions {
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.finance-attachments-head h3 {
  margin: 0;
  font-size: 1rem;
}

.finance-attachments-list {
  overflow-y: auto;
  padding: 0.75rem 1rem;
}

.finance-attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.finance-import-job-list,
.finance-import-review-list {
  display: grid;
  gap: 0.7rem;
}

.finance-import-instructions {
  width: 100%;
  min-height: 72px;
  margin: 0 0 0.8rem;
  padding: 0.65rem 0.75rem;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--text-primary);
}

.finance-import-job-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--primary-color) 5%, var(--card));
}

.finance-import-job-row strong,
.finance-import-job-row small {
  display: block;
}

.finance-import-job-row small {
  margin-top: 0.15rem;
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.finance-import-review-section {
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.finance-import-floating-hint {
  position: fixed;
  right: 86px;
  bottom: 18px;
  z-index: 9998;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.35rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--primary-color) 35%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary-color) 12%, var(--card));
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.status-dot {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  margin-top: 0.25rem;
  border-radius: 999px;
}

.status-dot.success { background: #22c55e; }
.status-dot.error { background: #ef4444; }

@media (max-width: 1366px), (max-height: 760px) {
  .finance-page-head {
    margin-bottom: 0.45rem;
  }

  .finance-kpi-grid {
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .finance-kpi-card {
    padding: 0.68rem 0.8rem;
  }

  .finance-chart-card {
    grid-template-columns: minmax(140px, 0.2fr) 1fr;
    padding: 0.58rem 0.75rem;
    margin-bottom: 0.5rem;
  }

  .finance-overview-chart {
    min-height: 56px;
  }

  .finance-chart-bars {
    height: 40px;
  }

  .finance-tab-action-row {
    margin-bottom: 0.5rem;
  }

  .finance-table-wrap {
    max-height: calc(100vh - 390px);
  }

  .workspace-heading p {
    display: none;
  }

  .workspace-type-option {
    flex-basis: 7.7rem;
    min-height: 34px;
    padding: 0.3rem 0.48rem;
  }

  .workspace-type-option small {
    display: none;
  }
}

@media (max-width: 1100px) {
  .finance-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-chart-card,
  .finance-summary-explain {
    grid-template-columns: 1fr;
  }

  .finance-secondary-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-toolbar input:first-child {
    flex-basis: 100%;
  }
}

@media (max-width: 760px) {
  .finance-page-head,
  .finance-tab-action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .finance-actions {
    justify-content: stretch;
  }

  .finance-actions .btn {
    flex: 1 1 140px;
  }

  .finance-toolbar button {
    width: 100%;
    flex-basis: 100%;
  }

  .finance-toolbar .filter-select,
  .finance-toolbar input:not(:first-child) {
    flex-basis: 100%;
  }

  .finance-secondary-kpis {
    grid-template-columns: 1fr;
  }
}

/* Responsive Billing Stats */
@media (max-width: 1024px) {
  .billing-stats-container {
    gap: 1rem;
  }

  .billing-stat-card {
    min-width: 180px;
    padding: 1.25rem;
  }
}

@media (max-width: 768px) {
  .billing-stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .billing-stat-card {
    min-width: unset;
    padding: 1rem;
  }

  .stat-number {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .billing-stats-container {
    grid-template-columns: 1fr;
  }

  .billing-stat-card {
    padding: 1rem;
  }

  .stat-number {
    font-size: 1.125rem;
  }

  .stat-label {
    font-size: 0.6875rem;
  }
}

@media (max-width: 1024px) {
  .finance-kpi-card {
    min-width: 0;
    padding: 0.72rem 0.85rem;
  }
}

@media (max-width: 768px) {
  .finance-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-kpi-card .stat-number {
    font-size: 1.08rem;
  }
}

.overview-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.overview-title svg {
  color: var(--brand);
  opacity: 0.8;
}

/* Modern Button Design */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  min-height: var(--hermes-touch-target);
  border-radius: var(--radius-lg);
  font-weight: 500;
  font-size: var(--text-sm);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--brand);
  color: var(--brand-foreground);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--brand);
}

.btn-primary:hover {
  background: var(--brand-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-color);
  color: var(--text-secondary);
  border: 1px solid var(--border-accent);
}

.btn-secondary:hover {
  background: var(--border-color);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* Modern Table Design */
.table-responsive {
  overflow-x: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-elevated);
}

.table th {
  padding: 1rem 1.5rem;
  text-align: left;
  background: var(--surface-color);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.table tbody tr {
  transition: all 0.2s ease;
}

.table tbody tr.table-row-clickable {
  cursor: pointer;
}

.table tbody tr.table-row-clickable:hover {
  background-color: rgba(113, 128, 150, 0.08);
}

.table tbody tr:hover {
  background-color: var(--surface-color);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Modern Status Badges */
.status {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-active {
  background-color: rgba(56, 161, 105, 0.1);
  color: var(--success-color);
  border: 1px solid rgba(56, 161, 105, 0.2);
}

.status-pending {
  background-color: rgba(214, 158, 46, 0.1);
  color: var(--warning-color);
  border: 1px solid rgba(214, 158, 46, 0.2);
}

.status-closed, .status-inactive {
  background-color: rgba(229, 62, 62, 0.1);
  color: var(--danger-color);
  border: 1px solid rgba(229, 62, 62, 0.2);
}

/* Modern Search & Filters */
.search-bar {
  display: flex;
  margin-bottom: 1.5rem;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.search-bar input {
  flex: 1;
  padding: 0.875rem 1.25rem;
  border-right: none;
  border-radius: 0;                 /* flush with adjacent button */
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

.search-bar input::placeholder {
  color: var(--text-tertiary);
}

.search-bar button {
  padding: 0.875rem 1.25rem;
  background: var(--brand);
  color: var(--brand-foreground);
  border: 1px solid var(--brand);
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-bar button:hover {
  background: var(--brand-light);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-select {
  /* inherits global select styling — just keep layout specifics */
  padding: 0.75rem 1rem;
  min-width: 160px;
  width: auto;
}

/* Modern Tabs */
.tabs {
  display: flex;
  list-style: none;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
}

.tabs a {
  display: block;
  padding: 1rem 1.5rem;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tabs a.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: linear-gradient(180deg, transparent, rgba(45, 55, 72, 0.05));
}

.tabs a:hover {
  color: var(--text-primary);
}

/* Modern Pagination */
.pagination {
  display: flex;
  justify-content: center;
  list-style: none;
  margin-top: 2rem;
  gap: 0.5rem;
}

.pagination a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: var(--text-secondary);
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  font-weight: 500;
}

.pagination a:hover {
  background: var(--surface-color);
  color: var(--text-primary);
}

.pagination a.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Dashboard Enhancements */
#toggle-dashboard {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

/* Priority Deadlines Styling */
.deadline-item {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0.75rem;
  background: var(--surface-color);
  border-left: 4px solid var(--accent-color);
  transition: all 0.2s ease;
}

.deadline-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.deadline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.deadline-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.deadline-days {
  background: var(--accent-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.deadline-case {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.deadline-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* Flow Statistics */
.flow-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.flow-stat {
  text-align: center;
  padding: 1.25rem;
  background: var(--surface-color);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
}

.flow-stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
  line-height: 1;
}

.flow-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* Attorney Workload */
.attorney-workloads {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.attorney-workload {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--surface-color);
  border-radius: 0.5rem;
}

.attorney-info {
  display: flex;
  flex-direction: column;
}

.attorney-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.attorney-cases {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.workload-bar {
  height: 8px;
  background: var(--border-color);
  border-radius: 1rem;
  overflow: hidden;
}

.workload-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), var(--info-color));
  border-radius: inherit;
}

.utilization {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 40px;
  text-align: right;
}

/* Money Flow Enhancements */
.money-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.money-stat {
  text-align: center;
  padding: 1.25rem;
  background: var(--surface-color);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
}

.money-stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.money-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-bar {
  height: 6px;
  background: var(--border-color);
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--success-color);
  border-radius: inherit;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* Recent Transactions */
.recent-transactions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.transaction-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: var(--surface-color);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.transaction-item:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.transaction-info {
  display: flex;
  flex-direction: column;
}

.transaction-client {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.transaction-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.transaction-amount {
  font-weight: 700;
  font-size: 0.875rem;
}

.transaction-amount.payment {
  color: var(--success-color);
}

.transaction-amount.expense {
  color: var(--danger-color);
}

.transaction-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-align: right;
}

/* Footer */
footer {
  background: var(--primary-color);
  color: rgba(255, 255, 255, 0.8);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
}

/* Responsive Design */
@media screen and (max-width: 1200px) {
  .dashboard {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .dashboard-sidebar {
    position: static;
  }

  .flow-stats, .money-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  header > .container {
    padding-right: 8px;
    padding-left: 8px;
  }

  .navbar {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .logo #header-logo-img {
    max-width: 132px;
    height: 38px;
  }

  .firm-logo-editor-overlay {
    padding: 12px;
  }

  .firm-logo-editor-header,
  .firm-logo-editor-body {
    padding: 1rem;
  }

  .firm-logo-editor-actions {
    padding: 0.85rem 1rem;
  }

  .nav-links {
    flex-wrap: wrap;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .flow-stats, .money-stats {
    grid-template-columns: 1fr;
  }

  .attorney-workload {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* Lazy Loading Styles */
img[data-src], [data-bg] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.loading, [data-bg].loading {
    opacity: 0.6;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

img.loaded, [data-bg].loaded {
    opacity: 1;
}

img.error {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* Content Lazy Loading */
[data-lazy-content] {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.content-loading {
    opacity: 0.8;
    position: relative;
}

.content-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
    z-index: 1;
}

.content-loaded {
    opacity: 1;
}

/* Shimmer animation for loading states */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Progressive enhancement for tables */
.table tbody tr {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Cards animation enhancement */
.overview-card, .card {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Performance optimization - reduce repaints */
.lazy-container {
    will-change: opacity, transform;
    backface-visibility: hidden;
    perspective: 1000;
}

/* Intersection observer fallback */
.no-js img[data-src] {
    opacity: 1;
}

/* Preload critical resources */
.critical-resource {
    display: none;
}

/* Calendar full-height no-scroll layout */
#calendar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Calendar topbar (compact header + filters + action) ─────────── */
.calendar-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 10px 0;
  flex-shrink: 0;
}

.calendar-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-topbar-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}

.cal-filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cal-filter-btn {
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-muted, #888);
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}

.cal-filter-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

#cfbtn-eventos.active {
  background: rgba(72, 187, 120, .15);
  color: #276749;
  border-color: rgba(72, 187, 120, .5);
}

#cfbtn-compromissos.active {
  background: rgba(245, 158, 11, .15);
  color: #92400e;
  border-color: rgba(245, 158, 11, .5);
}

.calendar-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.calendar-layout {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.calendar-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.calendar-main > .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.calendar-main > .card > .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

.calendar-main .calendar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.calendar-main .calendar-grid {
  flex: 1;
  min-height: 0;
}

.calendar-sidebar {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 128px);
  overflow: hidden;
  gap: 16px;
}

.calendar-sidebar > .card {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.calendar-sidebar > .card > .card-body,
#upcoming-compromissos-container {
  min-height: 0;
  overflow-y: auto;
}

/* Day events overlay - expands from clicked cell to fill calendar */
.day-events-overlay {
  position: absolute;
  z-index: 50;
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    left   0.32s cubic-bezier(0.4,0,0.2,1),
    top    0.32s cubic-bezier(0.4,0,0.2,1),
    width  0.32s cubic-bezier(0.4,0,0.2,1),
    height 0.32s cubic-bezier(0.4,0,0.2,1),
    opacity 0.28s ease,
    border-radius 0.32s ease;
}

.day-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--card);
  flex-shrink: 0;
}

.day-overlay-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--card-foreground);
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: center;
}

.day-overlay-nav-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.day-overlay-nav-btn:hover { background: var(--accent); }

.day-compact-nav {
  display: grid;
  grid-template-columns: repeat(7, minmax(42px, 1fr));
  gap: 6px;
  padding: 8px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.day-compact-item {
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 5px 3px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  text-transform: capitalize;
}

.day-compact-item span { font-size: .67rem; }
.day-compact-item strong { font-size: .85rem; color: var(--foreground); }
.day-compact-item:hover { background: var(--accent); }
.day-compact-item.is-selected {
  color: var(--primary-foreground);
  background: var(--primary);
  border-color: var(--primary);
}
.day-compact-item.is-selected strong { color: inherit; }

.day-overlay-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  margin-left: 12px;
}

.day-overlay-close:hover {
  color: var(--foreground);
  background: var(--accent);
}

.day-overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Day hover popup ──────────────────────────────────────────────── */
.day-hover-popup {
  position: absolute;
  z-index: 60;
  width: 240px;
  max-height: 280px;
  background: var(--surface-elevated, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  animation: dhp-appear .15s ease;
}

@keyframes dhp-appear {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dhp-header {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  flex-shrink: 0;
}

.dhp-body {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}

.dhp-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  border-left: 3px solid #10b981;
  margin: 2px 8px;
  border-radius: 0 5px 5px 0;
  background: var(--muted);
}

.dhp-compromisso {
  border-left-color: #f59e0b;
}

.dhp-time {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 38px;
}

.dhp-label {
  font-size: .8rem;
  color: var(--text-primary, #1e293b);
  line-height: 1.3;
  word-break: break-word;
}

/* ── Generic Modal (JS-created .modal-overlay) ───────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
  animation: modal-fade-in .18s ease;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-overlay .modal-content {
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-slide-in .2s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}

@keyframes modal-slide-in {
  from { opacity: 0; transform: translateY(-16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-overlay .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-overlay .modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-overlay .modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted-foreground);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.modal-overlay .modal-close:hover {
  background: var(--accent);
  color: var(--foreground);
}

.modal-overlay .modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-overlay .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ── Novo Compromisso Modal ───────────────────────────────────────── */
.comp-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: comp-overlay-in .18s ease;
}

@keyframes comp-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.comp-modal {
  background: var(--surface-elevated, #fff);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  animation: comp-modal-in .2s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}

@keyframes comp-modal-in {
  from { opacity: 0; transform: translateY(-16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.comp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.comp-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--card-foreground);
  margin: 0;
}

.comp-modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.comp-modal-close:hover {
  color: var(--foreground);
  background: var(--accent);
}

.comp-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.comp-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
}

.comp-row {
  display: flex;
  gap: 14px;
}

.comp-row .comp-field {
  flex: 1;
}

.comp-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* comp-input inherits global form field style; just add specifics */
.comp-input {
  /* sizing override */
  padding: 9px 12px;
  font-size: var(--text-sm);
}

.comp-input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

.comp-textarea {
  /* inherits global textarea styles */
  font-family: inherit;
}

.comp-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

/* Convert Lead modal — mode toggle & client list */
.convert-mode-btn.active {
  background: var(--brand);
  color: var(--brand-foreground);
  border-color: var(--brand);
}
.convert-client-option:hover {
  background: var(--accent);
}

/* ── Global loading states ────────────────────────────────────────── */

/* Button inline spinner */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: _btn-spin .65s linear infinite;
  vertical-align: middle;
}

/* For outline/secondary buttons — dark spinner */
.btn-secondary .btn-spinner,
.btn-outline .btn-spinner {
  border-color: rgba(0,0,0,.15);
  border-top-color: var(--text-primary, #1e293b);
}

@keyframes _btn-spin {
  to { transform: rotate(360deg); }
}

/* Disabled state */
button:disabled {
  opacity: .65;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* Item-level overlay (document row, compromisso card, table row) */
.item-load-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
  backdrop-filter: blur(1px);
}

.item-load-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color, #e2e8f0);
  border-top-color: var(--primary-color, #2d3748);
  border-radius: 50%;
  animation: _btn-spin .7s linear infinite;
}

/* Calendar section loading overlay */
.cal-load-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(255,255,255,.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: inherit;
  backdrop-filter: blur(2px);
}

.cal-load-spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color, #e2e8f0);
  border-top-color: var(--primary-color, #2d3748);
  border-radius: 50%;
  animation: _btn-spin .8s linear infinite;
}

.cal-load-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.calendar-sidebar .mt-4 {
  margin-top: 0 !important;
}

@media (max-width: 1000px) {
  .calendar-layout {
    flex-direction: column;
  }
  .calendar-sidebar {
    width: 100%;
    max-height: 400px;
  }
}

/* Enhanced Calendar Styles */
.calendar-container {
    background: var(--surface-elevated);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.calendar-controls h4 {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 150px;
    text-align: center;
}

.calendar-controls .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: 8px;
}

/* Calendar Header (Days of Week) */
.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: linear-gradient(135deg, var(--brand), var(--muted-foreground));
    color: var(--brand-foreground);
    margin: 0;
}

.calendar-header > div {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(5, 1fr);
    background: var(--surface-elevated);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Calendar Day Cells */
.calendar-day {
    min-height: 0;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    background: var(--surface-elevated);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.calendar-day:hover {
    background: rgba(49, 130, 206, 0.08);
    border-color: var(--info-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Day Number Styling */
.calendar-day .day-number {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    z-index: 2;
}

/* Different Month States */
.calendar-day.current-month {
    color: var(--text-primary);
    background: var(--surface-elevated);
}

.calendar-day.other-month {
    color: var(--muted-foreground);
    background: var(--muted);
}

.calendar-day.other-month:hover {
    background: var(--accent);
}

/* Today Highlighting */
.calendar-day.today {
    background: linear-gradient(135deg, var(--info-color), #2563eb);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(49, 130, 206, 0.3);
}

.calendar-day.today:hover {
    background: linear-gradient(135deg, #1e40af, #1d4ed8);
}

/* Selected Day */
.calendar-day.selected {
    background: linear-gradient(135deg, var(--brand), var(--muted-foreground));
    color: var(--brand-foreground);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.2);
}

/* Event Indicators */
.calendar-day.has-events::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    border: 2px solid var(--card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 3;
}

.calendar-day.has-multiple-events::before {
    background: var(--warning-color);
}

.calendar-day.has-important-events::before {
    background: var(--danger-color);
    animation: pulse-event 2s infinite;
}

@keyframes pulse-event {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Event Preview in Calendar Cell */
.calendar-day .event-preview {
    font-size: 10px;
    color: var(--secondary-foreground);
    background: var(--secondary);
    padding: 2px 4px;
    border-radius: 4px;
    margin-top: 2px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Product artwork is scoped; office branding and theme tokens stay unchanged. */
.product-lockup { display: inline-flex; width: 136px; height: 40px; flex: 0 0 136px; }
.product-lockup img { width: 100%; height: 100%; object-fit: contain; }
.product-dark, html.dark .product-light { display: none; }
html.dark .product-dark { display: block; }
#firm-brand[data-product-brand="false"] .product-lockup { display: none; }
#firm-brand [hidden] { display: none; }

.hermes-ui-icon { display: inline-block; width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
.document-viewer-dialog .modal-content { max-width: 1100px; height: min(860px, calc(100dvh - 48px)); }
.document-viewer-dialog .modal-header h3 { font-size: 16px; margin: 0; overflow-wrap: anywhere; }
.document-viewer-close { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid var(--border); border-radius: 6px; color: var(--foreground); background: var(--card); cursor: pointer; }
.document-viewer-body { display: flex; flex: 1; min-height: 0; }
.document-viewer-body iframe { width: 100%; height: 100%; border: 0; background: var(--card); }
.document-viewer-body p { padding: 24px; }
#event-save-button[hidden] { display: none !important; }
.event-readonly-details { margin: 0 0 20px; display: grid; gap: 16px; }
.event-readonly-details dt { font-size: 12px; color: var(--muted-foreground); margin-bottom: 4px; }
.event-readonly-details dd { margin: 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }

#eproc-check-btn { width: 36px; height: 36px; overflow: hidden; padding: 8px; gap: 8px; justify-content: flex-start; transition: width 160ms ease; }
#eproc-check-btn > svg { flex: 0 0 16px; }
#eproc-check-btn > .nav-command-label { opacity: 0; white-space: nowrap; transition: opacity 120ms ease; }
@media (min-width: 769px) {
    #eproc-check-btn:hover, #eproc-check-btn:focus-visible { width: 210px; }
    #eproc-check-btn:hover > .nav-command-label, #eproc-check-btn:focus-visible > .nav-command-label { opacity: 1; }
}
@media (max-width: 640px) {
    .product-lockup { width: 110px; flex-basis: 110px; height: 34px; }
}
:where(html[data-motion-reduced="true"]) { #eproc-check-btn, #eproc-check-btn > .nav-command-label { transition: none; } }

#settings-container { max-width: 1160px; width: 100%; margin-inline: auto; }
.motion-preference-field { display: grid; gap: 8px; max-width: 360px; margin-bottom: 20px; }
.motion-preference-field label { font-size: 14px; font-weight: 500; }
.motion-preference-field select { width: 100%; min-height: 40px; }
.court-setup-preference { display: flex; align-items: flex-start; gap: 10px; padding-block: 12px; margin-bottom: 16px; font-size: 14px; line-height: 1.5; }
.court-setup-preference input { flex: 0 0 auto; margin-top: 4px; }
#settings-container .settings-header { margin-bottom: 20px !important; }
#settings-container .settings-header h2 { font-size: 26px; }
#settings-container .settings-tabs { gap: 4px !important; margin-bottom: 24px !important; border-bottom: 1px solid var(--border) !important; }
#settings-container .settings-tab-button { min-height: 40px; padding: 8px 12px !important; font-size: 13px; border-radius: 0; transition: color 120ms ease, background 120ms ease !important; }
#settings-container .settings-panel .card { background: transparent; border: 0; border-radius: 0; box-shadow: none; }
#settings-container .settings-panel .card-header { background: transparent; padding: 0 0 12px; border-bottom: 1px solid var(--border); }
#settings-container .settings-panel .card-title { font-size: 18px; }
#settings-container .settings-panel .card-body { padding: 20px 0; }
#settings-container .form-group { max-width: 720px; }
#settings-container .alert, #settings-container .settings-status-banner { height: auto; min-height: 0; padding: 12px !important; border-left-width: 1px !important; box-shadow: none; font-size: 13px; line-height: 1.5; }
#settings-container :is(.alert, .settings-status-banner, button) svg { width: 16px; height: 16px; min-width: 16px; max-width: 16px; flex-shrink: 0; vertical-align: -3px; }
#settings-container .form-group label { font-size: 13px; }
#settings-container button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.calendar-day.today .event-preview,
.calendar-day.selected .event-preview {
    background: var(--card);
    color: var(--card-foreground);
}

/* Event Styles */
.day-events {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--card-foreground);
    background: var(--card);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.event-item:hover {
    background: var(--accent);
    border-color: var(--ring);
    transform: translateX(2px);
}

.event-time {
    font-weight: 600;
    color: var(--foreground);
    font-size: 0.875rem;
    min-width: 80px;
}

.event-details {
    flex: 1;
}

.event-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.event-client {
    font-size: 0.875rem;
    color: var(--text-secondary, #64748b);
}

.event-type-badge {
    padding: 0.25rem 0.75rem;
    max-width: 220px;
    background: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.event-hearing { border-left: 4px solid #ef4444; }
.event-meeting { border-left: 4px solid #3b82f6; }
.event-deposition { border-left: 4px solid #f59e0b; }
.event-deadline { border-left: 4px solid #dc2626; }
.event-consultation { border-left: 4px solid #10b981; }
.event-other { border-left: 4px solid #6b7280; }

.no-events {
    text-align: center;
    color: var(--text-secondary, #64748b);
    font-style: italic;
    padding: 2rem;
}

/* ── Compromisso calendar indicators ────────────────────────────────── */
.calendar-day.has-compromissos .compromisso-dot {
    display: inline-block;
    position: absolute;
    bottom: 5px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: #f59e0b;            /* amber — distinct from evento green */
    border-radius: 50%;
    border: 2px solid var(--card);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    z-index: 3;
}

.calendar-day .event-preview.compromisso-preview {
    background: rgba(245, 158, 11, .15);
    color: var(--warning-color);
}

/* ── Compromisso list items ─────────────────────────────────────────── */
.event-item.event-compromisso {
    border-left: 4px solid #f59e0b;
    background: rgba(245, 158, 11, .05);
}
.event-item.event-compromisso.compromisso-done {
    border-left-color: #10b981;
    opacity: .7;
}
.event-item.event-compromisso.compromisso-cancelled {
    border-left-color: #94a3b8;
    opacity: .55;
    text-decoration: line-through;
}

.badge-compromisso {
    background: #f59e0b !important;
    color: #fff !important;
}

/* ── Upcoming compromissos panel ────────────────────────────────────── */
.compromisso-item {
    padding: .75rem 1rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-left: 4px solid #f59e0b;
    border-radius: .5rem;
    margin-bottom: .6rem;
    color: var(--card-foreground);
    background: var(--card);
}
.compromisso-item.compromisso-overdue {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, .08);
}
.compromisso-item .compromisso-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: .3rem;
    font-size: .8rem;
}
.compromisso-tipo-badge {
    background: rgba(245,158,11,.15);
    color: var(--warning-color);
    padding: 1px 8px;
    border-radius: 999px;
    font-weight: 600;
    font-size: .75rem;
}
.compromisso-date { color: var(--text-secondary, #64748b); }
.compromisso-processo {
    font-family: monospace;
    font-size: .75rem;
    color: var(--primary-color, #4f46e5);
}
.compromisso-titulo {
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    font-size: .9rem;
    margin-bottom: .2rem;
}
.compromisso-descricao {
    font-size: .8rem;
    color: var(--text-secondary, #64748b);
    margin-bottom: .4rem;
}
.compromisso-actions {
    display: flex;
    gap: .4rem;
    margin-top: .4rem;
}
.btn-xs {
    padding: 2px 10px;
    font-size: .75rem;
    border-radius: .25rem;
    cursor: pointer;
    border: none;
    font-weight: 500;
}
.btn-xs.btn-success { background: #10b981; color: #fff; }
.btn-xs.btn-success:hover { background: #059669; }
.btn-xs.btn-danger  { background: #ef4444; color: #fff; }
.btn-xs.btn-danger:hover  { background: #dc2626; }
.btn-xs.btn-outline-danger { background: transparent; color: #ef4444; border: 1px solid #ef4444; }
.btn-xs.btn-outline-danger:hover { background: #ef4444; color: #fff; }

/* Upcoming Events Sidebar */
.upcoming-event {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    color: var(--card-foreground);
    background: var(--card);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.upcoming-event:hover {
    background: var(--accent);
    border-color: var(--ring);
}

.event-date {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.75rem;
    text-transform: uppercase;
    min-width: 40px;
    text-align: center;
}

.event-summary {
    flex: 1;
}

.event-summary .event-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.125rem;
}

.event-summary .event-time {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
}

/* Event Details Modal */
.event-detail-item {
    display: grid;
    grid-template-columns: minmax(120px, 160px) minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 0;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    color: var(--foreground);
    overflow-wrap: anywhere;
}

.event-detail-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.event-detail-item strong {
    color: var(--text-primary);
    display: block;
    min-width: 0;
}

.event-modal-content {
    max-width: 760px !important;
}

.event-edit-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.event-edit-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.event-edit-field.event-edit-wide {
    grid-column: 1 / -1;
}

.event-edit-field label {
    color: var(--muted-foreground);
    font-size: 0.78rem;
    font-weight: 600;
}

.event-edit-field textarea {
    min-height: 110px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    color: var(--card-foreground);
    background: var(--card);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: 0.75rem;
}

.stat-content h4 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.stat-content p {
    font-size: 0.875rem;
    color: var(--text-secondary, #64748b);
    margin: 0;
}

/* Calendar Responsive Design */
@media screen and (max-width: 768px) {
    .calendar-day {
        min-height: 60px;
        font-size: 0.875rem;
    }

    .weekday {
        padding: 0.75rem 0.25rem;
        font-size: 0.75rem;
    }

    .calendar-navigation {
        flex-direction: column;
        gap: 0.5rem;
    }

    .event-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .event-time {
        min-width: auto;
    }

    .event-detail-item,
    .event-edit-form {
        grid-template-columns: 1fr;
    }

    .event-detail-item {
        gap: 0.35rem;
    }

    .event-edit-field.event-edit-wide {
        grid-column: auto;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-content h4 {
        font-size: 1.5rem;
    }

  .transaction-item {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

/* Animation & Interaction Enhancements */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.overview-card {
  animation: fadeInUp 0.6s ease-out;
}

.overview-card:nth-child(2) {
  animation-delay: 0.1s;
}

.overview-card:nth-child(3) {
  animation-delay: 0.2s;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus states for accessibility */
.btn:focus,
.search-bar input:focus,
.filter-select:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Additional modern touches */
.card-body > *:last-child {
  margin-bottom: 0;
}

.sidebar-menu a::before {
  content: none;
}

/* Section Management Styles */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.section-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0 0.65rem;
  flex-shrink: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.workspace-heading .btn,
.btn-filter {
  min-height: 38px;
  padding-block: 0.45rem;
}

/* Page names live in the shell; actions belong with their filters/search. */

.workspace-heading h1 {
  margin: 0.08rem 0 0.15rem;
  color: var(--text-primary);
  font-size: clamp(1.3rem, 1rem + 0.9vw, 1.65rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.workspace-heading p {
  max-width: 680px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.workspace-eyebrow {
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.workspace-type-switch {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.05rem 0 0.35rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.workspace-type-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 8.5rem;
  min-width: 0;
  max-width: 13rem;
  min-height: 38px;
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.workspace-type-option:hover {
  border-color: var(--text-secondary);
}

.workspace-type-option.active {
  border-color: var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 6%, var(--surface-elevated));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary-color) 10%, transparent);
}

.workspace-type-option > span:last-child {
  display: grid;
  min-width: 0;
}

.workspace-type-option strong {
  overflow: hidden;
  font-size: clamp(0.74rem, 0.7rem + 0.12vw, 0.82rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-type-option small {
  overflow: hidden;
  margin-top: 0.02rem;
  color: var(--text-secondary);
  font-size: clamp(0.62rem, 0.59rem + 0.1vw, 0.68rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-option-icon,
.folder-type-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.type-all { background: rgba(100, 116, 139, 0.12); color: #526174; }
.type-judicial { background: rgba(29, 78, 216, 0.11); color: #1d4ed8; }
.type-administrative { background: rgba(13, 116, 99, 0.12); color: #0d7463; }
.type-dossier { background: rgba(180, 83, 9, 0.12); color: #a34b08; }
.type-closed { background: rgba(22, 101, 52, 0.12); color: #166534; }

.workspace-toolbar {
  gap: 0.75rem;
  padding: 0 0 0.65rem;
  flex-shrink: 0;
}

.workspace-toolbar .workspace-toolbar-main {
  width: 100%;
  min-width: 0;
  justify-content: space-between;
  flex-wrap: wrap;
}

.case-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.case-type-badge > span {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.case-type-judicial { background: rgba(29, 78, 216, 0.08); border-color: rgba(29, 78, 216, 0.2); color: #1d4ed8; }
.case-type-administrativo { background: rgba(13, 116, 99, 0.08); border-color: rgba(13, 116, 99, 0.22); color: #0d7463; }
.case-type-dossier { background: rgba(180, 83, 9, 0.08); border-color: rgba(180, 83, 9, 0.22); color: #9a4608; }

.case-route-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.case-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.case-stage-badge > span {
  font-weight: 800;
}

.case-stage-preparacao { background: #fff7ed; border-color: #fed7aa; color: #9a4608; }
.case-stage-em_tramitacao { background: #f1f5f9; border-color: #cbd5e1; color: #334155; }
.case-stage-encerrado { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }

.case-row td:first-child {
  border-left: 3px solid transparent;
}

.case-row.case-preparacao td:first-child { border-left-color: #c26a1b; }
.case-row.case-em_tramitacao td:first-child { border-left-color: #3b6fd8; }
.case-row.case-encerrado td:first-child { border-left-color: #2f855a; }

.case-proceedings {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.case-proceedings-heading span {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.case-proceedings-heading h4 {
  margin: 0.2rem 0 0.75rem;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.case-proceedings-list {
  display: grid;
  gap: 0.55rem;
}

.case-proceeding-item {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem;
  border: 1px solid var(--border-color);
  border-left-width: 3px;
  border-radius: 6px;
  background: var(--surface-elevated);
}

.case-proceeding-judicial { border-left-color: #1d4ed8; }
.case-proceeding-administrativo { border-left-color: #0d7463; }

.case-proceeding-item div {
  display: grid;
  min-width: 0;
}

.case-proceeding-item strong,
.case-proceeding-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-proceeding-item small,
.case-proceedings-empty {
  margin-top: 0.15rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.workspace-empty-state {
  display: grid;
  justify-items: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
  text-align: center;
}

.workspace-empty-state.compact {
  padding: 3rem 1rem;
}

.workspace-empty-state h3 {
  margin: 0.7rem 0 0.3rem;
  color: var(--text-primary);
  font-size: 1rem;
}

.workspace-empty-state p {
  max-width: 440px;
  margin: 0 0 1rem;
  font-size: 0.84rem;
}

.empty-state-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
  color: var(--text-secondary);
  font-size: 1.2rem;
}

.case-create-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.case-create-type {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: var(--surface-color);
  cursor: pointer;
}

.case-create-type:has(input:checked) {
  border-color: var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 6%, var(--surface-elevated));
  box-shadow: inset 0 -2px 0 var(--primary-color);
}

.case-create-type input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.case-create-type > span:last-child {
  display: grid;
  min-width: 0;
}

.case-create-type strong {
  font-size: 0.78rem;
}

.case-create-type small {
  margin-top: 0.1rem;
  color: var(--text-secondary);
  font-size: 0.65rem;
  line-height: 1.25;
}

.case-client-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 0.55rem;
}

.nested-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 21000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px);
}

.nested-modal {
  width: min(100%, 520px);
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-elevated);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.nested-modal-header,
.nested-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.nested-modal-header {
  border-bottom: 1px solid var(--border-color);
}

.nested-modal-header span {
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.nested-modal-header h2 {
  margin: 0.15rem 0 0;
  color: var(--text-primary);
  font-size: 1.05rem;
}

.nested-modal-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  padding: 1.25rem;
}

.nested-modal-field {
  display: grid;
  gap: 0.35rem;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
}

.nested-modal-field.full {
  grid-column: 1 / -1;
}

.nested-modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--border-color);
}

/* Make section content containers fill available height */
#clients-content,
#processos-content,
#leads-content,
#documentos-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#documents-explorer-content {
  height: 100%;
  overflow-y: auto;
}

.table-container {
  background: var(--surface-elevated);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
  border: 1px solid var(--border-color);
  flex: 1;
  min-height: 0;
}

#clients-table-container,
#processos-content > .table-container,
#documentos-content > .table-container {
  min-height: min(520px, calc(100vh - 260px));
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

.data-table th {
  background: var(--surface-color);
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table td {
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  height: 48px;
  max-height: 48px;
  overflow: hidden;
  white-space: nowrap;
}

/* Per-column widths */
#processos-table .col-tipo     { width: 125px; }
#processos-table .col-numero   { width: 130px; }
#processos-table .col-cliente  { width: 150px; }
#processos-table .col-assunto  { width: 200px; }
#processos-table .col-status   { width: 170px; }
#processos-table .col-data     { width: 90px; }

/* Case workspace inherits the dashboard language without restyling other tables. */
#processos-content { min-width: 0; gap: 12px; }
#processos-content .workspace-heading {
  position: static;
  z-index: auto;
  backdrop-filter: none;
  padding: 0;
  margin-bottom: 8px;
  flex-direction: row;
  align-items: center;
}
#processos-content .workspace-heading .btn { width: auto; border-radius: 6px; box-shadow: none; }
#processos-content .workspace-heading h1 {
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: 0;
  margin: 0;
}
#processos-content .workspace-type-switch { gap: 4px; margin: 0; padding-bottom: 6px; }
#processos-content .workspace-type-option {
  flex: 1 0 165px;
  max-width: none;
  min-height: 48px;
  border-radius: 6px;
  padding: 8px 12px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
#processos-content .workspace-type-option.active {
  background: var(--workspace-accent-soft);
  color: var(--workspace-accent);
}
#processos-content .workspace-type-option strong { font-size: 13px; white-space: normal; line-height: 1.4; }
#processos-content .workspace-type-option small { font-size: 11px; line-height: 1.4; }
#processos-content .type-option-icon { background: var(--secondary); color: var(--muted-foreground); border-radius: 4px; }
#processos-content .workspace-toolbar { margin: 0; padding: 0; }
#processos-content .case-search-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
#processos-content .search-container { flex: 1; min-width: 0; order: 0; }
#processos-search {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  background: var(--card);
  color: var(--foreground);
}
#processos-content .btn-filter {
  min-height: 40px;
  border-width: 1px;
  border-radius: 6px;
  padding: 8px 12px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
#processos-content .btn-filter.has-filters { color: var(--workspace-accent); border-color: var(--workspace-accent); background: var(--workspace-accent-soft); }
#processos-content .filter-count-badge { background: var(--workspace-accent); color: var(--card); }
#processos-content .filter-dropdown-panel { width: min(380px, calc(100vw - 32px)); border-radius: 8px; }
#processos-content .filter-dropdown-title { letter-spacing: 0; }
#processos-content .filter-date-input { min-width: 0; }
#processos-content .source-filter-group { flex-wrap: wrap; }
#processos-content .source-filter-btn { min-height: 36px; letter-spacing: 0; }
#processos-content .source-filter-btn.active { color: var(--workspace-accent); background: var(--workspace-accent-soft); border-color: var(--workspace-accent); }
#processos-table-container {
  min-width: 0;
  min-height: 260px;
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--border);
  box-shadow: none;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--muted-foreground) var(--background);
}
#processos-table { min-width: 1000px; font-variant-numeric: tabular-nums; }
#processos-table th { font-size: 12px; text-transform: none; letter-spacing: 0; }
#processos-table td { padding: 10px 12px; height: 56px; max-height: none; }
#processos-table .col-tipo { width: 160px; }
#processos-table .case-row { border-left: 0; }
#processos-table .case-row td:first-child { border-left: 0; }
#processos-table .case-encerrado { opacity: 1; }
#processos-table .case-stage-badge,
#processos-table .case-type-badge,
#processos-table .status-badge {
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0;
  border-radius: 4px;
  background: var(--secondary);
  color: var(--foreground);
  border-color: var(--border);
}
#processos-content .workspace-type-option:focus-visible,
#processos-content .source-filter-btn:focus-visible,
#processos-content .btn-filter:focus-visible,
#processos-table-container:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
@media (max-width: 768px) {
  #processos-content .workspace-heading h1 { font-size: 24px; }
  #processos-content .case-search-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; }
  #processos-content .filter-dropdown-wrapper { display: contents; }
  #processos-content .filter-dropdown-panel { position: static; grid-column: 1 / -1; width: 100%; box-shadow: none; }
  #processos-content .workspace-heading .btn { white-space: nowrap; }
}

.documents-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 1 auto;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-color);
  font-size: 0.82rem;
}

.document-scope-selector {
  gap: 0.25rem;
  padding: 0.18rem;
  border-radius: 0.65rem;
}

.document-scope-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.1rem;
  padding: 0.42rem 0.7rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}

.document-scope-option.active {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.loose-documents-shell {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: min(620px, 68vh);
    padding: 0.85rem;
  }

.loose-documents-shell.drag-over,
.loose-folder-card.drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: -6px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-color));
}

  .loose-documents-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
  }

  .loose-explorer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: 0.8rem;
    background: color-mix(in srgb, var(--surface-elevated) 72%, transparent);
  }

  .loose-explorer-nav,
  .loose-explorer-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
  }

  .loose-explorer-actions {
    color: var(--text-secondary);
    font-size: 0.82rem;
    flex-shrink: 0;
  }

  .loose-nav-btn {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    background: var(--surface-color);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 700;
  }

  .loose-nav-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
  }

  .loose-path-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    max-width: min(48vw, 620px);
    padding: 0.42rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .loose-path-pill span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .loose-path-folder {
    flex-shrink: 0;
  }

  .loose-explorer-canvas {
    flex: 1;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 0.9rem;
    background: color-mix(in srgb, var(--surface-color) 78%, transparent);
    overflow: auto;
  }

.loose-crumb {
  padding: 0.2rem 0.35rem;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
}

.loose-crumb:hover {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.loose-crumb-sep {
  color: var(--text-secondary);
}

  .loose-folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 210px));
    gap: 0.85rem;
    align-content: start;
  }

.loose-folder-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon name"
    "icon meta";
  gap: 0.1rem 0.7rem;
  min-height: 76px;
  padding: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 0.85rem;
  background: var(--surface-color);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.loose-folder-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border-color));
  background: var(--surface-elevated);
}

.loose-folder-icon {
  grid-area: icon;
  align-self: center;
  font-size: 1.7rem;
}

.loose-folder-card strong {
  grid-area: name;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loose-folder-card small {
  grid-area: meta;
  color: var(--text-secondary);
}

.loose-file-table {
  table-layout: fixed;
  width: 100%;
}

.loose-file-row {
  cursor: grab;
}

.loose-file-row:active {
  cursor: grabbing;
}

  .loose-file-row:hover {
    background: var(--surface-elevated);
  }

  .loose-upload-pending {
    opacity: 0.82;
    background: color-mix(in srgb, var(--primary) 5%, transparent);
  }

  .mini-spinner {
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
    border: 2px solid color-mix(in srgb, var(--primary) 22%, transparent);
    border-top-color: var(--primary);
    border-radius: 999px;
    animation: spin 0.8s linear infinite;
  }

  .loose-drop-empty {
    display: grid;
    place-items: center;
    gap: 0.35rem;
    min-height: 300px;
    border: 1px dashed var(--border-color);
    border-radius: 0.9rem;
    background: color-mix(in srgb, var(--surface-elevated) 55%, transparent);
  color: var(--text-secondary);
  text-align: center;
}

.loose-drop-empty div {
  font-size: 2rem;
}

  .loose-drop-empty strong {
    color: var(--text-primary);
  }

  @media (max-width: 900px) {
    .loose-explorer-toolbar {
      align-items: stretch;
      flex-direction: column;
    }

    .loose-explorer-actions {
      justify-content: flex-end;
      flex-wrap: wrap;
    }

    .loose-path-pill {
      max-width: 100%;
      flex: 1;
    }

    .loose-folder-grid {
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
  }

.document-folder-table {
  width: 100%;
  table-layout: fixed;
}

.document-folder-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.document-folder-row:hover {
  background: var(--surface-color);
}

.document-folder-row td:first-child {
  border-left: 3px solid transparent;
}

.document-folder-row.case-judicial td:first-child { border-left-color: #3b6fd8; }
.document-folder-row.case-administrativo td:first-child { border-left-color: #178574; }
.document-folder-row.case-dossier td:first-child { border-left-color: #c26a1b; }
.document-folder-row.case-encerrado td:first-child { border-left-color: #2f855a; }

.folder-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.case-judicial .folder-type-mark { background: rgba(29, 78, 216, 0.11); color: #1d4ed8; }
.case-administrativo .folder-type-mark { background: rgba(13, 116, 99, 0.12); color: #0d7463; }
.case-dossier .folder-type-mark { background: rgba(180, 83, 9, 0.12); color: #a34b08; }
.case-encerrado .folder-type-mark { background: rgba(22, 101, 52, 0.12); color: #166534; }

.folder-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-type-label,
.folder-subject {
  overflow: hidden;
  margin-top: 0.12rem;
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .workspace-type-switch {
    margin-inline: calc(var(--hermes-page-gutter) * -0.25);
    padding-inline: calc(var(--hermes-page-gutter) * 0.25);
  }

  .workspace-type-option {
    flex: 0 0 clamp(10.25rem, 42vw, 13rem);
    max-width: none;
  }

  .workspace-toolbar .workspace-toolbar-main {
    align-items: stretch;
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .workspace-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-heading .btn {
    justify-content: center;
    width: 100%;
  }

  .workspace-type-switch {
    gap: 0.4rem;
  }

  .workspace-type-option small {
    white-space: nowrap;
  }

  .workspace-type-option {
    flex-basis: clamp(9.7rem, 72vw, 12rem);
    padding-block: 0.42rem;
  }

  .case-create-type-grid {
    grid-template-columns: 1fr;
  }
}

/* Clients table column widths */
/* Record details share the workspace hierarchy without floating page cards. */
#processo-detail-content,
#client-detail-content { min-width: 0; overflow-wrap: anywhere; }
#processo-detail-content > .card,
#client-detail-content > .card {
    margin: 0 0 24px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}
#processo-detail-content .card-body,
#client-detail-content .card-body { padding: 16px 0; }
#processo-detail-content .card-header,
#client-detail-content .card-header {
    padding: 0 0 16px;
    background: transparent;
    border: 0;
    box-shadow: none;
}
#processo-detail-content .processo-detail-header,
#client-detail-content .processo-detail-header { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
#processo-detail-content .processo-breadcrumb,
#client-detail-content .processo-breadcrumb { display: flex; flex-wrap: wrap; min-width: 0; gap: 8px; flex: 1 1 280px; }
#processo-detail-content .breadcrumb-divider,
#client-detail-content .breadcrumb-divider { display: none; }
#processo-detail-number,
#client-detail-name { width: 100%; margin: 0; font-size: 26px; line-height: 1.25; letter-spacing: 0; color: var(--foreground); }
#processo-detail-content .processo-breadcrumb .btn,
#client-detail-content .processo-breadcrumb .btn { min-height: 36px; padding: 4px 0; font-size: 13px; color: var(--workspace-accent); }
#processo-detail-content .processo-header-actions { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; gap: 12px; }
#processo-detail-content .processo-header-commands { display: flex; flex-wrap: wrap; gap: 8px; }
#processo-detail-content .btn,
#client-detail-content .btn { width: auto; min-height: 36px; padding: 8px 12px; border-radius: 6px; font-size: 13px; box-shadow: none; transform: none; }
#processo-detail-content .btn svg,
#client-detail-content .btn svg { width: 16px; height: 16px; flex-shrink: 0; }
#processo-detail-content .summary-grid,
#processo-detail-content .meta-grid,
#client-detail-content .meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 16px 24px !important; }
#processo-detail-content :is(.summary-grid, .meta-grid) > div,
#client-detail-content .meta-grid > div { min-width: 0; }
#processo-detail-content .summary-grid > div,
#processo-detail-content .meta-item,
#client-detail-content .meta-item { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; transform: none; }
#processo-detail-content :is(.summary-grid, .meta-grid) h4 { font-size: 12px; margin: 0 0 4px; color: var(--muted-foreground); }
#processo-detail-content :is(.summary-grid, .meta-grid) p { font-size: 14px; margin: 0; }
#processo-detail-content h3,
#client-detail-content h3 { font-size: 15px; line-height: 1.4; margin: 0 0 12px !important; letter-spacing: 0; }
#processo-detail-content .detail-section-heading > span,
#processo-detail-content .case-proceedings-heading > div > span { display: none; }
#processo-detail-content .case-proceedings { margin: 20px 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
#processo-detail-content .case-proceeding-item { border-left: 0; border-radius: 6px; }
#processo-detail-content .processo-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
#processo-detail-content .tab-button { min-height: 40px; border-radius: 6px; font-size: 13px; color: var(--foreground); background: transparent; letter-spacing: 0; }
#processo-detail-content .tab-button.active { color: var(--workspace-accent); background: var(--workspace-accent-soft); border-color: transparent; }
#processo-detail-content .timeline-content { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; }
#processo-detail-content .timeline-header { flex-wrap: wrap; gap: 8px; }
#processo-detail-content .timeline-description { font-size: 14px; }
#processo-detail-content .prazo-banner { border-left: 0; border-radius: 6px; }
#client-detail-content .client-detail-profile { display: flex; flex-direction: row; align-items: flex-start; text-align: left; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
#client-detail-content .client-detail-info { min-width: 0; flex: 1 1 180px; }
#client-detail-content .client-detail-info > div { justify-content: flex-start; }
#client-detail-content .client-detail-info h2 { font-size: 18px; letter-spacing: 0; }
#client-detail-content .client-profile-pic,
#client-detail-content .client-avatar-placeholder { width: 64px; height: 64px; flex-shrink: 0; background: var(--secondary); color: var(--foreground); font-size: 22px; box-shadow: none; }
#client-detail-content .client-avatar-placeholder { border-radius: 50%; }
#client-detail-content .client-profile-pic img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
#client-detail-content .client-detail-data { border: 0; background: transparent; padding: 0; box-shadow: none; }
#client-detail-content :is(input, select, textarea),
#processo-detail-content .edit-field input { width: 100%; min-width: 0; min-height: 40px; font-size: 14px !important; border-radius: 6px; }
#client-detail-content input::placeholder,
#client-detail-content textarea::placeholder { color: var(--foreground); opacity: 1; font-style: normal; }
#client-detail-content .meta-label { font-size: 12px; color: var(--foreground); letter-spacing: 0; }
#client-detail-content .table-responsive { overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
#client-detail-content .data-table { min-width: 850px; font-size: 13px; }
#client-detail-content .data-table th { letter-spacing: 0; text-transform: none; }
#btn-save-client { min-height: 36px; padding: 8px 12px !important; background: var(--primary) !important; color: var(--primary-foreground) !important; }
#client-detail-content :is(.status-badge, .badge),
#processo-detail-content :is(.status-badge, .case-type-badge, .case-stage-badge) { background: var(--secondary); color: var(--foreground); border-color: var(--border); border-radius: 6px; letter-spacing: 0; font-size: 12px; }
#processo-detail-content .btn,
#client-detail-content .btn { order: 0; }
#processo-detail-content :is(button, input, select, [tabindex]):focus-visible,
#client-detail-content :is(button, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.detail-skeleton { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; min-height: 150px; padding: 16px 0; }
.detail-skeleton span { display: block; height: 16px; background: var(--secondary); border-radius: 4px; animation: detail-loading-pulse 1.4s ease-in-out infinite; }
.detail-skeleton span:nth-child(even) { width: 70%; }
.detail-load-status { margin: 8px 0 16px; font-size: 14px; color: var(--foreground); }
.detail-load-error { padding: 16px 0; color: var(--foreground); }
.detail-load-error p { margin: 0 0 12px; font-size: 14px; }
@keyframes detail-loading-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
:where(html[data-motion-reduced="true"]) { .detail-skeleton span { animation: none; } }
@media (max-width: 768px) {
    #processo-detail-number,
    #client-detail-name { font-size: 24px; }
    #processo-detail-content .processo-header-actions { align-items: flex-start; width: 100%; }
    #processo-detail-content .summary-grid,
    #processo-detail-content .meta-grid,
    #client-detail-content .meta-grid { grid-template-columns: minmax(0, 1fr) !important; }
    #processo-detail-content .btn,
    #client-detail-content .btn { min-height: 40px; }
    #client-edit-form > div:first-child { flex-wrap: wrap; gap: 12px; }
}

/* Clients and calendar extend the compact legal workspace. */
#clients-content .workspace-heading,
#calendar-content .calendar-topbar {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0 16px;
    margin: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    flex-shrink: 0;
}
#clients-content .workspace-heading { flex-direction: row; text-align: left; }

#clients-content h1,
#calendar-content .calendar-topbar-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0;
    color: var(--foreground);
    text-transform: none;
}

#clients-content .workspace-heading .btn,
#calendar-content .calendar-topbar .btn {
    width: auto;
    min-height: 36px;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    transform: none;
    box-shadow: none;
}

#clients-content .clients-toolbar { padding-bottom: 16px; flex-shrink: 0; }
#clients-content .clients-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
#clients-content .clients-toolbar #clients-search { flex: 1 1 240px; width: auto; max-width: none; }
#clients-content .clients-toolbar .btn { flex: 0 0 auto; min-height: 40px; width: auto; border-radius: 6px; }
#processos-content .case-search-controls, #documentos-content .document-search-controls { flex-wrap: wrap; }
#processos-content .workspace-create-action, #documentos-content .workspace-create-action { order: 2; flex: 0 0 auto; min-height: 40px; border-radius: 6px; white-space: nowrap; }
#processos-content .workspace-create-action svg, #documentos-content .workspace-create-action svg { width: 16px; height: 16px; }
#leads-content > .section-header { justify-content: flex-start; }
#leads-content > .section-header .section-actions { display: flex; flex-wrap: wrap; gap: 12px; width: 100%; min-width: 0; }
#leads-content > .section-header .section-actions > :is(input, select) { max-width: 100%; }
@media (max-width: 640px) {
  #processos-content .workspace-create-action, #documentos-content .workspace-create-action { flex-basis: 100%; width: 100%; }
}
#clients-search {
    width: min(100%, 480px);
    min-width: 0;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--foreground);
    background: var(--card);
    font-size: 14px;
}
#clients-content #clients-search::placeholder { color: var(--foreground); opacity: 1; font-style: normal; }
#clients-table-container {
    min-height: 0;
    overflow: auto;
    border-radius: 8px;
    box-shadow: none;
    scrollbar-color: var(--muted-foreground) var(--secondary);
}
#clients-table { min-width: 940px; }
#clients-table th,
#clients-table td { padding: 12px; letter-spacing: 0; }
#clients-table th { text-transform: none; }
#clients-table tbody tr:hover { background: var(--secondary); transform: none; }
#clients-table .badge { background: var(--secondary); color: var(--foreground); border-radius: 4px; }
#clients-table .clients-empty { padding: 32px 12px; text-align: center; color: var(--muted-foreground); }

#calendar-content { min-width: 0; overflow: auto; }
#calendar-content .calendar-topbar-left { flex-wrap: wrap; gap: 16px; min-width: 0; }
#calendar-content .cal-filter-group { flex-wrap: wrap; }
#calendar-content .cal-filter-btn {
    min-height: 32px;
    font-size: 12px;
    letter-spacing: 0;
    background: var(--card);
    color: var(--muted-foreground);
    border: 1px solid var(--border);
}
#calendar-content .cal-filter-btn.active {
    background: var(--workspace-accent-soft);
    color: var(--workspace-accent);
    border-color: var(--workspace-accent);
}
#calendar-content .calendar-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 24px;
    min-height: 600px;
}
#calendar-content .calendar-main { min-width: 0; min-height: 600px; }
#calendar-content .calendar-container {
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    box-shadow: none;
    overflow: hidden;
}
#calendar-content .calendar-controls { padding: 12px; gap: 8px; background: transparent; }
#calendar-content .calendar-controls .btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    transform: none;
    box-shadow: none;
    border-radius: 6px;
}
#calendar-content .month-selector { display: flex; min-width: 0; gap: 8px; }
#calendar-content .cal-nav-select {
    min-width: 0;
    max-width: 100%;
    min-height: 36px;
    font-size: 14px;
    padding: 6px;
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
}
#calendar-content .calendar-header {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--secondary);
    color: var(--foreground);
}
#calendar-content .calendar-header > div { padding: 10px 0; font-size: 12px; text-transform: none; letter-spacing: 0; }
#calendar-content .calendar-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); }
#calendar-content .calendar-day {
    min-width: 0;
    min-height: 76px;
    padding: 8px 6px;
    background: var(--card);
    color: var(--foreground);
    transform: none;
    box-shadow: none;
    transition: background 120ms;
}
#calendar-content .calendar-day:hover { background: var(--secondary); border-color: var(--border); }
#calendar-content .calendar-day.other-month { color: var(--muted-foreground); background: var(--background); cursor: default; }
#calendar-content .calendar-day .day-number { font-size: 14px; }
#calendar-content .calendar-day.today,
#calendar-content .calendar-day.selected { background: var(--workspace-accent-soft); color: var(--workspace-accent); box-shadow: none; }
#calendar-content .calendar-day.has-important-events::before { animation: none; background: var(--workspace-danger); box-shadow: none; }
#calendar-content .calendar-day .compromisso-dot { background: var(--workspace-warning); box-shadow: none; }
#calendar-content .calendar-day .event-preview.compromisso-preview { background: var(--secondary); color: var(--foreground); }
#calendar-content .calendar-sidebar { width: auto; max-height: none; min-width: 0; overflow: auto; }
#calendar-content .calendar-agenda { min-width: 0; }
#calendar-content .calendar-agenda-header { padding: 0 0 12px; border-bottom: 1px solid var(--border); }
#calendar-content .calendar-agenda-header h2 { margin: 0; font-size: 15px; font-weight: 600; }
#calendar-content #upcoming-compromissos-container { padding: 0; overflow: visible; }
#calendar-content .compromisso-item {
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 16px 0;
    margin: 0;
    background: transparent;
    overflow-wrap: anywhere;
}
#calendar-content .compromisso-tipo-badge,
#calendar-content .event-type-badge {
    background: var(--secondary) !important;
    color: var(--foreground) !important;
    border-radius: 4px;
    font-size: 11px;
    letter-spacing: 0;
}
#calendar-content .compromisso-prazo .compromisso-tipo-badge { color: var(--workspace-warning) !important; }
#calendar-content .compromisso-overdue .compromisso-date { color: var(--workspace-danger); }
#calendar-content .compromisso-processo { color: var(--muted-foreground); font-family: inherit; }
#calendar-content .compromisso-actions { flex-wrap: wrap; }
#calendar-content .compromisso-actions .btn,
#calendar-content .event-item .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 32px;
    width: auto;
    padding: 6px 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    transform: none;
    box-shadow: none;
}
#calendar-content .btn-xs svg { width: 14px; height: 14px; flex-shrink: 0; }
#calendar-content .btn-xs.btn-success { color: var(--workspace-accent); }
#calendar-content .btn-xs.btn-danger,
#calendar-content .btn-xs.btn-outline-danger { color: var(--workspace-danger); }
#calendar-content .day-events-overlay { box-shadow: none; }
#calendar-content .day-events-overlay { inset: 0; width: 100%; height: auto; transition: none; border-radius: 8px; }
#calendar-content .day-navigation-host { flex-shrink: 0; }
#calendar-content .calendar-controls { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; }
#calendar-content .month-selector { justify-content: center; background: transparent; padding: 0; }
#calendar-content #calendar-today { grid-column: 1 / -1; justify-self: center; width: auto; padding: 0 12px; font-size: 12px; }
#calendar-content .calendar-day.other-month { cursor: pointer; }
#calendar-content .calendar-day .event-preview {
    display: flex;
    gap: 4px;
    width: 100%;
    margin-top: 2px;
    padding: 0 2px;
    background: var(--secondary);
    color: var(--foreground);
    font-size: 12px;
    line-height: 16px;
}
#calendar-content .preview-time { font-variant-numeric: tabular-nums; flex-shrink: 0; }
#calendar-content .preview-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#calendar-content .calendar-more { font-size: 12px; line-height: 14px; color: var(--foreground); }
#calendar-content .day-hover-popup {
    max-height: 360px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgb(0 0 0 / 12%);
    animation: none;
}
#calendar-content .dhp-header {
    color: var(--foreground);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
    padding: 12px;
}
#calendar-content .dhp-body { padding: 0 12px; scrollbar-color: var(--muted-foreground) var(--secondary); }
#calendar-content .dhp-item { margin: 0; padding: 12px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; gap: 10px; }
#calendar-content .dhp-time { min-width: 36px; color: var(--foreground); font-size: 12px; font-variant-numeric: tabular-nums; }
#calendar-content .dhp-details { min-width: 0; overflow-wrap: anywhere; }
#calendar-content .dhp-label { color: var(--foreground); font-size: 14px; line-height: 1.4; }
#calendar-content .dhp-kind,
#calendar-content .dhp-process { color: var(--foreground); font-size: 12px; line-height: 1.4; }
#calendar-content .dhp-kind { display: block; margin-bottom: 4px; }
#calendar-content .calendar-load-message { color: var(--foreground); font-size: 14px; }
#calendar-content #calendar-load-status:empty { display: none; }
#calendar-content #calendar-load-status { padding: 0 12px; }
#calendar-content .day-overlay-header { padding: 12px; gap: 6px; }
#calendar-content .day-overlay-title { font-size: 14px; white-space: normal; min-width: 0; }
#calendar-content .day-overlay-close { margin-left: 0; }
#calendar-content .day-overlay-header button svg { width: 16px; height: 16px; }
#calendar-content .day-compact-nav { grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 8px; gap: 2px; }
#calendar-content .event-item { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; padding: 12px 0; box-shadow: none; transform: none; }
#calendar-content .event-details { min-width: 0; overflow-wrap: anywhere; }
#calendar-content .event-item .event-title { font-size: 14px; }
#calendar-content .event-time { font-size: 12px; color: var(--muted-foreground); }
#calendar-content .event-item.compromisso-done,
#calendar-content .event-item.compromisso-cancelled { opacity: 1; }
#clients-content :is(input, button, [tabindex]):focus-visible,
#calendar-content :is(button, select, [tabindex]):focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: -2px;
    box-shadow: none;
}

@media (max-width: 1100px) {
    #calendar-content .calendar-layout { grid-template-columns: minmax(0, 1fr); flex: none; }
    #calendar-content .calendar-sidebar { overflow: visible; }
}
@media (max-width: 768px) {
    #clients-content h1,
    #calendar-content .calendar-topbar-title { font-size: 24px; }
    #clients-content .workspace-heading .btn,
    #calendar-content .calendar-topbar .btn { min-height: 40px; }
    #calendar-content .calendar-topbar-left { width: 100%; gap: 12px; }
    #calendar-content .calendar-layout { gap: 24px; }
    #calendar-content .calendar-main { min-height: 540px; }
    #calendar-content .calendar-controls { padding: 8px; }
    #calendar-content .calendar-day { padding: 6px 3px; }
    #calendar-content .calendar-main { min-height: 684px; }
    #calendar-content .calendar-grid { min-height: 540px; grid-template-rows: repeat(6, minmax(90px, 1fr)); }
    #calendar-content .calendar-day { min-height: 90px; }
    #calendar-content .calendar-day .event-preview { padding: 0; background: transparent; }
    #calendar-content .cal-filter-btn { min-height: 40px; }
    #calendar-content .compromisso-actions .btn,
    #calendar-content .event-item .btn { min-height: 40px; }
    #calendar-content .event-item { flex-wrap: wrap; gap: 8px; }
    #calendar-content .event-item .event-details { flex: 1; min-width: 130px; }
    #calendar-content .event-item > div:last-child { flex-direction: row !important; flex-wrap: wrap; justify-content: flex-end; width: 100%; }
}

@media (max-width: 600px) {
    #calendar-content .calendar-day .preview-label { display: none; }
}

#clients-table th:nth-child(1),
#clients-table td:nth-child(1) { min-width: 200px; }       /* Nome */
#clients-table th:nth-child(2),
#clients-table td:nth-child(2) { width: 80px; }             /* Tipo */

/* Truncating text inside cells */
.cell-truncate {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Source type badges */
.source-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.source-eproc {
  background: rgba(66, 153, 225, 0.15);
  color: #3182ce;
  border: 1px solid rgba(66, 153, 225, 0.4);
}
.source-pje {
  background: rgba(72, 187, 120, 0.15);
  color: #276749;
  border: 1px solid rgba(72, 187, 120, 0.4);
}

/* Source filter toggle buttons (next to search bar) */
.source-filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.source-filter-btn {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-muted, #888);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.source-filter-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

#sfbtn-eproc.active {
  background: rgba(66, 153, 225, 0.15);
  color: #3182ce;
  border-color: rgba(66, 153, 225, 0.5);
}

#sfbtn-pje1g.active,
#sfbtn-pje2g.active {
  background: rgba(72, 187, 120, 0.15);
  color: #276749;
  border-color: rgba(72, 187, 120, 0.5);
}

.data-table tr.table-row-clickable {
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.data-table tr.table-row-clickable:hover {
  background: rgba(113, 128, 150, 0.08);
}

.data-table tr.table-row-clickable:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: -2px;
  background: rgba(113, 128, 150, 0.12);
}

.data-table tr:hover:not(.table-row-clickable) {
  background: var(--surface-color);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.status-ativo,
.status-badge.status-active {
  background: rgba(56, 161, 105, 0.1);
  color: var(--success-color);
}

.status-badge.status-pendente,
.status-badge.status-pending {
  background: rgba(229, 62, 62, 0.1);
  color: var(--danger-color);
}

.status-badge.status-aguardo {
  background: rgba(214, 158, 46, 0.1);
  color: var(--warning-color);
}

.status-badge.status-baixado {
  background: rgba(56, 161, 105, 0.1);
  color: var(--success-color);
}

.status-badge.status-encerrado,
.status-badge.status-inactive {
  background: rgba(229, 62, 62, 0.1);
  color: var(--danger-color);
}

.status-badge.status-recebido,
.status-badge.status-pago {
  background: rgba(56, 161, 105, 0.1);
  color: var(--success-color);
}

.status-badge.status-cancelado {
  background: rgba(229, 62, 62, 0.1);
  color: var(--danger-color);
}

/* Type badges for resumo table */
.type-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.type-badge.type-receita {
  background: rgba(56, 161, 105, 0.1);
  color: var(--success-color);
}

.type-badge.type-despesa {
  background: rgba(229, 62, 62, 0.1);
  color: var(--danger-color);
}

/* Resumo stats container */
.resumo-stats {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.resumo-stat-card {
  flex: 1;
  min-width: 150px;
  text-align: center;
  padding: 1rem;
  background: var(--surface-color);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
}

.date-range-filter {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
}

.date-range-filter input[type="date"] {
  /* inherits global input styling — just override padding */
  padding: var(--space-2);
  width: auto;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.badge-fisica {
  background: rgba(49, 130, 206, 0.1);
  color: var(--info-color);
}

.badge.badge-juridica {
  background: rgba(128, 90, 213, 0.1);
  color: #805ad5;
}

/* ── Lead stage badges ─────────────────────────────────────── */
.lead-stage-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}

/* Actions cell in leads table */
#leads-table .actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}
#leads-table .btn-sm {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 6px;
}
.btn-success {
  background: var(--success-color, #10b981);
  color: #fff;
  border: none;
  cursor: pointer;
}
.btn-success:hover {
  opacity: .85;
}
.btn-danger {
  background: var(--danger-color, #ef4444);
  color: #fff;
  border: none;
  cursor: pointer;
}
.btn-danger:hover {
  opacity: .85;
}

/* Editable field styles */
.editable-field {
  display: block;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: border-color .2s;
  outline: none;
  min-width: 120px;
}
.editable-field:hover {
  border-color: var(--border-color);
}
.editable-field:focus {
  border-color: var(--accent-blue, #3b82f6);
  background: var(--card-bg);
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

html.dark .spinner {
  border-color: var(--border-accent);
  border-top-color: var(--foreground);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-state {
  text-align: center;
  padding: 2rem;
  color: var(--danger-color);
}

.error-state .btn {
  margin-top: 1rem;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 12px;
  line-height: 1.4;
  border-radius: 6px;
}

.btn-sm + .btn-sm {
  margin-left: 0.5rem;
}

/* Hide sections by default */
#clients-content,
#processos-content {
  display: none;
}

/* Process Detail Styles */
.processo-detail-header {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border-top: 4px solid #3b6fd8;
  border-bottom: 1px solid var(--border-color);
  flex-direction: row;
  gap: 1.5rem;
}

#processo-detail-content[data-case-type="administrativo"] .processo-detail-header {
  border-top-color: #178574;
}

#processo-detail-content[data-case-type="dossier"] .processo-detail-header {
  border-top-color: #c26a1b;
}

.processo-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

#processo-detail-number {
  overflow: hidden;
  color: var(--text-primary);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processo-breadcrumb .btn-link {
  color: var(--text-secondary);
  opacity: 0.9;
  text-decoration: none;
  padding: 0.5rem 0;
  border: none;
  background: none;
  font-size: 0.875rem;
  transition: opacity 0.2s;
}

.processo-breadcrumb .btn-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.breadcrumb-divider {
  color: var(--text-secondary);
  opacity: 0.6;
  margin: 0 0.25rem;
}

.processo-header-actions,
.processo-header-commands,
.processo-status {
  display: flex;
  align-items: center;
}

.processo-header-commands .btn,
.error-state p,
.settings-banner span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hermes-ui-icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  vertical-align: -0.125em;
}

.processo-header-actions {
  flex: 0 0 auto;
  gap: 1rem;
  margin-left: auto;
}

.processo-header-commands,
.processo-status {
  gap: 0.5rem;
}

.processo-status {
  flex-wrap: nowrap;
}

.detail-documents-action,
.detail-edit-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.4rem 0.8rem;
  border-color: var(--border-color);
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 0.82rem;
  white-space: nowrap;
}

.detail-documents-action:hover,
.detail-edit-action:hover {
  border-color: var(--border-accent);
  background: var(--accent);
  color: var(--accent-foreground);
}

.detail-edit-action {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.detail-documents-action:focus-visible,
.detail-edit-action:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.detail-section-heading {
  margin-bottom: 1.25rem;
}

.detail-section-heading span {
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.detail-section-heading h3 {
  margin: 0.2rem 0 0;
  color: var(--text-primary);
  font-size: 1.1rem;
}

@media (max-width: 700px) {
  .processo-detail-header {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .processo-breadcrumb {
    flex-basis: 100%;
  }

  .processo-header-actions {
    align-items: flex-start;
    flex-basis: 100%;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-left: 0;
  }

  .processo-header-commands {
    margin-left: auto;
  }
}

@media (max-width: 460px) {
  .processo-header-actions,
  .processo-header-commands {
    width: 100%;
  }

  .processo-header-commands .btn {
    flex: 1;
  }
}

.status-badge {
  background: var(--surface-elevated);
  color: var(--primary-color);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: var(--shadow-sm);
}

/* Process Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}

.summary-grid > div {
  background: var(--surface-elevated);
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.summary-grid > div:hover {
  box-shadow: var(--shadow-md);
}

.summary-grid h4 {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.summary-grid p {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0;
}

.summary-assunto {
  background: var(--surface-elevated);
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.summary-assunto-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

/* Process Meta Information Grid */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: start;
}

.meta-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.5rem 0.75rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.meta-item-wide {
  grid-column: 1 / -1;
}

.meta-item:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-sm);
}

.meta-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}

.meta-value {
  color: var(--text-primary);
  font-size: 0.82rem;
  text-align: left;
  word-break: break-word;
}

.meta-sub {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-radius: 0.25rem;
  padding: 0.1rem 0.4rem;
}

/* Timeline Styles */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-color), var(--border-accent));
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
  padding-left: 2rem;
}

.timeline-marker {
  position: absolute;
  left: -2.25rem;
  top: 0.75rem;
  width: 1rem;
  height: 1rem;
  background: var(--accent-color);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.timeline-content {
  background: var(--surface-elevated);
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.timeline-content:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timeline-title {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 1.125rem;
}

.timeline-date {
  color: var(--text-secondary);
  font-size: 0.875rem;
  background: var(--surface-color);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid var(--border-color);
}

.timeline-description {
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.timeline-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.timeline-meta span {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.timeline-tag {
  background: var(--surface-color);
  color: var(--text-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
}

.timeline-tag.status {
  background: var(--info-color);
  color: white;
  border-color: var(--info-color);
}

/* Process Detail Cards Spacing */
#processo-detail-content .card {
  margin-bottom: 2rem;
}

#processo-detail-content .card:last-child {
  margin-bottom: 0;
}

/* Client Detail Page */
#client-detail-content .card {
  margin-bottom: 2rem;
}

#client-detail-content .card:last-child {
  margin-bottom: 0;
}

.client-detail-profile {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.client-profile-pic {
  flex-shrink: 0;
}

.client-avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2.5rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.client-avatar-placeholder.client-avatar-juridica {
  background: linear-gradient(135deg, #52606D 0%, #52606D 100%);
  font-size: 2rem;
}

.client-detail-info {
  flex: 1;
  min-width: 0;
}

.client-detail-data {
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .case-client-picker,
  .nested-modal-body {
    grid-template-columns: 1fr;
  }

  .nested-modal-field.full {
    grid-column: auto;
  }

  .client-detail-profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .client-detail-info > div {
    justify-content: center;
  }
}

/* Pagination Styles */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 1rem;
}

.pagination-info {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-numbers {
  display: flex;
  gap: 0.25rem;
}

.page-number {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  background: var(--surface-elevated);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: all 0.2s;
  cursor: pointer;
  min-width: 40px;
  text-align: center;
}

.page-number:hover {
  background: var(--surface-color);
  border-color: var(--border-accent);
}

.page-number.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.page-number.ellipsis {
  border: none;
  background: none;
  cursor: default;
}

.page-number.ellipsis:hover {
  background: none;
  border: none;
}

.pagination-settings {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.pagination-settings label {
  color: var(--text-secondary);
  white-space: nowrap;
}

.pagination-settings select {
  min-width: 80px;
  width: auto;
}

/* Responsive Design for Process Details */
@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .meta-item {
    flex-direction: column;
    gap: 0.5rem;
  }

  .meta-label {
    flex: none;
  }

  .meta-value {
    text-align: left;
  }

  .timeline {
    padding-left: 1.5rem;
  }

  .timeline-item {
    padding-left: 1.5rem;
  }

  .timeline-marker {
    left: -1.75rem;
  }

  .timeline-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Pagination responsive */
  .pagination-container {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .pagination-controls {
    justify-content: center;
    flex-wrap: wrap;
  }

  .pagination-info,
  .pagination-settings {
    text-align: center;
  }

  .page-numbers {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Enhanced Search Interface */
.search-container {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

/* Search Input Styling */
#processos-search {
  position: relative;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 40px 10px 16px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: var(--surface-elevated);
  width: 100%;
}

#processos-search:focus,
#clients-search:focus,
#search-documents:focus {
  border-color: var(--info-color);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
  outline: none;
}

#processos-search::placeholder,
#clients-search::placeholder,
#search-documents::placeholder {
  color: var(--text-tertiary);
  font-style: italic;
}

/* Search Icon */
.search-container::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: var(--text-tertiary);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  pointer-events: none;
  z-index: 1;
}

/* AI Toggle Styling */
.search-mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-elevated);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.3s ease;
  min-width: 160px;
}

.search-mode-toggle:hover {
  border-color: var(--info-color);
  color: var(--text-primary);
  background: rgba(49, 130, 206, 0.05);
}

.search-mode-toggle.active {
  background: linear-gradient(135deg, var(--info-color), #2c5282);
  border-color: var(--info-color);
  color: white;
  box-shadow: var(--shadow-md);
}

.search-mode-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--info-color);
  cursor: pointer;
}

/* Filter Dropdown Styles */
.filter-dropdown-wrapper {
  position: relative;
}

.btn-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 0.45rem 1rem;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn-filter:hover {
  border-color: var(--accent-color);
  background: var(--surface-color);
}

.btn-filter.has-filters {
  border-color: var(--info-color);
  background: rgba(49, 130, 206, 0.06);
  color: var(--info-color);
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--info-color);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.filter-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  background: var(--card, var(--surface-elevated));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,.15);
  z-index: 200;
  animation: filterFadeIn 0.15s ease;
  overflow: hidden;
}

.filter-dropdown-panel.open {
  display: block;
}

@keyframes filterFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.filter-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

.filter-dropdown-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.filter-clear-btn {
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--info-color);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
  font-family: inherit;
}

.filter-clear-btn:hover {
  background: rgba(49, 130, 206, 0.08);
}

.filter-dropdown-body {
  padding: 14px 18px;
  max-height: 380px;
  overflow-y: auto;
}

.filter-group {
  margin-bottom: 16px;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-group-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 20px;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--accent-color);
  color: var(--text-primary);
  background: var(--surface-color);
}

.filter-chip.active {
  border-color: var(--info-color);
  background: rgba(49, 130, 206, 0.1);
  color: var(--info-color);
  font-weight: 600;
}

.filter-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-date-input {
  /* inherits global input styling */
  flex: 1;
  padding: 8px 10px;
  font-size: 13px;
}

.filter-date-input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

.filter-date-sep {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.filter-dropdown-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  background: var(--surface-color);
}

/* Active filter tags displayed below main header */
.active-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  background: rgba(49, 130, 206, 0.1);
  color: var(--info-color);
  font-size: 12px;
  font-weight: 600;
}

.active-filter-tag button {
  background: none;
  border: none;
  color: var(--info-color);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.active-filter-tag button:hover {
  opacity: 1;
}

@media (max-width: 768px) {
  .filter-dropdown-panel {
    width: calc(100vw - 32px);
    right: -16px;
  }
}

/* Search Status Icon */
#search-status-icon {
  color: var(--info-color);
  font-size: 16px;
  animation: pulse 1.5s infinite;
  margin-left: 4px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Section Header Enhancement */
.section-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 0;
}

/* Responsive Search */
@media (max-width: 1024px) {
  .search-container {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #processos-search {
    width: 100% !important;
  }

  .search-mode-toggle {
    min-width: unset;
  }
}

@media (max-width: 768px) {
  .section-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-container {
    order: 2;
  }

  .btn.btn-primary {
    order: 1;
    width: 100%;
  }
}

/* Similarity Badges */
.similarity-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  min-width: 40px;
}

.similarity-badge.high-similarity {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.similarity-badge.medium-similarity {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.similarity-badge.low-similarity {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Row highlighting for similarity */
tr.high-similarity {
  background-color: rgba(212, 237, 218, 0.15);
  border-left: 3px solid var(--success-color);
}

tr.medium-similarity {
  background-color: rgba(255, 243, 205, 0.15);
  border-left: 3px solid var(--warning-color);
}

tr.low-similarity {
  background-color: rgba(248, 215, 218, 0.15);
  border-left: 3px solid var(--danger-color);
}

tr.high-similarity:hover,
tr.medium-similarity:hover,
tr.low-similarity:hover {
  background-color: rgba(45, 55, 72, 0.05);
}

/* Enhanced Calendar Navigation and Responsive Design */
.month-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-color);
    border-radius: 8px;
    padding: 4px 6px;
}

.cal-nav-select {
    /* inherits global select styling */
    font-weight: 600;
    font-size: 14px;
    padding: 5px 10px 5px 8px;
    width: auto;
    line-height: 1.4;
}

.cal-nav-select:hover {
    border-color: var(--ring);
}

.cal-nav-select:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

#cal-year-select {
    width: 80px;
}

#today-btn {
    font-size: 13px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
}

/* Calendar Controls Enhancement */
.calendar-controls {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    justify-content: center;
}

.calendar-controls .btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.calendar-controls .btn:hover {
    background: var(--brand);
    color: var(--brand-foreground);
    border-color: var(--brand);
    transform: scale(1.05);
}

/* Weekend Styling — no distinct background, same as weekdays */

/* Calendar Loading State */
.calendar-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
    color: var(--text-secondary);
}

.calendar-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Calendar Responsive Design */
@media (max-width: 768px) {
    .calendar-container {
        border-radius: 8px;
    }

    .calendar-day {
        height: 70px;
        padding: 4px;
        font-size: 14px;
    }

    .calendar-day .day-number {
        font-size: 14px;
    }

    .calendar-header > div {
        padding: 8px 4px;
        font-size: 12px;
    }

    .calendar-day .event-preview {
        display: none; /* Hide event previews on mobile */
    }

    .calendar-controls {
        padding: 12px;
    }

    .calendar-controls h4 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .calendar-day {
        height: 50px;
        padding: 2px;
    }

    .calendar-day .day-number {
        font-size: 12px;
    }

    .calendar-controls h4 {
        font-size: 14px;
        min-width: 120px;
    }

    .calendar-controls .btn {
        min-width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .calendar-header > div {
        padding: 6px 2px;
        font-size: 10px;
    }
}

/* ==============================
   PLACEHOLDER CONTENT STYLES
   ============================== */
.placeholder-content {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.placeholder-content .placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.placeholder-content h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.placeholder-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.placeholder-content ul {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.placeholder-content ul li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.placeholder-content ul li:last-child {
    border-bottom: none;
}

/* ================================
   PROCESSO TABS STYLES
   ================================ */

.processo-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-button {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.tab-button .tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.35rem;
    vertical-align: -0.15em;
}

.tab-button .tab-icon svg {
    display: block;
}

.tab-button:hover {
    color: var(--primary-color);
    background: var(--surface-hover);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--surface-elevated);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ================================
   DOCUMENTS STYLES
   ================================ */

.documents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.case-document-upload-zone {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px dashed #7aa7a1;
  border-radius: 8px;
  background: #f5fbfa;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.case-document-upload-zone.drag-over {
  border-color: #0f766e;
  background: #e7f7f4;
}

.case-document-upload-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 6px;
  background: #ccfbf1;
  color: #0f766e;
  font-size: 1.2rem;
  font-weight: 800;
}

.case-document-upload-copy {
  display: grid;
  min-width: 0;
}

.case-document-upload-copy strong {
  color: var(--text-primary);
  font-size: 0.86rem;
}

.case-document-upload-copy span {
  margin-top: 0.12rem;
  color: var(--text-secondary);
  font-size: 0.74rem;
}

.case-document-upload-progress {
  margin: -0.35rem 0 1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-elevated);
}

.case-document-upload-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.74rem;
}

.case-document-progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-secondary);
}

.case-document-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
  transition: width 0.2s ease;
}

  .document-origin-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .document-origin-total {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 3rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-left-width: 3px;
    border-radius: 6px;
    background: var(--surface-elevated);
    color: var(--text-secondary);
  }

  .document-origin-total.origin-court {
    border-left-color: #2563eb;
  }

  .document-origin-total.origin-hermes {
    border-left-color: #0f766e;
  }

  .document-origin-total-icon {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--surface-secondary);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 700;
  }

  .document-origin-filter {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
  }

  .document-origin-filter-btn {
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-right: 1px solid var(--border-color);
    background: var(--surface-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
  }

  .document-origin-filter-btn:last-child {
    border-right: 0;
  }

  .document-origin-filter-btn.active {
    background: var(--text-primary);
    color: var(--surface-elevated);
  }

.documents-search {
    flex: 1;
    max-width: 400px;
}

.documents-search .form-control {
    /* Override: slightly larger padding for search field */
    padding: 0.75rem 1rem;
}

.documents-stats {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.document-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.document-item.clickable-document {
    cursor: pointer;
}

.document-item.clickable-document:hover {
    background: var(--primary-color-light);
}

.document-item.clickable-document:active {
    transform: translateY(0);
}

.document-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color-light);
    border-radius: 8px;
}

.document-details {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.document-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.document-type {
    background: var(--primary-color-light);
    color: var(--primary-color);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

  .document-origin-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border: 1px solid currentColor;
    border-radius: 4px;
    font-weight: 700;
    white-space: nowrap;
  }

  .document-origin-badge.origin-court {
    color: #1d4ed8;
    background: #eff6ff;
  }

  .document-origin-badge.origin-hermes {
    color: #0f766e;
    background: #f0fdfa;
  }

.document-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.document-action-button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
}

.document-action-button:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.document-action-button.danger:hover {
  border-color: #b42318;
  background: #fff5f4;
  color: #b42318;
}

.document-action-button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.document-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.document-actions .btn-outline-primary {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.document-actions .btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

/* ================================
   PAGINATION STYLES
   ================================ */

.pagination-nav {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.25rem;
}

.pagination li {
    display: flex;
}

.page-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--surface-elevated);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.page-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================
   RESPONSIVE DOCUMENTS
   ================================ */

@media (max-width: 768px) {
  .case-document-upload-zone {
    grid-template-columns: max-content minmax(0, 1fr);
  }

  .case-document-upload-zone .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .document-origin-summary {
    grid-template-columns: 1fr;
  }

    .documents-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .documents-search {
        max-width: none;
    }

    .document-origin-filter {
      width: 100%;
    }

    .document-origin-filter-btn {
      flex: 1;
    }

    .document-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .document-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .documento-actions {
        align-self: stretch;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ================================
   DOCUMENT LOADING OVERLAY
   ================================ */

.document-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.document-loading-overlay.show {
    opacity: 1;
}

.document-loading-overlay.hide {
    opacity: 0;
}

.document-loading-content {
    background: var(--surface-elevated);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    min-width: 320px;
    max-width: 90vw;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.document-loading-spinner {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.document-loading-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.document-loading-document {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 500;
    word-break: break-word;
}

.document-loading-message {
    font-size: 0.875rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-weight: 500;
    min-height: 1.2em;
}

.document-loading-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.document-loading-cancel:hover {
    background: var(--surface-hover);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Text utility classes */
.text-success {
    color: var(--success-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.text-info {
    color: var(--info-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-tertiary) !important;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .document-loading-overlay {
        background: rgba(0, 0, 0, 0.85);
    }

    .spinner {
        border-color: rgba(255, 255, 255, 0.2);
        border-top-color: var(--primary-color);
    }
}

/* Document Manager Styles */
.documents-view {
    width: 100%;
}

.processo-folder {
    margin-bottom: 1rem;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--surface-elevated);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.folder-header:hover {
    background: var(--surface-color);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color);
    transform: translateY(-2px);
}

.folder-icon {
    color: #d69e2e;
    transform: rotate(-90deg);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.folder-info {
    flex: 1;
    min-width: 0;
}

.folder-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-client {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-badge {
    padding: 0.35rem 0.85rem;
    background: var(--surface-color);
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.folder-content {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    padding: 0 1.25rem 0.5rem 1.25rem;
    transition: all 0.3s ease;
}

.document-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1rem;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.document-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

/* Loading Spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    border: 4px solid var(--surface-elevated);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
}
/* Context Menu */
.context-menu {
    position: absolute;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 10000;
    padding: 0.5rem 0;
    animation: contextMenuFadeIn 0.15s ease-out;
}

@keyframes contextMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
    user-select: none;
}

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

.context-menu-item svg {
    flex-shrink: 0;
}

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

.context-menu-item.context-menu-danger:hover {
    background: rgba(229, 62, 62, 0.1);
}

/* Dashboard Cards Loading Animation */
.kpi-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--card);
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--foreground);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--secondary) !important;
}

.kpi-icon svg {
    color: var(--foreground) !important;
    fill: var(--foreground) !important;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    transition: filter 0.3s ease;
}

.kpi-value.blurred {
    filter: blur(8px);
    user-select: none;
    cursor: pointer;
}

.kpi-value.blurred:hover {
    filter: blur(0);
}

.privacy-toggle {
    background: none;
    border: none;
    padding: 4px;
    margin-left: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    opacity: 0.6;
    transition: opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.privacy-toggle:hover {
    opacity: 1;
}

.privacy-toggle svg {
    width: 16px;
    height: 16px;
}

.card-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.card-loading p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Pending Actions Card Styles */
.pending-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface-color);
    border-radius: 8px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 1rem;
    border-radius: 6px;
    transition: transform 0.2s;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-item.urgent {
    background: rgba(229, 62, 62, 0.1);
    border: 1px solid rgba(229, 62, 62, 0.3);
}

.stat-item.warning {
    background: rgba(214, 158, 46, 0.1);
    border: 1px solid rgba(214, 158, 46, 0.3);
}

.stat-item.normal {
    background: rgba(56, 161, 105, 0.1);
    border: 1px solid rgba(56, 161, 105, 0.3);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pending-list {
    max-height: 300px;
    overflow-y: auto;
}

.pending-item {
    padding: 1rem;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.pending-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.pending-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.pending-item-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.pending-item-deadline {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 500;
}

.pending-item-deadline.urgent {
    background: rgba(229, 62, 62, 0.15);
    color: var(--danger-color);
}

.pending-item-deadline.warning {
    background: rgba(214, 158, 46, 0.15);
    color: var(--warning-color);
}

.pending-item-deadline.normal {
    background: rgba(56, 161, 105, 0.15);
    color: var(--success-color);
}

.pending-item-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Revenue Card Styles */
.revenue-summary {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-item {
    padding: 1rem;
    background: var(--surface-color);
    border-radius: 6px;
    border-left: 4px solid var(--border-color);
}

.summary-item.positive {
    border-left-color: var(--success-color);
}

.summary-item.negative {
    border-left-color: var(--danger-color);
}

.summary-item .summary-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.summary-item .summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-item.positive .summary-value {
    color: var(--success-color);
}

.summary-item.negative .summary-value {
    color: var(--danger-color);
}

#revenue-chart {
    margin: 1rem 0;
    max-height: 250px;
}

.chart-legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Appointments Card Styles */
.appointments-list {
    max-height: 350px;
    overflow-y: auto;
}

.appointment-item {
    padding: 1rem;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--info-color);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.appointment-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.appointment-item.upcoming {
    border-left-color: var(--warning-color);
}

.appointment-item.today {
    border-left-color: var(--danger-color);
    background: rgba(229, 62, 62, 0.05);
}

.appointment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.appointment-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.appointment-time {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.appointment-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.appointment-location {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-tertiary);
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 0.9rem;
}

/* =====================================================
   PRAZO WARNING BANNERS
   ===================================================== */

.prazo-banner {
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.prazo-expired {
    background: rgba(229, 62, 62, 0.08);
    border-left-color: #e53e3e;
}

.prazo-urgent {
    background: rgba(237, 137, 54, 0.08);
    border-left-color: #ed8936;
}

.prazo-warning {
    background: rgba(214, 158, 46, 0.08);
    border-left-color: #d69e2e;
}

.prazo-normal {
    background: rgba(56, 161, 105, 0.08);
    border-left-color: #38a169;
}

.prazo-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.prazo-banner-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.prazo-banner-title i {
    font-size: 1.1rem;
}

.prazo-expired .prazo-banner-title i { color: #e53e3e; }
.prazo-urgent .prazo-banner-title i { color: #ed8936; }
.prazo-warning .prazo-banner-title i { color: #d69e2e; }
.prazo-normal .prazo-banner-title i { color: #38a169; }

.prazo-badge {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-weight: 600;
}

.prazo-expired .prazo-badge {
    background: rgba(229, 62, 62, 0.15);
    color: #e53e3e;
}

.prazo-urgent .prazo-badge {
    background: rgba(237, 137, 54, 0.15);
    color: #ed8936;
}

.prazo-warning .prazo-badge {
    background: rgba(214, 158, 46, 0.15);
    color: #d69e2e;
}

.prazo-normal .prazo-badge {
    background: rgba(56, 161, 105, 0.15);
    color: #38a169;
}

.prazo-banner-actions .btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 0.375rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: var(--surface-color);
    border-color: var(--text-secondary);
}

.prazo-banner-body {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.prazo-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.5rem;
}

.prazo-detail {
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
}

.prazo-detail-label {
    white-space: nowrap;
    font-size: 0.82rem;
}

.prazo-detail-value {
    font-size: 0.88rem;
}

.prazo-event-ref {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.prazo-closed-section {
    margin-bottom: 1rem;
}

.prazo-closed-summary {
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-tertiary);
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.prazo-closed-summary:hover {
    color: var(--text-secondary);
}

.prazo-closed-list {
    padding: 0.5rem 0;
}

.prazo-closed-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.prazo-closed-item:last-child {
    border-bottom: none;
}

/* =====================================================
   REVAMPED DASHBOARD - Card Grid System
   ===================================================== */

/* Daily-workflow dashboard: compact metrics, then agenda, then context. */
.dashboard {
    --workspace-accent: #8C4100;
    --workspace-accent-soft: #fff0e2;
    --workspace-warning: #925800;
    --workspace-danger: #b42318;
}

html.dark .dashboard {
    --workspace-accent: #FFB36B;
    --workspace-accent-soft: #34302B;
    --workspace-warning: #fbbf24;
    --workspace-danger: #fda4af;
}

.workspace-skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 350;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--primary);
    color: var(--primary-foreground);
    transform: translateY(-150%);
}
.workspace-skip-link:focus { transform: translateY(0); }
html.workspace-native-titlebar .workspace-skip-link { top: 56px; -webkit-app-region: no-drag; app-region: no-drag; }
html.workspace-native-titlebar .workspace-skip-link:not(:focus) { transform: translateY(calc(-100% - 64px)); }
body.hermes-access-pending .workspace-skip-link { display: none; }

.nav-icon-btn:focus-visible,
.nav-text-btn:focus-visible,
.finance-privacy-toggle:focus-visible,
.dash-see-all:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}
.sidebar-menu a { touch-action: manipulation; }
.dash-see-all { display: inline-flex; align-items: center; min-height: 32px; flex-shrink: 0; }

.dash-page-heading h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.25;
    letter-spacing: 0;
}

.dash-top-row {
    display: flex;
    gap: clamp(0.65rem, 1vw, 1rem);
    align-items: stretch;
}

.dash-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 16px;
    flex: 1;
    min-width: 0;
}

.dash-financial-side {
    width: 100%;
    min-width: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.dash-financial-side #dash-financial-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: filter 0.3s ease;
}

#dash-financial-content.finance-blurred {
    filter: blur(8px);
    user-select: none;
    cursor: pointer;
}

#dash-financial-content.finance-blurred:hover {
    filter: blur(0);
}

.finance-privacy-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    padding: 8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s;
}

.finance-privacy-toggle:hover {
    color: var(--text-primary);
}

.dash-kpi {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 12px 8px;
    transition: background-color 0.15s ease;
    box-shadow: none;
    min-height: 80px;
    min-width: 0;
}

.dash-kpi[role="button"] { cursor: pointer; }
.dash-kpi[role="button"]:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.dash-deadline-item[role="button"] { cursor: pointer; }
.dash-deadline-item[role="button"]:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: -2px;
}

.dash-kpi:hover {
    background: var(--secondary);
}

.dash-kpi-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--muted-foreground);
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-kpi:nth-child(3) .dash-kpi-icon { color: var(--workspace-warning); }
.dash-kpi:nth-child(6) .dash-kpi-icon { color: var(--destructive); }

.dash-kpi-body {
    flex: 1;
    min-width: 0;
}

.dash-kpi-label {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 12px;
    line-height: 1.4;
    color: var(--muted-foreground);
    font-weight: 500;
    white-space: normal;
    overflow-wrap: anywhere;
    margin-bottom: var(--space-0-5);
}

.dash-kpi-value {
    display: block;
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--foreground);
    line-height: 1.2;
    transition: filter 0.3s ease;
}

.dash-kpi-value.blurred {
    filter: blur(8px);
    user-select: none;
    cursor: pointer;
}

.dash-kpi-value.blurred:hover {
    filter: blur(0);
}

/* 2-col grid */
.dash-grid-2col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
    gap: 24px;
}

.dash-sync-row { display: contents; }

.dash-agenda-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Shared dash-card */
.dash-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    min-width: 0;
    box-shadow: none;
}

.dash-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.dash-card-header span,
.dash-card-header h2 {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    margin: 0;
    color: var(--foreground);
}

.dash-card-header svg {
    color: var(--muted-foreground);
    opacity: 0.6;
}

.dash-see-all {
    font-size: 12px;
    color: var(--workspace-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.dash-see-all:hover {
    color: var(--workspace-accent);
    text-decoration: underline;
}

/* Financial summary grid */
.dash-finance-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: var(--space-2-5);
}

.dash-finance-item {
    padding: 16px 0;
    background: transparent;
    border-radius: 0;
    border: 0;
    min-width: 0;
}

.dash-finance-item.full-width {
    text-align: left;
    background: transparent;
    color: var(--foreground);
    border: none;
    padding: 16px 0;
}

.dash-finance-item.full-width .dash-finance-label {
    color: var(--muted-foreground);
}

.dash-finance-item.full-width .dash-finance-value {
    color: var(--foreground);
    font-size: 18px;
}

.dash-finance-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0;
    margin-bottom: 0.1rem;
}

.dash-finance-value {
    display: block;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--text-primary);
}

.dash-finance-value.positive { color: var(--workspace-accent); }
.dash-finance-value.negative { color: var(--workspace-danger); }

.dash-finance-extra {
    display: flex;
    justify-content: flex-start;
    gap: 32px;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.dash-finance-extra > div {
    text-align: left;
}

.dash-finance-extra span {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0;
}

.dash-finance-extra strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.1rem;
}

/* Mini deadline list */
.dash-mini-list {
    max-height: 280px;
    overflow-y: auto;
}

.dash-deadline-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}

.dash-deadline-item:last-child {
    border-bottom: none;
}

.dash-deadline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dash-deadline-dot.urgent { background: var(--destructive); }
.dash-deadline-dot.warning { background: var(--warning-color); }
.dash-deadline-dot.normal { background: var(--success-color); }

.dash-deadline-info {
    flex: 1;
    min-width: 0;
}

.dash-deadline-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: normal;
    overflow-wrap: anywhere;
}

.dash-deadline-processo {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: normal;
    overflow-wrap: anywhere;
}

.dash-deadline-date {
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.dash-deadline-date.urgent {
    color: var(--workspace-danger);
    background: rgba(239,68,68,.1);
}

.dash-deadline-date.warning {
    color: var(--workspace-warning);
    background: rgba(245,158,11,.1);
}

.dash-deadline-date.normal {
    color: var(--workspace-accent);
    background: var(--workspace-accent-soft);
}

/* Timeline */
.dash-timeline {
    max-height: 280px;
    overflow-y: auto;
}

.dash-timeline-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    position: relative;
}

.dash-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 30px;
    bottom: -4px;
    width: 2px;
    background: var(--border);
}

.dash-timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.78rem;
    z-index: 1;
}

.dash-timeline-icon svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.dash-timeline-icon.evento { background: rgba(119,127,136,.12); color: #52606D; }
.dash-timeline-icon.cliente { background: rgba(16,185,129,.12); color: #10b981; }
.dash-timeline-icon.processo { background: rgba(59,130,246,.12); color: #3b82f6; }
.dash-timeline-icon.despesa { background: rgba(245,158,11,.12); color: #f59e0b; }

.dash-timeline-body {
    flex: 1;
    min-width: 0;
    padding-bottom: 0.4rem;
}

.dash-timeline-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.dash-timeline-text strong {
    font-weight: 600;
}

.dash-timeline-date {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* Status distribution bars */
.dash-status-bars {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.dash-status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dash-status-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    width: clamp(180px, 24vw, 320px);
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-status-bar-bg {
    flex: 1;
    height: 24px;
    background: var(--background);
    border-radius: 6px;
    overflow: visible;
    border: 1px solid var(--border);
    position: relative;
}

.dash-status-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
    min-width: 2px;
    position: relative;
    cursor: pointer;
}

.dash-status-bar-fill::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    transform: none;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    width: max-content;
    max-width: min(420px, 70vw);
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.dash-status-bar-fill:hover::after {
    opacity: 1;
}

.dash-status-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.dash-status-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.35rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dash-status-toggle:hover {
    background: var(--background);
    color: var(--text-primary);
}

/* Empty state for dashboard cards */
.dash-empty-state {
    text-align: center;
    padding: 1.75rem 1rem;
    color: var(--text-secondary);
    font-size: 13px;
    font-style: normal;
}

@media (max-width: 768px) {
    .dashboard { flex-direction: column; gap: 0; }
    .dashboard-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 402;
        display: none;
        width: min(288px, calc(100vw - 32px));
        min-width: 0;
        height: 100dvh;
        min-height: 0;
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        border-right: 1px solid var(--border);
        border-bottom: 0;
        overflow: visible;
    }
    .dashboard-sidebar.is-open { display: flex; }
    #workspace-menu-toggle { display: inline-flex; flex-shrink: 0; }
    .sidebar-drawer-heading { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; margin-bottom: 12px; }
    .sidebar-drawer-heading h2 { font-size: 16px; margin: 0 12px; }
    #workspace-menu-close .sidebar-collapse-icon { display: none; }
    #workspace-menu-close .sidebar-dismiss-icon { display: block; }
    #workspace-menu-close { width: 44px; height: 44px; }
    #workspace-navigation-overlay:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 401; background: rgb(0 0 0 / 45%); }
    .sidebar-menu { display: block; width: auto; }
    .sidebar-menu li { margin: 0; }
    .sidebar-menu a { min-height: 44px; white-space: normal; }
    .sidebar-menu a span { white-space: normal; }
    .dashboard-main { --workspace-page-block: 20px; --workspace-page-inline: 16px; padding: var(--workspace-page-block) var(--workspace-page-inline); }
    .dash-page-heading h1 { font-size: 24px; }
    .dash-agenda-row { grid-template-columns: 1fr; }
    #eproc-check-btn { width: 36px; height: 36px; padding: 8px; gap: 0; }
    #eproc-check-btn .nav-command-label { display: none; }
}

:where(html[data-motion-reduced="true"]) {
    .dashboard-sidebar,
    .sidebar-menu a,
    .dashboard-overview,
    .dash-kpi,
    .dash-kpi-value { transition: none; }
}

/* =====================================================
   AÇÕES PENDENTES - Full SPA Tab
   ===================================================== */

.acoes-pendentes-content {
    min-width: 0;
}

.acoes-header {
    margin-bottom: 1.25rem;
}

.acoes-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
}

.acoes-toolbar {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.acoes-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    flex: 1;
    min-width: 0;
    min-height: 40px;
}

.acoes-search svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.acoes-search input {
    /* Inside search wrapper — strip global border/bg */
    border: none;
    background: transparent;
    font-size: 14px;
    width: 100%;
    min-width: 0;
    color: var(--foreground);
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}
.acoes-search input::placeholder,
#processos-search::placeholder { color: var(--muted-foreground); opacity: 1; font-style: normal; }

.acoes-search input:focus {
    border: none;
    box-shadow: none;
}

.acoes-search:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }

.acoes-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.acoes-filter-btn {
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--card);
    color: var(--text-secondary);
    font-size: 13px;
    min-height: 36px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.acoes-filter-btn:hover {
    background: var(--background);
    border-color: var(--text-secondary);
}

.acoes-filter-btn.active {
    background: var(--workspace-accent-soft);
    color: var(--workspace-accent);
    border-color: var(--workspace-accent);
}

/* Summary counters */
.acoes-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.acoes-counter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 12px 8px;
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    min-width: 0;
    cursor: pointer;
    transition: background-color .15s ease;
}

.acoes-counter:hover,
.acoes-counter:focus-visible,
.acoes-counter.active {
    background: var(--secondary);
}

.acoes-counter-num {
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1;
}

.acoes-counter.do-now .acoes-counter-num { color: var(--workspace-danger); }
.acoes-counter.review .acoes-counter-num { color: var(--workspace-warning); }

.acoes-counter-label {
    font-size: 12px;
    overflow-wrap: anywhere;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.3;
}

.acoes-counter-label small {
    font-weight: 400;
    color: var(--muted-foreground);
}

/* Full action list */
.acoes-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.acoes-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 16px 8px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.acoes-item:hover {
    background: var(--secondary);
}

.acoes-item:focus-visible,
.acoes-counter:focus-visible,
.acoes-filter-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.acoes-item-freshness { margin-top: 8px; color: var(--muted-foreground); font-size: 12px; }
.acoes-item-freshness.stale { color: var(--workspace-warning); }
.acoes-item-actions .btn-dismiss-deadline { white-space: normal; }

.acoes-item-phase { font-size: 12px; color: var(--muted-foreground); margin-top: 4px; }
.acoes-legal-issues { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.acoes-legal-issue { padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; color: var(--muted-foreground); }
.acoes-recommendations { margin-top: 8px; display: grid; gap: 6px; }
.acoes-recommendation { font-size: 13px; color: var(--muted-foreground); line-height: 1.5; }
.acoes-legal-basis { color: var(--muted-foreground); }
.acoes-risk { font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, currentColor 8%, var(--background)); }
.acoes-risk-critical { color: var(--workspace-danger); }
.acoes-risk-high { color: #9a3412; }
html.dark .acoes-risk-high { color: #fdba74; }
.acoes-risk-medium { color: var(--workspace-warning); }
.acoes-risk-low { color: var(--workspace-accent); }
.acoes-risk-neutral { color: var(--muted-foreground); }

.acoes-item-body {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.acoes-item-title {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.acoes-item-processo {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.acoes-court-badge {
    display: inline-flex;
    align-items: center;
    height: 1.35rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--card) 82%, transparent);
    color: var(--muted-foreground);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
}

.acoes-court-badge.eproc {
    border-color: color-mix(in srgb, #f59e0b 38%, var(--border));
    background: color-mix(in srgb, #f59e0b 13%, var(--card));
    color: #b45309;
}

.acoes-court-badge.pje {
    border-color: color-mix(in srgb, #0ea5e9 38%, var(--border));
    background: color-mix(in srgb, #0ea5e9 13%, var(--card));
    color: #0369a1;
}

html.dark .acoes-court-badge.eproc { color: var(--workspace-warning); }
html.dark .acoes-court-badge.pje { color: var(--info-color); }

.acoes-item-client {
    color: var(--muted-foreground);
}

.acoes-item-client::before { content: '· '; }

.acoes-item-processo a {
    color: var(--workspace-accent);
    text-decoration: none;
}

.acoes-item-processo a:hover {
    text-decoration: underline;
}

.acoes-item-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.acoes-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    flex: 0 1 240px;
    min-width: 0;
}
.acoes-item-right:not(:has(> *)) { display: none; }

.acoes-item-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.acoes-item-badge.urgent {
    background: rgba(239,68,68,.12);
    color: var(--destructive);
}

.acoes-item-badge.warning {
    background: rgba(245,158,11,.12);
    color: #f59e0b;
}

.acoes-item-badge.normal {
    background: rgba(34,197,94,.12);
    color: #22c55e;
}

.acoes-item-badge.DO_NOW { background: color-mix(in srgb, var(--workspace-danger) 8%, var(--background)); color: var(--workspace-danger); }
.acoes-item-badge.REVIEW { background: color-mix(in srgb, var(--workspace-warning) 8%, var(--background)); color: var(--workspace-warning); }

.acoes-item-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
}

.acoes-item-actions .btn {
    font-size: 12px;
    padding: 6px 10px;
    min-height: 32px;
    max-width: 100%;
}

.acoes-item-actions .btn-icon.btn-xs {
    width: 1.55rem;
    height: 1.55rem;
    min-width: 1.55rem;
    padding: 0;
    justify-content: center;
    line-height: 1;
}

.acoes-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.acoes-empty p {
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive — Dashboard KPI row */
.dash-download-status {
    margin-top: 0.6rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 0.55rem;
    background: var(--muted);
}

.dash-download-status[hidden] {
    display: none;
}

.dash-download-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.dash-download-label {
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-download-pct,
.dash-download-size {
    color: var(--muted-foreground);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.dash-download-pct {
    flex: 0 0 auto;
}

.dash-download-track {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--border-color);
}

.dash-download-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #3b82f6;
    transition: width 0.25s ease, background-color 0.2s ease;
}

.dash-download-size {
    margin-top: 0.3rem;
}

.dash-download-status[data-state="completed"] .dash-download-bar {
    background: #22c55e;
}

.dash-download-status[data-state="paused"] .dash-download-bar,
.dash-download-status[data-state="interrupted"] .dash-download-bar {
    background: #f59e0b;
}

.dash-download-status[data-state="cancelled"] .dash-download-bar {
    background: #ef4444;
}

@media (max-width: 1100px) {
    .dash-top-row {
        flex-direction: column;
    }
    .dash-financial-side {
        width: 100%;
        min-width: 0;
    }
    .dash-kpi-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .dash-grid-2col {
        grid-template-columns: 1fr !important;
    }
    .dash-status-label {
        width: 110px;
    }
    .acoes-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.chat-ai-proposals {
    flex: 0 1 auto;
    max-height: 240px;
    overflow: auto;
    border-top: 1px solid var(--border-color, #ddd);
    padding: 12px 16px;
}
.chat-ai-proposals[hidden] { display: none; }
.chat-ai-proposal { padding: 8px 0; }
.chat-ai-proposal label { display: block; font-size: 13px; }
.chat-ai-proposal textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 64px;
    max-height: 140px;
    resize: vertical;
    margin: 6px 0;
    font: inherit;
}
.chat-ai-review-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-ai-review-actions .btn { padding: 6px 10px; font-size: 13px; }

@media (max-width: 640px) {
    .dash-kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dashboard-main {
        --workspace-page-block: 1rem;
        --workspace-page-inline: 1rem;
        padding: var(--workspace-page-block) var(--workspace-page-inline);
    }
    .dash-kpi-value {
        font-size: 22px;
    }
    .acoes-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .acoes-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .acoes-filters {
        flex-wrap: wrap;
    }
    .acoes-header h1 { font-size: 24px; }
    .acoes-counter { flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 4px; }
    .acoes-item { flex-direction: column; gap: 12px; }
    .acoes-item-right { flex: none; width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
    .acoes-item-actions { flex-basis: 100%; justify-content: flex-start; }
    .acoes-item-actions .btn { min-height: 40px; }
}

/* Evidence-first case dossier */
.evidence-dossier { display: grid; gap: 1rem; color: var(--text-primary); }
.evidence-hero, .evidence-section {
    border: 1px solid var(--border-color);
    border-radius: 0.8rem;
    background: var(--card-background, var(--surface-color));
    padding: 1rem;
}
.evidence-hero { display: flex; justify-content: space-between; gap: 1rem; border-left: 5px solid #22c55e; }
.evidence-health-attention { border-left-color: #f59e0b; }
.evidence-health-critical { border-left-color: #ef4444; }
.evidence-eyebrow, .evidence-kind { text-transform: uppercase; letter-spacing: 0; font-size: .7rem; color: var(--text-secondary); }
.evidence-hero h3, .evidence-section h3 { margin: .25rem 0 .65rem; }
.evidence-hero p, .evidence-section p { margin: .25rem 0; }
.evidence-health-metrics { display: flex; gap: .65rem; flex-wrap: wrap; align-items: center; }
.evidence-health-metrics span { padding: .5rem .7rem; border-radius: .55rem; background: rgba(127,127,127,.11); font-size: .8rem; }
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.evidence-section-heading, .evidence-claim-head, .evidence-review-footer { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.evidence-filter { width: auto; min-width: 9rem; }
.evidence-change, .evidence-claim, .evidence-deadline, .evidence-alert, .evidence-timeline-row {
    padding: .75rem 0; border-top: 1px solid var(--border-color);
}
.evidence-change:first-of-type, .evidence-claim:first-of-type, .evidence-deadline:first-of-type,
.evidence-alert:first-of-type, .evidence-timeline-row:first-of-type { border-top: 0; }
.evidence-change { display: grid; grid-template-columns: 6rem minmax(12rem, 1fr) auto; gap: .75rem; align-items: center; }
.evidence-change small { display: block; color: var(--text-secondary); margin-top: .2rem; }
.evidence-claim { border-left: 3px solid #22c55e; padding-left: .75rem; }
.evidence-claim.evidence-unsupported, .evidence-claim.evidence-insufficient { border-left-color: #f59e0b; }
.evidence-claim.evidence-conflicted { border-left-color: #ef4444; }
.evidence-claim-head { color: var(--text-secondary); font-size: .75rem; }
.evidence-citations { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.evidence-citation { border: 1px solid rgba(119,127,136,.45); background: rgba(119,127,136,.1); color: var(--text-primary); border-radius: 999px; padding: .25rem .55rem; cursor: pointer; font-size: .72rem; max-width: 24rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evidence-citation:hover { background: rgba(119,127,136,.22); }
.evidence-no-source, .evidence-empty { color: var(--text-secondary); font-style: italic; font-size: .8rem; }
.evidence-timeline-row { display: grid; grid-template-columns: 10.5rem minmax(12rem, 1fr) minmax(10rem, auto); gap: .75rem; align-items: center; }
.evidence-timeline-row time { color: var(--text-secondary); font-size: .78rem; }
.evidence-timeline-row strong { display: block; margin-top: .2rem; }
.evidence-deadline { display: grid; gap: .35rem; font-size: .85rem; }
.evidence-deadline > label { justify-self: end; font-weight: 600; }
.evidence-alert { border-left: 3px solid #f59e0b; padding-left: .75rem; }
.evidence-severity-high { border-left-color: #ef4444; }
.evidence-why summary { cursor: pointer; font-size: 1rem; font-weight: 700; }
.evidence-why h4 { margin: .85rem 0 .3rem; }
.evidence-why li { margin: .25rem 0; }
.evidence-review-footer { position: sticky; bottom: .5rem; padding: .8rem 1rem; border: 1px solid var(--border-color); border-radius: .7rem; background: color-mix(in srgb, var(--background-color, #111) 88%, transparent); backdrop-filter: blur(14px); z-index: 2; }
.evidence-source-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; margin-top: .8rem; }
.evidence-source-review { display: flex; align-items: flex-start; gap: .55rem; padding: .55rem; border: 1px solid var(--border-color); border-radius: .5rem; cursor: pointer; }
.evidence-source-review input { margin-top: .2rem; }
.evidence-source-review span { min-width: 0; }
.evidence-source-review strong, .evidence-source-review small { display: block; overflow-wrap: anywhere; }
.evidence-source-review small { color: var(--text-secondary); margin-top: .15rem; }
.evidence-source-highlight { outline: 2px solid #52606D; outline-offset: 4px; transition: outline .2s; }

/* Compact provenance shown inside the AI analysis itself */
.ai-why-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin: .45rem 0 0 1.75rem;
  color: var(--text-secondary);
  font-size: .72rem;
}
.ai-why-overview { margin: .65rem 0 0; }
.ai-why-compact { margin: .35rem 0 0; min-width: 0; }
.ai-why-label { font-weight: 600; white-space: nowrap; }
.ai-why-source {
  min-width: 0;
  max-width: min(18rem, 40vw);
  padding: .1rem 0;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--primary-color) 50%, transparent);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: .72rem;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-why-source:hover { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.ai-why-more {
  white-space: nowrap;
  border: 0;
  background: transparent;
  color: var(--primary-color);
  cursor: pointer;
  font: inherit;
  font-size: .72rem;
  padding: .1rem .2rem;
}
.ai-why-source.is-hidden { display: none; }
.ai-issue-with-why { display: grid; align-content: start; min-width: min(22rem, 100%); }

@media (max-width: 900px) {
    .evidence-grid { grid-template-columns: 1fr; }
    .evidence-source-list { grid-template-columns: 1fr; }
    .evidence-hero, .evidence-review-footer { flex-direction: column; align-items: stretch; }
    .evidence-change, .evidence-timeline-row { grid-template-columns: 1fr; }
    .ai-why-panel { margin-left: 0; }
    .ai-issue-with-why { min-width: 100%; }
}

/* Blocking desktop updater surface. Because this is hosted UI, an installed
   Hermes build can show it before the replacement binary starts. */
.desktop-update-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
    background: rgb(0 0 0 / 48%);
    outline: none;
    cursor: wait;
}
.desktop-update-overlay[hidden] { display: none !important; }
.desktop-update-dialog {
    width: min(440px, 100%);
    box-sizing: border-box;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--foreground);
    box-shadow: var(--shadow-lg);
    text-align: left;
    overflow-wrap: anywhere;
}
.desktop-update-heading { display: flex; align-items: center; gap: 12px; }
.desktop-update-mark {
    display: block;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    object-fit: contain;
}
.desktop-update-dialog h2 { margin: 0; color: var(--foreground); font-size: 18px; line-height: 1.4; letter-spacing: 0; }
.desktop-update-dialog p { margin: 16px 0 20px; color: var(--muted-foreground); font-size: 14px; line-height: 1.6; }
.desktop-update-dialog small { display: block; margin-top: 12px; color: var(--muted-foreground); font-size: 12px; line-height: 1.5; }
.desktop-update-progress {
    height: 4px;
    overflow: hidden;
    border-radius: 9999px;
    background: var(--border);
}
.desktop-update-progress span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: var(--workspace-accent);
    animation: hermes-update-progress 1.15s ease-in-out infinite;
}
body.desktop-update-blocked { overflow: hidden !important; }
@keyframes hermes-update-progress {
    0% { transform: translateX(-115%); }
    55% { transform: translateX(90%); }
    100% { transform: translateX(245%); }
}
:where(html[data-motion-reduced="true"]) {
    .desktop-update-progress span { animation-duration: 2.4s; }
}

/* Mixed monetary and non-cash revenue settlements */
.receita-recebimentos-section {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

.receita-recebimentos-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.receita-recebimentos-heading h4,
.receita-recebimentos-heading p {
    margin: 0;
}

.receita-recebimentos-heading p {
    margin-top: var(--space-1);
    color: var(--muted-foreground);
    font-size: var(--text-sm);
}

.receita-recebimentos-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.receita-recebimentos-summary article {
    min-width: 0;
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--secondary);
}

.receita-recebimentos-summary small,
.receita-recebimentos-summary strong {
    display: block;
}

.receita-recebimentos-summary small {
    color: var(--muted-foreground);
    font-size: var(--text-xs);
}

.receita-recebimentos-summary strong {
    margin-top: var(--space-1);
    overflow: hidden;
    font-size: var(--text-base);
    text-overflow: ellipsis;
}

.receita-recebimentos-list {
    display: grid;
    gap: var(--space-2);
}

.recebimento-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
}

.recebimento-row.is-cancelled {
    opacity: .62;
}

.recebimento-row-main,
.recebimento-row-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.recebimento-row-main {
    min-width: 0;
}

.recebimento-row-main div {
    min-width: 0;
}

.recebimento-row-main strong,
.recebimento-row-main small {
    display: block;
}

.recebimento-row-main small,
.receita-progress-detail {
    color: var(--muted-foreground);
    font-size: var(--text-xs);
}

.receita-progress-detail {
    display: block;
    margin-top: var(--space-1);
}

.recebimento-kind {
    flex: 0 0 auto;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

.recebimento-kind.cash {
    background: color-mix(in srgb, var(--success-color) 14%, transparent);
    color: var(--success-color);
}

.recebimento-kind.asset {
    background: color-mix(in srgb, var(--info-color) 14%, transparent);
    color: var(--info-color);
}

.recebimento-form {
    margin-top: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--secondary);
}

.recebimento-form-grid,
.recebimento-asset-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.recebimento-asset-fields {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

.recebimento-form label {
    display: grid;
    gap: var(--space-1);
    color: var(--foreground);
    font-size: var(--text-sm);
    font-weight: 600;
}

.recebimento-form input,
.recebimento-form select,
.recebimento-form textarea {
    width: 100%;
    box-sizing: border-box;
}

.recebimento-observacoes {
    margin-top: var(--space-3);
}

.recebimento-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.recebimento-excess-warning {
    margin: calc(var(--space-2) * -1) 0 var(--space-4);
    padding: var(--space-2) var(--space-3);
    border: 1px solid color-mix(in srgb, var(--warning-color) 45%, var(--border));
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--warning-color) 10%, transparent);
    color: var(--warning-color);
    font-size: var(--text-sm);
}

@media (max-width: 900px) {
    .receita-recebimentos-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .receita-recebimentos-heading,
    .recebimento-row {
        align-items: stretch;
        flex-direction: column;
    }

    .recebimento-row-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .receita-recebimentos-summary,
    .recebimento-form-grid,
    .recebimento-asset-fields {
        grid-template-columns: 1fr;
    }
}
.ws-knowledge-row { padding: 12px 0; border-bottom: 1px solid #ddd; overflow-wrap: anywhere; }
.ws-knowledge-row p { white-space: pre-wrap; margin: 8px 0; }
.ws-knowledge-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#ws-knowledge-section { margin-top: 24px; min-width: 0; }
#ws-knowledge-form { display: grid; gap: 12px; }
#ws-knowledge-form label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#ws-knowledge-form input:not([type="hidden"]), #ws-knowledge-form textarea {
    width: 100%; box-sizing: border-box; min-height: 40px; padding: 8px 10px;
    border: 1px solid #d1d5db; border-radius: 6px; font: inherit; font-size: 14px;
}
#ws-knowledge-form button { justify-self: start; }
.chat-ai-proposal small { display: block; overflow-wrap: anywhere; }
.chat-intake-requests { flex-shrink: 0; border-top: 1px solid #ddd; padding: 8px 16px; font-size: 13px; }
.chat-intake-requests[hidden] { display: none; }
.chat-intake-requests summary { cursor: pointer; }
.chat-intake-list { max-height: min(420px, 50vh); overflow-y: auto; }
.chat-intake-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; }
.chat-intake-row span { overflow-wrap: anywhere; min-width: 0; }
.chat-booking { flex-basis: 100%; min-width: 0; }
.chat-booking form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; padding: 8px 0; }
.chat-booking label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 160px; min-width: 0; font-size: 12px; }
.chat-booking input { width: 100%; min-width: 0; box-sizing: border-box; padding: 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 12px; }
.chat-booking button { white-space: normal; max-width: 100%; }
.chat-booking select { width: 100%; min-width: 0; padding: 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 12px; }
.chat-booking input[type="checkbox"] { width: 16px; height: 16px; }
.chat-booking .chat-asset-review { flex-direction: row; align-items: center; flex-basis: 100%; }
#ws-access-section { margin-top: 24px; min-width: 0; }
#ws-access-section[hidden] { display: none; }
.ws-access-searches, .ws-access-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.ws-access-searches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ws-access-forms form { display: grid; gap: 12px; align-content: start; min-width: 0; }
#ws-access-section label { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 14px; }
#ws-access-section input:not([type="checkbox"]), #ws-access-section select, #ws-access-section textarea {
    width: 100%; min-height: 40px; box-sizing: border-box; padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit;
}
#ws-access-section textarea { resize: vertical; }
#ws-access-section .ws-access-check { flex-direction: row; align-items: start; }
.ws-access-forms button { justify-self: start; }
.ws-access-record { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; border-top: 1px solid #ddd; padding: 12px 0; font-size: 13px; }
.ws-access-record span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .ws-access-searches, .ws-access-forms { grid-template-columns: minmax(0, 1fr); } }

/* Finance and document library inherit the daily workspace's flat surfaces. */
#billing-content, #documentos-content { min-width: 0; width: 100%; letter-spacing: 0; }
#billing-content .finance-page-head, #documentos-content .workspace-heading {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 20px;
}
#billing-content .finance-page-head h1, #documentos-content .workspace-heading h1 {
  margin: 0; font-size: 26px; line-height: 1.25; letter-spacing: 0; color: var(--foreground); text-transform: none; text-align: left;
}
#billing-content .finance-page-controls, #billing-content .finance-custom-period { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
#billing-content .finance-page-controls > *, #billing-content .finance-custom-period > * { max-width: 100%; min-width: 0; }
#billing-content .card, #billing-content .finance-chart-card {
  background: transparent; border: 0; box-shadow: none; border-radius: 0; padding: 0; min-width: 0; overflow: visible;
}
#billing-content .card-body { padding: 0; min-width: 0; }
#billing-content .card-header { padding: 0 0 12px; background: transparent; border: 0; }
#billing-content .card-title { font-size: 15px; }
#billing-content .finance-overview-panel { margin: 0 0 24px; }
#billing-content .finance-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 16px; }
#billing-content .finance-kpi-card { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; background: transparent; padding: 12px 8px; min-width: 0; }
#billing-content .finance-kpi-card::before { display: none; }
#billing-content .finance-kpi-card .stat-number { font-size: 22px; line-height: 1.3; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
#billing-content .finance-kpi-card .stat-label, #billing-content .finance-kpi-sub { font-size: 12px; overflow-wrap: anywhere; }
#billing-content .finance-kpi-warning .stat-number { color: var(--workspace-warning); }
#billing-content .text-success { color: var(--workspace-accent); }
#billing-content .text-danger { color: var(--workspace-danger); }
#billing-content .stat-number.text-success { color: var(--workspace-accent); }
#billing-content .stat-number.text-danger { color: var(--workspace-danger); }
#billing-content .finance-chart-head { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 8px; }
#billing-content .finance-chart-head strong { font-size: 15px; }
#billing-content .finance-chart-head span { font-size: 12px; }
#billing-content .finance-chart-bucket { min-width: 0; }
#billing-content .finance-chart-bucket small { font-size: 10px; white-space: nowrap; }
#billing-content .finance-bar { border-radius: 2px 2px 0 0; }
#billing-content .finance-bar.receita { background: var(--workspace-accent); }
#billing-content .finance-bar.despesa { background: var(--workspace-danger); }
#billing-content .finance-tab-action-row { flex-wrap: wrap; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
#billing-content .finance-tabs { min-width: 0; border: 0; flex-wrap: wrap; gap: 4px; }
#billing-content .finance-tabs .tab-link { padding: 8px 12px; font-size: 14px; border-radius: 6px; border: 0; color: var(--muted-foreground); }
#billing-content .finance-tabs .tab-link.active { background: var(--workspace-accent-soft); color: var(--workspace-accent); }
#billing-content .finance-actions { justify-content: flex-start; gap: 8px; }
#billing-content .finance-toolbar { gap: 8px; margin-bottom: 12px; }
#billing-content .finance-toolbar input:first-child { flex: 1 1 200px; min-width: 0; }
#billing-content .finance-toolbar .filter-select, #billing-content .finance-toolbar input:not(:first-child) { flex: 1 1 140px; min-width: 0; }
#billing-content input, #billing-content select, #documentos-content input {
  height: 38px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--foreground); padding: 8px 10px; font-size: 14px;
}
#billing-content input::placeholder, #documentos-content input::placeholder { color: var(--muted-foreground); opacity: 1; font-style: normal; }
#billing-content .finance-toolbar button { border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--foreground); }
#billing-content .btn, #documentos-content .btn { min-height: 36px; max-width: 100%; border-radius: 6px; font-size: 13px; white-space: normal; }
#billing-content .btn svg, #documentos-content svg { width: 16px; height: 16px; flex-shrink: 0; vertical-align: middle; }
#billing-content .finance-table-wrap { width: 100%; min-width: 0; max-height: none; min-height: 220px; overflow: auto; border: 0; border-top: 1px solid var(--border); border-radius: 0; scrollbar-width: thin; scrollbar-color: var(--muted-foreground) var(--background); }
#billing-content .finance-table-wrap .table { min-width: 1000px; table-layout: fixed; font-variant-numeric: tabular-nums; }
#billing-content #resumo-content .table { min-width: 850px; }
#billing-content .table th, #documentos-content .table th { font-size: 12px; letter-spacing: 0; text-transform: none; background: var(--secondary); color: var(--foreground); }
#billing-content .table td, #documentos-content .table td { padding: 10px 12px; font-size: 13px; height: auto; max-height: none; overflow-wrap: anywhere; }
#billing-content .status-badge { font-size: 12px; padding: 3px 6px; border-radius: 4px; background: var(--secondary); color: var(--foreground); }
#billing-content .status-recebido, #billing-content .status-pago { background: var(--workspace-accent-soft); color: var(--workspace-accent); }
#billing-content .status-pendente { background: var(--secondary); color: var(--workspace-warning); }
#billing-content .finance-secondary-kpis { gap: 12px; }
#billing-content .finance-secondary-kpis > div, #billing-content .finance-summary-explain > div { background: transparent; border: 0; border-radius: 0; padding: 12px 0; box-shadow: none; border-bottom: 1px solid var(--border); min-width: 0; overflow-wrap: anywhere; }
#billing-content .finance-secondary-kpis strong { font-size: 20px; }
#billing-content .finance-secondary-kpis span, #billing-content .finance-secondary-kpis small { font-size: 12px; }
#billing-content .finance-summary-explain h4 { font-size: 15px; }
#documentos-content { overflow: visible; gap: 0; }
#documentos-content .workspace-type-switch { display: flex; flex-wrap: wrap; overflow: visible; gap: 4px; padding: 0 0 16px; margin: 0; }
#documentos-content .workspace-type-option { flex: 0 1 auto; min-width: 0; width: auto; padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; box-shadow: none; font-size: 13px; color: var(--muted-foreground); }
#documentos-content .workspace-type-option.active { background: var(--workspace-accent-soft); color: var(--workspace-accent); }
#documentos-content .workspace-toolbar { margin-bottom: 12px; }
#documentos-content .workspace-toolbar-main { display: flex; flex-wrap: wrap; width: 100%; gap: 12px; min-width: 0; }
#documentos-content .document-search-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 300px; min-width: 0; }
#documentos-content .search-container { flex: 1 1 200px !important; min-width: 0; }
#search-documents { width: 100%; }
#documentos-content .document-scope-selector { flex: 0 1 auto; padding: 3px; background: var(--secondary); border: 0; border-radius: 6px; }
#documentos-content .document-scope-option { padding: 8px 10px; min-height: 36px; border-radius: 4px; font-size: 13px; }
#documentos-content .document-scope-option.active { box-shadow: none; }
#documentos-content #document-mode-toggle { max-width: 100%; }
#documentos-content .doc-view-toggle { min-height: 32px; font-size: 13px !important; }
.document-location-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; padding: 8px 0 12px; font-size: 13px; overflow-wrap: anywhere; }
#documentos-content > .table-container { min-height: 300px; max-height: none; border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; background: transparent; overflow: visible; }
#documents-explorer-content { width: 100%; height: auto; min-height: 300px; max-height: 65vh; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--muted-foreground) var(--background); }
#documents-explorer-content .table { min-width: 780px; table-layout: fixed; font-variant-numeric: tabular-nums; }
#documents-explorer-content .document-folder-table { min-width: 720px; }
#documentos-content .folder-type-mark { background: var(--secondary); color: var(--muted-foreground); width: 32px; height: 32px; border-radius: 6px; }
#documentos-content .document-folder-row td:first-child { border-left: 0; }
#documentos-content .folder-name { font-size: 14px; }
#documentos-content .folder-type-label, #documentos-content .folder-subject { font-size: 12px; }
#documentos-content .loose-documents-shell { min-height: 300px; padding: 0; }
#documentos-content .loose-explorer-toolbar { flex-wrap: wrap; background: transparent; padding: 12px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
#documentos-content .loose-explorer-nav { flex: 1 1 220px; }
#documentos-content .loose-explorer-canvas { min-width: 0; min-height: 220px; padding: 0; border: 0; border-radius: 0; background: transparent; }
#documentos-content .loose-explorer-actions { flex-wrap: wrap; flex-shrink: 1; gap: 8px; }
#documentos-content .loose-path-pill { min-width: 0; max-width: 100%; border-radius: 6px; background: var(--secondary); }
#documentos-content .loose-path-pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#documentos-content .loose-nav-btn { min-width: 32px; border-radius: 6px; }
#documentos-content .loose-folder-grid { grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: 12px; }
#documentos-content .loose-folder-card { min-width: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--card); box-shadow: none; padding: 12px; }
#documentos-content .loose-folder-card strong { font-size: 14px; overflow-wrap: anywhere; }
#documentos-content .loose-folder-card small { font-size: 12px; }
#documentos-content .loose-drop-empty { min-height: 220px; border-radius: 6px; }
.workspace-load-feedback, .workspace-load-error { padding: 20px 0; }
.workspace-load-status { color: var(--muted-foreground); font-size: 13px; padding: 8px 0; }
.workspace-load-error p { font-size: 14px; margin: 0 0 12px; color: var(--foreground); }
.workspace-skeleton { display: grid; gap: 16px; padding: 16px 0; }
.workspace-skeleton span { display: block; width: 100%; height: 16px; border-radius: 4px; background: var(--secondary); animation: workspace-skeleton-pulse 1400ms ease-in-out infinite alternate; }
.workspace-skeleton span:nth-child(even) { width: 75%; }
@keyframes workspace-skeleton-pulse { to { opacity: .45; } }
#billing-content :is(button, a, input, select, [tabindex]):focus-visible,
#documentos-content :is(button, a, input, select, [tabindex]):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
@media (max-width: 1100px) {
  #billing-content .finance-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #billing-content .finance-secondary-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  #documentos-content .loose-explorer-nav { flex: 0 1 auto; }
}
@media (max-width: 768px) {
  #billing-content .finance-page-head h1, #documentos-content .workspace-heading h1 { font-size: 24px; }
  #billing-content .finance-page-controls { width: 100%; }
  #billing-content .finance-page-controls > * { flex: 1 1 130px; }
  #billing-content .finance-actions { width: 100%; }
  #billing-content .finance-toolbar { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
  #billing-content .finance-toolbar > * { width: 100%; min-width: 0; margin: 0; order: 0; grid-column: span 6; }
  #billing-content .finance-toolbar input:first-child { grid-column: span 10; }
  #billing-content .finance-toolbar button { grid-column: span 2; }
  #documentos-content .workspace-heading { align-items: flex-start; }
  #documentos-content .workspace-heading > div { width: 100%; text-align: left; }
  #billing-content .finance-secondary-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #billing-content .finance-summary-explain { grid-template-columns: minmax(0, 1fr); }
  #documentos-content .workspace-toolbar-main, #documentos-content .document-search-controls { flex-basis: 100%; }
  #documentos-content .document-scope-selector { width: auto; max-width: 100%; }
}
@media (max-width: 600px) {
  #billing-content .finance-chart-bucket:nth-child(even) small { visibility: hidden; }
}
:where(html[data-motion-reduced="true"]) {
  .workspace-skeleton span { animation: none; }
}

/* Scoped form dialogs; the application and editor's other overlays are untouched. */
.workspace-dialog {
  --workspace-accent: #8C4100; --workspace-accent-soft: #fff0e2; --workspace-danger: #b42318;
  position: fixed !important; inset: 0 !important; height: 100dvh; box-sizing: border-box;
  display: flex !important; align-items: center !important; justify-content: center !important;
  padding: 16px !important; background: rgba(0, 0, 0, .45) !important; overscroll-behavior: contain;
  backdrop-filter: none !important;
}
.dark .workspace-dialog { --workspace-accent: #FFB36B; --workspace-accent-soft: #34302B; --workspace-danger: #fda4af; }
.workspace-dialog-panel {
  box-sizing: border-box; width: min(760px, 100%) !important; max-width: 760px !important;
  max-height: calc(100dvh - 32px) !important; min-width: 0; padding: 20px !important;
  display: block !important; overflow: auto !important; overscroll-behavior: contain;
  background: var(--card) !important; color: var(--foreground); border: 1px solid var(--border);
  border-radius: 8px !important; box-shadow: none !important; letter-spacing: 0;
  scrollbar-width: thin; scrollbar-color: var(--muted-foreground) var(--card);
}
#create-category-modal .workspace-dialog-panel, #move-doc-modal .workspace-dialog-panel, #rename-doc-modal .workspace-dialog-panel { max-width: 440px !important; }
.workspace-dialog h3 { font-size: 18px !important; line-height: 1.4; letter-spacing: 0; font-weight: 600; color: var(--foreground) !important; overflow-wrap: anywhere; }
.workspace-dialog h4 { font-size: 15px; line-height: 1.4; }
.workspace-dialog p, .workspace-dialog small { font-size: 12px; color: var(--muted-foreground); overflow-wrap: anywhere; }
.workspace-dialog label, .workspace-dialog label > span { font-size: 12px !important; line-height: 1.5; letter-spacing: 0 !important; text-transform: none !important; color: var(--foreground) !important; }
.workspace-dialog label { margin-bottom: 6px !important; }
.workspace-dialog input:not([type="hidden"]):not([type="checkbox"]), .workspace-dialog select, .workspace-dialog textarea {
  box-sizing: border-box; min-width: 0; max-width: 100%; width: 100%; min-height: 38px;
  border: 1px solid var(--border) !important; border-radius: 6px !important;
  background: var(--card) !important; color: var(--foreground) !important;
  padding: 8px 10px !important; font: inherit; font-size: 14px !important; letter-spacing: 0;
}
.workspace-dialog textarea { resize: vertical; }
.workspace-dialog input::placeholder, .workspace-dialog textarea::placeholder { color: var(--muted-foreground); opacity: 1; font-style: normal; }
.workspace-dialog input[type="file"] { height: auto; min-height: 44px; }
.workspace-dialog input:disabled, .workspace-dialog select:disabled, .workspace-dialog textarea:disabled { opacity: .7; }
.workspace-dialog .btn { min-height: 36px; max-width: 100%; padding: 8px 12px; border-radius: 6px; font-size: 13px; white-space: normal; }
.workspace-dialog button.btn { width: auto; }
.workspace-dialog svg { width: 16px; height: 16px; flex-shrink: 0; vertical-align: middle; }
.workspace-dialog .dialog-close { width: 32px; min-width: 32px; height: 32px; padding: 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--muted-foreground); }
.workspace-dialog .dialog-field-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px !important; }
.workspace-dialog .dialog-field-grid > div { min-width: 0; }
.workspace-dialog .dialog-field-wide { grid-column: 1 / -1; }
.workspace-dialog .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px !important; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 20px !important; }
.workspace-dialog .dialog-actions > button { width: auto; flex: 0 1 auto; }
.workspace-dialog .dialog-feedback { font-size: 13px; line-height: 1.5; margin: 0 0 16px; padding: 8px 0; color: var(--muted-foreground); overflow-wrap: anywhere; }
.workspace-dialog .dialog-feedback[role="alert"], .workspace-dialog .dialog-field-feedback[role="alert"] { color: var(--workspace-danger); }
.workspace-dialog .dialog-field-feedback { font-size: 12px; padding-top: 6px; line-height: 1.5; }
.workspace-dialog [hidden] { display: none !important; }
.workspace-dialog :is(button, a, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.workspace-dialog .receita-recebimentos-section { padding-top: 20px; margin-top: 24px; border-top: 1px solid var(--border); }
.workspace-dialog .receita-recebimentos-heading { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.workspace-dialog .receita-recebimentos-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.workspace-dialog .receita-recebimentos-summary article { min-width: 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; border-radius: 0; padding: 8px 0; }
.workspace-dialog .receita-recebimentos-summary strong { font-size: 18px; overflow-wrap: anywhere; }
.workspace-dialog .recebimento-row { border-radius: 6px; background: transparent; border: 1px solid var(--border); box-shadow: none; padding: 12px; }
.workspace-dialog .recebimento-row-main, .workspace-dialog .recebimento-row-actions { flex-wrap: wrap; gap: 8px; min-width: 0; }
.workspace-dialog .recebimento-row-main > div { min-width: 0; overflow-wrap: anywhere; }
.workspace-dialog .recebimento-form, .workspace-dialog .recebimento-asset-fields { background: transparent; border: 0; border-radius: 0; padding: 12px 0; }
.workspace-dialog .recebimento-form-grid, .workspace-dialog .recebimento-asset-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
#upload-document-modal .workspace-dialog-panel { padding: 0 !important; }
#upload-document-modal .workspace-dialog-panel > div { padding: 16px !important; min-width: 0; }
#upload-document-modal .workspace-dialog-panel > .dialog-feedback { padding: 0 16px 12px !important; margin: 0; }
#upload-document-modal .workspace-dialog-panel > div:first-child { align-items: center !important; }
#upload-document-modal .workspace-dialog-panel > div:last-child { position: sticky; bottom: 0; background: var(--card); display: flex; flex-wrap: wrap; gap: 8px !important; }
#upload-document-modal .workspace-dialog-panel > div:last-child button { width: auto; }
#upload-document-process-list { border-radius: 6px !important; background: transparent !important; }
#upload-document-process-list button { min-width: 0; }
#upload-document-process-list button strong, #upload-document-process-list button span { max-width: 100%; overflow-wrap: anywhere; white-space: normal !important; }
#upload-document-selected-process { background: var(--workspace-accent-soft) !important; border: 0 !important; border-radius: 6px !important; overflow-wrap: anywhere; }
#upload-document-file-list { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .workspace-dialog { padding: 12px !important; }
  .workspace-dialog-panel { padding: 16px !important; max-height: calc(100dvh - 24px) !important; }
  .workspace-dialog .dialog-field-grid, .workspace-dialog .recebimento-form-grid, .workspace-dialog .recebimento-asset-fields { grid-template-columns: minmax(0, 1fr); }
  .workspace-dialog .receita-recebimentos-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
:where(html[data-motion-reduced="true"]) {
  .workspace-dialog *, .workspace-dialog *::before, .workspace-dialog *::after { animation: none !important; transition: none !important; }
}

/* GUTTO identity accents; status colors retain their semantic meaning. */
:root, .workspace-dialog {
  --workspace-accent: #8C4100;
  --workspace-accent-soft: #fff0e2;
}
html.dark, html.dark .workspace-dialog {
  --workspace-accent: #FFB36B;
  --workspace-accent-soft: #34302B;
  --secondary: #2B3137;
  --muted: #2B3137;
  --accent: #2B3137;
  --popover: #1F2429;
}
::selection { background: #FFB36B; color: #1F2429; }
input, textarea, [contenteditable="true"] { caret-color: var(--workspace-accent); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
html { scrollbar-color: #777F88 var(--background); }
.btn-primary:hover { color: var(--primary-foreground); }
.nav-text-btn { color: var(--workspace-accent); }
.nav-text-btn:hover { color: var(--brand-foreground); }
.sidebar-menu a:hover { color: var(--workspace-accent); }
#firm-brand[data-product-brand="false"] { color: var(--foreground); }
.firm-brand-mark, .firm-branding-preview-mark { background: #18181b; color: #fafafa; }
html.dark :is(.firm-brand-mark, .firm-branding-preview-mark) { background: #fafafa; color: #09090b; }
#processos-content .filter-count-badge { color: var(--foreground); background: var(--workspace-accent-soft); }
.dash-finance-value.positive, .acoes-risk-low,
#calendar-content .btn-xs.btn-success,
#billing-content .text-success, #billing-content .stat-number.text-success { color: var(--success-color); }
#billing-content .finance-bar.receita { background: var(--success-color); }
#billing-content .status-recebido, #billing-content .status-pago {
  color: var(--success-color);
  background: color-mix(in srgb, var(--success-color) 12%, var(--card));
}
/* Case integrity remains visible independently of the selected detail tab. */
.processo-readiness {
    min-width: 0;
    padding: 16px 0;
    border-block: 1px solid var(--border-color);
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.processo-readiness:empty { display: none; }
.processo-readiness h2, .readiness-provisional h3 { font-size: 1.125rem; margin: 0 0 8px; }
.processo-readiness p, .readiness-dialog-body p { margin: 8px 0; }
.readiness-documents {
    max-height: 280px;
    overflow: auto;
    padding: 0;
    margin: 8px 0;
    list-style: none;
    scrollbar-color: var(--text-secondary) var(--surface-elevated);
}
.readiness-documents li { padding: 12px 4px; border-bottom: 1px solid var(--border-color); }
.readiness-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.case-identity-review { margin-top: 6px; font-size: .8125rem; }
.case-identity-review summary { display: inline-block; cursor: pointer; color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 6px; padding: 3px 8px; background: var(--surface-color); }
.case-identity-review summary:hover { border-color: var(--text-secondary); }
.case-identity-review summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.case-identity-review p { max-width: 52ch; margin: 8px 0 0; color: var(--text-secondary); font-size: .8125rem; overflow-wrap: anywhere; }
.readiness-summary h2 { font-size: 1rem; margin: 0; }
.readiness-summary p { margin: 4px 0 0; font-size: .875rem; }
.readiness-caption, .readiness-secondary, .readiness-technical { color: var(--text-secondary); font-size: .8125rem; }
.readiness-summary .readiness-caption { margin-top: 6px; }
.readiness-document-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; font-size: .875rem; }
.readiness-document-heading strong { min-width: 0; font-weight: 500; }
.readiness-state { flex: none; font-size: .75rem; color: var(--text-secondary); }
.readiness-state[data-state="failed"], .readiness-state[data-state="missing"] { color: var(--text-primary); font-weight: 600; }
.readiness-disclosure { border-top: 1px solid var(--border-color); margin-top: 12px; padding-top: 8px; }
.readiness-disclosure summary { width: fit-content; max-width: 100%; cursor: pointer; padding: 6px 0; font-size: .8125rem; color: var(--text-secondary); }
.readiness-disclosure summary span { margin-left: 6px; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.readiness-disclosure summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 4px; }
.readiness-secondary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.readiness-secondary .btn { font-size: .8125rem; }
.readiness-issues { font-size: .8125rem; padding-left: 20px; }
.readiness-issues li { padding-block: 4px; }
.readiness-issues code { display: inline-block; max-width: 100%; overflow-wrap: anywhere; font-size: .75rem; color: var(--text-secondary); }
.readiness-feedback:empty { display: none; }
@media (max-width: 640px) {
    .readiness-summary { align-items: stretch; flex-direction: column; gap: 12px; }
    .readiness-document-heading { flex-direction: column; gap: 4px; }
}
.readiness-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.readiness-actions .btn, .readiness-documents .btn { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
.readiness-provisional { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-color); }
#processo-readiness-dialog .workspace-dialog-panel { width: min(680px, calc(100% - 24px)); min-width: 0; }
#processo-readiness-dialog h2 { font-size: 20px; margin: 0 0 12px; }
#processo-readiness-dialog footer { background: transparent; color: inherit; margin: 0; padding: 16px 0 0; border-top: 1px solid var(--border-color); }
.readiness-dialog-body { min-height: 0; overflow: auto; overflow-wrap: anywhere; padding-block: 12px; }
.readiness-dialog-body input[type="file"] { display: block; max-width: 100%; min-width: 0; margin-block: 12px; }
.readiness-identity { display: flex; align-items: flex-start; gap: 8px; margin-block: 16px; }
.readiness-identity input { flex: none; margin-top: 4px; }
/* The licensed variable Inter used by the design lab, available offline. */
@font-face {font-family:'Inter';src:url('../assets/fonts/InterVariable.woff2') format('woff2');font-weight:100 900;font-style:normal;font-display:swap;}

/* Other-party or unconfirmed deadlines are reference information, not a safe/urgent user obligation. */
.prazo-banner.prazo-reference{background:var(--card);border-left-color:var(--border)}
.prazo-reference .prazo-badge{background:var(--muted);color:var(--foreground)}
.guto-recipient-dialog { margin: auto; width: min(34rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; border: 1px solid var(--border-color, #41484f); border-radius: 12px; padding: 24px; background: var(--bg-secondary, #1f2429); color: var(--text-primary, #fafafa); }
.guto-recipient-dialog::backdrop { background: rgb(0 0 0 / .4); }
.guto-recipient-dialog form { display: flex; flex-direction: column; gap: 14px; }
.guto-recipient-dialog h2 { font-size: 1.2rem; margin: 0; }
.guto-recipient-dialog .recipient-save { color: var(--workspace-accent, #8c4100); font-weight: 600; }
.guto-recipient-dialog .recipient-context { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px 14px; padding: 14px 0; border-block: 1px solid var(--border); }
.guto-recipient-dialog .recipient-context dt { color: var(--muted-foreground); }
.guto-recipient-dialog .recipient-context dd { margin: 0; overflow-wrap: anywhere; }
.guto-recipient-dialog p { margin: 0; line-height: 1.5; }
.guto-recipient-dialog fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; }
.guto-recipient-dialog legend { font-weight: 600; margin-bottom: 12px; }
.guto-recipient-dialog fieldset label { display: flex; gap: 10px; align-items: start; }
.guto-recipient-dialog input[type=radio] { margin-top: 4px; accent-color: var(--primary-color, #ff7a00); }
.guto-recipient-dialog textarea { width: 100%; min-height: 6rem; padding: 10px; border: 1px solid var(--border-color, #41484f); border-radius: 8px; background: var(--bg-primary, #171b1f); color: inherit; font: inherit; }
.guto-recipient-dialog [hidden] { display: none !important; }
.guto-recipient-dialog .legal-sources { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.guto-recipient-dialog summary { cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.guto-recipient-dialog .legal-sources .btn { display: block; margin-top: 8px; max-width: 100%; white-space: normal; text-align: left; }
.guto-recipient-dialog .legal-choice-fields { display: grid; gap: 16px; margin-block: 16px; }
.guto-recipient-dialog .legal-field { display: grid; gap: 6px; min-width: 0; }
.guto-recipient-dialog .legal-field label { font-weight: 600; line-height: 1.45; }
.guto-recipient-dialog .legal-field input, .guto-recipient-dialog .legal-field select,
.guto-recipient-dialog .legal-document-picker input[type=search] { width: 100%; min-width: 0; min-height: 42px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-primary); color: var(--foreground); font: inherit; }
.guto-recipient-dialog .legal-field select { appearance: auto; background-image: none; }
.guto-recipient-dialog .legal-document-picker { padding-block: 12px; border-block: 1px solid var(--border); }
.guto-recipient-dialog .legal-document-picker > * + * { margin-top: 12px; }
.guto-recipient-dialog .legal-document-list { display: grid; gap: 10px; max-height: 15rem; overflow: auto; }
.guto-recipient-dialog .legal-document-row { display: flex; align-items: start; gap: 8px; }
.guto-recipient-dialog .legal-document-row label { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-wrap: anywhere; }
.guto-recipient-dialog input[type=checkbox] { flex: none; margin-top: 4px; accent-color: var(--primary); }
.guto-recipient-dialog .legal-field-help { color: var(--muted-foreground); font-size: .875rem; line-height: 1.5; margin-block: 12px; }
.guto-recipient-dialog .recipient-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; position: sticky; bottom: -24px; padding-block: 14px; background: var(--bg-secondary); border-top: 1px solid var(--border); }
.guto-recipient-dialog .recipient-dialog-actions .btn { min-height: 40px; white-space: normal; }
.guto-recipient-dialog .recipient-dialog-feedback { flex-basis: 100%; overflow-wrap: anywhere; }
.guto-recipient-dialog .recipient-dialog-feedback:empty { display: none; }
.guto-legal-dialog { width: min(42rem, calc(100vw - 2rem)); }
.guto-legal-dialog .recipient-dialog-heading { position: sticky; top: -24px; z-index: 1; background: var(--bg-secondary); padding-block: 12px; border-bottom: 1px solid var(--border); }
.guto-legal-dialog .recipient-dialog-heading p { margin-top: 6px; font-size: .875rem; color: var(--muted-foreground); }
.guto-legal-dialog .legal-choice-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.guto-legal-dialog .legal-field-wide { grid-column: 1 / -1; }
.guto-legal-dialog input,.guto-legal-dialog textarea,.guto-legal-dialog select { scroll-margin-block: 96px; }
@media (max-width: 480px) { .guto-recipient-dialog { padding: 18px; } .guto-recipient-dialog .recipient-dialog-actions { bottom: -18px; } }
@media (max-width: 640px) { .guto-legal-dialog .legal-choice-fields { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .guto-legal-dialog .recipient-dialog-heading { top: -18px; } }
