/* =============================================================
   ADVMS Admin — Design System
   Single source of truth for typography, color, spacing,
   form controls, tables, cards, navigation and components.
   ============================================================= */

/* ---------- Design tokens ---------- */
:root {
  --ink-900: #0f172a;
  --ink-800: #1e293b;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --ink-200: #e2e8f0;
  --ink-100: #f1f5f9;
  --ink-050: #f8fafc;

  --brand-700: #3730a3;
  --brand-600: #4f46e5;
  --brand-500: #6366f1;
  --brand-100: #eef2ff;

  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #0ea5e9;

  --surface: #ffffff;
  --surface-alt: #f7f8fb;
  --border: #e6eaf0;
  --border-strong: #d9dee6;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 14px -6px rgba(15, 23, 42, 0.12), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 40px -20px rgba(15, 23, 42, 0.25);

  --radius-sm: 0.45rem;
  --radius:    0.625rem;
  --radius-lg: 0.875rem;
  --radius-xl: 1.125rem;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --sidebar-bg: #0b1220;
  --sidebar-bg-2: #111a2e;
  --sidebar-fg: #cbd5e1;
  --sidebar-fg-muted: #94a3b8;
  --sidebar-active: #6366f1;
}

/* ---------- Base typography ---------- */
html, body {
  font-family: var(--font-sans);
}

body {
  background: var(--surface-alt);
  color: var(--ink-800);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--ink-900);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.h4 { font-size: 1.15rem; }
.h5 { font-size: 1rem; }
.h6 { font-size: 0.9rem; }

small, .small { font-size: 0.78rem; }
.text-body-secondary { color: var(--ink-500) !important; }
.text-body-tertiary  { color: var(--ink-400) !important; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }

hr { color: var(--border); opacity: 1; }

/* ---------- Shell layout (vertical sidebar) ---------- */
body.has-topnav,
body.has-sidebar { min-height: 100vh; }

.main-admin-column { min-height: 100vh; }

.sidebar-scroll {
  overflow-y: auto;
  padding-top: 0.4rem;
}

.mobile-navbar {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%) !important;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.35);
}

.admin-main-inner {
  background: var(--surface-alt);
  padding-top: 1.1rem !important;
  padding-bottom: 1.5rem !important;
}

.admin-main-inner > .row { --bs-gutter-y: 1rem; }

/* Fixed, predictable max width for content on big monitors */
@media (min-width: 1400px) {
  .admin-main-inner { max-width: 1380px; margin-left: auto; margin-right: auto; }
}

/* ---------- Horizontal top navigation ---------- */
.topnav-bar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-fg);
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.35);
}

.topnav-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  max-width: 100%;
}

@media (min-width: 1400px) {
  .topnav-inner { padding-left: 1.5rem; padding-right: 1.5rem; }
}

.topnav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  flex-shrink: 0;
  padding-right: 0.85rem;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  margin-right: 0.4rem;
}

.topnav-brand:hover { color: #fff !important; }

.topnav-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  font-size: 0.95rem;
}

.topnav-brand-text .brand-sub {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--sidebar-fg-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topnav-menu {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.1rem;
  flex: 1 1 auto;
  min-width: 0;
}

.topnav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-fg) !important;
  font-size: 0.83rem;
  font-weight: 500;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
  position: relative;
}

.topnav-link .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-fg-muted);
  width: 1rem;
  height: 1rem;
}

.topnav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff !important;
}

.topnav-link:hover .nav-icon { color: #fff; }

.topnav-link.active {
  background: rgba(99, 102, 241, 0.18);
  color: #fff !important;
  font-weight: 600;
}

.topnav-link.active .nav-icon { color: #c7d2fe; }

.topnav-link.active::after {
  content: '';
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: -7px;
  height: 2px;
  background: var(--sidebar-active);
  border-radius: 2px;
}

/* Dropdown parent + submenu items */
.topnav-dropdown { position: relative; }

.topnav-link.dropdown-toggle::after {
  margin-left: 0.3rem;
  vertical-align: 0.13em;
  border-top-color: rgba(255, 255, 255, 0.55);
}

.topnav-link.dropdown-toggle.active::after,
.topnav-link.dropdown-toggle:hover::after { border-top-color: #fff; }

.topnav-submenu.dropdown-menu {
  margin-top: 0.4rem;
  min-width: 13rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem;
  box-shadow: var(--shadow-md);
}

.topnav-submenu .dropdown-item {
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-800);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.topnav-submenu .dropdown-item svg { color: var(--ink-500); }

.topnav-submenu .dropdown-item:hover,
.topnav-submenu .dropdown-item:focus {
  background: var(--ink-100);
  color: var(--ink-900);
}
.topnav-submenu .dropdown-item:hover svg,
.topnav-submenu .dropdown-item:focus svg { color: var(--brand-600); }

.topnav-submenu .dropdown-item.active {
  background: var(--brand-100);
  color: var(--brand-700);
}
.topnav-submenu .dropdown-item.active svg { color: var(--brand-600); }

/* Mobile offcanvas — collapsible group */
.offcanvas-body .nav-link-group {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.offcanvas-body .nav-link-group .nav-caret {
  transition: transform 0.15s ease;
  font-size: 0.7rem;
}
.offcanvas-body .nav-link-group[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }

.offcanvas-body .nav-submenu {
  margin: 0.1rem 0 0.2rem;
  padding-left: 1.25rem;
}

.offcanvas-body .nav-submenu .nav-link {
  font-size: 0.85rem;
  padding: 0.5rem 0.85rem;
}

.topnav-badge {
  margin-left: 0.15rem;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--sidebar-active);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.topnav-actions .global-search {
  margin-left: 0;
  max-width: 280px;
  min-width: 180px;
}

.topnav-actions .global-search-input.form-control {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: transparent;
  height: 36px;
}

.topnav-actions .global-search-input.form-control::placeholder { color: rgba(226, 232, 240, 0.65); }

.topnav-actions .global-search-input.form-control:focus {
  background: #ffffff;
  color: var(--ink-900);
}

.topnav-actions .global-search-input.form-control:focus::placeholder { color: var(--ink-400); }

.topnav-actions .global-search-icon { color: rgba(226, 232, 240, 0.7); }

.topnav-actions .global-search-input.form-control:focus ~ .global-search-icon,
.topnav-actions .global-search:focus-within .global-search-icon { color: var(--ink-500); }

/* Profile menu adapts to dark navbar */
.topnav-actions .profile-menu .profile-menu-toggle { color: #f1f5f9; }
.topnav-actions .profile-menu .profile-menu-welcome,
.topnav-actions .profile-menu .profile-menu-name { color: #f1f5f9; }
.topnav-actions .profile-menu .profile-menu-toggle:hover,
.topnav-actions .profile-menu .profile-menu-toggle:focus-visible {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.08) !important;
}
.topnav-actions .profile-menu .profile-menu-toggle.dropdown-toggle::after { border-top-color: rgba(255, 255, 255, 0.7); }
.topnav-actions .profile-menu .profile-menu-avatar {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.topnav-burger {
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 0.32rem 0.55rem;
}
.topnav-burger:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

@media (max-width: 991.98px) {
  .topnav-inner { padding: 0.4rem 0.75rem; gap: 0.5rem; flex-wrap: wrap; }
  .topnav-actions {
    order: 3;
    flex: 1 1 100%;
    margin-left: 0;
    justify-content: stretch;
  }
  .topnav-actions .global-search {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
  }
  .topnav-brand { padding-right: 0.6rem; }
  .topnav-brand-text { font-size: 0.9rem; }
}

@media (max-width: 575.98px) {
  .topnav-brand-text .brand-sub { display: none; }
}

/* ---------- Sidebar ---------- */
.sidebar-desktop {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%) !important;
  color: var(--sidebar-fg);
}

.sidebar-desktop .border-bottom { border-color: rgba(255, 255, 255, 0.06) !important; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 1rem;
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-600) 0%, #8b5cf6 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px -4px rgba(99, 102, 241, 0.6);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.sidebar-brand-text .brand-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--sidebar-fg-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-section-label {
  padding: 0.85rem 1rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(203, 213, 225, 0.55);
}

.sidebar-desktop .nav,
.offcanvas-body .nav { gap: 0.125rem; }

.sidebar-desktop .nav-link,
.offcanvas-body .nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  margin: 0 0.45rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-fg) !important;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  position: relative;
}

.sidebar-desktop .nav-link .nav-icon,
.offcanvas-body .nav-link .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--sidebar-fg-muted);
  flex-shrink: 0;
}

.sidebar-desktop .nav-link:hover,
.offcanvas-body .nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff !important;
}

.sidebar-desktop .nav-link:hover .nav-icon,
.offcanvas-body .nav-link:hover .nav-icon { color: #fff; }

.sidebar-desktop .nav-link.active,
.offcanvas-body .nav-link.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.18), rgba(99, 102, 241, 0.05));
  color: #fff !important;
  font-weight: 600;
}

