/* ======= myLegacy — App shell styles ====== */

:root {
  /* Brand */
  --brand-primary:   #0d3b66;
  --brand-primary-2: #0a2f52;
  --brand-accent:    #c9a227;

  /* Surfaces */
  --surface-bg:      #f4f6f9;
  --surface-card:    #ffffff;
  --surface-muted:   #eef1f5;
  --surface-hover:   #f8fafc;

  /* Text */
  --text-primary:    #1a2b42;
  --text-secondary:  #5a6b82;
  --text-muted:      #8896a8;

  /* Lines */
  --border-subtle:   #e6e9ee;
  --border-strong:   #d0d7e2;

  /* States */
  --state-success:   #198754;
  --state-warning:   #f0ad4e;
  --state-danger:    #dc3545;
  --state-info:      #0dcaf0;

  /* Layout */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 30, 54, .04);
  --shadow-md: 0 2px 8px rgba(16, 30, 54, .06);
  --shadow-lg: 0 8px 24px rgba(16, 30, 54, .08);

  --brand: #0d3b66;
  --brand-hover: #0a2f52;
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --topbar-height: 56px;
  --sidebar-bg: #0d3b66;
  --sidebar-fg: #e7eef6;
  --sidebar-fg-muted: #92a9c3;
  --sidebar-hover: rgba(255, 255, 255, .08);
  --sidebar-active: rgba(255, 255, 255, .16);
}

* { box-sizing: border-box; }

body {
  background: var(--surface-bg);
  color: var(--text-primary);
  overflow-x: hidden;
}

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
/* ---------- Sidebar ---------- */
.app-sidebar {
  width: var(--sidebar-width, 240px);
  background: var(--brand-primary);
  color: #e7eef6;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  transition: transform .25s ease, width .25s ease;
  overflow: hidden;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: var(--topbar-height, 56px);
  flex-shrink: 0;
}
.sidebar-brand-link {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  white-space: nowrap;
  letter-spacing: .3px;
}
.sidebar-brand-icon {
  font-size: 1.35rem;
  color: var(--brand-accent);
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}
.sidebar-close-mobile {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,.75);
  font-size: 1rem;
  padding: .25rem .5rem;
  border-radius: var(--radius-sm);
  transition: background .12s ease, color .12s ease;
}
.sidebar-close-mobile:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

/* Nav */
.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .75rem 0;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 3px;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Section labels */
.sidebar-section {
  padding: 1rem 1.25rem .35rem;
}
.sidebar-section-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(231, 238, 246, .4);
  font-weight: 700;
}

/* Links */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .62rem 1.25rem;
  color: rgba(231, 238, 246, .82);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  white-space: nowrap;
  border-left: 3px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  position: relative;
}
.sidebar-link:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.sidebar-link.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  font-weight: 600;
  border-left-color: var(--brand-accent);
}
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--brand-accent);
}

.sidebar-link i {
  font-size: 1.05rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  transition: color .15s ease;
}
.sidebar-link.active i {
  color: var(--brand-accent);
}

.sidebar-label {
  transition: opacity .2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* User block */
.sidebar-user {
  padding: .85rem 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.sidebar-user-avatar {
  font-size: 1.75rem;
  color: rgba(231, 238, 246, .55);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: color .15s ease;
}
.sidebar-user-row:hover .sidebar-user-avatar {
  color: var(--brand-accent);
}
.sidebar-user-meta {
  flex: 1 1 auto;
  min-width: 0;
}
.sidebar-user-name {
  font-weight: 600;
  font-size: .83rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .7rem;
  color: rgba(231, 238, 246, .55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-logout {
  margin: 0;
  flex-shrink: 0;
}
.sidebar-user-logout button {
  background: transparent;
  border: 0;
  color: rgba(231, 238, 246, .6);
  padding: .35rem .45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  transition: background .12s ease, color .12s ease;
  display: inline-flex;
  align-items: center;
}
.sidebar-user-logout button:hover {
  background: rgba(220, 53, 69, .2);
  color: #fca5a5;
}

/* ---------- Collapsed desktop mode ---------- */
body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed, 64px);
}
body.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-collapsed, 64px);
}
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-section-label,
body.sidebar-collapsed .sidebar-brand-text {
  opacity: 0;
  pointer-events: none;
  width: 0;
}
body.sidebar-collapsed .sidebar-section {
  padding: .75rem 0 .35rem;
  text-align: center;
  height: 1rem;
}
body.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: .75rem 0;
  gap: 0;
}
body.sidebar-collapsed .sidebar-link i {
  width: auto;
}
body.sidebar-collapsed .sidebar-user-meta {
  display: none;
}
body.sidebar-collapsed .sidebar-user-row {
  justify-content: center;
  gap: 0;
}
body.sidebar-collapsed .sidebar-user-logout {
  display: none;
}
body.sidebar-collapsed .sidebar-brand-link {
  justify-content: center;
}

