@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,100..900;1,100..900&display=swap');

/* ==========================================================================
   Custom Dark Mode Palette, Typography & Global Variables
   Primary Brand Color: #80662b (Warm Amber Bronze / Antique Gold)
   ========================================================================== */
:root,
[data-bs-theme="dark"] {
    /* Primary Signature Color & Accents (#80662b) */
    --primary-color: #80662b;
    --primary-hover: #967935;
    --primary-active: #6e5724;
    --primary-light: #b59344;
    --primary-accent: #c59e41;
    --primary-bright: #e6ba54;
    --primary-tint: rgba(128, 102, 43, 0.16);
    --primary-tint-hover: rgba(128, 102, 43, 0.26);
    --primary-glow: rgba(181, 147, 68, 0.3);

    /* Refined Obsidian / Warm Charcoal Backgrounds (harmonizes with gold) */
    --bg-dark: #111215;
    --bg-panel: #17191e;
    --bg-card: #1f2129;
    --bg-card-hover: #272a34;
    --border-color: #2c303a;
    --border-highlight: rgba(181, 147, 68, 0.35);

    /* Typography & Foreground */
    --text-main: #f1f3f7;
    --text-muted: #9ca3af;

    /* Complementary Functional Colors */
    --accent-gold: #b59344;
    --accent-purple: #8b5cf6;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-orange: #f97316;
    --accent-yellow: #eab308;

    --sidebar-width: 260px;
    --header-height: 56px;

    /* Bootstrap 5 Theme Overrides for 100% Unified Palette */
    --bs-primary: #80662b;
    --bs-primary-rgb: 128, 102, 43;
    --bs-link-color: var(--primary-accent);
    --bs-link-hover-color: var(--primary-bright);
    --bs-body-bg: var(--bg-dark);
    --bs-body-color: var(--text-main);
    --bs-body-color-rgb: 241, 243, 247;
    --bs-body-bg-rgb: 17, 18, 21;
    --bs-border-color: var(--border-color);
    --bs-border-color-translucent: rgba(255, 255, 255, 0.08);
    --bs-tertiary-bg: var(--bg-panel);
    --bs-secondary-bg: var(--bg-card);
    --bs-card-bg: var(--bg-panel);
    --bs-modal-bg: var(--bg-panel);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: "Hanken Grotesk", "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.015em;
}

a {
    text-decoration: none;
    color: var(--primary-accent);
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-bright);
}

/* Layout Wrapper */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Top Header removed from Desktop (Logo now at top of Sidebar) */
#top-header {
    display: none !important;
}

#mobile-top-bar,
#mobile-bottom-nav,
.mobile-ios-sheet {
    display: none;
}

/* ==========================================================================
   Sidebar Styling (Full Height, Brand Logo on Top, Scrollable, Pinned Footer)
   ========================================================================== */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Brand Header on top of Sidebar (Không thanh ngăn, logo căn trái) */
.sidebar-brand-header {
    height: 64px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    border-bottom: none;
    flex-shrink: 0;
    background-color: var(--bg-panel);
}

.sidebar-brand-header a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-logo {
    height: 32px;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* Scroll Area for Menu & Companion Box */
#sidebar-scroll-area {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#sidebar-scroll-area::-webkit-scrollbar {
    width: 5px;
}

#sidebar-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

#sidebar-scroll-area::-webkit-scrollbar-thumb:hover {
    background: rgba(181, 147, 68, 0.35);
}

#sidebar-scroll-area {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* Nav Items & Links */
#sidebar .nav-item {
    margin: 1px 8px;
}

#sidebar .nav-link {
    color: var(--text-main);
    padding: 7px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    user-select: none;
    border-left: 3px solid transparent;
}

#sidebar .nav-link i.fa {
    width: 20px;
    min-width: 20px;
    height: 20px;
    font-size: 0.95rem;
    text-align: center;
    margin-right: 10px;
    color: var(--primary-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s ease, color 0.15s ease;
}

#sidebar .nav-link:hover {
    background-color: var(--bg-card);
    color: #ffffff;
}

#sidebar .nav-link:hover i.fa {
    transform: scale(1.08);
    color: var(--primary-bright);
}

