/* =============================================
   Pushed.AI Dashboard — Dark Theme
   Matches plugin aesthetic (Base UI / dark mode)
   Design tokens (--text-muted, --text-secondary,
   --primary-color) live in tokens.css.
   ============================================= */

/* --- Base --- */
body {
    font-family: "Work Sans", sans-serif;
    font-size: .875rem;
    color: var(--text-primary);
    background: var(--bg-app);
    overflow-x: clip;
}

::placeholder {
    color: var(--text-secondary) !important;
    opacity: 1;
}

::-ms-input-placeholder {
    color: var(--text-secondary) !important;
}

::selection {
    background: var(--selection-bg);
    color: var(--text-primary);
}

a {
    color: var(--accent);
    transition: color 0.12s;
}

a:hover {
    color: var(--accent-hover);
}

.feather {
    width: 16px;
    height: 16px;
    vertical-align: text-bottom;
}

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

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* --- Layout --- */
.main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper .page-wrapper {
    flex: 1;
    background: var(--bg-app);
    width: 100%;
    display: flex;
    flex-direction: column;
}

.main-wrapper .page-content {
    padding: 2.5rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* --- Top Nav --- */
.topnav {
    position: sticky;
    top: 0;
    z-index: 990;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
}

.topnav-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    height: 60px;
    max-width: 1400px;
    margin: 0 auto;
}

.topnav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}

.topnav-brand:hover {
    color: var(--text-primary);
}

.topnav-brand .logo {
    width: 1.5rem;
    height: 1.5rem;
}

/* org switcher */
.topnav-org {
    flex-shrink: 0;
}

.topnav-org-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 6px 10px 6px 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    transition: border-color 0.12s, background 0.12s;
    cursor: pointer;
}

.topnav-org-btn:hover {
    border-color: var(--border-strong);
    background: var(--hover-bg);
}

.topnav-org-btn .caret {
    width: 12px;
    height: 12px;
    color: var(--text-secondary);
    margin-left: 2px;
}

.org-avatar {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--text-on-accent);
    font-weight: 600;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.org-avatar-sm {
    width: 20px;
    height: 20px;
    font-size: 10px;
    border-radius: 5px;
}

.topnav-org-menu {
    min-width: 240px;
    padding: 6px;
}

.topnav-org-current {
    padding: 8px 10px 6px;
}

.topnav-org-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.topnav-org-current-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
}

.topnav-org-list {
    border-top: 1px solid var(--border-subtle);
    margin-top: 4px;
    padding-top: 4px;
    max-height: 240px;
    overflow-y: auto;
}

.topnav-org-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.topnav-org-menu .dropdown-item svg {
    width: 14px;
    height: 14px;
}

/* primary nav links */
.topnav-links {
    display: flex;
    gap: 2px;
    flex: 1;
    justify-content: center;
}

.topnav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    /* Darky baseline — small +1 top / -1 bottom shift is enough at 13px.
       Bigger shifts pushed text into the bottom of the pill. */
    padding: 9px 12px 7px;
    border-radius: 6px;
    transition: color 0.12s, background 0.12s;
    display: inline-flex;
    align-items: center;
}

.topnav-link:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.topnav-link.active {
    color: var(--text-primary);
    background: var(--border-subtle);
}

/* ------------------------------------------------------------
   Darky baseline correction
   Darky's cap-height sits ~1-2px above the em-box center, so
   labels read as top-aligned in flex containers. We nudge text
   1px down inside span-wrapped labels (the .topnav-link case is
   handled via asymmetric padding above). Containers keep their
   box dimensions because the shift is sub-pixel.
   ------------------------------------------------------------ */
.topnav-brand>span,
.topnav-org-btn .org-name,
.topnav-org-current-name,
.topnav-org-menu .dropdown-item>span,
.topnav-profile-btn .profile-name,
.topnav-profile-btn .profile-sub,
.topnav-profile-menu .dropdown-item>span,
.topnav-profile-header .profile-name,
.topnav-profile-header .profile-email,
.dropdown-section-label {
    display: inline-block;
    transform: translateY(2px);
}

/* Dropdown items (org switcher, profile menu) — text wrapped in spans is
   shifted above; for direct text nodes (just-in-case), nudge via padding. */
