:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 10px 24px rgba(2, 6, 23, 0.08);
  --primary: #2563eb;
  --primary-weak: rgba(37, 99, 235, 0.12);
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: radial-gradient(900px 500px at 10% 0%, #eef2ff 0%, transparent 65%),
    radial-gradient(900px 600px at 90% 10%, #eff6ff 0%, transparent 60%), var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  width: 300px;
  min-width: 300px;
  max-width: 300px;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  overflow-x: hidden;
}

.sidebar-inner {
  padding: 18px 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: inherit;
}

.logo {
  width: 100%;
  height: auto;
  min-height: 60px;
  max-width: 100%;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-title {
  display: grid;
  line-height: 1.1;
}

.brand-title strong {
  font-size: 14px;
}

.brand-title span {
  font-size: 12px;
  color: var(--muted);
}

.org-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
}

.org-chip .meta {
  display: grid;
  gap: 2px;
}

.org-chip .meta strong {
  font-size: 13px;
}

.org-chip .meta span {
  font-size: 12px;
  color: var(--muted);
}

.org-chip .pill {
  display: none;
}

.workspace-chip-wrap {
  position: relative;
}
.org-chip-workspace {
  flex-wrap: wrap;
}
.org-chip-workspace .pill {
  display: none;
}
.org-chip-workspace .meta {
  flex: 1;
  min-width: 0;
}
.org-chip-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.org-chip-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.org-chip-btn:hover {
  background: #f8fafc;
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.35);
}
.org-chip-add {
  font-size: 18px;
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.35);
  background: var(--primary-weak);
}
.org-chip-add:hover {
  background: rgba(37, 99, 235, 0.15);
}

/* Workspace selector */
.workspace-selector {
  position: relative;
}
.workspace-selector-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.workspace-selector-btn:hover {
  background: #f8fafc;
}
.workspace-selector-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.workspace-selector-meta strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace-selector-meta span {
  font-size: 11px;
  color: var(--muted);
}
.workspace-selector-chevron {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}
.workspace-chip-wrap .workspace-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  z-index: 100;
}
.workspace-chip-wrap .workspace-dropdown.open {
  display: block;
}
.workspace-dropdown.open {
  display: block;
}
.workspace-dropdown-item {
  padding: 10px 12px;
  cursor: pointer;
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}
.workspace-dropdown-item:last-child {
  border-bottom: none;
}
.workspace-dropdown-item:hover {
  background: #f8fafc;
}
.workspace-dropdown-item strong {
  font-size: 13px;
}
.workspace-dropdown-item .muted {
  font-size: 11px;
}
.workspace-dropdown-create {
  color: var(--primary);
  font-weight: 600;
}

.workspaces-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.workspace-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.8);
}
.workspace-list-item-active {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.06);
}

.nav {
  display: grid;
  gap: 6px;
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: white;
}

.nav a,
.nav button.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px;
  border-radius: 10px;
  color: #0b1220;
  font-size: 14px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.nav-link-main {
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav-link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 8px;
}
.nav-link-icon svg {
  width: 18px;
  height: 18px;
}
.nav-link-icon.nav-icon-dashboard {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}
.nav-link-icon.nav-icon-claims {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}
.nav-link-icon.nav-icon-brokers {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}
.nav a.active .nav-link-icon.nav-icon-dashboard,
.nav a.nav-link.active .nav-link-icon.nav-icon-dashboard {
  background: rgba(37, 99, 235, 0.2);
  color: #1d4ed8;
}
.nav a.active .nav-link-icon.nav-icon-claims,
.nav a.nav-link.active .nav-link-icon.nav-icon-claims {
  background: rgba(217, 119, 6, 0.2);
  color: #b45309;
}
.nav a.active .nav-link-icon.nav-icon-brokers,
.nav a.nav-link.active .nav-link-icon.nav-icon-brokers {
  background: rgba(22, 163, 74, 0.2);
  color: #15803d;
}

.nav a:hover,
.nav button.nav-link:hover {
  background: #f1f5f9;
  color: #0b1220;
}
.nav a:hover .nav-link-icon.nav-icon-dashboard,
.nav button.nav-link:hover .nav-link-icon.nav-icon-dashboard {
  background: rgba(37, 99, 235, 0.18);
  color: #2563eb;
}
.nav a:hover .nav-link-icon.nav-icon-claims,
.nav button.nav-link:hover .nav-link-icon.nav-icon-claims {
  background: rgba(217, 119, 6, 0.18);
  color: #d97706;
}
.nav a:hover .nav-link-icon.nav-icon-brokers,
.nav button.nav-link:hover .nav-link-icon.nav-icon-brokers {
  background: rgba(22, 163, 74, 0.18);
  color: #16a34a;
}

