/* === BUTTON SYSTEM === */
.btn-primary-new {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: var(--text-on-accent);
  border: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-1);
  transition: all var(--transition-base);
}

.btn-primary-new:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
  filter: brightness(1.05);
}

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

.btn-secondary-new {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid transparent;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: var(--font-semibold);
  transition: all var(--transition-base);
}

.btn-secondary-new:hover {
  background: var(--accent-soft-hover);
}

.btn-tertiary-new {
  background: transparent;
  color: var(--text-normal);
  border: 1px solid var(--border-normal);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

/* === CARD SYSTEM === */
.card-elevated {
  background: var(--surface-0);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2), var(--highlight);
  transition: all var(--transition-base);
}

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

/* === INPUT SYSTEM === */
.input-modern {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  color: var(--text-normal);
  transition: all var(--transition-fast);
}

.input-modern:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface-0);
}

/* === TABLE SYSTEM === */
.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-modern tbody tr {
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-subtle);
}

.table-modern tbody tr:hover {
  background: var(--accent-soft);
}

/* === PILL/BADGE SYSTEM === */
.pill-accent {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: var(--text-on-accent);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  box-shadow: var(--shadow-1), var(--highlight);
}

/* === FORM BASELINE OVERRIDES === */
.form-control,
.form-select {
  background: var(--surface-1);
  border-color: var(--border-subtle);
  color: var(--text-normal);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* === MODAL STACKING === */
.modal-backdrop {
  z-index: 6900;
}

.modal {
  z-index: 7000;
}

.modal.show,
.modal.fade.show,
.modal.d-block {
  z-index: 7000;
  position: fixed;
  inset: 0;
}

.modal-content {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow-3);
}

.modal-header,
.modal-footer {
  border-color: var(--border-subtle);
}

.card {
  background: var(--surface-0);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-1);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-outline-secondary {
  color: var(--text-normal);
  border-color: var(--border-normal);
}

.btn-outline-secondary:hover {
  background: var(--surface-2);
  color: var(--text-strong);
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border-normal);
  color: var(--text-normal);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-normal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--text-strong);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-label {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* === NOTIFICATION CENTER === */
.notification-center {
  position: relative;
  display: inline-flex;
}

.notification-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-normal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.notification-btn:hover {
  background: var(--surface-2);
  color: var(--text-strong);
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: #ef4444;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
  border: 2px solid var(--surface-0);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
  animation: badge-pop 0.3s ease-out;
}

@keyframes badge-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.dropdown-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.notification-header .header-title {
  font-weight: var(--font-semibold);
  color: var(--text-strong);
}

.mark-read-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 0;
}

.mark-read-btn:hover {
  text-decoration: underline;
}

.notification-list {
  flex: 1;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-subtle);
}

.notification-item:hover {
  background: var(--surface-1);
}

.notification-item.unread {
  background: var(--accent-soft);
}

.notification-item.unread:hover {
  background: var(--accent-soft-hover, rgba(var(--accent-rgb, 99, 102, 241), 0.12));
}

.notification-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.notification-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notification-title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-body {
  font-size: var(--text-xs, 0.75rem);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-time {
  font-size: var(--text-xs, 0.75rem);
  color: var(--text-muted);
}

.notification-list .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  color: var(--text-muted);
}

.notification-list .empty-state i {
  font-size: 1.5rem;
}

.notification-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.notification-footer a {
  color: var(--accent);
  font-size: var(--text-sm);
  text-decoration: none;
}

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

.notification-footer-divider {
  color: var(--text-muted);
  margin: 0 var(--space-2);
}

/* === NOTIFICATION PANEL - MOBILE BOTTOM SHEET === */

@media (min-width: 769px) {
    .notification-backdrop {
        display: none;
    }
}

@media (max-width: 768px) {
    .notification-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1099;
        animation: notifFadeIn 0.2s ease-out;
    }

    .notification-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
        z-index: 1100;
        animation: notifSlideUp 0.25s ease-out;
    }

    .notification-panel .notification-title {
        white-space: normal;
    }

    .notification-panel .notification-body {
        white-space: normal;
    }

    @keyframes notifSlideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    @keyframes notifFadeIn {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}

/* === NAV-TABS MOBILE FALLBACK === */

@media (max-width: 768px) {
    .nav-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tabs .nav-item {
        flex-shrink: 0;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: var(--text-sm);
    }
}

/* === NAV SECTION HEADERS === */
.nav-section-header {
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-3) var(--space-4) var(--space-1);
}

/* === PAGE HEADER BAR === */
.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.page-title {
    margin: 0;
    font-size: var(--text-xl, 1.25rem);
    color: var(--text-strong);
}

/* === ROLE MANAGEMENT === */
.role-management-page {
    max-width: 1100px;
}

