/**
 * mBill — Modern UI Styles v4
 * Based on outgoing-payments-analytics.html design
 */

/* ==========================================================================
   1. CSS VARIABLES & BASE SETTINGS
   ========================================================================== */

:root {
    --color-primary: #2470dc;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --color-info: #17a2b8;
    --color-gray: #6c757d;
    --color-light-gray: #f5f7fa;
    --color-border: #dee2e6;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: all 0.2s ease;
}

/* Search hidden items */
.search-hidden {
    display: none !important;
}

/* Search input with clear button */
.search-input-wrapper {
    position: relative;
    width: 250px;
}

.search-input-wrapper input {
    padding-right: 32px;
    width: 100%;
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    color: var(--color-gray);
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.search-clear-btn:hover {
    opacity: 1;
}

/* ==========================================================================
   2. GLOBAL STYLES (ALL SCREENS)
   ========================================================================== */

body {
    background: var(--color-light-gray);
    font-size: 0.875rem;
}

/* Page Title / Breadcrumb */
nav[aria-label="breadcrumb"] {
    padding: 1rem 0 1.5rem 0 !important;
}

nav[aria-label="breadcrumb"] .breadcrumb {
    margin: 0;
    padding: 0;
    background: transparent;
}

nav[aria-label="breadcrumb"] .breadcrumb-item {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a2e;
}

nav[aria-label="breadcrumb"] .breadcrumb-item a {
    color: #1a1a2e;
    text-decoration: none;
}

nav[aria-label="breadcrumb"] .breadcrumb-item a:hover {
    color: var(--color-primary);
}

nav[aria-label="breadcrumb"] .breadcrumb-item + .breadcrumb-item::before {
    color: var(--color-gray);
}

nav[aria-label="breadcrumb"] .breadcrumb-item i {
    margin-right: 0.5rem;
    color: var(--color-primary);
}

/* Main content area */
main.col-md-9,
main.ms-sm-auto {
    background: var(--color-light-gray);
    padding: 1.5rem !important;
}


/* ==========================================================================
   3. KPI CARDS - MODERN STYLE (ALL SCREENS)
   ========================================================================== */

/* Card container rows */
.row.rm {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
    margin: 0 !important;
    margin-bottom: 1rem !important;
    padding: 0 !important;
}

.row.rm.mt-3 {
    margin-top: 1rem !important;
}

.row.rm > .col.cp {
    flex: 1 1 calc(25% - 0.75rem);
    max-width: calc(25% - 0.75rem);
    min-width: 180px;
    padding: 0 !important;
    margin: 0 !important;
}

/* Modern Card Style - Global */
.card.bg-green,
.card.bg-yellow,
.card.bg-red,
.card.bg-blue,
.card.bg-gray,
.card.bg-purple,
.card.bg-orange,
.card.bg-teal,
.card.bg-indigo,
.card.bg-pink {
    background: #fff !important;
    border: none !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.card.bg-green:hover,
.card.bg-yellow:hover,
.card.bg-red:hover,
.card.bg-blue:hover,
.card.bg-gray:hover,
.card.bg-purple:hover,
.card.bg-orange:hover,
.card.bg-teal:hover,
.card.bg-indigo:hover,
.card.bg-pink:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Colored left border */
.card.bg-green::before,
.card.bg-yellow::before,
.card.bg-red::before,
.card.bg-blue::before,
.card.bg-gray::before,
.card.bg-purple::before,
.card.bg-orange::before,
.card.bg-teal::before,
.card.bg-indigo::before,
.card.bg-pink::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.card.bg-green::before { background: var(--color-success); }
.card.bg-yellow::before { background: var(--color-warning); }
.card.bg-red::before { background: var(--color-danger); }
.card.bg-blue::before { background: var(--color-info); }
.card.bg-gray::before { background: var(--color-gray); }
.card.bg-purple::before { background: #9b59b6; }
.card.bg-orange::before { background: #e67e22; }
.card.bg-teal::before { background: #1abc9c; }
.card.bg-indigo::before { background: #3f51b5; }
.card.bg-pink::before { background: #e91e63; }

/* Card body with colored cards */
.card.bg-green .card-body,
.card.bg-yellow .card-body,
.card.bg-red .card-body,
.card.bg-blue .card-body,
.card.bg-gray .card-body,
.card.bg-purple .card-body,
.card.bg-orange .card-body,
.card.bg-teal .card-body,
.card.bg-indigo .card-body,
.card.bg-pink .card-body {
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
}

/* Legacy support for .row.rm */
.row.rm .card {
    background: #fff !important;
    border: none !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm);
    margin: 0 !important;
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

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

.row.rm .card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

/* Card colors within .row.rm */
.row.rm .card.bg-green::before { background: var(--color-success); }
.row.rm .card.bg-yellow::before { background: var(--color-warning); }
.row.rm .card.bg-red::before { background: var(--color-danger); }
.row.rm .card.bg-blue::before { background: var(--color-info); }
.row.rm .card.bg-gray::before { background: var(--color-gray); }
.row.rm .card.bg-purple::before { background: #9b59b6; }
.row.rm .card.bg-orange::before { background: #e67e22; }
.row.rm .card.bg-teal::before { background: #1abc9c; }
.row.rm .card.bg-indigo::before { background: #3f51b5; }
.row.rm .card.bg-pink::before { background: #e91e63; }

/* Gradient backgrounds for dashboard cards */
.row.rm .card.bg-green { background: linear-gradient(to right, rgba(40, 167, 69, 0.08), #fff 25%) !important; }
.row.rm .card.bg-yellow { background: linear-gradient(to right, rgba(255, 193, 7, 0.12), #fff 25%) !important; }
.row.rm .card.bg-red { background: linear-gradient(to right, rgba(220, 53, 69, 0.08), #fff 25%) !important; }
.row.rm .card.bg-blue { background: linear-gradient(to right, rgba(23, 162, 184, 0.08), #fff 25%) !important; }
.row.rm .card.bg-gray { background: linear-gradient(to right, rgba(108, 117, 125, 0.08), #fff 25%) !important; }
.row.rm .card.bg-purple { background: linear-gradient(to right, rgba(155, 89, 182, 0.08), #fff 25%) !important; }
.row.rm .card.bg-orange { background: linear-gradient(to right, rgba(230, 126, 34, 0.08), #fff 25%) !important; }
.row.rm .card.bg-teal { background: linear-gradient(to right, rgba(26, 188, 156, 0.08), #fff 25%) !important; }
.row.rm .card.bg-indigo { background: linear-gradient(to right, rgba(63, 81, 181, 0.08), #fff 25%) !important; }
.row.rm .card.bg-pink { background: linear-gradient(to right, rgba(233, 30, 99, 0.08), #fff 25%) !important; }

/* Card body */
.row.rm .card-body {
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.25rem;
}

/* KPI Value */
.row.rm .card-body h4,
.row.rm .card-body .h4 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    color: #333;
}

/* KPI Label */
.row.rm .card-body > .d-flex:last-child > div:first-child {
    font-size: 0.7rem;
    color: var(--color-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Secondary value (right side) */
.row.rm .card-body > .d-flex > h4:last-child:not(:first-child),
.row.rm .card-body > .d-flex > .h4:last-child:not(:first-child) {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-gray);
}

/* rub and prc suffixes */
.rub::after {
    content: ' \20BD';
    font-size: 0.85em;
    font-weight: 500;
}

.prc::after {
    content: '%';
    font-size: 0.85em;
}

/* Text colors in cards */
.row.rm .card .text-dark {
    color: #333 !important;
}

.row.rm .card .text-danger {
    color: var(--color-danger) !important;
}

/* Links in cards */
.row.rm .card a {
    font-size: 0.8rem;
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition);
}

.row.rm .card a:hover {
    color: #1a5bb8;
    text-decoration: underline;
}

/* ==========================================================================
   3.1 SELECTABLE KPI CARDS (Unpaid page)
   ========================================================================== */

/* KPI Row - контейнер карточек */
.kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

/* KPI Column */
.kpi-col {
    flex: 1 1 200px;
    min-width: 180px;
    max-width: calc(25% - 0.75rem);
}

.kpi-col-half {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 280px;
    max-width: calc(50% - 0.5rem);
}

.kpi-col-third {
    flex: 1 1 calc(33.333% - 0.667rem);
    min-width: 250px;
    max-width: calc(33.333% - 0.667rem);
}

/* KPI Card */
.kpi-card {
    display: block;
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    height: 100%;
}

.kpi-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-primary);
}

.kpi-card.bg-blue::before { background: var(--color-info); }
.kpi-card.bg-green::before { background: var(--color-success); }
.kpi-card.bg-yellow::before { background: var(--color-warning); }
.kpi-card.bg-red::before { background: var(--color-danger); }

/* Gradient backgrounds for KPI cards */
.kpi-card.bg-blue { background: linear-gradient(to right, rgba(23, 162, 184, 0.08), #fff 25%) !important; }
.kpi-card.bg-green { background: linear-gradient(to right, rgba(40, 167, 69, 0.08), #fff 25%) !important; }
.kpi-card.bg-yellow { background: linear-gradient(to right, rgba(255, 193, 7, 0.12), #fff 25%) !important; }
.kpi-card.bg-red { background: linear-gradient(to right, rgba(220, 53, 69, 0.08), #fff 25%) !important; }

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

/* Selected state */
.btn-check:checked + .kpi-card {
    background: #e8f4fd !important;
    box-shadow: var(--shadow-md);
}

.btn-check:checked + .kpi-card::before {
    width: 6px;
}

/* KPI Value */
.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}

/* KPI Badge (days) */
.kpi-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.06);
    color: #666;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* KPI Label */
.kpi-label {
    font-size: 0.7rem;
    color: var(--color-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* KPI Footer */
.kpi-footer {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

.kpi-count {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.kpi-sub {
    font-size: 0.7rem;
    color: var(--color-gray);
    text-transform: uppercase;
}

.kpi-prc {
    margin-left: auto;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-gray);
}

/* ==========================================================================
   3.2 SEGMENT BUTTONS (Contractors page)
   ========================================================================== */

.segment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.segment-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.segment-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-gray);
    cursor: pointer;
    transition: var(--transition);
}

.segment-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-check:checked + .segment-btn {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.segment-cnt {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

.btn-check:checked + .segment-btn .segment-cnt {
    background: rgba(255, 255, 255, 0.25);
}

.segment-actions {
    flex-shrink: 0;
}

/* ==========================================================================
   4. BUTTONS - MODERN STYLE
   ========================================================================== */

.btn {
    border-radius: var(--radius-xs);
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
}

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

.btn-primary:hover {
    background: #1a5bb8;
    border-color: #1a5bb8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(36, 112, 220, 0.3);
}

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

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

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

.btn-outline-secondary:hover {
    background: #f8f9fa;
    border-color: var(--color-gray);
    color: #333;
}

.btn-success {
    background: var(--color-success);
    border-color: var(--color-success);
}

.btn-success:hover {
    background: #218838;
    border-color: #218838;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* ==========================================================================
   5. FORM CONTROLS - MODERN STYLE
   ========================================================================== */

.form-control,
.form-select,
.bootstrap-select > .dropdown-toggle {
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus,
.bootstrap-select > .dropdown-toggle:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(36, 112, 220, 0.15);
}

/* Filter container */
.frm {
    background: #fff;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-sm);
}

.frm label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-gray);
    margin-bottom: 0.375rem;
    font-weight: 500;
}

/* Bootstrap Select */
.bootstrap-select .dropdown-menu {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    left: 0 !important;
    transform: none !important;
    max-width: calc(100vw - 250px);
}

.filter-row .bootstrap-select {
    position: static;
}

.filter-row {
    position: relative;
}

.filter-row .bootstrap-select .dropdown-menu {
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
}

.bootstrap-select .dropdown-item {
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.bootstrap-select .dropdown-item:hover,
.bootstrap-select .dropdown-item.active {
    background: rgba(36, 112, 220, 0.1);
    color: var(--color-primary);
}

/* ==========================================================================
   6. CHARTS & CONTAINERS
   ========================================================================== */

.chart-container {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

/* Filter row (selects) */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 10;
}

.filter-col {
    flex: 1 1 180px;
    min-width: 150px;
}

.filter-col-wide {
    flex: 2 1 300px;
    min-width: 250px;
}

.filter-col .frm {
    height: auto;
}

/* ==========================================================================
   7. TABLES - MODERN STYLE
   ========================================================================== */

.table-responsive {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    color: var(--color-gray);
    border-bottom: 2px solid var(--color-border);
    padding: 1rem 0.75rem;
}

.table tbody td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

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

.table tbody tr:hover {
    background: rgba(36, 112, 220, 0.03);
}

/* ==========================================================================
   8. LIST GROUP - MODERN STYLE
   ========================================================================== */

.list-group {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.list-group-item {
    border: none;
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 1.25rem;
    background: #fff;
    transition: var(--transition);
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background: rgba(36, 112, 220, 0.03);
}

.list-group-item h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

/* Document list item states */
.list-group-item.list-group-item-action {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.list-group-item.list-group-item-success {
    background: linear-gradient(to right, rgba(40, 167, 69, 0.08), #fff 20%);
    border-left: 4px solid var(--color-success);
}

.list-group-item.list-group-item-warning {
    background: linear-gradient(to right, rgba(255, 193, 7, 0.12), #fff 20%);
    border-left: 4px solid var(--color-warning);
}

.list-group-item.list-group-item-info {
    background: linear-gradient(to right, rgba(23, 162, 184, 0.08), #fff 20%);
    border-left: 4px solid var(--color-info);
}

.list-group-item.list-group-item-danger {
    background: linear-gradient(to right, rgba(220, 53, 69, 0.08), #fff 20%);
    border-left: 4px solid var(--color-danger);
}

/* Icons column */
.list-icns {
    width: 40px;
    min-width: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
}

.list-icns img,
.list-icns i {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Buttons column */
.list-btns,
.list-2-btns {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
}

.list-btns {
    width: 44px;
    min-width: 44px;
}

.list-2-btns {
    width: 80px;
    min-width: 80px;
}

.list-2-btns .btn,
.list-btns .btn {
    padding: 0.375rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-2-btns .btn:hover,
.list-btns .btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Invoice payment indicator */
.invpay {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.04);
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
}

.invpay .bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    background: var(--color-danger);
    transition: width 0.3s ease;
}

.invpay a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed #99c;
}

.invpay a:hover {
    border-bottom-style: solid;
}

/* Deposit sum badge */
.dep-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.dep-badge.positive {
    background: rgba(40, 167, 69, 0.1);
    color: var(--color-success);
}

.dep-badge.negative {
    background: rgba(220, 53, 69, 0.1);
    color: var(--color-danger);
}

/* Button abbr style */
.btn.btn-abbr {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed #99c;
    padding: 0;
    background: none;
    border-radius: 0;
}

.btn.btn-abbr:hover {
    border-bottom-style: solid;
    background: none;
}

/* ==========================================================================
   9. PAGINATION - MODERN STYLE
   ========================================================================== */

.pagination {
    gap: 0.25rem;
}

.page-link {
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border);
    color: var(--color-gray);
    padding: 0.5rem 0.875rem;
    transition: var(--transition);
}

.page-link:hover {
    background: #f8f9fa;
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.page-item.active .page-link {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* ==========================================================================
   10. BADGES - MODERN STYLE
   ========================================================================== */

.badge {
    font-weight: 500;
    padding: 0.375rem 0.625rem;
    border-radius: 50px;
    font-size: 0.75rem;
}

.badge.bg-success {
    background: rgba(40, 167, 69, 0.15) !important;
    color: var(--color-success);
}

.badge.bg-warning {
    background: rgba(255, 193, 7, 0.15) !important;
    color: #d39e00;
}

.badge.bg-danger {
    background: rgba(220, 53, 69, 0.15) !important;
    color: var(--color-danger);
}

.badge.bg-info {
    background: rgba(23, 162, 184, 0.15) !important;
    color: var(--color-info);
}

.badge.bg-secondary {
    background: rgba(108, 117, 125, 0.15) !important;
    color: var(--color-gray);
}

/* ==========================================================================
   11. MODALS - MODERN STYLE
   ========================================================================== */

.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding: 1.25rem;
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 1rem 1.25rem;
}

/* ==========================================================================
   12. NAVBAR - MODERN ENHANCEMENTS
   ========================================================================== */

.navbar-brand {
    font-weight: 600;
}

/* ==========================================================================
   13. MOBILE RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 767.98px) {
    html, body {
        overflow-x: hidden;
    }

    /* Navbar - минималистичный */
    .navbar {
        padding: 0.75rem 1rem;
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .navbar-brand {
        font-size: 1.125rem;
        font-weight: 600;
        padding: 0;
        margin: 0;
        background: none !important;
        box-shadow: none !important;
    }

    #dt {
        display: none !important;
    }

    /* Бургер-кнопка - современный стиль */
    .navbar-toggler {
        position: relative !important;
        padding: 0.5rem;
        margin: 0;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .navbar-toggler:focus {
        box-shadow: none !important;
    }

    .navbar-toggler-icon {
        width: 22px;
        height: 22px;
    }

    /* Мобильный поиск - контейнер */
    .mobile-search-container {
        margin-top: 0.5rem;
        margin-bottom: 1.5rem !important;
    }

    .search-input-wrapper {
        position: relative;
        display: flex;
        align-items: center;
    }

    .search-input-wrapper .form-control {
        padding-right: 2.75rem;
    }

    .search-clear-btn {
        position: absolute;
        right: 0.5rem;
        width: 32px;
        height: 32px;
        border: none;
        background: #e0e0e0;
        border-radius: 50%;
        font-size: 0.875rem;
        color: #666;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: var(--transition);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .search-clear-btn.visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .search-clear-btn:hover {
        background: #ccc;
        color: #333;
    }

    /* Main content - увеличенные отступы */
    .container-fluid {
        padding: 0;
    }

    main.col-md-9,
    main.ms-sm-auto {
        padding: 1rem 1.25rem !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Filter row - 2 колонки на мобильных */
    .filter-row {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        margin: 0 0 1rem 0 !important;
    }

    .filter-col {
        min-width: 0 !important;
    }

    /* Широкая колонка занимает всю строку на мобильных */
    .filter-col-wide {
        grid-column: 1 / -1;
    }

    .frm {
        padding: 0.625rem 0.875rem;
        height: 100%;
    }

    /* KPI Cards Grid - всегда 2 колонки */
    .row.rm {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .row.rm > .col.cp {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .row.rm .card-body {
        padding: 0.875rem 0.875rem 0.875rem 1rem;
    }

    /* KPI Row - mobile 2 columns */
    .kpi-row {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .kpi-col {
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .kpi-card {
        padding: 1rem;
    }

    .kpi-value {
        font-size: 1.125rem;
    }

    .kpi-badge {
        top: 0.75rem;
        right: 0.75rem;
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }

    .kpi-footer {
        margin-top: 0.75rem;
        padding-top: 0.5rem;
    }

    .kpi-count {
        font-size: 1rem;
    }

    /* Segment buttons on mobile */
    .segment-row {
        flex-direction: column;
        align-items: stretch;
    }

    .segment-buttons {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
        margin: 0 -1.25rem;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .segment-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .segment-actions {
        display: flex;
        justify-content: flex-end;
    }

    .row.rm .card-body h4 {
        font-size: 1.25rem;
    }

    .row.rm .card-body > .d-flex:last-child > div:first-child {
        font-size: 0.65rem;
    }

    /* Tables */
    .table-responsive {
        margin: 0 -1.25rem 1rem;
        border-radius: 0;
        width: calc(100% + 2.5rem);
    }

    /* List items - document list */
    .list-group-item.list-group-item-action {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.25rem;
        padding: 0.5rem 1.25rem;
        position: relative;
    }

    .list-group-item .list-icns {
        display: none;
    }

    .list-group-item .flex-fill {
        width: 100%;
        padding-right: 55px;
    }

    .list-group-item .flex-fill .d-flex {
        flex-wrap: wrap;
        gap: 0.125rem 0.5rem;
        align-items: center;
    }

    .list-group-item .flex-fill .d-flex:first-child {
        margin-bottom: 0.125rem;
    }

    .list-group-item .flex-fill h6 {
        font-size: 0.875rem;
        margin: 0 !important;
        font-weight: 600;
        width: 100%;
    }

    /* Hide less important info on mobile */
    .list-group-item .flex-fill .d-flex > .ms-auto {
        display: none;
    }

    .list-group-item .flex-fill .d-flex:last-child .text-secondary {
        font-size: 0.8rem;
    }

    .list-group-item .list-2-btns {
        position: absolute;
        right: 1.25rem;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        flex-direction: column;
        gap: 0.375rem;
        padding: 0;
        border: none;
        margin: 0;
    }

    .list-group-item .list-2-btns .btn {
        width: 44px;
        height: 44px;
        min-height: 44px;
        padding: 0;
        border-radius: var(--radius-sm);
        font-size: 1.25rem;
        background: #f0f0f0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .list-group-item .list-2-btns .btn i {
        margin: 0;
    }

    /* Compact payment and deposit badges on mobile */
    .list-group-item .invpay {
        padding: 0.125rem 0.375rem;
        font-size: 0.8rem;
    }

    .list-group-item .dep-badge {
        padding: 0.125rem 0.375rem;
        font-size: 0.75rem;
    }

    /* Full width list on mobile */
    .list-group {
        margin: 0 -1.25rem;
        border-radius: 0;
        width: calc(100% + 2.5rem);
    }

    /* Buttons */
    .btn:not(.btn-sm):not(.list-2-btns .btn) {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Новые клиенты/партнеры - в колонку на мобиле */
    .row > .col-md-7,
    .row > .col-md-5 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
}

/* Very small screens */
@media (max-width: 399.98px) {
    .row.rm > .col.cp {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .row.rm .card-body {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

    .pt-3 > .row:first-child > .col {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* KPI on very small screens - 1 column */
    .kpi-row {
        grid-template-columns: 1fr !important;
    }

    /* Filter row - 1 column on very small screens */
    .filter-row {
        grid-template-columns: 1fr !important;
    }

    .filter-col,
    .filter-col-wide {
        grid-column: auto;
    }
}

/* Landscape */
@media (max-width: 767.98px) and (orientation: landscape) {
    .row.rm > .col.cp {
        flex: 0 0 calc(25% - 0.75rem);
        max-width: calc(25% - 0.75rem);
    }
}

/* ==========================================================================
   14. SAFE AREA (iPhone X+)
   ========================================================================== */

@supports (padding: max(0px)) {
    @media (max-width: 767.98px) {
        .navbar {
            padding-left: max(0.5rem, env(safe-area-inset-left));
            padding-right: max(0.5rem, env(safe-area-inset-right));
        }

        main {
            padding-bottom: max(1rem, env(safe-area-inset-bottom));
        }
    }
}

/* ==========================================================================
   15. PRINT STYLES
   ========================================================================== */

@media print {
    body {
        background: #fff;
    }

    .sidebar-gdrive,
    .navbar,
    #toast,
    .modal {
        display: none !important;
    }

    main {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff;
    }

    .row.rm > .col.cp {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .row.rm .card {
        box-shadow: none;
        border: 1px solid #ddd !important;
    }
}

/* ==========================================================================
   16. TOAST & LOADER
   ========================================================================== */

#toast {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

@media (max-width: 767.98px) {
    #toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}

/* ==========================================================================
   17. UTILITY OVERRIDES
   ========================================================================== */

/* Better text colors */
.text-black-50 {
    color: var(--color-gray) !important;
}

/* Smooth transitions for all interactive elements */
a, button, .btn, input, select, .nav-link, .list-group-item {
    transition: var(--transition);
}

/* Focus states */
a:focus,
button:focus,
.btn:focus,
input:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 112, 220, 0.15);
}

/* ==========================================================================
   18. SUPPLIERS PAGE
   ========================================================================== */

/* Suppliers Grid */
.suppliers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

/* Supplier Card */
.supplier-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    border-left: 4px solid var(--cat-color, var(--color-gray));
}

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

.supplier-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.supplier-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.3;
}

.supplier-category-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
}

.supplier-inn {
    font-size: 0.8rem;
    color: var(--color-gray);
    margin-bottom: 0.75rem;
}

/* Supplier Tags */
.supplier-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.supplier-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--color-light-gray);
    color: var(--color-gray);
}

/* Supplier Contact */
.supplier-contact {
    font-size: 0.85rem;
    color: #444;
    margin-bottom: 0.75rem;
}

.supplier-contact i {
    color: var(--color-gray);
    margin-right: 0.25rem;
}

/* Supplier Stats */
.supplier-stats {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--color-border);
    padding-top: 0.75rem;
    margin-top: auto;
}

.supplier-stat {
    text-align: center;
}

.supplier-stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a2e;
}

.supplier-stat-label {
    font-size: 0.7rem;
    color: var(--color-gray);
}

/* Category Chips */
.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--color-border);
    cursor: pointer;
    font-size: 0.8rem;
    color: #444;
    transition: var(--transition);
}

.category-chip:hover {
    border-color: var(--chip-color, var(--color-primary));
    color: var(--chip-color, var(--color-primary));
}

.category-chip.active {
    background: var(--chip-color, var(--color-primary));
    border-color: var(--chip-color, var(--color-primary));
    color: #fff;
}

.category-chip .count {
    font-size: 0.7rem;
    background: rgba(0,0,0,0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
}

.category-chip.active .count {
    background: rgba(255,255,255,0.2);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-gray);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state h5 {
    color: #444;
    margin-bottom: 0.5rem;
}

/* Form Sections in Modal */
.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title i {
    color: var(--color-primary);
}

/* Supplier Detail Modal */
.supplier-detail .detail-section {
    background: var(--color-light-gray);
    padding: 1rem;
    border-radius: var(--radius-sm);
}

.supplier-detail .detail-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.75rem;
}

.supplier-detail .detail-table {
    width: 100%;
}

.supplier-detail .detail-table td {
    padding: 0.375rem 0;
    font-size: 0.85rem;
    vertical-align: top;
}

.supplier-detail .detail-table td.label {
    color: var(--color-gray);
    width: 40%;
}

/* Mobile responsive */
@media (max-width: 767.98px) {
    .suppliers-grid {
        grid-template-columns: 1fr;
    }

    .category-chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .category-chip {
        flex-shrink: 0;
    }
}

/* ==========================================================================
   19. KPI MINI WIDGETS (Supplier Page)
   ========================================================================== */

.kpi-mini {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    height: 100%;
}

.kpi-mini-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.kpi-mini-icon.blue { background: rgba(36,112,220,0.1); color: var(--color-primary); }
.kpi-mini-icon.green { background: rgba(40,167,69,0.1); color: var(--color-success); }
.kpi-mini-icon.orange { background: rgba(255,193,7,0.15); color: #d39e00; }
.kpi-mini-icon.purple { background: rgba(111,66,193,0.1); color: #6f42c1; }

.kpi-mini-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.kpi-mini-label {
    font-size: 0.7rem;
    color: var(--color-gray);
    text-transform: uppercase;
}

/* ==========================================================================
   20. FILTERS PANEL & SEARCH BOX
   ========================================================================== */

.filters-panel {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.search-box {
    position: relative;
}

.search-box input {
    padding-left: 2.5rem;
    border-radius: 8px;
}

.search-box i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-gray);
}

/* ==========================================================================
   21. VIEW TOGGLE (Grid/List)
   ========================================================================== */

.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: #f0f0f0;
    padding: 0.25rem;
    border-radius: 8px;
}

.view-toggle button {
    border: none;
    background: transparent;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    color: var(--color-gray);
    cursor: pointer;
}

.view-toggle button.active {
    background: #fff;
    color: var(--color-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ==========================================================================
   22. SUPPLIERS TABLE (List View)
   ========================================================================== */

.suppliers-table {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: none;
}

.suppliers-table.active {
    display: block;
}

.suppliers-grid.hidden {
    display: none;
}

.suppliers-table table {
    margin-bottom: 0;
}

.suppliers-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-gray);
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.suppliers-table td {
    vertical-align: middle;
}

.suppliers-table tr:hover {
    background: #f8f9fa;
}

.table-supplier-name {
    font-weight: 600;
}

.table-category-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Mobile responsive for filters */
@media (max-width: 767.98px) {
    .kpi-mini {
        padding: 0.75rem;
    }

    .kpi-mini-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .kpi-mini-value {
        font-size: 1.1rem;
    }

    .kpi-mini-label {
        font-size: 0.65rem;
    }

    .view-toggle {
        padding: 0.125rem;
    }

    .view-toggle button {
        padding: 0.25rem 0.5rem;
    }

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

/* ==========================================================================
   23. SUPPLIER EDIT PAGE
   ========================================================================== */

.supplier-edit-page {
    max-width: 1200px;
}

.supplier-edit-page .card {
    border: none;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
}

.supplier-edit-page .card-header {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.supplier-edit-page .card-body {
    padding: 1.25rem;
}

.supplier-edit-page .form-control,
.supplier-edit-page .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    padding: 0.625rem 0.875rem;
    transition: var(--transition);
}

.supplier-edit-page .form-control:focus,
.supplier-edit-page .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(36, 112, 220, 0.1);
}

.supplier-edit-page .form-control-lg,
.supplier-edit-page .form-select-lg {
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
}

.supplier-edit-page .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.375rem;
}

.supplier-edit-page textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.supplier-edit-page .btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-sm);
}

.supplier-edit-page .btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.supplier-edit-page .btn-primary:hover {
    background: #1a5ab8;
    border-color: #1a5ab8;
}

.supplier-edit-page .btn-outline-secondary {
    border-color: var(--color-border);
    color: #495057;
}

.supplier-edit-page .btn-outline-secondary:hover {
    background: #f8f9fa;
    border-color: var(--color-border);
    color: #212529;
}

.supplier-edit-page .btn-outline-danger {
    border-color: #f5c6cb;
    color: var(--color-danger);
}

.supplier-edit-page .btn-outline-danger:hover {
    background: #fff5f5;
    border-color: var(--color-danger);
}

/* Sticky sidebar on desktop */
@media (min-width: 992px) {
    .supplier-edit-page .col-lg-4 > .card:last-child {
        position: sticky;
        top: 1rem;
    }
}

/* Mobile adjustments */
@media (max-width: 991.98px) {
    .supplier-edit-page .col-lg-4 {
        margin-top: 1rem;
    }
}

/* ==========================================================================
   24. SUPPLIER DOCUMENTS
   ========================================================================== */

.document-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.document-item:hover {
    background: #e9ecef;
}

.document-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    font-size: 0.75rem;
    color: var(--color-gray);
}

.document-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.document-actions .btn {
    padding: 0.25rem 0.5rem;
}

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    transition: var(--transition);
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--color-primary);
    background: rgba(36, 112, 220, 0.02);
}

.upload-zone-content {
    padding: 1.5rem;
    text-align: center;
    color: var(--color-gray);
}

.upload-zone-content i {
    color: var(--color-primary);
    opacity: 0.6;
}

.upload-zone-content p {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.upload-zone.uploading {
    pointer-events: none;
    opacity: 0.6;
}

.upload-zone.uploading .upload-zone-content::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    margin: 0 auto 0.5rem;
    border: 2px solid var(--color-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.upload-zone.uploading .upload-zone-content i,
.upload-zone.uploading .upload-zone-content p,
.upload-zone.uploading .upload-zone-content small {
    display: none;
}

/* ==========================================================================
   25. GOOGLE DRIVE STYLE SIDEBAR
   ========================================================================== */

/* Sidebar container */
.sidebar-gdrive {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-gdrive-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Logo section */
.sidebar-logo {
    padding: 1rem 1.25rem;
    border-bottom: none;
}

.sidebar-logo-link {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    text-decoration: none;
    color: #202124;
}

.sidebar-logo-link .logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: #202124;
    letter-spacing: -0.5px;
}

.sidebar-logo-link .logo-version {
    font-size: 0.75rem;
    font-weight: 400;
    color: #5f6368;
}

/* Create button */
.sidebar-create {
    padding: 0.75rem 1rem;
}

.btn-create {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 24px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #3c4043;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px rgba(60, 64, 67, 0.15);
}

.btn-create:hover {
    background: #f6fafe;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px rgba(60, 64, 67, 0.15);
}

.btn-create:active {
    background: #e8f0fe;
}

.btn-create i {
    font-size: 1.5rem;
    color: var(--color-primary);
}

/* Search box */
.sidebar-search {
    padding: 0.5rem 1rem 0.75rem;
}

.search-box-gdrive {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box-gdrive i {
    position: absolute;
    left: 0.875rem;
    color: #5f6368;
    font-size: 0.875rem;
}

.search-box-gdrive input {
    width: 100%;
    padding: 0.625rem 0.875rem 0.625rem 2.5rem;
    border: none;
    border-radius: 8px;
    background: #f1f3f4;
    font-size: 0.875rem;
    color: #202124;
    transition: all 0.2s ease;
}

.search-box-gdrive input:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px rgba(60, 64, 67, 0.15);
}

.search-box-gdrive input::placeholder {
    color: #5f6368;
}

/* Menu section */
.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

/* Menu items */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0 1rem;
    margin: 0 0.75rem;
    height: 40px;
    border-radius: 0 20px 20px 0;
    text-decoration: none;
    color: #202124;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
}

.sidebar-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #202124;
}

.sidebar-nav-item.active {
    background: #e8f0fe;
    color: #1967d2;
}

.sidebar-nav-item.active:hover {
    background: #d3e3fd;
}

.sidebar-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    flex-shrink: 0;
}

.sidebar-nav-icon i {
    font-size: 1.125rem;
    color: #5f6368;
}

.sidebar-nav-item.active .sidebar-nav-icon i {
    color: #1967d2;
}

.sidebar-nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Group items (expandable) */
.sidebar-nav-group {
    margin: 0.25rem 0;
}

.sidebar-nav-group-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0 1rem;
    margin: 0 0.75rem;
    height: 40px;
    border-radius: 0 20px 20px 0;
    color: #202124;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sidebar-nav-group-header:hover {
    background: rgba(0, 0, 0, 0.04);
}

.sidebar-nav-arrow {
    font-size: 0.75rem;
    color: #5f6368;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.sidebar-nav-group.open .sidebar-nav-arrow {
    transform: rotate(180deg);
}

.sidebar-nav-group-items {
    display: none;
    padding-left: 1rem;
}

.sidebar-nav-group.open .sidebar-nav-group-items {
    display: block;
}

/* Divider */
.sidebar-divider {
    height: 1px;
    background: #dadce0;
    margin: 0.5rem 1rem;
}

/* Footer section */
.sidebar-footer {
    border-top: 1px solid #e0e0e0;
    padding: 0.75rem 0;
    margin-top: auto;
}

.sidebar-footer-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0 1rem;
    margin: 0 0.75rem;
    height: 40px;
    border-radius: 0 20px 20px 0;
    text-decoration: none;
    color: #5f6368;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar-footer-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #202124;
}

.sidebar-footer-item i {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
}

.sidebar-time {
    padding: 0.5rem 1.75rem;
    font-size: 0.75rem;
    color: #5f6368;
}

.sidebar-time strong {
    font-weight: 600;
    margin-right: 0.5rem;
}

/* Main content area adjustment */
.main-gdrive {
    margin-left: 260px !important;
    padding: 1.5rem !important;
    background: var(--color-light-gray);
    min-height: 100vh;
}

/* Remove old sidebar styles override */
.sidebar-gdrive .nav,
.sidebar-gdrive .nav-item,
.sidebar-gdrive .nav-link {
    all: unset;
}

/* Scrollbar styling */
.sidebar-menu::-webkit-scrollbar {
    width: 8px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* ==========================================
   MOBILE STYLES FOR GOOGLE DRIVE SIDEBAR
   ========================================== */

@media (max-width: 767.98px) {
    /* Hide desktop sidebar by default */
    .sidebar-gdrive {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        z-index: 9999;
        background: #fff;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar-gdrive.show {
        transform: translateX(0);
    }

    /* Mobile header */
    .sidebar-gdrive .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.25rem;
        padding-top: calc(1rem + env(safe-area-inset-top, 0px));
        min-height: 60px;
        border-bottom: 1px solid #e0e0e0;
        background: #fff;
    }

    .sidebar-gdrive .sidebar-title {
        font-size: 1.25rem;
        font-weight: 600;
        color: #202124;
    }

    .sidebar-gdrive .sidebar-close {
        width: 44px;
        height: 44px;
        border: none;
        background: #f5f5f5;
        border-radius: 50%;
        font-size: 1.25rem;
        color: #5f6368;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .sidebar-gdrive .sidebar-close:hover {
        background: #e0e0e0;
    }

    /* Content padding */
    .sidebar-gdrive-content {
        padding-top: 0;
        height: calc(100% - 60px);
        overflow-y: auto;
    }

    /* Hide desktop logo on mobile */
    .sidebar-gdrive .sidebar-logo {
        display: none !important;
    }

    /* Adjust create button */
    .sidebar-create {
        padding: 1rem;
    }

    .btn-create {
        width: 100%;
        justify-content: center;
    }

    /* Main content full width on mobile */
    .main-gdrive {
        margin-left: 0 !important;
        padding: 1rem !important;
        margin-top: 56px;
    }

    /* Mobile navbar show */
    header.navbar.d-md-none {
        display: flex !important;
    }

    /* Adjust nav items for mobile */
    .sidebar-nav-item {
        height: 48px;
        margin: 0 0.5rem;
        padding: 0 1rem;
        font-size: 1rem;
    }

    .sidebar-nav-icon i {
        font-size: 1.25rem;
    }

    .sidebar-footer-item {
        height: 48px;
        margin: 0 0.5rem;
        padding: 0 1rem;
        font-size: 1rem;
    }

    .sidebar-footer-item i {
        font-size: 1.25rem;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar-gdrive {
        width: 220px;
    }

    .main-gdrive {
        margin-left: 220px !important;
    }

    .btn-create span {
        display: none;
    }

    .btn-create {
        padding: 0.75rem;
        border-radius: 50%;
        width: 48px;
        height: 48px;
        justify-content: center;
    }

    .btn-create i {
        margin: 0;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .sidebar-gdrive {
        width: 280px;
    }

    .main-gdrive {
        margin-left: 280px !important;
    }
}