.nav a.active,
.nav a.nav-link.active {
  background: rgba(37, 99, 235, 0.1) !important;
  color: var(--primary) !important;
  font-weight: 600;
}

.nav small {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

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

.sidebar-workspace {
  padding: 10px 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.9);
  margin-bottom: 14px;
}

.sidebar-workspace .brand {
  margin-bottom: 10px;
}

.sidebar-user-info {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.sidebar-user-info .sidebar-org-name {
  width: 100%;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.sidebar-user-info .sidebar-user-label {
  margin: 0;
}

.sidebar-user-info .sidebar-user-name {
  margin: 0;
}

.sidebar-user {
  margin-top: auto;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.9);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-user-label {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.sidebar-user-name {
  font-weight: 600;
}

.sidebar-user-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.sidebar-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  border-radius: 8px;
  font: inherit;
}

.sidebar-user-btn:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}
.sidebar-user-btn:hover,
.sidebar-user-btn:hover svg {
  color: var(--primary);
}

.sidebar-user-btn svg {
  flex-shrink: 0;
}

.sidebar-user-logout {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
}

.sidebar-user-logout:hover {
  text-decoration: underline;
}

.sidebar-footer {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer-link {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  text-align: left;
}

.sidebar-footer-link:hover {
  text-decoration: underline;
}

.sidebar-footer-link-inline {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}

.sidebar-footer-link-inline:hover {
  text-decoration: underline;
}

.content {
  padding: 22px 22px 36px;
}

.layout > .content.shell {
  min-width: 0;
  width: 100%;
  padding: 20px 18px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.topbar .subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  background: #f8fafc;
}

.btn.primary {
  border-color: rgba(37, 99, 235, 0.35);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.95), rgba(37, 99, 235, 0.88));
  color: white;
  box-shadow: 0 14px 22px rgba(37, 99, 235, 0.22);
}

.btn.primary:hover {
  filter: brightness(1.02);
}

.btn.draft {
  border-color: rgba(100, 116, 139, 0.4);
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
}
.btn.draft:hover {
  background: rgba(100, 116, 139, 0.2);
  border-color: rgba(100, 116, 139, 0.5);
}

.btn.ready {
  border-color: rgba(217, 119, 6, 0.45);
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}
.btn.ready:hover {
  background: rgba(217, 119, 6, 0.2);
  border-color: rgba(217, 119, 6, 0.55);
}

.btn.success {
  border-color: rgba(22, 163, 74, 0.5);
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}
.btn.success:hover {
  background: rgba(22, 163, 74, 0.2);
  border-color: rgba(22, 163, 74, 0.6);
}

.btn.closed {
  border-color: rgba(15, 23, 42, 0.3);
  background: rgba(15, 23, 42, 0.08);
  color: #334155;
}
.btn.closed:hover {
  background: rgba(15, 23, 42, 0.14);
  border-color: rgba(15, 23, 42, 0.4);
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.card-header h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.card-header span {
  font-size: 12px;
  color: var(--muted);
}

.card-body {
  padding: 12px 14px 14px;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--mono);
}

.empty {
  padding: 18px 14px;
  font-size: 13px;
  color: var(--muted);
}

.empty p {
  margin: 0;
}

/* Modal & form fields (shared) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.modal {
  width: min(520px, 100% - 32px);
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.35);
  overflow: hidden;
}

.modal-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.modal-header h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.modal-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.modal-close {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 999px;
}

.modal-close:hover {
  background: #f1f5f9;
}

.modal-body {
  padding: 14px 16px 8px;
  max-height: min(480px, 70vh);
  overflow: auto;
}

.modal-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.field-grid.one-col {
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.field label {
  font-weight: 600;
}

.field small {
  color: var(--muted);
  font-size: 11px;
}

.field input,
.field select,
.field textarea {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 9px;
  font: inherit;
  font-size: 13px;
  background: #f8fafc;
}

.field textarea {
  resize: vertical;
  min-height: 70px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  outline-offset: 0;
  border-color: rgba(37, 99, 235, 0.6);
  background: #fff;
}

.field-error {
  border-color: rgba(220, 38, 38, 0.9) !important;
  background: #fef2f2 !important;
}

.field-error-text {
  color: #dc2626;
  font-size: 11px;
}

.form-section {
  margin-bottom: 18px;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  background: rgba(248, 250, 252, 0.8);
}

tr:hover td {
  background: rgba(241, 245, 249, 0.7);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
}

.pilllink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.pilllink:hover {
  background: #f8fafc;
}

/* Mobile header (hamburger + logo) - hidden on desktop */
.sidebar-mobile-header {
  display: none;
}