.sidebar-desktop .nav-link.active::before,
.offcanvas-body .nav-link.active::before {
  content: '';
  position: absolute;
  left: -0.45rem;
  top: 25%;
  bottom: 25%;
  width: 3px;
  border-radius: 3px;
  background: var(--sidebar-active);
}

.sidebar-desktop .nav-link.active .nav-icon,
.offcanvas-body .nav-link.active .nav-icon { color: var(--sidebar-active); }

.sidebar-desktop .nav-link .nav-badge,
.offcanvas-body .nav-link .nav-badge {
  margin-left: auto;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--sidebar-active);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Offcanvas mobile nav carries the same dark look */
.offcanvas.text-bg-dark { background: var(--sidebar-bg); }

/* ---------- Page-title strip (under top nav) ---------- */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
}

body.has-sidebar .admin-topbar { top: 0; }
body.has-sidebar .topbar-inner { gap: 0.75rem; }
body.has-sidebar .topbar-inner .topbar-title { flex: 0 0 auto; margin-right: 0.5rem; }
body.has-sidebar .topbar-inner .global-search { margin-left: auto; max-width: 360px; flex: 1 1 360px; }
body.has-sidebar .topbar-inner .topbar-actions { flex-shrink: 0; margin-left: 0; }
body.has-sidebar .topbar-inner .profile-menu { flex-shrink: 0; }

@media (max-width: 767.98px) {
  body.has-sidebar .admin-topbar { top: 56px; }
  body.has-sidebar .topbar-inner {
    flex-wrap: wrap;
    padding: 0.45rem 0.75rem;
    gap: 0.5rem;
  }
  body.has-sidebar .topbar-inner .topbar-title {
    flex: 1 1 auto;
    min-width: 0;
    margin-right: 0;
  }
  body.has-sidebar .topbar-inner .profile-menu {
    order: 2;
    margin-left: auto;
  }
  body.has-sidebar .topbar-inner .global-search {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
  }
}

.admin-topbar--light {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1rem;
}

@media (min-width: 1400px) {
  .topbar-inner { padding-left: 1.5rem; padding-right: 1.5rem; }
}

.admin-topbar h1 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-900);
}

/* ---------- Profile dropdown (desktop) ---------- */
.profile-menu-toggle {
  color: var(--ink-800);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  box-shadow: none !important;
  padding: 0.3rem 0.55rem;
}

.profile-menu-toggle:hover,
.profile-menu-toggle:focus-visible {
  color: var(--ink-900);
  background-color: var(--ink-100) !important;
}

.profile-menu-toggle:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.45);
  outline-offset: 1px;
}

.profile-menu:not(.profile-menu--dark) .profile-menu-welcome {
  color: var(--ink-700);
  max-width: 12rem;
}

.profile-menu:not(.profile-menu--dark) .profile-menu-name {
  font-weight: 600;
  color: var(--ink-900);
}

.profile-menu-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-600), #4338ca);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
  border-radius: 50%;
}

.profile-menu-toggle.dropdown-toggle::after {
  margin-left: 0.2rem;
  vertical-align: 0.15em;
  border-top-color: var(--ink-500);
}

.profile-menu:not(.profile-menu--dark) .profile-menu-toggle.dropdown-toggle::after { border-top-color: var(--ink-600); }

/* Mobile dark variant */
.profile-menu--dark .profile-menu-toggle { color: #f1f5f9; }
.profile-menu--dark .profile-menu-welcome,
.profile-menu--dark .profile-menu-name { color: #f1f5f9; }
.profile-menu--dark .profile-menu-toggle.dropdown-toggle::after { border-top-color: rgba(255, 255, 255, 0.7); }
.profile-menu--dark .profile-menu-avatar {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.08));
  color: #fff;
}
.profile-menu--dark .profile-menu-toggle:hover,
.profile-menu--dark .profile-menu-toggle:focus-visible {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.08) !important;
}

@media (max-width: 575.98px) {
  .profile-menu-welcome { max-width: 7rem; font-size: 0.8125rem; }
  .profile-menu-avatar { width: 2rem; height: 2rem; font-size: 0.72rem; }
}

/* Dropdown menu */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  box-shadow: var(--shadow-md);
  min-width: 14rem;
}

.dropdown-item {
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-800);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--ink-100);
  color: var(--ink-900);
}

.dropdown-item.text-danger:hover { background: #fef2f2; color: var(--danger) !important; }

.dropdown-header { font-size: 0.78rem; font-weight: 600; color: var(--ink-700); padding: 0.4rem 0.7rem 0.2rem; }
.dropdown-divider { border-color: var(--border); margin: 0.3rem 0; }

/* ---------- Page header (reusable across all pages) ---------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page-header-main {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.page-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--brand-100);
  color: var(--brand-600);
  flex-shrink: 0;
}

.page-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink-900);
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.8rem;
  color: var(--ink-500);
  margin: 0.1rem 0 0;
}

.case-view-meta-strip {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 48%, #f0f9ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-md, 0.5rem);
  padding: 0.65rem 0.85rem;
  box-shadow: 0 1px 3px rgba(67, 56, 202, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.case-view-meta-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem 0.65rem;
}

.case-view-meta-chip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  padding: 0.4rem 0.7rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(199, 210, 254, 0.95);
  border-radius: var(--radius-sm, 0.375rem);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  min-width: 0;
}

.case-view-meta-chip-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-700, #4338ca);
  white-space: nowrap;
}

.case-view-meta-chip-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-900);
  word-break: break-word;
}

.page-header-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 1rem; }

.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0.95rem;
  font-weight: 600;
  color: var(--ink-900);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.card-header-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.card-header-title .card-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-600);
  flex-shrink: 0;
}

.card-body { padding: 0.95rem; }
.card-footer { background: var(--surface-alt); border-top: 1px solid var(--border); padding: 0.65rem 0.95rem; border-radius: 0 0 var(--radius) var(--radius); }

/* Borderless utility keeps boxes consistent */
.card.border-0 { border: 1px solid var(--border) !important; }
.card.shadow-sm { box-shadow: var(--shadow-sm) !important; }

/* ---------- Forms ---------- */
.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 0.3rem;
  letter-spacing: 0.005em;
}

.mb-3 { margin-bottom: 0.85rem !important; }

.form-label.required::after {
  content: '*';
  color: var(--danger);
  margin-left: 0.2rem;
  font-weight: 700;
}

.form-control,
.form-select {
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-900);
  font-size: 0.85rem;
  padding: 0.42rem 0.65rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  box-shadow: none;
  line-height: 1.45;
}

.form-control::placeholder { color: var(--ink-400); }

.form-control:focus,
.form-select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.form-control:disabled,
.form-control[readonly] {
  background-color: var(--ink-050);
  color: var(--ink-600);
}

textarea.form-control { min-height: 3.2rem; }

.form-text { color: var(--ink-500); font-size: 0.78rem; margin-top: 0.35rem; }

.form-check-input {
  border-color: var(--border-strong);
  width: 1rem;
  height: 1rem;
  margin-top: 0.3rem;
}

.form-check-input:checked {
  background-color: var(--brand-600);
  border-color: var(--brand-600);
}

.form-check-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.input-group-text {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink-500);
}

/* File input aligns with the rest */
.form-control[type="file"] { padding: 0.35rem 0.6rem; }
.form-control[type="file"]::file-selector-button {
  background: var(--ink-100);
  border: 0;
  border-right: 1px solid var(--border);
  padding: 0.45rem 0.7rem;
  margin: -0.35rem 0.7rem -0.35rem -0.6rem;
  border-radius: 0;
  font-weight: 500;
  color: var(--ink-700);
  transition: background-color 0.15s ease;
}
.form-control[type="file"]::file-selector-button:hover { background: var(--ink-200); }

/* ---------- Buttons ---------- */
.btn {
  font-weight: 500;
  font-size: 0.83rem;
  border-radius: var(--radius-sm);
  padding: 0.42rem 0.85rem;
  letter-spacing: 0.005em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  line-height: 1.3;
}

.btn:focus-visible { box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3); outline: none; }
.btn:active { transform: translateY(1px); }

.btn-sm { font-size: 0.74rem; padding: 0.28rem 0.6rem; border-radius: 0.35rem; }
.btn-lg { font-size: 0.9rem; padding: 0.55rem 1.05rem; }