#sidebar .nav-link.active {
    background-color: var(--primary-tint);
    color: var(--primary-bright);
    font-weight: 600;
    border-left-color: var(--primary-light);
    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
}

#sidebar .nav-link.active i.fa {
    color: var(--primary-bright);
}

/* Suppress Bootstrap's auto ::after on dropdown-toggle in sidebar */
#sidebar .dropdown-toggle::after {
    display: none !important;
}

/* Submenu Styling */
.submenu-arrow {
    transition: transform 0.2s ease, color 0.2s ease;
    font-size: 0.8rem;
    color: var(--text-muted);
}

#sidebar [aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
    color: var(--primary-accent);
}

.submenu-list {
    margin: 2px 0 4px 12px;
    padding-left: 8px;
    border-left: 1px solid var(--border-color);
}

.submenu-link {
    padding: 5px 8px !important;
    font-size: 0.815rem !important;
    color: var(--text-muted) !important;
    border-radius: 5px !important;
    border-left: none !important;
}

.submenu-link:hover {
    color: #ffffff !important;
    background-color: var(--bg-card-hover) !important;
}

.submenu-link.active {
    color: var(--primary-bright) !important;
    background-color: var(--primary-tint) !important;
    font-weight: 600 !important;
}

.submenu-icon {
    width: 14px !important;
    min-width: 14px !important;
    margin-right: 8px !important;
    font-size: 0.72rem !important;
    color: var(--text-muted) !important;
}

.submenu-link.active .submenu-icon {
    color: var(--primary-bright) !important;
}

/* Companion Status Box in Sidebar (Inside Scroll Area, Fully Visible) */
.companion-status-box {
    margin: 14px 8px 16px 8px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-highlight);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.companion-status-header {
    background: linear-gradient(135deg, #967935, #80662b);
    color: #ffffff;
    padding: 8px 11px;
    font-weight: 600;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 7px;
}

.companion-header-title {
    color: #ffffff !important;
    text-decoration: none;
}

.companion-status-body {
    padding: 10px 11px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.companion-status-title {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-main);
}

.status-indicator {
    color: var(--accent-red);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.82rem;
    display: inline-block;
}

.companion-info-item {
    margin-bottom: 5px;
}

.companion-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
    line-height: 1.2;
}

.companion-buttons {
    margin-top: 6px;
}

.companion-buttons p {
    margin-bottom: 5px;
}

.companion-buttons button {
    font-size: 0.78rem;
    padding: 5px 8px;
    border-radius: 5px;
    margin-bottom: 4px;
}

.companion-note {
    font-style: italic;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.3;
}

/* Sidebar Non-Windows OS Warning */
.sidebar-os-warning {
    margin: 14px 8px 16px 8px;
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.28);
    border-radius: 8px;
    padding: 10px 12px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.sidebar-os-warning-title {
    color: #ea868f;
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-os-warning-text {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

/* ==========================================================================
   Sidebar User Profile Footer & Modern Dropup Menu
   ========================================================================== */
#sidebar-user-footer {
    flex-shrink: 0;
    padding: 8px 10px 12px 10px;
    border-top: none;
    background-color: var(--bg-panel);
    position: relative;
}

.user-profile-btn {
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-profile-btn:hover,
.user-profile-btn[aria-expanded="true"] {
    background-color: var(--bg-card);
    border-color: rgba(181, 147, 68, 0.35);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.user-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    display: inline-block;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 1.5px solid rgba(181, 147, 68, 0.4);
    transition: border-color 0.15s ease;
}

.user-profile-btn:hover .user-avatar {
    border-color: var(--primary-light);
}

.user-online-status {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 9px;
    height: 9px;
    background-color: #10b981;
    border: 2px solid var(--bg-panel);
    border-radius: 50%;
}

.user-details {
    line-height: 1.25;
    margin-left: 9px;
    min-width: 0;
}

.user-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: #ffffff;
}

.user-role-label {
    font-size: 0.72rem;
    color: var(--primary-bright);
    font-weight: 500;
}

.dropup-icon {
    font-size: 0.72rem;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.user-profile-btn[aria-expanded="true"] .dropup-icon {
    transform: rotate(180deg);
    color: var(--primary-bright) !important;
}

/* Dropup Menu Container */
#sidebar-user-footer .dropdown-menu.user-dropup-menu {
    background-color: #171922;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
    margin-bottom: 8px !important;
    overflow: hidden;
}

/* Dropdown Header Card */
.user-dropdown-header {
    padding: 12px 12px 10px 12px;
    background: rgba(255, 255, 255, 0.025);
    border-bottom: 1px solid var(--border-color);
}

.dropdown-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 1.5px solid var(--primary-light);
}