.sidebar-mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.sidebar-mobile-brand .logo {
  height: 40px;
  width: auto;
  max-width: 140px;
  min-height: 0;
}

.sidebar-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

.sidebar-hamburger:hover {
  background: #f8fafc;
}

.hamburger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.sidebar-open .sidebar-hamburger .hamburger-bar:nth-child(1),
.mobile-menu-overlay.open .sidebar-hamburger .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.sidebar-open .sidebar-hamburger .hamburger-bar:nth-child(2),
.mobile-menu-overlay.open .sidebar-hamburger .hamburger-bar:nth-child(2) {
  opacity: 0;
}

.sidebar-open .sidebar-hamburger .hamburger-bar:nth-child(3),
.mobile-menu-overlay.open .sidebar-hamburger .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* Mobile menu overlay - moved to body for reliable stacking on iOS */
.mobile-menu-overlay {
  display: none;
}

@media (max-width: 768px) {
  .mobile-menu-overlay {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.98);
    box-sizing: border-box;
  }
  .mobile-menu-overlay.open {
    bottom: 0;
    height: 100vh;
    height: 100dvh;
  }
  .mobile-menu-overlay .sidebar-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .mobile-menu-overlay .sidebar-collapsible {
    display: none;
    flex: 1;
    position: relative;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 14px;
    box-sizing: border-box;
  }
  .mobile-menu-overlay.open .sidebar-collapsible {
    display: block !important;
  }
  .sidebar-mobile-spacer {
    height: 60px;
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: flex;
    flex-direction: column;
  }

  .sidebar .sidebar-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .sidebar .sidebar-workspace .brand {
    display: none;
  }

  .sidebar-collapsible {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100vw;
    z-index: 100;
    background: rgba(255, 255, 255, 0.98);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 14px;
    padding-top: 70px;
    box-sizing: border-box;
  }

  .sidebar.sidebar-open .sidebar-collapsible {
    display: block !important;
  }

  .sidebar.sidebar-open .sidebar-mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    z-index: 101;
    box-sizing: border-box;
  }

  .sidebar .sidebar-inner {
    padding: 0;
    gap: 12px;
  }

  .sidebar .sidebar-workspace {
    margin-bottom: 12px;
  }

  .sidebar .nav a,
  .sidebar .nav button.nav-link {
    padding: 12px 14px;
    min-height: 44px;
  }

  .sidebar .sidebar-user-btn {
    min-height: 44px;
    padding: 12px 14px;
  }

  .sidebar .sidebar-footer-link-inline {
    padding: 8px 0;
    display: inline-block;
  }

  .mobile-menu-overlay .sidebar-user-btn {
    min-height: 44px;
    padding: 12px 14px;
  }
  .mobile-menu-overlay .sidebar-footer-legal {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    align-items: center;
  }
  .mobile-menu-overlay .sidebar-footer-link-inline {
    min-height: 44px;
    padding: 10px 4px;
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 768px) {
  .broker-slide-panel,
  .broker-slide-panel-wide {
    width: 100%;
    max-width: 100%;
  }
  .broker-slide-body {
    padding: 14px 16px 24px;
    -webkit-overflow-scrolling: touch;
  }
  .broker-slide-footer .btn {
    min-height: 44px;
  }
  .legal-slide-tabs {
    flex-wrap: wrap;
    gap: 8px;
  }
  .legal-tab {
    min-height: 44px;
    padding: 12px 16px;
  }
  .modal-backdrop {
    padding: 16px;
    align-items: flex-end;
  }
  .modal {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 18px 18px 0 0;
  }
  .modal-body {
    max-height: 60vh;
  }
  .modal-close {
    min-width: 44px;
    min-height: 44px;
  }
  .modal-footer .btn {
    min-height: 44px;
  }
  .team-member-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .team-member-item .team-member-actions {
    flex-wrap: wrap;
  }
  .broker-slide-body .field input,
  .broker-slide-body .field select {
    min-height: 44px;
  }
}

.site-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.9);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.site-footer a {
  color: var(--primary);
  font-weight: 600;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  margin-bottom: 6px;
}

.site-footer .footer-copy {
  font-size: 11px;
}

/* Leak Score pills */
.leak-score-hint {
  cursor: help;
}
.leak-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: none;
}
.leak-pill.leak-good {
  background: rgba(22, 163, 74, 0.2);
  color: #15803d;
}
.leak-pill.leak-mixed {
  background: rgba(217, 119, 6, 0.2);
  color: #b45309;
}
.leak-pill.leak-risky {
  background: rgba(220, 38, 38, 0.2);
  color: #b91c1c;
}
.leak-pill.leak-unknown {
  background: rgba(100, 116, 139, 0.2);
  color: #64748b;
}