.topnav-org-menu .dropdown-item,
.topnav-profile-menu .dropdown-item {
    padding-top: 9px;
    padding-bottom: 7px;
}

/* theme toggle */
.topnav-theme-toggle {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}

.topnav-theme-toggle:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.topnav-theme-toggle .theme-icon {
    width: 18px;
    height: 18px;
}

[data-theme="dark"] .theme-icon-moon {
    display: none;
}

[data-theme="light"] .theme-icon-sun {
    display: none;
}

[data-theme="dark"] [data-theme-label-dark] {
    display: none;
}

[data-theme="light"] [data-theme-label-light] {
    display: none;
}

/* profile */
.topnav-profile {
    flex-shrink: 0;
}

.topnav-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 4px 8px 4px 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}

.topnav-profile-btn:hover {
    background: var(--hover-bg);
}

.topnav-profile-btn .profile-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border-subtle);
}

.topnav-profile-btn .profile-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.topnav-profile-btn .profile-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    text-align: left;
}

.topnav-profile-btn .profile-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.topnav-profile-btn .profile-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

.topnav-profile-btn .caret {
    width: 12px;
    height: 12px;
    color: var(--text-secondary);
    margin-left: 2px;
}

.topnav-profile-menu {
    min-width: 260px;
    max-width: calc(100vw - 16px);
    padding: 6px;
}

.topnav-profile-header {
    padding: 10px 10px 8px;
}

.topnav-profile-header .profile-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.topnav-profile-header .profile-email {
    font-size: 12px;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.topnav-profile-menu .dropdown-section-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 6px 10px 2px;
}

.topnav-profile-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.topnav-profile-menu .dropdown-item svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.topnav-profile-menu .dropdown-item.logout-link,
.topnav-profile-menu .dropdown-item.logout-link svg {
    color: var(--danger-fg);
}

.topnav-profile-menu .dropdown-divider {
    border-color: var(--border-subtle);
    margin: 4px 0;
}

.topnav-profile-menu .dropdown-item.active,
.topnav-profile-menu .dropdown-item.active:focus {
    color: var(--text-primary);
    background: var(--border-subtle);
}

.topnav-profile-menu .dropdown-item.active svg {
    color: var(--text-primary);
}

.topnav-profile-menu .dropdown-item .notification-dot {
    margin-left: auto;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    height: 100%;
    position: fixed;
    left: 0;
    top: 0;
    transition: width 0.1s ease, margin 0.1s ease-in-out;
    z-index: 999;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
}

.sidebar .sidebar-body {
    max-height: calc(100% - 66px);
    position: relative;
    height: 100%;
    overflow: auto;
}