.dropdown-user-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.3;
}

.dropdown-user-email {
    font-size: 0.73rem;
    color: var(--text-muted);
    line-height: 1.2;
}

/* Role Badges */
.role-badge-owner {
    background: linear-gradient(135deg, rgba(44, 196, 201, 0.2), rgba(20, 140, 145, 0.3));
    color: #5eead4;
    border: 1px solid rgba(94, 234, 212, 0.3);
    font-size: 0.69rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-block;
}

.role-badge-admin {
    background: linear-gradient(135deg, rgba(181, 147, 68, 0.2), rgba(128, 102, 43, 0.3));
    color: #fef08a;
    border: 1px solid rgba(234, 179, 8, 0.3);
    font-size: 0.69rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-block;
}

.role-badge-user {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.69rem;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-block;
}

.user-active-badge {
    font-size: 0.72rem;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
}

.user-active-badge .status-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    margin-right: 5px;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

/* Action Items in Dropdown */
.user-dropdown-body,
.user-dropdown-footer {
    padding: 4px;
}

.user-dropdown-action {
    display: flex;
    align-items: center;
    padding: 7px 8px;
    border-radius: 6px;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.15s ease;
    gap: 10px;
    white-space: normal;
}

.user-dropdown-action:hover {
    background-color: var(--bg-card-hover);
    color: #ffffff;
}

.action-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.action-icon-gold {
    background: rgba(181, 147, 68, 0.15);
    color: var(--primary-bright);
    border: 1px solid rgba(181, 147, 68, 0.25);
}

.action-icon-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.action-icon-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.action-text {
    flex-grow: 1;
    min-width: 0;
}

.action-title {
    font-size: 0.83rem;
    font-weight: 600;
    line-height: 1.25;
}

.action-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.action-arrow {
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0.5;
    margin-left: auto;
    transition: transform 0.15s ease, opacity 0.15s ease;
    flex-shrink: 0;
}

.user-dropdown-action:hover .action-arrow {
    opacity: 1;
    transform: translateX(2px);
    color: #ffffff;
}

.user-dropdown-action.logout-action:hover {
    background-color: rgba(239, 68, 68, 0.12);
}

.user-dropdown-action.logout-action:hover .action-title,
.user-dropdown-action.logout-action:hover .action-arrow {
    color: #fca5a5 !important;
}

.text-danger-soft {
    color: #fca5a5;
    opacity: 0.75;
}

#sidebar-user-footer .dropdown-divider {
    border-color: var(--border-color);
    margin: 4px 0;
    opacity: 0.7;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
#main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    margin-top: 0;
    padding: 24px 28px;
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    min-width: 0;
}

/* ==========================================================================
   Consistent Elements: Panels, Cards, Tables, Forms, Modals
   ========================================================================== */
/* Panels and Cards */
.panel,
.card,
.panel-default {
    background-color: var(--bg-panel);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 22px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.panel-header,
.panel-heading,
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.015);
}

.panel-header h5,
.panel-heading h3,
.panel-heading h4,
.panel-heading h5,
.panel-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
    color: #ffffff;
}

.panel-body,
.card-body {
    padding: 18px;
}

/* Tables - Modern Dark Consistent Styling */
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.015);
    --bs-table-hover-bg: rgba(181, 147, 68, 0.06);
    color: var(--text-main);
    border-color: var(--border-color);
    vertical-align: middle;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 9px 12px;
    background-color: transparent;
    border-bottom-color: var(--border-color);
}