/* Claim status badges (claims page, dashboard) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
}
.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.badge.status-draft {
  background: rgba(100, 116, 139, 0.18);
  border-color: rgba(100, 116, 139, 0.4);
  color: #475569;
}
.badge.status-draft .dot { background: #64748b; }
.badge.status-ready_to_send {
  background: rgba(217, 119, 6, 0.18);
  border-color: rgba(217, 119, 6, 0.45);
  color: #b45309;
}
.badge.status-ready_to_send .dot { background: var(--warn); }
.badge.status-sent {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.45);
  color: #1d4ed8;
}
.badge.status-sent .dot { background: var(--primary); }
.badge.status-broker_viewed {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(14, 165, 233, 0.45);
  color: #0284c7;
}
.badge.status-broker_viewed .dot { background: #0ea5e9; }
.badge.status-broker_accepted {
  background: rgba(22, 163, 74, 0.18);
  border-color: rgba(22, 163, 74, 0.45);
  color: #15803d;
}
.badge.status-broker_accepted .dot { background: var(--success); }
.badge.status-broker_declined {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.45);
  color: #b91c1c;
}
.badge.status-broker_declined .dot { background: var(--danger); }
.badge.status-paid {
  background: rgba(22, 163, 74, 0.22);
  border-color: rgba(22, 163, 74, 0.5);
  color: #14532d;
}
.badge.status-paid .dot { background: #14532d; }
.badge.status-disputed {
  background: rgba(124, 58, 237, 0.18);
  border-color: rgba(124, 58, 237, 0.45);
  color: #6d28d9;
}
.badge.status-disputed .dot { background: #7c3aed; }
.badge.status-closed {
  background: rgba(15, 23, 42, 0.12);
  border-color: rgba(15, 23, 42, 0.3);
  color: #334155;
}
.badge.status-closed .dot { background: #0f172a; }
.badge.status-closed-paid {
  background: rgba(22, 163, 74, 0.18);
  border-color: rgba(22, 163, 74, 0.45);
  color: #15803d;
}
.badge.status-closed-paid .dot { background: var(--success); }
.badge.status-closed-paid-partial { background: rgba(22, 163, 74, 0.18); border-color: rgba(22, 163, 74, 0.45); color: #15803d; }
.badge.status-closed-paid-partial .dot { background: var(--success); }
.badge.status-closed-unpaid {
  background: rgba(217, 119, 6, 0.18);
  border-color: rgba(217, 119, 6, 0.45);
  color: #b45309;
}
.badge.status-closed-unpaid .dot { background: var(--warn); }
.badge.status-closed-declined {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.45);
  color: #b91c1c;
}
.badge.status-closed-declined .dot { background: var(--danger); }

/* Broker slide-out panel */
.broker-slide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.broker-slide-overlay.open {
  display: block;
  opacity: 1;
}
.broker-slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 40px rgba(15, 23, 42, 0.15);
  z-index: 51;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: hidden;
}
.broker-slide-overlay.open .broker-slide-panel {
  transform: translateX(0);
}
.broker-slide-panel-wide {
  width: min(480px, 100vw);
}
.broker-slide-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.broker-slide-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 24px;
}
.broker-slide-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.broker-slide-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.8);
  border: 1px solid var(--border);
  font-size: 13px;
  margin-bottom: 8px;
}
.broker-slide-metric:last-child {
  margin-bottom: 0;
}
.broker-slide-metric span:first-child {
  color: var(--muted);
  font-size: 12px;
}
.broker-slide-metric span:last-child {
  font-weight: 600;
  font-size: 14px;
}
.broker-slide-metric.metric-positive span:last-child {
  color: var(--success);
}
.broker-slide-metric.metric-warn span:last-child {
  color: var(--warn);
}
.broker-slide-metric.metric-primary span:last-child {
  color: var(--primary);
}
.broker-slide-section {
  margin-bottom: 20px;
}
.broker-slide-section:last-child {
  margin-bottom: 0;
}
.broker-slide-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(37, 99, 235, 0.2);
}
.broker-slide-overview-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.broker-slide-overview-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(99, 102, 241, 0.05));
  border: 1px solid rgba(37, 99, 235, 0.2);
}
.broker-slide-overview-card .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.broker-slide-overview-card .value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.broker-slide-metrics-grid {
  display: grid;
  gap: 8px;
}
.settings-slide-section {
  margin-bottom: 18px;
}
.settings-slide-section:last-child {
  margin-bottom: 0;
}
.broker-slide-contact {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.8);
  margin-bottom: 8px;
  font-size: 12px;
}
.broker-slide-contact:last-child {
  margin-bottom: 0;
}
.broker-slide-contact .type {
  font-weight: 600;
  margin-bottom: 2px;
}
.broker-slide-contact .email {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* Legal slide (Terms / Privacy) */
.legal-slide-tabs {
  display: flex;
  gap: 4px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.legal-tab {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.legal-tab:hover {
  background: rgba(248, 250, 252, 0.9);
  color: var(--text);
}

.legal-tab.active {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--primary);
}

.legal-tab-pane {
  display: none;
}

.legal-tab-pane.active {
  display: block;
}

.legal-slide-body .legal-tab-pane h4 {
  color: var(--text);
}

/* Full legal doc in slide */
.legal-slide-doc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.55;
  padding: 0 18px 24px;
}
.legal-slide-doc h1 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}
.legal-slide-doc .legal-updated {
  font-size: 10px;
  margin-bottom: 16px;
}
.legal-slide-doc h2 {
  font-size: 12px;
  font-weight: 600;
  margin: 16px 0 6px;
  color: var(--text);
}
.legal-slide-doc p,
.legal-slide-doc li {
  margin-bottom: 6px;
}
.legal-slide-doc ul {
  margin: 0 0 10px;
  padding-left: 18px;
}
.legal-slide-doc hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
.legal-slide-doc a {
  color: var(--primary);
}