.sidebar-x {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.sidebar-footer .username {
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 0;
    word-break: break-word;
}

.sidebar-footer .title {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.sidebar-footer .profile-img-wrapper {
    width: 2rem;
    height: 2rem;
    overflow: hidden;
    border-radius: 50%;
    margin-right: 10px;
    border: 1px solid var(--border-subtle);
}

.sidebar-footer .profile-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-footer .dropdown-menu {
    right: 0 !important;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--bg-overlay);
    padding: 4px 0;
}

.sidebar-footer .dropdown-menu .dropdown-item {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px 14px;
    transition: background 0.08s;
}

.sidebar-footer .dropdown-menu .dropdown-item:hover,
.sidebar-footer .dropdown-menu .dropdown-item:active {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.sidebar .sidebar-body>div>.nav:first-child {
    padding-top: 1rem;
}

.sidebar .sidebar-body .nav-link {
    display: flex;
    align-items: center;
    font-size: .9rem;
    color: var(--text-muted);
    line-height: 1.12;
    padding: .5rem 12px;
    margin: 2px 0;
    margin-left: 1.25rem;
    margin-right: 1rem;
    border-radius: 6px;
    transition: color 0.1s, background 0.1s;
}

.sidebar .nav-link svg {
    margin-right: 10px;
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    color: inherit;
}

.sidebar .nav-link.active {
    color: var(--text-primary);
    background: var(--border-subtle);
}

.sidebar .nav-link:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.sidebar .nav-link:hover .feather,
.sidebar .nav-link.active .feather {
    color: inherit;
}

.sidebar-header {
    padding: 1.25rem 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-header svg.logo {
    width: 1.75rem;
    height: 1.75rem;
    margin-right: 8px;
}

.sidebar-header h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.sidebar-bottom-nav {
    padding: .75rem 0;
    border-top: 1px solid var(--border-subtle);
}

.sidebar .nav .nav-item.nav-category:not(:first-child) {
    margin-top: 1.25rem;
}

.sidebar .nav .nav-item.nav-category {
    color: var(--text-secondary);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: .75rem;
    padding-left: 1.25rem;
}

/* --- Navbar (mobile) --- */
.navbar {
    width: 100%;
    height: 64px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0;
    left: 0;
    right: 0;
    position: fixed;
    z-index: 978;
    transition: width 0.1s ease, left 0.1s ease;
}

.navbar .navbar-content {
    display: flex;
    width: 100%;
    height: 100%;
    padding: 1rem 1.25rem;
    align-items: center;
}

.navbar .navbar-content svg.logo {
    width: 2rem;
    height: 2rem;
}

.navbar .navbar-content svg.action-icon {
    color: var(--text-secondary);
}

.navbar .navbar-content h3,
.navbar .navbar-content h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-toggler {
    cursor: pointer;
    color: var(--text-secondary);
}

.profile-container .dropdown-menu {
    right: 0 !important;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--bg-overlay);
}

.profile-container .username {
    font-size: .9rem;
    color: var(--text-primary);
    margin-bottom: 0;
}

.profile-container .profile-img-wrapper {
    width: 2rem;
    height: 2rem;
    overflow: hidden;
    border-radius: 50%;
    margin-right: 10px;
    border: 1px solid var(--border-subtle);
}

.profile-container .profile-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Page Headers --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
}

p {
    color: var(--text-secondary);
}

.page-content>div>h3 {
    font-weight: 600;
    font-size: 1.4rem;
}

.page-content>div>p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* --- Tables --- */
.table> :not(caption)>*>*,
.datepicker table> :not(caption)>*>* {
    padding: 1rem 1.25rem;
    border-color: var(--border-subtle);
    color: var(--text-secondary);
    background: transparent;
}

.table thead th,
.datepicker table thead th {
    background: var(--hover-bg);
    font-weight: 500;
    font-size: 13px;
    padding: 12px 1.25rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-subtle) !important;
}

.table> :not(:last-child)> :last-child>* {
    border-bottom-color: var(--border-subtle);
    border-top: 1px solid var(--border-subtle);
}

.table tbody tr {
    transition: background 0.08s;
}

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

.table td a {
    color: var(--accent);
}

.table td a:hover {
    color: var(--accent-hover);
}

.table-wrapper {
    background: var(--hover-bg);
    border: 1px solid var(--border-subtle);
    padding: 1.25rem 0;
    border-radius: 12px;
}

.table-wrapper .pagination-wrapper {
    padding: 0 1.25rem;
}

.table-filter {
    padding: 0 1.25rem 1.25rem;
}