.btn-primary {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.btn-primary:disabled { background: var(--brand-500); border-color: var(--brand-500); opacity: 0.65; }

.btn-outline-primary { color: var(--brand-600); border-color: var(--brand-600); }
.btn-outline-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

.btn-outline-secondary { color: var(--ink-700); border-color: var(--border-strong); background: var(--surface); }
.btn-outline-secondary:hover { background: var(--ink-100); border-color: var(--border-strong); color: var(--ink-900); }

.btn-outline-danger { color: var(--danger); border-color: #fecaca; background: var(--surface); }
.btn-outline-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-link { color: var(--brand-600); font-weight: 500; text-decoration: none; padding: 0; }
.btn-link:hover { color: var(--brand-700); text-decoration: underline; }

/* ---------- Tables ---------- */
.table {
  color: var(--ink-800);
  font-size: 0.83rem;
  margin-bottom: 0;
  --bs-table-hover-bg: var(--ink-050);
}

.table > :not(caption) > * > * { padding: 0.6rem 0.75rem; }

.table thead th {
  background: var(--surface-alt);
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  white-space: nowrap;
}

.table tbody td {
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.table-hover tbody tr { transition: background-color 0.1s ease; }

.table.table-sm > :not(caption) > * > * { padding: 0.45rem 0.6rem; }

/* ---------- Badges ---------- */
.badge {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 0.7rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
}

.badge.text-bg-light {
  background: var(--ink-100) !important;
  color: var(--ink-700) !important;
  border: 1px solid var(--border);
}

.badge.text-bg-secondary {
  background: var(--ink-200) !important;
  color: var(--ink-700) !important;
}

.badge.text-bg-dark {
  background: var(--ink-900) !important;
  color: #fff !important;
}

.badge.text-bg-info {
  background: #e0f2fe !important;
  color: #075985 !important;
}

.badge.text-bg-success {
  background: #d1fae5 !important;
  color: #047857 !important;
}

.badge.text-bg-warning {
  background: #fef3c7 !important;
  color: #92400e !important;
}

.badge-soft {
  background: var(--brand-100);
  color: var(--brand-700);
  font-weight: 600;
  border: 1px solid #e0e7ff;
}

/* ---------- Alerts ---------- */
.alert {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
}

.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ---------- Modal ---------- */
.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.modal-title { font-weight: 600; color: var(--ink-900); font-size: 0.95rem; }

.modal-body { padding: 1rem; }
.modal-body .row.g-3 { --bs-gutter-y: 0.7rem; --bs-gutter-x: 0.85rem; }

.modal-footer {
  padding: 0.65rem 1rem;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  gap: 0.4rem;
}

.modal-dialog-scrollable .modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
}

/* ---------- Toasts (top-right, auto-dismiss) ---------- */
.app-toast-container {
  z-index: 1090;
  max-width: 22rem;
}

.app-toast {
  position: relative;
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 12px 30px -12px rgba(15, 23, 42, 0.45), 0 6px 16px -10px rgba(15, 23, 42, 0.3);
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 18rem;
  animation: app-toast-in 0.25s ease-out both;
}

.app-toast .toast-body { padding: 0.85rem 0.9rem 0.85rem 1rem; }
.app-toast .app-toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  flex-shrink: 0;
}

.app-toast .btn-close {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}
.app-toast .btn-close:hover { opacity: 1; }

.app-toast--success {
  background: linear-gradient(135deg, #059669 0%, #10b981 60%, #14b8a6 100%);
}

.app-toast::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.7);
  transform-origin: left center;
  transform: scaleX(1);
}

.app-toast.is-armed::after {
  animation: app-toast-progress var(--toast-duration, 3000ms) linear forwards;
}

.app-toast.is-hiding {
  animation: app-toast-out 0.3s ease-in forwards;
}

@keyframes app-toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes app-toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

@keyframes app-toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

@media (max-width: 575.98px) {
  .app-toast-container { left: 0.5rem !important; right: 0.5rem !important; max-width: none; }
  .app-toast { min-width: 0; width: 100%; }
}

/* ---------- Footer ---------- */
.admin-footer { font-size: 0.8125rem; background: var(--surface) !important; border-color: var(--border) !important; }
.admin-footer a { color: inherit; text-decoration: none; }

/* ---------- Dashboard ---------- */
.dashboard h2 { color: var(--ink-900); }

.widget {
  position: relative;
  padding: 1.15rem 1.2rem 1rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: #fff;
  box-shadow: 0 10px 25px -18px rgba(15, 23, 42, 0.45);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  isolation: isolate;
}

.widget::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.35;
  background:
    radial-gradient(120px 120px at 110% -10%, rgba(255, 255, 255, 0.45), transparent 60%),
    radial-gradient(140px 140px at -10% 110%, rgba(0, 0, 0, 0.25), transparent 55%);
  pointer-events: none;
}

.widget > * { position: relative; z-index: 1; }
.widget:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -14px rgba(15, 23, 42, 0.45); }

.widget-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem; }

.widget-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(2px);
  color: #fff;
}

.widget-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

.widget-value {
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 700;
  color: #fff;
  margin: 0.1rem 0 0.75rem;
  letter-spacing: -0.02em;
}

.widget-spark {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 34px;
  margin-bottom: 0.65rem;
}

.widget-spark > span {
  flex: 1;
  min-width: 4px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 3px;
  display: block;
  transition: transform 0.2s ease;
}

.widget-spark > span:last-child { background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35); }
.widget:hover .widget-spark > span { transform: scaleY(1.08); }

.widget-foot { font-size: 0.78rem; color: rgba(255, 255, 255, 0.92); font-weight: 500; }

.widget-pill,
.widget-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.widget-trend.is-up { background: rgba(16, 185, 129, 0.95); }
.widget-trend.is-down { background: rgba(239, 68, 68, 0.95); }