/* Team slide-out */
.team-member-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.team-member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.8);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  font-size: 13px;
}
.team-member-item:last-child {
  margin-bottom: 0;
}
.team-member-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.team-member-main strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-member-email {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-member-item .badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.team-member-item .badge.status-sent {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.35);
}
.team-member-item .badge.status-active {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.35);
}
.team-member-item .badge.status-revoked {
  background: rgba(100, 116, 139, 0.2);
  color: var(--muted);
  border-color: var(--border);
}
.team-member-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}
.team-member-revoke {
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
}
.team-member-revoke:hover {
  background: rgba(220, 38, 38, 0.15);
}

/* Broker search & summary (New Claim modal) */
.broker-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  z-index: 50;
}
.broker-search-result {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.broker-search-result:last-child {
  border-bottom: none;
}
.broker-search-result:hover {
  background: #f8fafc;
}
.broker-search-result strong {
  display: block;
}
.broker-search-result span {
  font-size: 12px;
  color: var(--muted);
}
.broker-summary {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.9);
}
.broker-summary-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.broker-summary-main .leak-score-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.broker-summary-main .leak-metrics-hint {
  font-size: 12px;
  color: var(--muted);
  cursor: help;
}
.broker-summary-main .leak-score-wrap:hover .broker-metrics-preview {
  display: block;
}
.broker-metrics-preview {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  z-index: 20;
  min-width: 200px;
  font-size: 12px;
}
.broker-metrics-preview-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  gap: 16px;
}
.broker-metrics-preview-row span:first-child {
  color: var(--muted);
}
.broker-view-details {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}
.broker-view-details:hover {
  text-decoration: underline;
}
.broker-clear {
  margin-top: 10px;
  padding: 6px 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.broker-clear:hover {
  color: var(--primary);
  text-decoration: underline;
}
.field.field-relative {
  position: relative;
}

@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .topbar .actions {
    flex-wrap: wrap;
  }
  .topbar .actions .btn,
  .topbar .actions a.btn {
    min-height: 44px;
    flex: 1;
    min-width: 120px;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap table {
    min-width: 600px;
  }
  .table-wrap .pilllink,
  .table-wrap button[type="button"] {
    min-height: 44px;
    padding: 10px 14px;
  }
}

@media (max-width: 560px) {
  .content {
    padding: 16px 14px 26px;
  }
  .topbar h1 {
    font-size: 16px;
  }
  .topbar .subtitle {
    font-size: 12px;
  }
  .table-wrap table {
    min-width: 520px;
    font-size: 12px;
  }
  .table-wrap th,
  .table-wrap td {
    padding: 10px 8px;
  }
  .broker-slide-footer .btn {
    min-height: 44px;
    flex: 1;
    min-width: 0;
  }
}

/* Inline loading spinner (dashboard, brokers, claims) */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 200px;
  padding: 32px;
  font-size: 14px;
  color: var(--muted);
}
.page-loading[hidden] {
  display: none !important;
}
.page-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: page-spin 0.7s linear infinite;
}
@keyframes page-spin {
  to {
    transform: rotate(360deg);
  }
}