/* --- Cards --- */
.card {
    background: var(--hover-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
}

/* --- Forms --- */
.form-control,
.form-select {
    background: var(--hover-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 15px;
    transition: border-color 0.12s;
}

.form-control:focus,
.form-select:focus {
    background: var(--hover-bg);
    border-color: var(--border-strong);
    box-shadow: none;
    color: var(--text-primary);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--border-strong);
}

.form-control:disabled,
.form-select:disabled {
    background: var(--hover-bg);
    color: var(--text-secondary);
    opacity: 0.5;
}

.form-label {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-label.required::after {
    content: " *";
    color: var(--danger-fg);
}

.form-check-input {
    width: 18px;
    height: 18px;
    background-color: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    transition: background 0.1s, border 0.1s;
}

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

.form-check-input:checked[type="checkbox"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='20 6 9 17 4 12'/%3e%3c/svg%3e");
    background-size: 12px;
}

.form-check-input:focus {
    box-shadow: none;
    border-color: var(--border-strong);
}

.form-check-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.invalid-feedback {
    color: var(--danger-fg);
    font-size: 13px;
}

.is-invalid {
    border-color: var(--danger-fg) !important;
}

.alert {
    background: var(--hover-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-secondary);
}

.alert-warning {
    background: var(--warning-bg);
    border-color: var(--warning-bg);
    color: var(--warning-fg);
}

/* --- Buttons --- */
.btn {
    border-radius: 8px;
    padding: 8px 20px;
    box-shadow: none !important;
    font-size: 15px;
    font-weight: 500;
    font-family: "Work Sans", sans-serif;
    transition: background 0.12s, transform 0.1s, border-color 0.12s;
    border: none !important;
}

.btn:active {
    transform: scale(0.985);
}

.btn-primary {
    background: var(--text-primary) !important;
    color: var(--bg-app) !important;
    font-weight: 600;
}

.btn-primary:focus,
.btn-primary:hover {
    background: var(--text-secondary) !important;
    color: var(--bg-app) !important;
}

.btn-primary:active {
    background: var(--text-muted) !important;
}

.btn-primary:disabled {
    background: var(--text-primary) !important;
    color: var(--bg-app) !important;
    opacity: 0.4;
}

.btn-secondary,
.btn-light,
.btn-light-2 {
    background: transparent !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-strong) !important;
}

.btn-secondary:hover,
.btn-light:hover,
.btn-light-2:hover {
    border-color: var(--border-strong) !important;
    background: var(--hover-bg) !important;
}

.btn-secondary:active,
.btn-light:active,
.btn-light-2:active {
    background: var(--border-subtle) !important;
}

.btn-danger {
    background: var(--danger-bg) !important;
    color: var(--danger-fg) !important;
    border: 1px solid var(--danger-bg) !important;
}

.btn-danger:hover {
    background: var(--danger-bg) !important;
    border-color: var(--danger-fg) !important;
}

.btn-danger-2 {
    background: var(--danger-fg) !important;
    color: var(--bg-app) !important;
}

.btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 50%;
    color: var(--text-muted);
}

.btn-icon-text {
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
}

.btn-icon:hover {
    background: var(--hover-bg) !important;
    border-color: var(--border-strong) !important;
    color: var(--text-primary);
}

.btn-link {
    color: var(--accent) !important;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
}

.btn-link:hover {
    color: var(--accent-hover) !important;
}

/* --- Pagination --- */
.page-link {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    transition: background 0.12s, color 0.12s;
    font-size: 14px;
}

.page-link:focus {
    box-shadow: none;
    background: transparent;
}

.pagination .page-item .page-link {
    border-radius: 6px;
    color: var(--text-secondary);
}

.pagination .page-item:not(:first-child):not(:last-child) .page-link {
    background-color: transparent;
    border: none;
}

.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    border-radius: 6px;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.pagination .page-item.active .page-link {
    color: var(--text-primary);
    background-color: var(--border-subtle) !important;
    border-color: transparent;
    font-weight: 500;
}

.pagination .page-item.disabled .page-link {
    color: var(--text-muted);
    pointer-events: none;
    background-color: transparent;
    border-color: var(--border-subtle);
}

.pagination .page-item:not(.disabled):hover .page-link {
    background-color: var(--hover-bg);
    color: var(--text-secondary);
}

/* --- Dropdowns --- */
.dropdown-menu {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--bg-overlay);
    padding: 4px 0;
}

.dropdown-item {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px 14px;
    transition: background 0.08s;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.dropdown-item:active {
    background: var(--border-subtle);
    color: var(--text-primary);
}

.dropdown-item svg {
    color: var(--text-muted);
}

/* --- Modals --- */
.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
}

.modal-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: 16px 20px;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    color: var(--text-secondary);
}

.modal-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 16px 20px;
}