.table thead th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.02) !important;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table-bordered {
    border: 1px solid var(--border-color);
}

.table-bordered > :not(caption) > * > * {
    border: 1px solid var(--border-color);
}

/* Action Buttons inside Table cells (Enlarged for comfortable clicking) */
.table td .btn {
    padding: 6px 11px;
    font-size: 0.88rem;
    min-width: 33px;
    height: 33px;
    border-radius: 6px;
    margin: 2px 2px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Form Controls & Inputs */
.form-control,
.form-select {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control-sm,
.form-select-sm {
    padding: 4px 8px;
    font-size: 0.84rem;
    border-radius: 6px;
    min-height: 31px;
    height: 31px;
    line-height: 1.5;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-card);
    border-color: var(--primary-light);
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(181, 147, 68, 0.22);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
    color: var(--text-muted);
    opacity: 0.85;
}

.input-group-text {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Coloris Color Picker Integration */
.clr-field {
    display: block !important;
    width: 100% !important;
}

.clr-field input {
    width: 100% !important;
    display: block !important;
}

.clr-field button {
    border-radius: 0 6px 6px 0 !important;
}

/* Buttons with modern styling */
.btn {
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.86rem;
    padding: 6px 13px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
}

/* Reset margin-bottom for buttons in compound components, headers, flex containers, and tables */
.pagination > button.btn,
.pagination .btn,
.pagination-box .btn,
.pagination-box .form-control,
.pagination-box input,
.d-flex > .btn,
.d-inline-flex > .btn,
.btn-group > .btn,
.input-group > .btn,
.input-group button,
.modal-footer .btn,
.modal-footer button,
.modal-header .btn,
.modal-header .btn-close,
.panel-header .btn,
.card-header .btn,
.table td .btn,
.table th .btn,
#sidebar-toggle,
.sidebar-brand-header .btn,
#sidebar-user-footer .btn,
.user-profile-btn,
.dropdown-menu .btn {
    margin-bottom: 0 !important;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.84rem;
    border-radius: 6px;
    gap: 5px;
    min-height: 31px;
    height: 31px;
    line-height: 1.5;
}

/* Pagination toolbar controls & input alignment */
.pagination-box {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}

.pagination-box .btn,
.pagination-box .form-control,
.pagination-box input {
    height: 31px !important;
    min-height: 31px !important;
    max-height: 31px !important;
    line-height: 29px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
    vertical-align: middle;
    box-sizing: border-box;
}

.pagination-box .btn {
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.pagination-box .page-input {
    width: 48px !important;
    text-align: right;
    padding: 0 6px !important;
    line-height: 29px !important;
    border-radius: 6px;
    font-size: 0.84rem;
    -moz-appearance: textfield;
}

.pagination-box .page-input::-webkit-outer-spin-button,
.pagination-box .page-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pagination-box .page-max-input {
    width: 52px !important;
    text-align: left;
    padding: 0 6px !important;
    line-height: 29px !important;
    border-radius: 6px;
    font-size: 0.84rem;
    cursor: default;
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Primary Button in #80662b Gold/Bronze Theme */
.btn-primary {
    background: linear-gradient(135deg, #967935, #80662b);
    border: 1px solid rgba(230, 186, 84, 0.25);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(128, 102, 43, 0.35);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ab8a3d, #967935);
    border-color: rgba(230, 186, 84, 0.4);
    box-shadow: 0 4px 12px rgba(128, 102, 43, 0.45);
    color: #ffffff;
}

.btn-primary:active:not(:disabled) {
    background: #6e5724;
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #ffffff;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.2);
}

.btn-warning:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #ffffff;
}

.btn-secondary {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-card-hover);
    border-color: #3b4254;
    color: #ffffff;
}

/* Pagination - Unified Modern Segment */
.pagination {
    display: inline-flex;
    align-items: stretch;
    margin: 8px 0 16px 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
}

.pagination > button.btn {
    border-radius: 0 !important;
    border: none !important;
    border-right: 1px solid var(--border-color) !important;
    background: transparent;
    color: var(--text-main);
    padding: 6px 12px;
    font-size: 0.85rem;
    height: 35px;
    transition: background-color 0.15s ease;
}

.pagination > button.btn:last-child {
    border-right: none !important;
}

.pagination > button.btn:hover:not(:disabled) {
    background-color: var(--bg-card-hover);
    color: #ffffff;
}

.pagination > button.btn:disabled {
    opacity: 0.4;
}

.pagination > input.form-control {
    border-radius: 0 !important;
    border: none !important;
    border-right: 1px solid var(--border-color) !important;
    background: transparent;
    color: var(--text-main);
    box-shadow: none !important;
    font-size: 0.85rem;
    text-align: center;
    height: 35px;
}

/* Modals */
.modal-content {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
    background-color: rgba(255, 255, 255, 0.015);
}

.modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
    background-color: rgba(255, 255, 255, 0.01);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
}

/* Nav Tabs & Tab Content */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    gap: 4px;
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--text-muted);
    font-weight: 500;
    padding: 9px 16px;
    transition: all 0.2s ease;
    background: transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--text-main);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.nav-tabs .nav-link.active {
    color: var(--primary-bright);
    background: transparent;
    border-bottom-color: var(--primary-light);
    font-weight: 600;
}