.widget--violet  { background: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #6366f1 100%); }
.widget--emerald { background: linear-gradient(135deg, #059669 0%, #10b981 50%, #14b8a6 100%); }
.widget--amber   { background: linear-gradient(135deg, #f59e0b 0%, #f97316 55%, #ef4444 100%); }
.widget--rose    { background: linear-gradient(135deg, #ec4899 0%, #f43f5e 55%, #8b5cf6 100%); }

.chart-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.15rem 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  height: 100%;
}

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

.chart-card-header h3 { color: var(--ink-900); }

.chart-area { position: relative; height: 280px; }
.chart-area--donut { height: 220px; }

.chart-legend { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink-500); }

.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.35rem; }
.legend-dot--indigo { background: #8b5cf6; }
.legend-dot--green  { background: #10b981; }
.legend-dot--amber  { background: #f59e0b; }
.legend-dot--rose   { background: #f43f5e; }

.legend-list { list-style: none; padding: 0; margin: 0; }
.legend-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
}
.legend-list li:first-child { border-top: 0; }

.recent-table thead th {
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  font-weight: 600;
}

.recent-table tbody td {
  border-top: 1px solid var(--border);
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}
.activity-list li:first-child { border-top: 0; }

.activity-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  background: linear-gradient(135deg, var(--brand-600), #8b5cf6);
  flex-shrink: 0;
}

.min-w-0 { min-width: 0; }

/* ---------- Files page polish ---------- */
.files-card .card-header { padding: 1rem 1.15rem 0.6rem; border-bottom-color: transparent; }

/* Register file modal */
.file-register-modal-body {
  padding-top: 1.1rem;
}
.modal-dialog-scrollable .modal-content.file-register-modal {
  max-height: calc(100vh - (var(--bs-modal-margin, 0.5rem) * 2));
  display: flex;
  flex-direction: column;
}
.modal-dialog-scrollable .modal-content.file-register-modal > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
}
.modal-dialog-scrollable .modal-content.file-register-modal .modal-header,
.modal-dialog-scrollable .modal-content.file-register-modal .modal-footer {
  flex-shrink: 0;
}
.modal-dialog-scrollable .modal-content.file-register-modal .modal-body.file-register-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-bottom: 1.25rem;
}
@media (min-width: 576px) {
  .modal-dialog-scrollable.file-register-modal-dialog {
    height: calc(100% - (var(--bs-modal-margin, 0.5rem) * 2));
    max-height: calc(100vh - (var(--bs-modal-margin, 0.5rem) * 2));
  }
}
.file-register-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.file-register-section {
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--border, #dee2e6);
  border-radius: 0.5rem;
  background: var(--ink-050, #f8f9fa);
  margin-bottom: 1rem;
}
.file-register-section-last {
  margin-bottom: 0;
}
.file-register-loc-status {
  min-height: 1.25rem;
  margin-top: 0.35rem;
  margin-bottom: 0;
}
.file-register-loc-status:empty {
  display: none;
}
.file-register-page .card-body.file-register-modal-body {
  padding: 1.1rem 1.15rem;
}
.file-register-form .file-register-field {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}
.file-register-form .row > [class*="col-"] {
  display: flex;
  flex-direction: column;
}
.file-register-client-row .file-register-field-label,
.file-register-form .file-register-field-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.25rem;
  margin-bottom: 0.5rem;
}
.file-register-client-row .file-register-field-label .form-label,
.file-register-form .file-register-field-label .form-label {
  margin-bottom: 0;
  line-height: 1.25;
}
.file-register-client-row .file-register-field-control,
.file-register-form .file-register-field-control {
  flex: 1 1 auto;
}
.file-register-client-row .file-register-field-control .form-select,
.file-register-client-row .file-register-field-control .form-control,
.file-register-form .file-register-field-control .form-select,
.file-register-form .file-register-field-control .form-control {
  width: 100%;
}
.modal .file-register-modal-body .file-register-form,
.modal .file-register-modal-body .file-register-section {
  overflow: visible;
}
@media (min-width: 768px) and (max-width: 1199.98px) {
  .modal .file-register-modal-body .file-register-section .row > .col-lg-3 {
    flex: 0 0 auto;
    width: 50%;
  }
}
.file-client-input-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}
.file-client-input-main {
  flex: 1 1 auto;
  min-width: 0;
}
.file-client-mode-toggle {
  flex-shrink: 0;
  align-self: stretch;
  width: 2.375rem;
  min-width: 2.375rem;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
  font-weight: 600;
}

.file-client-combobox .file-client-input-main {
  position: relative;
}

.modal .file-client-combobox,
.modal .file-client-combobox .file-client-input-main,
.modal .file-register-client-row {
  overflow: visible;
}

.modal .file-client-combobox:focus-within {
  position: relative;
  z-index: 6;
}

.file-client-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: auto;
  bottom: calc(100% + 2px);
  z-index: 1060;
  max-height: min(220px, 40vh);
  overflow-y: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #dee2e6);
  border-radius: var(--radius-sm, 0.375rem);
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.12);
}

.file-client-suggestion-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 0.875rem;
  color: var(--ink-900, #0f172a);
}

.file-client-suggestion-item:hover,
.file-client-suggestion-item:focus {
  background: rgba(99, 102, 241, 0.08);
  outline: none;
}

.file-client-mode-toggle:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Monthly file report hub tiles */
.monthly-report-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 150px;
  aspect-ratio: 1 / 1;
  max-width: 200px;
  margin: 0 auto;
  padding: 1rem 0.85rem;
  text-align: center;
  text-decoration: none;
  color: var(--ink-900, #0f172a);
  background: #fff;
  border: 1px solid var(--border, #dee2e6);
  border-radius: 0.65rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.monthly-report-tile:hover,
.monthly-report-tile:focus-visible {
  color: var(--ink-900, #0f172a);
  border-color: #6366f1;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.14);
  transform: translateY(-2px);
}
.monthly-report-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.6rem;
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}
.monthly-report-tile-label {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
}
@media (max-width: 575.98px) {
  .monthly-report-tile {
    min-height: 130px;
    max-width: 180px;
  }
}

.global-report-stat {
  border: 1px solid var(--border, #dee2e6);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.global-report-stat:hover,
.global-report-stat:focus-visible {
  border-color: var(--bs-primary);
  box-shadow: 0 0.25rem 0.75rem rgba(13, 110, 253, 0.12);
}
.global-report-stat-count {
  line-height: 1.1;
}
.global-report-stat-label {
  line-height: 1.25;
}
.global-report-section {
  scroll-margin-top: 5rem;
}

.client-summary {
  margin-top: 0.15rem;
  padding: 0.85rem 1rem;
  border-radius: 0.375rem;
  background: #fff;
  border: 1px solid var(--border, #dee2e6);
}
.client-summary-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-500, #6c757d);
  margin-bottom: 0.65rem;
}
.client-summary-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.client-summary-key {
  font-size: 0.78rem;
  color: var(--ink-500, #6c757d);
}
.client-summary-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-900, #212529);
  word-break: break-word;
}

.files-summary { align-items: center; }

.files-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  background: var(--ink-050);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--ink-600);
  font-weight: 500;
}

.files-chip strong { color: var(--ink-900); font-weight: 700; }

.files-chip-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.files-chip-dot--indigo { background: #6366f1; }
.files-chip-dot--sky    { background: #0ea5e9; }
.files-chip-dot--amber  { background: #f59e0b; }

/* All tasks — assignee filter chips */
.all-tasks-assign-row {
  border-top: 1px solid var(--border);
  background: var(--ink-020, rgba(0,0,0,.02));
  padding: 0.75rem 1.15rem;
}
.all-tasks-chip-wrap { display: inline-flex; align-items: center; gap: 0.25rem; }
.all-tasks-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.2rem 0.2rem 0.6rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--ink-800, #1e293b);
  font-weight: 500;
  max-width: 100%;
}
.all-tasks-user-chip .all-tasks-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 12rem;
}
.all-tasks-user-chip .btn-all-tasks-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  line-height: 1;
  border: none;
  border-radius: 50%;
  background: var(--ink-100, #f1f5f9);
  color: var(--ink-500, #64748b);
  font-size: 1rem;
  cursor: pointer;
}
.all-tasks-user-chip .btn-all-tasks-chip-remove:hover {
  background: #fecaca;
  color: #b91c1c;
}

.files-search .form-control,
.files-search .input-group-text { border-color: var(--border-strong); }
.files-search .form-control:focus { box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18); }

/* ---------- Choices.js theming ---------- */
.choices { margin-bottom: 0; }

.choices__inner {
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-height: calc(1.5em + 1rem + 2px);
  padding: 0.3rem 0.5rem 0.1rem;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.is-invalid-wrap .choices__inner {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.is-invalid-wrap .invalid-feedback { display: inline-block !important; }

.choices[data-type*="select-multiple"] .choices__input {
  background-color: transparent;
  margin: 0;
  padding: 0.25rem 0.3rem;
  font-size: 0.9rem;
}

.choices__list--multiple .choices__item {
  background: var(--brand-100);
  color: var(--brand-700);
  border: 1px solid #e0e7ff;
  border-radius: 999px;
  padding: 0.15rem 0.55rem 0.15rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  margin: 0.15rem 0.25rem 0.15rem 0;
  box-shadow: none;
}

.choices__list--multiple .choices__item.is-highlighted {
  background: #e0e7ff;
  border-color: #c7d2fe;
}

.choices__list--multiple .choices__button {
  border-left: 1px solid rgba(55, 48, 163, 0.25);
  margin-left: 0.4rem;
  padding-left: 0.5rem;
  opacity: 0.7;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="%233730a3" d="M14.348 5.652a1 1 0 0 1 0 1.414L11.414 10l2.934 2.934a1 1 0 1 1-1.414 1.414L10 11.414l-2.934 2.934a1 1 0 1 1-1.414-1.414L8.586 10 5.652 7.066a1 1 0 1 1 1.414-1.414L10 8.586l2.934-2.934a1 1 0 0 1 1.414 0z"/></svg>');
}

.choices__list--multiple .choices__button:hover,
.choices__list--multiple .choices__button:focus { opacity: 1; }

.choices__list--dropdown,
.choices__list[aria-expanded] {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-top: 0.25rem;
  overflow: hidden;
  z-index: 2000;
}

.choices__list--dropdown .choices__item--selectable {
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
  background: var(--brand-100);
  color: var(--brand-700);
}

.choices__list--dropdown .choices__input {
  background-color: var(--ink-050);
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
}

.choices[data-type*="select-multiple"]::after { border-color: var(--ink-500) transparent transparent; }

.modal .choices__list--dropdown,
.modal .choices__list[aria-expanded] { z-index: 2060; }

.modal .choices.is-flipped .choices__list--dropdown,
.modal .choices.is-flipped .choices__list[aria-expanded] {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.modal .choices.is-open {
  overflow: visible;
}

.modal .file-register-section-last .choices,
.modal .file-register-section-last .choices__inner {
  overflow: visible;
}

.modal .file-register-section-last .choices:focus-within {
  position: relative;
  z-index: 6;
}

/* ---------- PDF party reader ---------- */
.pdf-party-empty .card-body {
  min-height: 14rem;
}
.pdf-party-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.pdf-party-card-header-vadi {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
}
.pdf-party-card-header-prativadi {
  background: #fff7ed;
  border-bottom-color: #fed7aa;
}
.pdf-party-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-500, #64748b);
  margin-bottom: 0.35rem;
}
.pdf-party-field-value {
  font-size: 1rem;
  line-height: 1.5;
  word-break: break-word;
}
.advms-marathi-field,
.pdf-marathi-text,
.pdf-party-field-value.advms-marathi-field,
.pdf-text-preview.advms-marathi-field {
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
}
.pdf-party-raw {
  font-size: 0.82rem;
  color: var(--ink-500, #64748b);
  margin-top: 0.35rem;
}
.pdf-party-details {
  white-space: pre-wrap;
  font-size: 0.95rem;
}
.pdf-people-names-list .pdf-party-field-value {
  border-bottom: 1px solid var(--border, #dee2e6);
  font-size: 1rem;
}
.pdf-people-names-list .pdf-party-field-value:last-child {
  border-bottom: 0;
}
.pdf-text-preview {
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.45;
  background: var(--ink-050, #f8f9fa);
  border: 1px solid var(--border, #dee2e6);
  border-radius: 0.375rem;
  padding: 0.85rem 1rem;
}
.pdf-text-full {
  max-height: min(70vh, 720px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.55;
  background: var(--ink-050, #f8f9fa);
  border: 1px solid var(--border, #dee2e6);
  border-radius: 0.375rem;
  padding: 1rem 1.15rem;
}
.pdf-text-full.advms-marathi-field {
  font-size: 0.98rem;
}

/* ---------- Login / auth shell — legal-themed background ---------- */
.auth-shell {
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  color: #ffffff;
  background-color: #0b1220;
  /* Three stacked layers (top → bottom):
     1. A deep navy/indigo gradient wash for readability.
     2. A subtle scales-of-justice SVG motif tiled on top.
     3. A high-quality legal-themed photograph. */
  background-image:
    linear-gradient(135deg, rgba(11, 18, 32, 0.82) 0%, rgba(49, 46, 129, 0.78) 55%, rgba(15, 23, 42, 0.88) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'><g fill='none' stroke='%23ffffff' stroke-opacity='0.06' stroke-width='1.4'><path d='M110 28v150'/><path d='M70 28h80'/><circle cx='110' cy='28' r='3' fill='%23ffffff' fill-opacity='0.08'/><path d='M70 54c0 16 12 30 28 30s28-14 28-30'/><path d='M94 54c0 16-12 30-28 30S38 70 38 54'/><path d='M56 84v8m108-8v8'/><path d='M44 92h24m108 0h24'/><path d='M90 178h40M96 170h28'/></g></svg>"),
    url("https://images.unsplash.com/photo-1589829545856-d10d557cf95f?auto=format&fit=crop&w=1920&q=80");
  background-repeat: no-repeat, repeat, no-repeat;
  background-position: center, top left, center;
  background-size: cover, 220px 220px, cover;
  background-attachment: fixed, fixed, fixed;
}

/* Soft top/bottom vignette for extra readability */
.auth-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 75% -10%, rgba(99, 102, 241, 0.25), transparent 60%),
    radial-gradient(900px 500px at -5% 110%, rgba(14, 165, 233, 0.18), transparent 55%);
  z-index: -1;
}

/* Brand block above the card renders on a dark backdrop.
   Only light-up text OUTSIDE the card — inside the card we want the
   normal dark typography for readability on white. */
.auth-shell h1 { color: #ffffff; }
.auth-shell > main .text-center .text-body-secondary {
  color: rgba(226, 232, 240, 0.85) !important;
}

.auth-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  box-shadow:
    0 30px 60px -20px rgba(2, 6, 23, 0.55),
    0 8px 20px -12px rgba(2, 6, 23, 0.4);
  overflow: hidden;
  backdrop-filter: blur(6px) saturate(1.05);
  -webkit-backdrop-filter: blur(6px) saturate(1.05);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand-600) 0%, #8b5cf6 100%);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.08),
    0 14px 28px -14px rgba(99, 102, 241, 0.9);
}

/* Keep the auth footer text readable over the dark image */
body.auth-shell > footer .text-body-secondary,
body.auth-shell > footer small.text-body-secondary {
  color: rgba(226, 232, 240, 0.75) !important;
}

/* ---------- Case / workflow view ---------- */
.case-summary .meta-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 0.2rem;
}

.case-summary .meta-value {
  font-size: 0.95rem;
  color: var(--ink-900);
  font-weight: 500;
}

.case-detail-list dt {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 0;
}

.case-detail-list dd {
  color: var(--ink-800);
  font-size: 0.92rem;
  margin-bottom: 0;
}

/* Pill-style tabs used on case detail + similar pages */
.app-tabs {
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}

.app-tabs .nav-link {
  color: var(--ink-600);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-tabs .nav-link:hover {
  background: var(--ink-100);
  color: var(--ink-900);
}

.app-tabs .nav-link.active {
  background: var(--brand-100);
  color: var(--brand-700);
}

.app-tabs .nav-link .badge {
  font-weight: 600;
}

/* Case view — full-width menu strip (visible gray toolbar) */
.case-view-menus {
  margin-left: -1rem;
  margin-right: -1rem;
  background: #e2e8f0;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
}

@media (min-width: 992px) {
  .case-view-menus {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
  }
}

.case-view-menus-inner {
  padding: 0.6rem 1rem;
}

@media (min-width: 992px) {
  .case-view-menus-inner {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.case-view-menus-row {
  width: 100%;
}

.case-view-menus-row + .case-view-menus-row {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #cbd5e1;
}

.case-view-menus .app-tabs-case,
.case-view-menus .app-tabs-sub {
  border-bottom: none;
  padding-bottom: 0;
  gap: 0.15rem;
}

.case-view-menus .app-tabs-case {
  flex-wrap: wrap;
  min-width: 0;
}

.case-view-menus .app-tabs .nav-link {
  color: var(--ink-700);
}

.case-view-menus .app-tabs .nav-link:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-900);
}

.case-view-menus .app-tabs .nav-link.active {
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(203, 213, 225, 0.9);
}

.case-view-actions .badge {
  font-weight: 600;
}

.case-view-actions .btn {
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .case-view-menus-row.d-flex {
    flex-direction: column;
    align-items: stretch !important;
  }

  .case-view-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.app-tabs-sub .nav-link {
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
}

.case-doc-grid .case-doc-card {
  border: 1px solid var(--border);
  overflow: hidden;
}

.case-doc-thumb {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--ink-50);
  overflow: hidden;
}

.case-doc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-doc-pdf-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 7rem;
  color: var(--ink-400);
}

.case-doc-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-900);
}

.case-revenue-diary-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.case-revenue-diary-date-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-700);
  font-size: 0.75rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.case-revenue-diary-date-pill:hover {
  border-color: var(--brand-400);
  color: var(--brand-700);
  background: rgba(99, 102, 241, 0.06);
}

.case-revenue-diary-date-pill.is-active {
  border-color: var(--brand-500);
  background: var(--brand-600);
  color: #fff;
  font-weight: 600;
}

.case-revenue-diary-detail {
  border-color: var(--border) !important;
}

.case-doc-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--ink-50);
}

/* =============================================================
   Horizontal timeline
   Center rail runs left→right, dots sit on the rail, cards
   alternate above/below. Scrolls horizontally on overflow.
   ============================================================= */
.timeline-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.25rem 0.75rem;
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  /* Two full “cards above + rail + cards below” rows. */
  min-height: 280px;
}

/* Horizontal center rail. */
.timeline-list::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  top: 50%;
  height: 2px;
  transform: translateY(-1px);
  background: linear-gradient(
    to right,
    rgba(99, 102, 241, 0) 0%,
    rgba(99, 102, 241, 0.35) 4%,
    rgba(99, 102, 241, 0.35) 96%,
    rgba(99, 102, 241, 0) 100%
  );
  border-radius: 2px;
  z-index: 0;
}

.timeline-item {
  position: relative;
  flex: 0 0 auto;
  width: 220px;
  padding: 0 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  scroll-snap-align: start;
  z-index: 1;
}

/* The circular node centered on the rail. */
.timeline-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 0.68rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 4px rgba(99, 102, 241, 0.25),
    0 3px 8px -2px rgba(99, 102, 241, 0.55);
  z-index: 2;
}

/* Card with the note text. Odd = above the line, Even = below. */
.timeline-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  text-align: left;
  font-size: 0.75rem;
  line-height: 1.35;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  width: 100%;
  max-height: 108px;
  overflow: hidden;
}

.timeline-content:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  max-height: none;
  overflow: visible;
  z-index: 3;
}

/* Position the card above (odd) or below (even) the rail. */
.timeline-item:nth-child(odd) .timeline-content {
  margin-top: 0;
  margin-bottom: auto;
  align-self: flex-start;
}
.timeline-item:nth-child(even) .timeline-content {
  margin-top: auto;
  margin-bottom: 0;
  align-self: flex-end;
}

/* Connecting arrow between the card edge and the rail. */
.timeline-content::before,
.timeline-content::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-style: solid;
}