.btn-close {
    opacity: 0.5;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.btn-close:hover {
    opacity: 0.8;
}

.modal-backdrop {
    background-color: var(--bg-overlay);
}

/* --- Accordion --- */
.accordion-item {
    background: var(--hover-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 8px !important;
}

.accordion-button {
    background: transparent;
    color: var(--text-primary);
    box-shadow: none;
    font-weight: 500;
}

.accordion-button:not(.collapsed) {
    background: var(--hover-bg);
    color: var(--text-primary);
    box-shadow: none;
}

[data-theme="dark"] .accordion-button::after {
    filter: invert(1);
}

.accordion-body {
    color: var(--text-secondary);
}

/* --- Input Group --- */
.input-group-text {
    background: var(--hover-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

/* --- Misc --- */
.cursor-pointer {
    cursor: pointer;
}

.object-fit-contain {
    object-fit: contain;
}

.object-fit-cover {
    object-fit: cover;
}

.border-bottom {
    border-color: var(--border-subtle) !important;
}

.border-top {
    border-color: var(--border-subtle) !important;
}

.border-primary {
    border-color: var(--text-primary) !important;
}

.text-body {
    color: var(--text-primary) !important;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.text-decoration-none {
    text-decoration: none;
}

/* --- Password field toggle --- */
.password-field {
    position: relative;
}

.password-field button {
    position: absolute;
    top: 38px;
    right: 11px;
    padding: 0;
    background: unset;
    border: unset;
    color: var(--text-secondary);
}

.settings-section .password-field button {
    top: 35px;
}

.password-field button:hover {
    color: var(--text-primary);
}

/* --- SweetAlert2 --- */
.swal2-title {
    font-weight: 500;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.swal2-html-container {
    color: var(--text-secondary);
}

.swal2-popup {
    background: var(--bg-surface-2) !important;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
}

.swal2-styled.swal2-confirm {
    background-color: var(--text-primary) !important;
    color: var(--bg-app) !important;
    border-radius: 8px;
    padding: 8px 24px;
    box-shadow: none !important;
    border-color: transparent !important;
    font-weight: 600;
}

.swal2-styled.swal2-cancel {
    background: var(--danger-bg) !important;
    color: var(--danger-fg) !important;
    border-radius: 8px;
    padding: 8px 24px;
    box-shadow: none !important;
    border: 1px solid var(--danger-bg) !important;
}

.swal2-icon {
    border-color: var(--border-strong) !important;
}

/* --- Badge / status pills --- */
.badge {
    font-weight: 500;
    font-size: 12px;
    border-radius: 6px;
    padding: 4px 10px;
}

/* --- Notification dot --- */
.notification-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger-fg);
    margin-left: auto;
}

/* --- Toastify --- */
.toastify {
    background: var(--bg-surface-2) !important;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--bg-overlay);
    font-family: "Work Sans", sans-serif;
    font-size: 13px;
    color: var(--text-primary);
}

/* --- Daterangepicker --- */
.daterangepicker {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-secondary);
}

.daterangepicker td.active,
.daterangepicker td.active:hover {
    background: var(--accent) !important;
    color: var(--text-on-accent) !important;
}

.daterangepicker td.in-range {
    background: var(--border-subtle);
    color: var(--text-secondary);
}

.daterangepicker th,
.daterangepicker td {
    color: var(--text-secondary);
}

.daterangepicker .calendar-table {
    background: var(--bg-surface-2);
    border: none;
}

.daterangepicker td.off {
    color: var(--text-muted);
}

.daterangepicker .ranges li {
    color: var(--text-secondary);
    transition: background 0.08s;
}

.daterangepicker .ranges li:hover {
    background: var(--hover-bg);
}

.daterangepicker .ranges li.active {
    background: var(--border-subtle);
    color: var(--text-primary);
}

.daterangepicker select.monthselect,
.daterangepicker select.yearselect {
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.daterangepicker .drp-buttons {
    border-top: 1px solid var(--border-subtle);
}

.daterangepicker.show-ranges.ltr .drp-calendar.left {
    border-left: 1px solid var(--border-subtle);
}

.drp-selected {
    display: none !important;
}

.drp-buttons {
    padding: 1rem !important;
}

.drp-buttons button {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    font-weight: normal !important;
}

/* --- Responsive --- */
@media (min-width: 992px) {

    .modal-lg,
    .modal-xl {
        max-width: 800px;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: .875rem;
    }

    .topnav-links {
        display: none;
    }

    .topnav-theme-toggle {
        display: none;
    }

    .topnav-org .topnav-org-btn .org-name {
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topnav-profile-btn .profile-meta {
        display: none !important;
    }

    .topnav-profile {
        margin-left: auto;
    }

    .main-wrapper .page-content {
        padding: 1.25rem;
    }
}

/* The mobile navbar (.navbar.d-lg-none) is position:fixed and visible
   below 992px. Without a matching top margin in the 769–991px range,
   the navbar covers the page header. Sidebar layout stays intact —
   only the top offset is added. */
@media (max-width: 991.98px) {
    .main-wrapper .page-wrapper {
        margin-top: 64px;
    }
}

/* --- Sub-menus --- */
.nav.sub-menu .nav-item a {
    margin-left: 3.5rem;
}

.sub-menu-arrow svg {
    margin: 0 !important;
}

.sub-menu-arrow {
    display: inline-block;
    transition: transform 0.3s ease;
}

.nav .nav-item a:not(.collapsed) .sub-menu-arrow {
    transform: rotate(180deg);
}

/* --- Page Header --- */
.page-header {
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.page-header .page-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 0;
}

.page-header .page-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.page-header .page-actions .btn {
    white-space: nowrap;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: var(--text-muted);
}

.empty-state .empty-icon .feather {
    width: 48px;
    height: 48px;
}

.empty-state h4 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: .5rem;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 360px;
    margin: 0 auto 1.5rem;
}

/* --- Section Card --- */
.section-card {
    background: var(--hover-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.5rem;
}

@media (max-width: 767.98px) {
    .section-card {
        padding: 0 !important;
    }
}

.section-card .section-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* --- Inline Form (Add Account, Invite User) --- */
.inline-form {
    background: var(--hover-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.inline-form .form-group {
    flex: 1;
}

.inline-form .form-group label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

@media (max-width: 768px) {
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }
}

/* --- Status Dot --- */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    flex-shrink: 0;
}

.status-dot.connected {
    background: var(--success-fg);
}

.status-dot.disconnected {
    background: var(--danger-fg);
}

.status-dot.pending {
    background: var(--warning-fg);
}

/* --- Animations --- */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-content {
    animation: fade-in 0.2s ease-out;
}

/* ============================================================
   Global button reset
   - Unified 36px height across .btn variants
   - Tight line-height + asymmetric padding for optical centering
     of Darky's high cap-height
   - !important needed to override inline padding/font-size on
     individual .btn elements throughout the dashboard
   ============================================================ */
.btn:not(.btn-link) {
    height: 36px !important;
    min-height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    /* Darky's cap-letters sit ~3-4px above the em-box center.
       Asymmetric padding shifts the text-box down so cap-letters
       land on the button's geometric center. */
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    /* Horizontal padding falls through to Bootstrap default or
       any inline override — we only force the vertical metrics. */
    gap: 6px;
    box-sizing: border-box;
}

/* Bootstrap btn-sm should still hit 36px under this rule.
   (We deliberately do NOT exempt it — user wants ALL buttons
   the same height.) */
.btn-sm:not(.btn-link),
.btn-lg:not(.btn-link) {
    height: 36px !important;
    min-height: 36px !important;
}

/* Form submit buttons that aren't .btn — also normalize */
button[type="submit"]:not(.btn):not(.dropdown-item):not(.topnav-theme-toggle):not(.topnav-profile-btn),
input[type="submit"]:not(.btn),
input[type="button"]:not(.btn) {
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding-top: 1px;
    padding-bottom: 0;
    box-sizing: border-box;
}

/* ============================================================
   Add-on buttons (Subscription card)
   Two action cards: "Add Klaviyo account" and "Add user seat",
   each showing the per-month add-on price.
   ============================================================ */
.v2-addons {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

.v2-addons-head {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}

.v2-addon-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.v2-addon-btn {
    flex: 1 1 240px;
    min-width: 240px;
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    padding: 0 14px !important;
    height: 56px !important;
    min-height: 56px !important;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
    transition: border-color 0.12s, background 0.12s, transform 0.06s;
    cursor: pointer;
    text-align: left;
}

.v2-addon-btn:hover {
    border-color: var(--border-strong);
    background: var(--hover-bg);
    color: var(--text-primary);
}

.v2-addon-btn:active {
    transform: scale(0.99);
}

.v2-addon-btn-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: var(--accent-bg);
    color: var(--accent);
}

.v2-addon-btn-icon svg {
    width: 14px;
    height: 14px;
}

.v2-addon-btn-label {
    flex-grow: 1;
    font-weight: 500;
    /* Darky baseline shift — cap-letters sit ~3px high in the em-box */
    transform: translateY(3px);
}

.v2-addon-btn-price {
    flex-shrink: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface-2);
    padding: 4px 8px 2px;
    border-radius: 6px;
}

.v2-addon-note {
    margin: 14px 0 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}