/* ---------- Tooltips (collapsed mode) ---------- */
body.sidebar-collapsed .sidebar-link {
  position: relative;
}
body.sidebar-collapsed .sidebar-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #1a2b42;
  color: #fff;
  font-size: .75rem;
  font-weight: 500;
  padding: .35rem .65rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  box-shadow: var(--shadow-md);
  z-index: 1100;
}
body.sidebar-collapsed .sidebar-link:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
}

/* ---------- Mobile ---------- */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width, 240px);
    box-shadow: 0 0 24px rgba(0,0,0,.25);
  }
  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  body.sidebar-collapsed .app-main {
    margin-left: 0;
  }
  body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-width, 240px);
  }
  /* Disable collapsed visuals on mobile */
  body.sidebar-collapsed .sidebar-label,
  body.sidebar-collapsed .sidebar-section-label,
  body.sidebar-collapsed .sidebar-brand-text,
  body.sidebar-collapsed .sidebar-user-meta {
    opacity: 1;
    pointer-events: auto;
    width: auto;
  }
  body.sidebar-collapsed .sidebar-link {
    justify-content: flex-start;
    padding: .62rem 1.25rem;
    gap: .85rem;
  }
  body.sidebar-collapsed .sidebar-link::after {
    display: none;
  }
  body.sidebar-collapsed .sidebar-user-row {
    justify-content: flex-start;
    gap: .65rem;
  }
  body.sidebar-collapsed .sidebar-user-logout {
    display: inline-flex;
  }
}

/* =========================================================
   Buttons — app-wide design system
   ========================================================= */

.btn {
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .01em;
  padding: .5rem .9rem;
  border-radius: var(--radius-sm);
  transition: background-color .15s ease, border-color .15s ease,
              color .15s ease, box-shadow .15s ease, transform .08s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  line-height: 1.2;
  border-width: 1px;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 59, 102, .18);
}

/* Sizes */
.btn-sm {
  font-size: .78rem;
  padding: .35rem .7rem;
  border-radius: var(--radius-sm);
  gap: .3rem;
}
.btn-lg {
  font-size: .95rem;
  padding: .65rem 1.2rem;
}

/* ---------- Primary ---------- */
.btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--brand-primary-2);
  border-color: var(--brand-primary-2);
  color: #fff;
}

/* ---------- Outline Primary ---------- */
.btn-outline-primary {
  background: transparent;
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

/* ---------- Outline Secondary ---------- */
.btn-outline-secondary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ---------- Secondary ---------- */
.btn-secondary {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn-secondary:hover,
.btn-secondary:focus {
  background: #e2e8f0;
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ---------- Success ---------- */
.btn-success {
  background: var(--state-success);
  border-color: var(--state-success);
  color: #fff;
}
.btn-success:hover,
.btn-success:focus {
  background: #146c43;
  border-color: #146c43;
  color: #fff;
}
.btn-outline-success {
  background: transparent;
  border-color: var(--state-success);
  color: var(--state-success);
}
.btn-outline-success:hover,
.btn-outline-success:focus {
  background: var(--state-success);
  border-color: var(--state-success);
  color: #fff;
}

/* ---------- Danger ---------- */
.btn-danger {
  background: var(--state-danger);
  border-color: var(--state-danger);
  color: #fff;
}
.btn-danger:hover,
.btn-danger:focus {
  background: #b02a37;
  border-color: #b02a37;
  color: #fff;
}
.btn-outline-danger {
  background: transparent;
  border-color: var(--state-danger);
  color: var(--state-danger);
}
.btn-outline-danger:hover,
.btn-outline-danger:focus {
  background: var(--state-danger);
  border-color: var(--state-danger);
  color: #fff;
}

/* ---------- Ghost (text-only) ---------- */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
  padding: .35rem .55rem;
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--brand-primary);
}

/* ---------- Icon-only buttons ---------- */
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}
.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

/* ---------- Disabled ---------- */
.btn:disabled,
.btn.disabled {
  opacity: .55;
  pointer-events: none;
}

/* ---------- Button groups ---------- */
.btn-group > .btn {
  border-radius: 0;
}
.btn-group > .btn:first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}
.btn-group > .btn:last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

/* ---------- Dropdown toggle ---------- */
.dropdown-toggle-split {
  padding-left: .5rem;
  padding-right: .5rem;
}

/* ---------- Link-style buttons ---------- */
.btn-link {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 600;
  padding: .25rem .35rem;
  background: transparent;
  border: 0;
}
.btn-link:hover {
  color: var(--brand-primary-2);
  text-decoration: underline;
}

/* =========================================================
   Password field — toggle visibility
   ========================================================= */

.password-field-wrapper {
  position: relative;
  display: block;
}