.timeline-item:nth-child(odd) .timeline-content::before {
  bottom: -9px;
  border-width: 9px 8px 0 8px;
  border-color: var(--border) transparent transparent transparent;
}
.timeline-item:nth-child(odd) .timeline-content::after {
  bottom: -8px;
  border-width: 9px 8px 0 8px;
  border-color: var(--surface) transparent transparent transparent;
}
.timeline-item:nth-child(even) .timeline-content::before {
  top: -9px;
  border-width: 0 8px 9px 8px;
  border-color: transparent transparent var(--border) transparent;
}
.timeline-item:nth-child(even) .timeline-content::after {
  top: -8px;
  border-width: 0 8px 9px 8px;
  border-color: transparent transparent var(--surface) transparent;
}

/* Head: name / department / timestamp row. Compact. */
.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.2rem;
  font-size: 0.72rem;
  line-height: 1.25;
}

.timeline-head .badge {
  font-size: 0.6rem;
  padding: 0.18em 0.45em;
}

.timeline-head .ms-auto {
  font-size: 0.65rem;
  flex-basis: 100%;
  color: var(--ink-500);
  margin-left: 0 !important;
}

.timeline-note {
  color: var(--ink-800);
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: pre-line;
  /* Clamp to 3 lines by default; card grows on hover (see above). */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.timeline-content:hover .timeline-note {
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* Scrollbar styling for the horizontal strip */
.timeline-list::-webkit-scrollbar { height: 8px; }
.timeline-list::-webkit-scrollbar-thumb {
  background: var(--ink-200);
  border-radius: 4px;
}
.timeline-list::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }
.timeline-list::-webkit-scrollbar-track { background: transparent; }

/* --- Small screens: fall back to a vertical, single-column feed --- */
@media (max-width: 575.98px) {
  .timeline-list {
    flex-direction: column;
    overflow-x: hidden;
    min-height: 0;
    padding-left: 2.2rem;
  }
  .timeline-list::before {
    top: 0.25rem;
    bottom: 0.25rem;
    left: 1rem;
    right: auto;
    width: 2px;
    height: auto;
    transform: none;
    background: linear-gradient(
      to bottom,
      rgba(99, 102, 241, 0) 0%,
      rgba(99, 102, 241, 0.35) 6%,
      rgba(99, 102, 241, 0.35) 94%,
      rgba(99, 102, 241, 0) 100%
    );
  }
  .timeline-item {
    width: 100%;
    padding: 0 0 0.75rem 0;
  }
  .timeline-dot {
    left: -1.2rem;
    top: 0.5rem;
    transform: none;
  }
  .timeline-content,
  .timeline-item:nth-child(odd) .timeline-content,
  .timeline-item:nth-child(even) .timeline-content {
    margin: 0;
    max-height: none;
    overflow: visible;
  }
  .timeline-content::before,
  .timeline-content::after,
  .timeline-item:nth-child(odd) .timeline-content::before,
  .timeline-item:nth-child(odd) .timeline-content::after,
  .timeline-item:nth-child(even) .timeline-content::before,
  .timeline-item:nth-child(even) .timeline-content::after {
    top: 0.6rem; bottom: auto;
    left: -9px; right: auto;
    transform: none;
    border-width: 8px 9px 8px 0;
    border-color: transparent var(--border) transparent transparent;
  }
  .timeline-item:nth-child(odd) .timeline-content::after,
  .timeline-item:nth-child(even) .timeline-content::after {
    left: -8px;
    border-color: transparent var(--surface) transparent transparent;
  }
  .timeline-note {
    -webkit-line-clamp: unset;
    overflow: visible;
  }
}

/* ---------- Misc utilities ---------- */
.link-muted { color: var(--ink-500); text-decoration: none; }
.link-muted:hover { color: var(--brand-600); text-decoration: underline; }

.soft-divider { height: 1px; background: var(--border); margin: 1.25rem 0; border: 0; }

/* Responsive tweaks */
@media (max-width: 575.98px) {
  .page-header { margin-bottom: 1.1rem; }
  .page-title { font-size: 1.125rem; }
  .page-header-icon { width: 38px; height: 38px; }
  .card-body { padding: 0.95rem; }
  .card-header { padding: 0.85rem 0.95rem; }
  .widget { padding: 1rem 1rem 0.85rem; }
  .widget-value { font-size: 1.6rem; }
}

/* -----------------------------------------------------------------
   Global topbar search
----------------------------------------------------------------- */
.topbar-title { flex-shrink: 0; }

.global-search {
  flex: 1 1 0;
  max-width: 520px;
  min-width: 0;
}
.global-search-box { width: 100%; }

.global-search-input.form-control {
  background: #f1f5f9;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.5rem 2.5rem 0.5rem 2.5rem;
  font-size: 0.9rem;
  height: 40px;
  transition: box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.global-search-input.form-control::placeholder { color: #94a3b8; }
.global-search-input.form-control:focus {
  background: #ffffff;
  border-color: #c7d2fe;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
  outline: none;
}

.global-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  display: inline-flex;
}

.global-search-spinner {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  color: #6366f1;
}

.global-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.15);
  z-index: 1050;
  max-height: 70vh;
  overflow-y: auto;
}
.global-search-dropdown[hidden] { display: none; }