.builtin-roles-section,
.custom-roles-section {
    margin-bottom: var(--space-4);
}

.section-label {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-strong);
    margin-bottom: var(--space-2);
}

.role-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.role-card {
    background: var(--surface-0);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    box-shadow: var(--shadow-1);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.role-card:hover {
    box-shadow: var(--shadow-2);
}

.role-card.active {
    border-color: var(--accent);
}

.role-card.builtin {
    border-left: 3px solid var(--accent);
}

.role-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.role-icon-badge {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.role-info {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: wrap;
}

.role-name {
    font-size: var(--text-sm);
    color: var(--text-strong);
}

.role-description {
    font-size: var(--text-xs, 0.75rem);
    color: var(--text-muted);
    margin: 0 0 var(--space-2);
    line-height: 1.4;
}

.role-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.role-user-count i {
    font-size: 0.6rem;
}

/* ── Permission Panel ── */
.permission-panel {
    background: var(--surface-0);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.permission-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.permission-panel-header h3 {
    margin: 0;
    font-size: var(--text-lg);
    color: var(--text-strong);
}

.permission-matrix {
    padding: var(--space-4);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
}

.permission-category {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.permission-category-name {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--text-strong);
    margin: 0;
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--border-subtle);
}

.permission-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.permission-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    cursor: pointer;
    font-size: var(--text-sm);
}

.permission-item input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent);
}

.permission-item input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.permission-item:has(input[type="checkbox"]:disabled) {
    opacity: 0.7;
    cursor: default;
}

.permission-item-info {
    display: flex;
    flex-direction: column;
}

.permission-item-name {
    color: var(--text-normal);
    font-size: var(--text-sm);
}

.permission-item-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* === TAXES & FEES === */
.taxes-fees-page {
    max-width: 900px;
}

.fees-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.fee-breakdown-card,
.client-fees-card {
    background: var(--surface-0);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.fee-breakdown-header,
.client-fees-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.fee-breakdown-header h3,
.client-fees-header h3 {
    margin: 0;
    font-size: var(--text-base);
    color: var(--text-strong);
}

.fee-breakdown-body {
    padding: var(--space-3) var(--space-4);
}

.fee-breakdown-table {
    width: 100%;
    border-collapse: collapse;
}

.fee-breakdown-table td {
    padding: var(--space-2) 0;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-subtle);
}

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

.fee-label {
    color: var(--text-normal);
}

.fee-amount {
    text-align: right;
    font-family: monospace;
    color: var(--text-strong);
}

.fee-row-subtotal td {
    font-weight: var(--font-semibold);
}

.fee-row-platform .fee-label {
    color: var(--text-muted);
}

.fee-locked-icon {
    font-size: 0.6rem;
    margin-left: var(--space-1);
    color: var(--text-muted);
}

.fee-row-total td {
    border-top: 2px solid var(--border-subtle);
    border-bottom: none;
    font-size: var(--text-base);
    padding-top: var(--space-3);
}

.fee-breakdown-footer {
    padding: var(--space-2) var(--space-4);
    background: var(--surface-1);
    font-size: 0.65rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Client Fees ── */
.client-fees-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-6);
    text-align: center;
    color: var(--text-muted);
}

.client-fees-empty i {
    font-size: 1.5rem;
}

.fee-presets {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

.fee-presets-label {
    font-size: var(--text-xs, 0.75rem);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.fee-presets-buttons {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    justify-content: center;
}

.fee-presets-hint {
    font-size: var(--text-xs, 0.75rem);
    color: var(--text-muted);
    text-align: center;
}

.client-fees-list {
    padding: var(--space-2) 0;
}

.client-fee-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.client-fee-row:last-child {
    border-bottom: none;
}

.client-fee-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.client-fee-info strong {
    font-size: var(--text-sm);
    color: var(--text-strong);
}

.client-fee-detail {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.client-fee-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ── Platform Notice ── */
.platform-fees-notice {
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    border: 1px solid var(--border-subtle);
}

.platform-notice-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-strong);
}

.platform-fees-notice p {
    font-size: var(--text-xs, 0.75rem);
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

/* === HUB PAGE SYSTEM === */
.configure-hub {
    padding: var(--space-6);
    max-width: 1100px;
}

.configure-header {
    margin-bottom: var(--space-6);
}

.configure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-5);
}

.configure-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

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

.configure-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.configure-card-icon {
    font-size: 1.4rem;
    color: var(--accent);
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.configure-card-title {
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
    color: var(--text-primary);
    line-height: 1.3;
}

.configure-card-desc {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.configure-shortcut-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.configure-shortcut-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.configure-shortcut-link:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.configure-shortcut-link i:first-child {
    width: 1.1rem;
    text-align: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.configure-shortcut-link span {
    flex: 1;
}

.configure-shortcut-chevron {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-left: auto;
}