.password-field-wrapper input {
  padding-right: 2.75rem !important;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: .5rem;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: .25rem .5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 1;
  transition: color .15s ease, background .15s ease;
  z-index: 2;
}
.password-toggle:hover {
  color: var(--brand-primary);
  background: var(--surface-hover);
}
.password-toggle i {
  font-size: 1rem;
  display: block;
}

/* ---------- Main area ---------- */
.app-main {
  flex: 1 1 auto;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}

.app-topbar {
  height: var(--topbar-height);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-btn {
  background: transparent;
  border: 0;
  color: #33475b;
  font-size: 1.15rem;
  padding: .4rem .55rem;
  border-radius: .5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background .15s ease;
}

.topbar-btn:hover {
  background: var(--surface-muted);
  color: var(--brand-primary);
}

.topbar-title {
  font-weight: 600;
  color: #33475b;
}

.app-content {
  padding: 1.25rem;
  flex: 1 1 auto;
}

.app-footer {
  padding: .75rem 1.25rem;
  color: var(--text-muted);
  font-size: .8rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-card);
  text-align: center;
}

/* ---------- Backdrop (mobile) ---------- */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1035;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Collapsed desktop ---------- */
body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed);
}

body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-section-label,
body.sidebar-collapsed .sidebar-user-meta {
  opacity: 0;
  pointer-events: none;
}

body.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-collapsed);
}

body.sidebar-collapsed .sidebar-user form .btn span {
  display: none;
}

/* ---------- Mobile ---------- */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    box-shadow: 0 0 24px rgba(0,0,0,.25);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  body.sidebar-collapsed .app-main {
    margin-left: 0;
  }

  .app-content {
    padding: 1rem;
  }
}

/* ---------- Cards ---------- */
.card { 
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); 
}
.card-header {
  background: var(--surface-card) !important;
  border-bottom: 1px solid var(--border-subtle);
  padding: .85rem 1.1rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header .card-action {
  font-size: .75rem;
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 500;
}
.card-header .card-action:hover { text-decoration: underline; }


/* ---------- Topbar ---------- */
.app-topbar {
  height: var(--topbar-height, 56px);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 .9rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  gap: .5rem;
}

.topbar-zone {
  display: flex;
  align-items: center;
  gap: .5rem;
  z-index: 2;
  min-width: 0;
}

/* Prevent topbar items from squishing too aggressively */
.topbar-zone-right > * {
  flex-shrink: 0;
}
.topbar-zone-right .topbar-search {
  flex-shrink: 1;   /* search is the only thing allowed to shrink */
  min-width: 160px;
}

/* Breadcrumb */
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-left: .5rem;
  font-size: .82rem;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.crumb-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: .25rem .35rem;
  border-radius: var(--radius-sm);
  transition: background .12s ease, color .12s ease;
}
.crumb-link:hover { background: var(--surface-hover); color: var(--brand-primary); }
.crumb-sep { color: var(--text-muted); font-size: .6rem; }
.crumb-current {
  color: var(--text-primary);
  font-weight: 600;
  padding: .25rem .35rem;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Floating center logo */
.topbar-center-brand {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .25rem .75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  z-index: 1;
  transition: background .15s ease;
}
.topbar-center-brand:hover { background: var(--surface-hover); }

.topbar-logo {
  height: 90px;
  padding-top: 20px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  display: block;
}

/* Search */
.topbar-search {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 100px;
  padding: .3rem .75rem;
  min-width: 220px;
  max-width: 320px;
  transition: border-color .15s ease, background .15s ease;
}
.topbar-search:hover,
.topbar-search:focus-within {
  background: var(--surface-card);
  border-color: var(--border-strong);
}
.topbar-search i {
  color: var(--text-muted);
  font-size: .9rem;
}
.topbar-search input {
  border: 0;
  background: transparent;
  outline: none;
  flex: 1 1 auto;
  font-size: .85rem;
  color: var(--text-primary);
  min-width: 0;
}
.topbar-search input::placeholder { color: var(--text-muted); }

/* Mobile — logo shrinks so it doesn't collide with action buttons */
@media (max-width: 575.98px) {
  .topbar-logo {
    height: 26px;
    max-width: 120px;
  }
  .app-topbar {
    padding: 0 .5rem;
  }
}

/* ---------- topbar buttons ---------- */
.topbar-btn {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-size: 1.05rem;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
  position: relative;
}
.topbar-btn:hover { background: var(--surface-hover); color: var(--brand-primary); }

/* Notification dot */
.topbar-notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--state-danger);
  border: 2px solid var(--surface-card);
}

/* User button */
.topbar-user-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: transparent;
  border: 0;
  padding: .25rem .5rem .25rem .25rem;
  border-radius: 100px;
  color: var(--text-primary);
  transition: background .12s ease;
}
.topbar-user-btn:hover { background: var(--surface-hover); }
.topbar-user-avatar {
  font-size: 1.35rem;
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
}
.topbar-user-name {
  font-size: .85rem;
  font-weight: 600;
}
.topbar-user-caret { font-size: .7rem; color: var(--text-muted); }