.tab-content {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Stat Cards (Dashboard & Email Grids) */
.stat-card {
    background-color: var(--bg-card);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.25);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: #ffffff;
    margin-right: 16px;
    flex-shrink: 0;
}

.stat-content .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
}

.stat-content .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Color Themes for Stat Cards */
.bg-gold { background-color: var(--primary-color); color: #fff; }
.bg-purple { background-color: var(--accent-purple); }
.bg-red { background-color: var(--accent-red); }
.bg-blue { background-color: var(--accent-blue); }
.bg-pink { background-color: var(--accent-pink); }
.bg-green { background-color: var(--accent-green); }
.bg-orange { background-color: var(--accent-orange); }
.bg-yellow { background-color: var(--accent-yellow); color: #000; }

/* Special Icons for Email Status */
.status-icon-circle {
    width: 32px;
    height: 32px;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
}

/* Server Info List */
.server-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.server-info-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
}

.server-info-list li:last-child {
    border-bottom: none;
}

.server-info-list li span:first-child {
    color: var(--text-muted);
    margin-right: 8px;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.88rem;
}

.alert-warning {
    background-color: rgba(234, 179, 8, 0.1);
    border-color: rgba(234, 179, 8, 0.25);
    color: #fef08a;
}

.alert-info {
    background-color: rgba(181, 147, 68, 0.12);
    border-color: rgba(181, 147, 68, 0.3);
    color: #fef3c7;
}

/* Tooltip helper */
.pn-tooltip {
    color: var(--primary-accent);
    cursor: pointer;
    margin-left: 3px;
}

/* ==========================================================================
   Responsive Styles (Mobile & Tablet)
   ========================================================================== */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    z-index: 1080;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

body.sidebar-open {
    overflow: hidden;
}

@media (max-width: 991.98px) {
    /* Hide desktop sidebar on mobile since iOS bottom bar handles navigation */
    #sidebar {
        display: none !important;
    }

    .sidebar-backdrop {
        display: none !important;
    }

    #mobile-top-bar {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        height: 50px;
        padding: 0 16px;
        background-color: rgba(20, 22, 28, 0.94);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 0.5px solid rgba(255, 255, 255, 0.15);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1040;
    }

    #main-content {
        margin-left: 0 !important;
        margin-top: 50px !important;
        padding: 16px 14px 20px 14px !important;
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* ==========================================================================
       Classic iOS Full-Width Bottom Tab Bar
       ========================================================================== */
    #mobile-bottom-nav {
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 50px;
        box-sizing: content-box;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background-color: rgba(20, 22, 28, 0.95);
        backdrop-filter: blur(25px) saturate(180%);
        -webkit-backdrop-filter: blur(25px) saturate(180%);
        border-top: 0.5px solid rgba(255, 255, 255, 0.18);
        z-index: 1050;
        user-select: none;
    }

    .mobile-tab-item {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #8e8e93;
        text-decoration: none;
        padding: 4px 1px;
        background: transparent;
        border: none;
        outline: none !important;
        box-shadow: none !important;
        transition: color 0.12s ease, opacity 0.12s ease;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        min-width: 0;
    }

    .mobile-tab-item:active {
        opacity: 0.45;
    }

    .mobile-tab-item.active {
        color: #e6ba54;
    }

    .mobile-tab-icon {
        font-size: 1.25rem;
        line-height: 1;
        margin-bottom: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 22px;
    }

    .mobile-tab-label {
        font-size: 0.62rem;
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: -0.15px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* ==========================================================================
       Classic iOS Full-Width Action Sheet (Offcanvas Bottom)
       ========================================================================== */
    .mobile-ios-sheet {
        display: flex;
        flex-direction: column;
        border-radius: 14px 14px 0 0 !important;
        background-color: #171922 !important;
        border-top: 0.5px solid rgba(255, 255, 255, 0.18) !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
        max-height: 84vh !important;
        height: auto !important;
        box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.75) !important;
        padding-bottom: env(safe-area-inset-bottom, 14px) !important;
        z-index: 1070 !important;
    }

    .ios-sheet-handle {
        width: 36px;
        height: 4.5px;
        border-radius: 3px;
        background: rgba(255, 255, 255, 0.28);
        margin: 8px auto 4px auto;
        flex-shrink: 0;
    }

    .mobile-ios-sheet .offcanvas-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 14px;
    }

    /* iOS Grouped List Style */
    .ios-section-title {
        font-size: 0.72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #8e8e93;
        padding: 6px 4px 4px 4px;
    }

    .ios-grouped-list {
        background-color: rgba(255, 255, 255, 0.04);
        border-radius: 10px;
        overflow: hidden;
        border: 0.5px solid rgba(255, 255, 255, 0.08);
        margin-bottom: 12px;
    }

    .ios-list-row {
        display: flex;
        align-items: center;
        padding: 11px 14px;
        color: var(--text-main);
        text-decoration: none;
        border-bottom: 0.5px solid rgba(255, 255, 255, 0.07);
        transition: background-color 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .ios-list-row:last-child {
        border-bottom: none;
    }

    .ios-list-row:active {
        background-color: rgba(255, 255, 255, 0.08);
    }

    .ios-list-row.active {
        background-color: rgba(181, 147, 68, 0.12);
        color: #e6ba54;
        font-weight: 500;
    }

    .ios-row-icon {
        width: 28px;
        height: 28px;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.06);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        color: #e6ba54;
        margin-right: 12px;
        flex-shrink: 0;
    }

    .ios-list-row.active .ios-row-icon {
        background: rgba(181, 147, 68, 0.25);
    }

    .ios-row-label {
        font-size: 0.86rem;
        flex-grow: 1;
        min-width: 0;
    }

    .ios-chevron {
        font-size: 0.72rem;
        color: #636366;
        flex-shrink: 0;
    }

    /* iOS User Card in Menu Sheet */
    .ios-user-card {
        background: rgba(255, 255, 255, 0.04);
        border: 0.5px solid rgba(255, 255, 255, 0.08);
        border-radius: 10px;
        padding: 12px;
        margin-bottom: 12px;
    }

    .user-avatar-lg {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        object-fit: cover;
        display: block;
        border: 1.5px solid var(--primary-light);
    }

    .mobile-hide {
        display: none !important;
    }
}

/* ==========================================================================
   Modern Dashboard Card & Layout Components (Unified with manage_payment.php)
   ========================================================================== */

.page-header-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-title {
    margin-bottom: 0.25rem;
    color: var(--text-main);
    font-weight: 700;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0;
}

.dashboard-stat-card,
.payment-stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-stat-card:hover,
.payment-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.dashboard-stat-icon,
.payment-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.content-table-card,
.payment-table-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.info-alert-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-light);
    border-radius: 10px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.info-alert-card .info-alert-icon {
    font-size: 1.15rem;
    color: var(--primary-light);
    flex-shrink: 0;
}

.info-alert-card > div,
.info-alert-card > span,
.info-alert-card > p {
    margin: 0;
}