.global-search-hint,
.global-search-empty {
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  color: #64748b;
}

.global-search-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.global-search-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 0.85rem;
  align-items: center;
  padding: 0.6rem 1rem;
  color: #0f172a;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.global-search-item:hover,
.global-search-list li.is-active .global-search-item {
  background: #eef2ff;
  border-left-color: #6366f1;
  color: #0f172a;
  text-decoration: none;
}

.global-search-item .gs-no {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: #4f46e5;
  background: rgba(99, 102, 241, 0.1);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

.global-search-item .gs-body { min-width: 0; }
.global-search-item .gs-title {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-search-item .gs-sub {
  display: block;
  font-size: 0.78rem;
  color: #475569;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-search-item .gs-sub span + span::before {
  content: " · ";
  color: #cbd5e1;
}
.global-search-item .gs-meta {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-search-item mark {
  background: #fef3c7;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.global-search-item .gs-status {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.global-search-item .gs-status.status-active      { background: #dcfce7; color: #166534; }
.global-search-item .gs-status.status-in_progress { background: #dbeafe; color: #1d4ed8; }
.global-search-item .gs-status.status-completed   { background: #e2e8f0; color: #334155; }

/* Hide the browser-provided clear "x" in the search input so our
   rounded pill looks clean. */
.global-search-input::-webkit-search-cancel-button { display: none; }

@media (max-width: 767.98px) {
  .global-search {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
  }

  .global-search-input.form-control {
    height: 36px;
    font-size: 0.85rem;
  }

  .global-search-dropdown {
    max-height: min(60vh, 420px);
    z-index: 1060;
  }

  .global-search-item {
    grid-template-columns: 1fr auto;
    row-gap: 0.25rem;
  }

  .global-search-item .gs-no {
    grid-column: 1 / -1;
  }

  .global-search-item .gs-status {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }
}

/* ---------- Reusable grid footer (count + pagination) ---------- */
.grid-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.95rem;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 0.78rem;
  color: var(--ink-500);
}

.grid-footer .pagination {
  margin: 0;
  --bs-pagination-padding-x: 0.55rem;
  --bs-pagination-padding-y: 0.2rem;
  --bs-pagination-font-size: 0.78rem;
  --bs-pagination-color: var(--ink-700);
  --bs-pagination-bg: var(--surface);
  --bs-pagination-border-color: var(--border-strong);
  --bs-pagination-hover-color: var(--brand-700);
  --bs-pagination-hover-bg: var(--brand-100);
  --bs-pagination-hover-border-color: var(--brand-100);
  --bs-pagination-focus-color: var(--brand-700);
  --bs-pagination-focus-bg: var(--brand-100);
  --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  --bs-pagination-active-color: #fff;
  --bs-pagination-active-bg: var(--brand-600);
  --bs-pagination-active-border-color: var(--brand-600);
  --bs-pagination-disabled-color: var(--ink-400);
  --bs-pagination-disabled-bg: var(--surface);
  --bs-pagination-disabled-border-color: var(--border);
  --bs-pagination-border-radius: var(--radius-sm);
  gap: 0.2rem;
}

.grid-footer .page-link {
  border-radius: var(--radius-sm) !important;
  font-weight: 500;
  min-width: 2rem;
  text-align: center;
}

.grid-footer .page-item.active .page-link { box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25); }

@media (max-width: 575.98px) {
  .grid-footer { justify-content: center; }
  .grid-footer .grid-footer-summary { width: 100%; text-align: center; }
}

/* ---------- Floating Task FAB ---------- */
.task-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1050;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem 0.6rem 0.85rem;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  box-shadow: 0 12px 28px -12px rgba(79, 70, 229, 0.55), 0 4px 10px -4px rgba(15, 23, 42, 0.18);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.task-fab:hover,
.task-fab:focus-visible {
  transform: translateY(-2px);
  background: linear-gradient(135deg, var(--brand-700), var(--brand-600));
  box-shadow: 0 16px 34px -14px rgba(79, 70, 229, 0.65), 0 6px 14px -6px rgba(15, 23, 42, 0.2);
  outline: none;
  color: #fff;
}
.task-fab:active { transform: translateY(0); }
.task-fab .task-fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}
.task-fab .task-fab-label { line-height: 1; }

@media (max-width: 575.98px) {
  .task-fab { right: 0.85rem; bottom: 0.85rem; padding: 0.55rem 0.9rem 0.55rem 0.7rem; font-size: 0.8rem; }
  .task-fab .task-fab-icon { width: 24px; height: 24px; }
}

/* ---------- Floating Work Allotment FAB ---------- */
.work-allotment-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1050;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem 0.6rem 0.85rem;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #d97706, #f59e0b);
  box-shadow: 0 12px 28px -12px rgba(217, 119, 6, 0.55), 0 4px 10px -4px rgba(15, 23, 42, 0.18);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.work-allotment-fab.fab-stack-has-task { bottom: 4.85rem; }
.work-allotment-fab:hover,
.work-allotment-fab:focus-visible {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #b45309, #d97706);
  box-shadow: 0 16px 34px -14px rgba(217, 119, 6, 0.65), 0 6px 14px -6px rgba(15, 23, 42, 0.2);
  outline: none;
  color: #fff;
}
.work-allotment-fab:active { transform: translateY(0); }
.work-allotment-fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}
.work-allotment-fab-label { line-height: 1; }

@media (max-width: 575.98px) {
  .work-allotment-fab { right: 0.85rem; bottom: 0.85rem; padding: 0.55rem 0.9rem 0.55rem 0.7rem; font-size: 0.8rem; }
  .work-allotment-fab.fab-stack-has-task { bottom: 4.35rem; }
  .work-allotment-fab .work-allotment-fab-icon { width: 24px; height: 24px; }
}

.reg-doc-name-chip-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-height: calc(1.5em + 1rem + 2px);
  padding: 0.35rem 0.5rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border-strong, #cbd5e1);
  border-radius: var(--radius-sm, 0.375rem);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.reg-doc-name-chip-field:focus-within {
  border-color: var(--brand-500, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.reg-doc-name-chip-list {
  display: contents;
}

.reg-doc-name-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.15rem 0.15rem 0.15rem 0.55rem;
  background: var(--ink-50, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-800, #1e293b);
}

.reg-doc-name-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 10rem;
}

.reg-doc-name-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--ink-100, #f1f5f9);
  color: var(--ink-500, #64748b);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.reg-doc-name-chip-remove:hover {
  background: #fecaca;
  color: #b91c1c;
}

.reg-doc-name-chip-input {
  flex: 1 1 8rem;
  min-width: 6rem;
  padding: 0.15rem 0.25rem !important;
  background: transparent !important;
}

.reg-doc-name-chip-input:focus {
  outline: none;
  box-shadow: none !important;
}

/* ---------- Registered Document Records — mobile ---------- */
@media (max-width: 767.98px) {
  .reg-doc-header-actions {
    width: 100%;
  }

  .reg-doc-header-actions .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-height: 44px;
    justify-content: center;
  }

  .reg-doc-page .reg-doc-list-header {
    flex-direction: column;
    align-items: stretch !important;
  }

  .reg-doc-page .reg-doc-search {
    min-width: 0 !important;
    margin-left: 0 !important;
  }

  .reg-doc-page .reg-doc-search .input-group {
    flex-wrap: nowrap;
  }

  .reg-doc-page .reg-doc-search .form-control {
    font-size: 16px;
    min-width: 0;
  }

  #regDocAddModal .reg-doc-modal-dialog {
    margin: 0;
  }

  @media (min-width: 768px) {
    #regDocAddModal .reg-doc-modal-dialog {
      margin: var(--bs-modal-margin);
    }
  }

  #regDocAddModal .modal-content.file-register-modal {
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  @media (min-width: 768px) {
    #regDocAddModal .modal-content.file-register-modal {
      min-height: 0;
      max-height: calc(100vh - (var(--bs-modal-margin, 0.5rem) * 2));
      border-radius: var(--bs-modal-border-radius);
    }
  }

  #regDocAddModal .modal-header {
    padding: 0.85rem 1rem;
  }

  #regDocAddModal .file-register-modal-body {
    padding: 0.75rem 0.85rem 1rem;
  }

  #regDocAddModal .file-register-section {
    padding: 0.85rem 0.9rem;
  }

  #regDocAddModal .reg-doc-modal-footer {
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  #regDocAddModal .reg-doc-modal-footer .btn {
    min-height: 44px;
    margin: 0;
  }

  .reg-doc-record-form .form-control,
  .reg-doc-record-form .form-select,
  .reg-doc-record-form .reg-doc-name-chip-input {
    font-size: 16px;
  }

  .reg-doc-record-form .file-client-mode-toggle {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .reg-doc-record-form .reg-doc-name-chip-remove {
    min-width: 32px;
    min-height: 32px;
    font-size: 1.1rem;
  }

  .reg-doc-record-form .reg-doc-name-chip {
    padding: 0.25rem 0.2rem 0.25rem 0.65rem;
    font-size: 0.875rem;
  }

  .reg-doc-record-form .reg-doc-name-chip-input {
    flex: 1 1 100%;
    min-width: 8rem;
  }

  .reg-doc-record-form .file-client-suggestions {
    max-height: min(240px, 35vh);
  }

  .reg-doc-edit-page .card-body.file-register-modal-body {
    padding: 0.85rem 0.95rem;
  }

  .reg-doc-edit-page .file-register-section {
    padding: 0.85rem 0.9rem;
  }

  .reg-doc-edit-footer .btn {
    min-height: 44px;
    margin: 0;
  }

  .reg-doc-records-table thead {
    display: none;
  }

  .reg-doc-records-table tbody tr {
    display: block;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
  }

  .reg-doc-records-table tbody tr:last-child {
    border-bottom: 0;
  }

  .reg-doc-records-table tbody td {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border: 0;
    max-width: none !important;
    text-align: left !important;
  }

  .reg-doc-records-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 6.75rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-500, #64748b);
    line-height: 1.35;
    padding-top: 0.1rem;
  }

  .reg-doc-records-table tbody td.reg-doc-actions-cell::before {
    display: none;
  }

  .reg-doc-records-table tbody td.reg-doc-actions-cell {
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.65rem;
    margin-top: 0.25rem;
    border-top: 1px dashed var(--border, #e2e8f0);
  }

  .reg-doc-records-table tbody td.reg-doc-actions-cell .btn {
    min-height: 40px;
    min-width: 40px;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .reg-doc-records-table .text-truncate {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .reg-doc-records-table tbody td.reg-doc-cell-file::before {
    flex-basis: 100%;
    margin-bottom: 0.15rem;
  }

  .reg-doc-records-table tbody td.reg-doc-cell-file {
    flex-wrap: wrap;
  }
}

@media (max-width: 767.98px) {
  .page-header-actions:has(.reg-doc-header-actions) {
    width: 100%;
  }
}

.work-allotment-task-list,
.work-allotment-user-list {
  margin-bottom: 0;
}

.work-allotment-task-list li + li,
.work-allotment-user-list li + li {
  margin-top: 0.25rem;
}

/* ---------- Topbar notifications ---------- */
.topbar-actions { flex-shrink: 0; }
.notification-menu-toggle {
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}
.notification-badge {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
}
.notification-dropdown { width: min(22rem, 92vw); max-height: 24rem; overflow: hidden; }
.notification-list { max-height: 18rem; overflow: auto; }
.notification-item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
  cursor: pointer;
}
.notification-item:last-child { border-bottom: 0; }
.notification-item:hover { background: var(--ink-050, #f8fafc); }
.notification-item.is-read { opacity: 0.72; }
.notification-item-title { font-size: 0.82rem; font-weight: 600; color: var(--ink-900, #111827); }
.notification-item-message {
  font-size: 0.78rem;
  color: var(--ink-600, #4b5563);
  margin-top: 0.15rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.notification-item-time { font-size: 0.68rem; color: var(--ink-400, #9ca3af); margin-top: 0.25rem; }

/* ---------- My Tasks grid niceties ---------- */
.task-row.is-completed td { color: var(--ink-500); }
.task-row.is-completed .task-name { text-decoration: line-through; }
.task-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.task-status-pill.is-pending     { background: #fef3c7; color: #92400e; }
.task-status-pill.is-in_progress { background: #dbeafe; color: #1d4ed8; }
.task-status-pill.is-completed   { background: #dcfce7; color: #166534; }
.task-status-pill.is-query       { background: #fde2e4; color: #9b1c1c; }

/* Chip-styled <select> for changing task status inline */
.task-status-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 0;
  outline: none;
  cursor: pointer;
  padding: 0.25rem 1.6rem 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
  background-color: #fef3c7;
  color: #92400e;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='%23475569'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
}
.task-status-select:focus { box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35); }
.task-status-select.is-pending     { background-color: #fef3c7; color: #92400e; }
.task-status-select.is-in_progress { background-color: #dbeafe; color: #1d4ed8; }
.task-status-select.is-completed   { background-color: #dcfce7; color: #166534; }
.task-status-select.is-query       { background-color: #fde2e4; color: #9b1c1c; }
.task-status-select option { color: var(--ink-900); background: #fff; font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 0.85rem; }

.task-note-form { display: none; }
.task-note-form.is-visible { display: flex; }

.task-notes-chip { cursor: help; user-select: none; }
.task-notes-chip:hover,
.task-notes-chip:focus { background-color: var(--ink-200) !important; outline: none; }

.task-notes-popover { max-width: 320px; }
.task-notes-popover .popover-header { font-size: 0.75rem; font-weight: 600; }
.task-notes-popover .popover-body   { padding: 0.5rem 0.75rem; }
.task-note-popover-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 280px;
  overflow-y: auto;
}
.task-note-popover-list li {
  border-left: 3px solid var(--brand-500);
  padding: 0.1rem 0 0.1rem 0.55rem;
}
.task-note-popover-text { font-size: 0.8rem; color: var(--ink-800); white-space: pre-wrap; }
.task-note-popover-meta { font-size: 0.68rem; color: var(--ink-500); margin-top: 0.1rem; }

/* @ mention dropdown (task notes) */
.task-mention-wrap { z-index: 1; }
.task-mention-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 2px;
  z-index: 1080;
  max-height: 200px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 0.2rem 0;
}
.task-mention-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.4rem 0.6rem;
  line-height: 1.2;
  cursor: pointer;
}
.task-mention-item:hover,
.task-mention-item.is-active { background: var(--ink-100); }
.task-mention-name { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-900); }
.task-mention-mail { display: block; font-size: 0.68rem; color: var(--ink-500); }
.task-mention-empty {
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  color: var(--ink-600);
  max-width: 280px;
}
.page-my-tasks tr[data-mention-open="1"] { z-index: 20; position: relative; }

/* My tasks: expand row + chevron (delegated subtasks) */
.page-my-tasks .task-subtask-expand-row td { border-top: none !important; }
.page-my-tasks .task-subtask-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.page-my-tasks .task-subtask-toggle:not(.collapsed) .task-subtask-chevron { transform: rotate(180deg); }
.task-subtask-expand-panel { background: var(--ink-100); }

/* Subtask delegation track (red / green) */
.subtask-ribbon { background: #4f46e5 !important; color: #fff !important; font-size: 0.65rem; font-weight: 600; }
.task-subtrack-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 0.25rem;
}
.subtask-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  max-width: 10rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subtask-pill.is-pending { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.subtask-pill.is-done   { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }

.court-diary-stage-cell .court-diary-stage-input {
  min-width: 8rem;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.court-diary-stage-cell .court-diary-stage-input:hover {
  border-color: var(--bs-border-color);
  background: #fff;
}
.court-diary-stage-cell .court-diary-stage-input:focus {
  border-color: var(--bs-primary);
  background: #fff;
  box-shadow: 0 0 0 0.15rem rgba(var(--bs-primary-rgb), 0.15);
}
.court-diary-stage-cell.is-saving .court-diary-stage-input {
  opacity: 0.7;
}
.court-diary-stage-cell.is-saved .court-diary-stage-input {
  border-color: #198754;
}
.court-diary-stage-cell.is-error .court-diary-stage-input {
  border-color: #dc3545;
}

.court-diary-roznama-cell .court-diary-roznama-input {
  min-width: 10rem;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.court-diary-roznama-cell .court-diary-roznama-input:hover {
  border-color: var(--bs-border-color);
  background: #fff;
}
.court-diary-roznama-cell .court-diary-roznama-input:focus {
  border-color: var(--bs-primary);
  background: #fff;
  box-shadow: 0 0 0 0.15rem rgba(var(--bs-primary-rgb), 0.15);
}
.court-diary-roznama-cell.is-saving .court-diary-roznama-input {
  opacity: 0.7;
}
.court-diary-roznama-cell.is-saved .court-diary-roznama-input {
  border-color: #198754;
}
.court-diary-roznama-cell.is-error .court-diary-roznama-input {
  border-color: #dc3545;
}

.court-diary-view-date {
  width: auto;
  min-width: 10.5rem;
  max-width: 100%;
}

/* Family tree page */
.page-family-tree .ft-tree-card {
  min-height: 28rem;
  display: flex;
  flex-direction: column;
}
.page-family-tree .ft-tree-card > .card-body {
  flex: 1;
  min-height: 0;
}
.page-family-tree .ft-tree-panel {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  min-height: 24rem;
  height: 100%;
  background:
    radial-gradient(circle at 1px 1px, rgba(99, 102, 241, 0.08) 1px, transparent 0) 0 0 / 18px 18px,
    linear-gradient(180deg, #fbfcff 0%, #f8fafc 100%);
}
.page-family-tree .ft-empty {
  color: var(--ink-500);
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 22rem;
  margin: 0 auto;
}
.page-family-tree .ft-tree,
.page-family-tree .ft-branch {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
}
.page-family-tree .ft-tree {
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 1.25rem 0.75rem 2rem;
  min-width: max-content;
}
.page-family-tree .ft-root-item {
  display: flex;
  justify-content: center;
}
.page-family-tree .ft-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.page-family-tree .ft-couple {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.page-family-tree .ft-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 6.5rem;
  max-width: 12rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 2px solid var(--border-strong);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-800);
  text-align: center;
  line-height: 1.25;
  word-break: break-word;
}
.page-family-tree .ft-node.is-male {
  border-color: #93c5fd;
  background: #eff6ff;
}
.page-family-tree .ft-node.is-female {
  border-color: #f9a8d4;
  background: #fdf2f8;
}
.page-family-tree .ft-node.is-neutral {
  border-color: #c4b5fd;
  background: #f5f3ff;
}
.page-family-tree .ft-branch {
  position: relative;
  padding-top: 1.75rem;
  gap: 1.25rem;
}
.page-family-tree .ft-branch::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 1.75rem;
  border-left: 2px solid var(--ink-300);
}
.page-family-tree .ft-branch-item {
  position: relative;
  padding-top: 0;
}
.page-family-tree .ft-branch-item::before,
.page-family-tree .ft-branch-item::after {
  content: '';
  position: absolute;
  top: 0;
  border-top: 2px solid var(--ink-300);
}
.page-family-tree .ft-branch-item::before {
  right: 50%;
  width: 50%;
  border-right: 2px solid var(--ink-300);
}
.page-family-tree .ft-branch-item::after {
  left: 50%;
  width: 50%;
}
.page-family-tree .ft-branch-item:first-child::before {
  border-top: 0;
}
.page-family-tree .ft-branch-item:last-child::after {
  border-top: 0;
}
.page-family-tree .ft-branch-item:only-child::before,
.page-family-tree .ft-branch-item:only-child::after {
  border-top: 0;
  border-right: 0;
}
.page-family-tree .ft-relation-list li + li {
  border-top: 1px dashed var(--border);
}

.page-family-tree .ft-tree-toast {
  margin: 0 1rem 0.5rem;
  border-radius: 0.5rem;
}
.page-family-tree .ft-tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
}
.page-family-tree .ft-tree-toolbar .badge {
  font-weight: 500;
}
.page-family-tree .ft-tree-canvas-wrap {
  flex: 1;
  overflow: auto;
  padding: 1.25rem;
  min-height: 22rem;
}
.page-family-tree .ft-svg-node {
  touch-action: none;
  cursor: grab;
}
.page-family-tree .ft-svg-node-rect {
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.06));
  transition: stroke 0.15s, filter 0.15s;
  pointer-events: all;
}
.page-family-tree .ft-tree-svg-host {
  width: fit-content;
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.page-family-tree #familyTreeSvg {
  display: block;
  vertical-align: top;
}
.page-family-tree .ft-svg-edge {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 2;
  stroke-linecap: round;
}
.page-family-tree .ft-svg-node-rect.is-selected {
  stroke-width: 2.5;
  filter: drop-shadow(0 4px 12px rgba(79, 70, 229, 0.25));
}
.page-family-tree .ft-svg-node.is-dragging .ft-svg-node-rect {
  opacity: 0.35;
}
.page-family-tree .ft-svg-node.is-drop-target .ft-svg-node-rect {
  stroke: #4f46e5;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 0 3px rgba(79, 70, 229, 0.2));
}
.page-family-tree .ft-drag-ghost {
  position: fixed;
  z-index: 1080;
  pointer-events: none;
  padding: 0.45rem 0.75rem;
  border-radius: 0.625rem;
  border: 2px solid #4f46e5;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-900);
  max-width: 12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translate(-50%, -50%);
}
.page-family-tree .ft-link-popover {
  position: fixed;
  z-index: 1090;
  min-width: 16rem;
  max-width: 20rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}
.page-family-tree .ft-link-popover-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-500);
  margin-bottom: 0.5rem;
}
.page-family-tree .ft-link-popover-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.page-family-tree .ft-link-popover-list .btn {
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
}
.page-family-tree .ft-tree-canvas-wrap.is-dragging {
  cursor: grabbing;
  user-select: none;
}
.page-family-tree .ft-svg-node-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  fill: var(--ink-900);
  pointer-events: none;
}
.page-family-tree .ft-svg-node-sub {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 500;
  fill: var(--ink-500);
  pointer-events: none;
}
.page-family-tree .ft-tree-empty {
  color: var(--ink-500);
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 22rem;
  margin: 0 auto;
}

.advms-marathi-suggest-panel {
  z-index: 1080;
  max-width: min(420px, calc(100vw - 16px));
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md, 0.5rem);
  background: var(--surface, #fff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.advms-marathi-suggest-panel .advms-marathi-suggest-options .btn {
  font-family: inherit;
}