/* Dropdown polish */
.topbar-dropdown {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: .35rem 0;
  margin-top: .5rem;
}
.topbar-dropdown .dropdown-item {
  padding: .5rem 1rem;
  font-size: .87rem;
}
.topbar-dropdown .dropdown-item:hover {
  background: var(--surface-hover);
  color: var(--brand-primary);
}
.topbar-dropdown .dropdown-header {
  padding: .5rem 1rem .25rem;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

.topbar-notif-item {
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: normal;
}
.topbar-notif-item:last-of-type { border-bottom: 0; }
.notif-title { font-size: .82rem; color: var(--text-primary); }
.notif-meta  { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }

/* Mobile adjustments */
@media (max-width: 767.98px) {
  .topbar-logo { height: 26px; max-width: 120px; }
  .app-topbar { padding: 0 .5rem; }
  .topbar-user-name, .topbar-user-caret { display: none !important; }
}

/* ---------- Topbar firm switcher ---------- */
.topbar-firm-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .7rem;
  background: var(--surface-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  max-width: 260px;
  margin: 0 .35rem;
}
.topbar-firm-btn:hover,
.topbar-firm-btn:focus {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--brand-primary);
  outline: none;
}
.topbar-firm-btn i.bi-building {
  font-size: .95rem;
  color: var(--brand-primary);
  flex-shrink: 0;
}
.topbar-firm-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
.topbar-firm-caret {
  font-size: .65rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Compact variant on smaller desktop widths */
@media (max-width: 1199.98px) {
  .topbar-firm-name {
    max-width: 100px;
  }
}

/* Mobile: icon-only firm button */
@media (max-width: 991.98px) {
  .topbar-firm-btn {
    padding: .35rem .5rem;
    margin: 0 .15rem;
  }
  .topbar-firm-name,
  .topbar-firm-caret {
    display: none !important;
  }
}


/* ======== Tables — app-wide design system ======== */

.table-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table-card > .table-responsive {
  border: 0;
}

.table-card .table {
  margin: 0;
  color: var(--text-primary);
  font-size: .875rem;
  border-collapse: separate;
  border-spacing: 0;
}

/* Header */
.table-card .table > thead > tr > th {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .85rem 1rem;
  white-space: nowrap;
  vertical-align: middle;
}

/* Rows */
.table-card .table > tbody > tr > td {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-primary);
}

.table-card .table > tbody > tr:last-child > td {
  border-bottom: 0;
}

.table-card .table > tbody > tr {
  transition: background .12s ease;
}

.table-card .table > tbody > tr:hover > td {
  background: var(--surface-hover);
}

/* Numeric alignment */
.table-card .num,
.table-card .text-end {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Empty state inside table */
.table-card .table-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
}
.table-card .table-empty i {
  font-size: 2rem;
  opacity: .35;
  display: block;
  margin-bottom: .75rem;
}
.table-card .table-empty a {
  color: var(--brand-primary);
  font-weight: 600;
  text-decoration: none;
}
.table-card .table-empty a:hover {
  text-decoration: underline;
}

/* Pagination inside table card */
.table-card .table-pagination {
  border-top: 1px solid var(--border-subtle);
  padding: .75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  background: var(--surface-card);
  font-size: .8rem;
  color: var(--text-muted);
}
.table-card .table-pagination .pagination {
  margin: 0;
}
.table-card .table-pagination .page-link {
  border: 0;
  color: var(--text-secondary);
  font-size: .8rem;
  padding: .35rem .65rem;
  border-radius: var(--radius-sm);
  margin: 0 2px;
  background: transparent;
}
.table-card .table-pagination .page-link:hover {
  background: var(--surface-hover);
  color: var(--brand-primary);
}
.table-card .table-pagination .page-item.active .page-link {
  background: var(--brand-primary);
  color: #fff;
  font-weight: 600;
}
.table-card .table-pagination .page-item.disabled .page-link {
  color: var(--text-muted);
  opacity: .5;
}

/* Compact variant — for denser lists */
.table-card.table-compact .table > tbody > tr > td {
  padding: .65rem 1rem;
}
.table-card.table-compact .table > thead > tr > th {
  padding: .65rem 1rem;
}

/* Column-specific helpers */
.table-card .col-primary {
  font-weight: 600;
  color: var(--brand-primary);
  text-decoration: none;
}
.table-card .col-primary:hover {
  text-decoration: underline;
}
.table-card .col-muted {
  color: var(--text-muted);
  font-size: .8rem;
}
.table-card .col-actions {
  text-align: right;
  white-space: nowrap;
}


