/**
 * Kadim Bayat Dergi Takip Sistemi
 * Modern UI v3.0 — 2026
 */

/* =============================================
   DESIGN TOKENS
   ============================================= */
:root {
    /* Brand */
    --brand-50: #FFF8F0;
    --brand-100: #FEECD6;
    --brand-200: #FDD5A8;
    --brand-300: #FBBA72;
    --brand-400: #F59E3B;
    --brand-500: #E8870F;
    --brand-600: #C96A09;
    --brand-700: #A74F0B;
    --brand-800: #883F10;
    --brand-900: #6F3410;

    /* Neutral */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Sidebar */
    --sidebar-bg: #0F172A;
    --sidebar-bg-hover: rgba(255, 255, 255, 0.06);
    --sidebar-bg-active: linear-gradient(90deg, var(--brand-500) 0%, var(--brand-400) 100%);
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-text-active: #FFFFFF;

    /* Semantic */
    --success: #16A34A;
    --success-bg: #F0FDF4;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --danger: #DC2626;
    --danger-bg: #FEF2F2;
    --info: #2563EB;
    --info-bg: #EFF6FF;

    /* Layout */
    --sidebar-w: 272px;
    --topbar-h: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.05);

    /* Motion */
    --ease: cubic-bezier(.4, 0, .2, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --duration: .2s;
    --duration-md: .3s;
}

/* =============================================
   RESET & BASE
   ============================================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-100);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

::selection {
    background: var(--brand-200);
    color: var(--brand-900);
}

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

img { max-width: 100%; display: block; }
a { color: var(--brand-600); text-decoration: none; transition: color var(--duration) var(--ease); }
a:hover { color: var(--brand-700); }

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    height: 100dvh;
    background: var(--sidebar-bg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform var(--duration-md) var(--ease);
    will-change: transform;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 99px; }

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
    text-align: center;
}

.sidebar-header i {
    font-size: 2rem;
    color: var(--brand-400);
    margin-bottom: 8px;
    display: block;
}

.sidebar-header h4 {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -.3px;
}

.sidebar-header small {
    color: rgba(255,255,255,.45);
    font-size: .78rem;
    display: block;
    margin-top: 4px;
    font-weight: 400;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    margin: 2px 10px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: all var(--duration) var(--ease);
    position: relative;
    gap: 0;
}

.sidebar-menu a i {
    width: 22px;
    margin-right: 12px;
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
    transition: color var(--duration) var(--ease);
}

.sidebar-menu a:hover {
    background: var(--sidebar-bg-hover);
    color: #fff;
}

.sidebar-menu a:hover i {
    color: var(--brand-400);
}

.sidebar-menu a.active {
    background: var(--sidebar-bg-active);
    color: var(--sidebar-text-active);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(232, 135, 15, .35);
}

.sidebar-menu a.active i {
    color: #fff;
}

/* =============================================
   SIDEBAR OVERLAY (mobile)
   ============================================= */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1039;
    animation: overlayIn var(--duration-md) var(--ease);
}

.sidebar-overlay.show {
    display: block;
}

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

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--duration-md) var(--ease);
}

/* =============================================
   TOP NAVBAR
   ============================================= */
.top-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-h);
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.top-navbar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    letter-spacing: -.3px;
    white-space: nowrap;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-700);
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
    line-height: 1;
}

.mobile-menu-btn:hover {
    background: var(--gray-100);
    color: var(--brand-600);
}

/* User dropdown */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    flex-shrink: 0;
}

.dropdown-toggle {
    font-weight: 500;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-toggle::after {
    font-size: .65rem;
}

.dropdown-menu {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 180px;
    animation: dropdownIn var(--duration) var(--ease);
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: .88rem;
    font-weight: 500;
    color: var(--gray-700);
    transition: all var(--duration) var(--ease);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--gray-100);
    color: var(--gray-900);
}

.dropdown-item i {
    margin-right: 8px;
    width: 18px;
    text-align: center;
    font-size: .9rem;
}

.dropdown-divider {
    margin: 4px 0;
    border-color: var(--gray-200);
}

/* =============================================
   CONTENT AREA
   ============================================= */
.content-area {
    flex: 1;
    padding: 28px;
}

/* =============================================
   CARDS
   ============================================= */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    margin-bottom: 24px;
    transition: box-shadow var(--duration-md) var(--ease);
}

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

.card-header {
    background: var(--gray-900);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 16px 22px;
    font-weight: 600;
    font-size: .95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -.1px;
}

.card-header i {
    color: var(--brand-400);
    font-size: 1rem;
}

.card-header.bg-danger { background: var(--danger) !important; }
.card-header.bg-success { background: var(--success) !important; }
.card-header.bg-primary { background: var(--brand-500) !important; }
.card-header.bg-warning { background: var(--warning) !important; }
.card-header.bg-info { background: var(--info) !important; }

.card-header[class*="bg-"] i {
    color: rgba(255,255,255,.85);
}

.card-body {
    padding: 22px;
}

/* =============================================
   STAT CARDS
   ============================================= */
.stat-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    transition: all var(--duration-md) var(--ease);
    box-shadow: var(--shadow-xs);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-500);
    border-radius: 3px 3px 0 0;
}

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

.stat-card i {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.2rem;
    opacity: .1;
    color: var(--gray-800);
}

.stat-card h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 4px;
    line-height: 1.2;
    letter-spacing: -.5px;
}

.stat-card p {
    color: var(--gray-500);
    font-size: .85rem;
    font-weight: 500;
    margin: 0;
}

.stat-card.primary::before { background: var(--brand-500); }
.stat-card.primary i { color: var(--brand-500); }

.stat-card.success::before { background: var(--success); }
.stat-card.success i { color: var(--success); }

.stat-card.warning::before { background: var(--warning); }
.stat-card.warning i { color: var(--warning); }

.stat-card.danger::before { background: var(--danger); }
.stat-card.danger i { color: var(--danger); }

.stat-card.info::before { background: var(--info); }
.stat-card.info i { color: var(--info); }

/* =============================================
   TABLES
   ============================================= */
.table-responsive {
    border-radius: var(--radius-md);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin: 0;
    font-size: .875rem;
}

.table thead th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 12px 16px;
    border: none;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.table tbody td {
    padding: 13px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.table tbody tr {
    transition: background var(--duration) var(--ease);
}

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

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

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    font-weight: 500;
    font-size: .875rem;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    border: none;
    transition: all var(--duration) var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none;
    line-height: 1.5;
    cursor: pointer;
    position: relative;
}

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

.btn i {
    font-size: .9em;
}

.btn-primary {
    background: var(--brand-500);
    color: #fff;
    box-shadow: 0 1px 3px rgba(232, 135, 15, .3);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--brand-600);
    color: #fff;
    box-shadow: 0 4px 12px rgba(232, 135, 15, .35);
    transform: translateY(-1px);
}

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

.btn-success:hover {
    background: #15803D;
    color: #fff;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #B45309;
    color: #fff;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #B91C1C;
    color: #fff;
    transform: translateY(-1px);
}

.btn-info {
    background: var(--info);
    color: #fff;
}

.btn-info:hover {
    background: #1D4ED8;
    color: #fff;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
    color: var(--gray-800);
}

.btn-outline-primary {
    background: transparent;
    border: 1.5px solid var(--brand-500);
    color: var(--brand-600);
}

.btn-outline-primary:hover {
    background: var(--brand-500);
    color: #fff;
}

.btn-sm {
    padding: 5px 11px;
    font-size: .8rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
}

.btn-link {
    background: none;
    border: none;
    box-shadow: none;
}

.btn-link:hover {
    background: var(--gray-100);
    transform: none;
    box-shadow: none;
}

.btn-close {
    filter: none;
    opacity: .6;
    transition: opacity var(--duration) var(--ease);
}

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

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: .7;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

/* =============================================
   BADGES
   ============================================= */
.badge {
    font-weight: 600;
    font-size: .75rem;
    padding: 5px 10px;
    border-radius: 6px;
    letter-spacing: .2px;
    line-height: 1.4;
}

.bg-primary { background-color: var(--brand-500) !important; }
.bg-success { background-color: var(--success) !important; }
.bg-warning { background-color: var(--warning) !important; color: #fff !important; }
.bg-danger { background-color: var(--danger) !important; }
.bg-info { background-color: var(--info) !important; }
.bg-secondary { background-color: var(--gray-500) !important; }
.bg-dark { background-color: var(--gray-800) !important; }

/* =============================================
   FORMS
   ============================================= */
.form-label {
    font-weight: 600;
    color: var(--gray-700);
    font-size: .85rem;
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: .9rem;
    color: var(--gray-800);
    background: #fff;
    transition: all var(--duration) var(--ease);
    line-height: 1.5;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(232, 135, 15, .12);
    outline: none;
}

.form-control:disabled,
.form-control[readonly] {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

.form-select {
    cursor: pointer;
}

.form-text,
.form-control + small,
.form-label + small {
    font-size: .8rem;
    color: var(--gray-500);
}

.input-group-text {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-300);
    color: var(--gray-500);
    font-size: .9rem;
    padding: 10px 14px;
    transition: all var(--duration) var(--ease);
}

.input-group:focus-within .input-group-text {
    border-color: var(--brand-500);
    color: var(--brand-600);
    background: var(--brand-50);
}

.input-group:focus-within .form-control {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(232, 135, 15, .12);
}

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

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(232, 135, 15, .15);
    border-color: var(--brand-500);
}

/* =============================================
   ALERTS
   ============================================= */
.alert {
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-weight: 500;
    font-size: .88rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: alertIn var(--duration-md) var(--ease-spring);
    border-left: 4px solid transparent;
}

@keyframes alertIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.alert-success {
    background: var(--success-bg);
    color: #166534;
    border-left-color: var(--success);
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400E;
    border-left-color: var(--warning);
}

.alert-danger {
    background: var(--danger-bg);
    color: #991B1B;
    border-left-color: var(--danger);
}

.alert-info {
    background: var(--info-bg);
    color: #1E40AF;
    border-left-color: var(--info);
}

.alert .btn-close {
    filter: none;
    padding: 8px;
    font-size: .7rem;
}

/* =============================================
   MODALS
   ============================================= */
.modal-backdrop {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    background: var(--gray-900);
    color: #fff;
    border: none;
    padding: 18px 24px;
}

.modal-title {
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: -.2px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--gray-200);
    gap: 8px;
}

.modal.fade .modal-dialog {
    transition: transform var(--duration-md) var(--ease-spring);
}

/* =============================================
   LIST GROUPS
   ============================================= */
.list-group-item {
    border-color: var(--gray-100);
    padding: 14px 0;
    font-size: .88rem;
    transition: background var(--duration) var(--ease);
}

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

.list-group-item:hover {
    background: var(--gray-50);
}

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
    gap: 4px;
}

.page-link {
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    border-radius: var(--radius-sm) !important;
    padding: 8px 14px;
    font-size: .85rem;
    font-weight: 500;
    transition: all var(--duration) var(--ease);
}

.page-link:hover {
    background: var(--brand-50);
    border-color: var(--brand-300);
    color: var(--brand-700);
}

.page-item.active .page-link {
    background: var(--brand-500);
    border-color: var(--brand-500);
    color: #fff;
}

/* =============================================
   DASHBOARD METRIC BOXES
   ============================================= */
.dash-metric {
    border-radius: var(--radius-md);
    padding: 16px 10px;
    text-align: center;
    border: 1.5px solid transparent;
    transition: all var(--duration) var(--ease);
}

.dash-metric__value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -.3px;
    margin-bottom: 4px;
}

.dash-metric__label {
    display: block;
    font-size: .78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .3px;
}

/* Green — Gelir */
.dash-metric--green {
    background: #F0FDF4;
    border-color: #BBF7D0;
}
.dash-metric--green .dash-metric__value { color: #15803D; }
.dash-metric--green .dash-metric__label { color: #4ADE80; }

/* Red — Gider */
.dash-metric--red {
    background: #FEF2F2;
    border-color: #FECACA;
}
.dash-metric--red .dash-metric__value { color: #B91C1C; }
.dash-metric--red .dash-metric__label { color: #F87171; }

/* Blue — Net */
.dash-metric--blue {
    background: #EFF6FF;
    border-color: #BFDBFE;
}
.dash-metric--blue .dash-metric__value { color: #1D4ED8; }
.dash-metric--blue .dash-metric__label { color: #60A5FA; }

/* Indigo — Basılan */
.dash-metric--indigo {
    background: #EEF2FF;
    border-color: #C7D2FE;
}
.dash-metric--indigo .dash-metric__value { color: #4338CA; }
.dash-metric--indigo .dash-metric__label { color: #818CF8; }

/* Amber — Dağıtılan */
.dash-metric--amber {
    background: #FFFBEB;
    border-color: #FDE68A;
}
.dash-metric--amber .dash-metric__value { color: #B45309; }
.dash-metric--amber .dash-metric__label { color: #FBBF24; }

/* Teal — Kalan */
.dash-metric--teal {
    background: #F0FDFA;
    border-color: #99F6E4;
}
.dash-metric--teal .dash-metric__value { color: #0F766E; }
.dash-metric--teal .dash-metric__label { color: #2DD4BF; }

@media (max-width: 768px) {
    .dash-metric {
        padding: 12px 6px;
    }

    .dash-metric__value {
        font-size: 1.05rem;
    }

    .dash-metric__label {
        font-size: .7rem;
    }
}

@media (max-width: 480px) {
    .dash-metric {
        padding: 10px 4px;
    }

    .dash-metric__value {
        font-size: .92rem;
    }

    .dash-metric__label {
        font-size: .65rem;
    }
}

/* =============================================
   PAGE HEADING AREA
   ============================================= */
.content-area > .row:first-child h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-area > .row:first-child h2 i {
    color: var(--brand-500);
    font-size: 1.15rem;
}

/* =============================================
   FILTER BAR
   ============================================= */
.card .row .form-control,
.card .row .form-select {
    font-size: .85rem;
    padding: 8px 12px;
}

/* =============================================
   PROGRESS BARS
   ============================================= */
.progress {
    height: 8px;
    border-radius: 99px;
    background: var(--gray-100);
    overflow: hidden;
}

.progress-bar {
    background: var(--brand-500);
    border-radius: 99px;
    transition: width .6s var(--ease);
}

/* =============================================
   TABS / NAV TABS
   ============================================= */
.nav-tabs {
    border-bottom: 2px solid var(--gray-200);
    gap: 4px;
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--gray-500);
    font-weight: 500;
    font-size: .9rem;
    padding: 10px 18px;
    margin-bottom: -2px;
    border-radius: 0;
    transition: all var(--duration) var(--ease);
}

.nav-tabs .nav-link:hover {
    color: var(--brand-600);
    background: transparent;
    border-bottom-color: var(--brand-300);
}

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

/* =============================================
   HR
   ============================================= */
hr {
    border-color: var(--gray-200);
    opacity: 1;
}

/* =============================================
   TEXT UTILITIES
   ============================================= */
.text-muted { color: var(--gray-500) !important; }
.text-dark { color: var(--gray-900) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

strong {
    font-weight: 600;
    color: var(--gray-800);
}

small, .small {
    font-size: .82rem;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.text-muted.mb-0,
p.text-muted:only-child {
    text-align: center;
    padding: 20px 0;
    font-size: .9rem;
}

/* =============================================
   LOGIN PAGE
   ============================================= */
body.login-page {
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 420px;
    width: 100%;
    overflow: hidden;
    animation: loginIn .5s var(--ease);
}

@keyframes loginIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    background: var(--sidebar-bg);
    color: #fff;
    padding: 44px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-header::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -30%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(232, 135, 15, .08);
}

.login-header::before {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(232, 135, 15, .06);
}

.login-header i {
    font-size: 3rem;
    margin-bottom: 14px;
    display: block;
    color: var(--brand-400);
    position: relative;
    z-index: 1;
}

.login-header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0;
    position: relative;
    z-index: 1;
    letter-spacing: -.5px;
}

.login-header p {
    margin: 8px 0 0;
    opacity: .6;
    font-size: .9rem;
    position: relative;
    z-index: 1;
}

.login-body {
    padding: 36px 32px;
}

.btn-login {
    background: var(--brand-500);
    border: none;
    color: #fff;
    width: 100%;
    padding: 13px;
    font-size: .95rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    transition: all var(--duration) var(--ease);
    box-shadow: 0 2px 8px rgba(232, 135, 15, .3);
}

.btn-login:hover {
    background: var(--brand-600);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 135, 15, .4);
}

.btn-login:active {
    transform: translateY(0);
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-area > .row {
    animation: slideUp .35s var(--ease) both;
}

.content-area > .row:nth-child(2) { animation-delay: .05s; }
.content-area > .row:nth-child(3) { animation-delay: .1s; }
.content-area > .row:nth-child(4) { animation-delay: .15s; }

/* Loading spinner */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--brand-500);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

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

/* =============================================
   PAGE HEADING — button wrap
   ============================================= */
.content-area > .row:first-child > .col-12 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.content-area > .row:first-child > .col-12 h2 {
    width: 100%;
    margin-bottom: 0;
}

/* =============================================
   TABLE ACTION BUTTONS — nowrap group
   ============================================= */
td:last-child {
    white-space: nowrap;
}

td .btn-sm + .btn-sm,
td .btn-sm + a.btn-sm,
td a.btn-sm + .btn-sm {
    margin-left: 4px;
}

/* =============================================
   STAT CARD — prevent text overflow
   ============================================= */
.stat-card h3 {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* =============================================
   RESPONSIVE — Tablet (<=992px)
   ============================================= */
@media (max-width: 992px) {
    :root {
        --sidebar-w: 272px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .content-area {
        padding: 20px;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    .top-navbar {
        padding: 0 16px;
    }

    .top-navbar h1 {
        font-size: 1.1rem;
    }

    /* modal-lg full width on tablet */
    .modal-lg,
    .modal-xl {
        --bs-modal-width: 95%;
    }
}

/* =============================================
   RESPONSIVE — Mobile (<=768px)
   ============================================= */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
    }

    .content-area {
        padding: 16px 12px;
    }

    .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 13px 16px;
        font-size: .88rem;
    }

    .stat-card {
        padding: 18px;
        margin-bottom: 14px;
    }

    .stat-card h3 {
        font-size: 1.3rem;
        max-width: calc(100% - 50px);
    }

    .stat-card i {
        font-size: 1.6rem;
        right: 14px;
    }

    .stat-card p {
        font-size: .8rem;
    }

    /* Tables */
    .table-responsive {
        font-size: .82rem;
    }

    .table thead th {
        padding: 10px 10px;
        font-size: .7rem;
    }

    .table tbody td {
        padding: 10px 10px;
    }

    /* Top navbar */
    .top-navbar {
        height: 56px;
        padding: 0 12px;
    }

    .top-navbar h1 {
        font-size: 1rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dropdown-toggle span {
        display: none;
    }

    /* Modals */
    .modal-dialog {
        margin: 10px;
    }

    .modal-lg .modal-dialog,
    .modal-dialog-lg {
        max-width: 100%;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-header {
        padding: 14px 18px;
    }

    .modal-footer {
        padding: 12px 18px;
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 100px;
    }

    /* Buttons */
    .btn {
        font-size: .82rem;
        padding: 8px 14px;
    }

    .btn-sm {
        padding: 5px 9px;
        font-size: .75rem;
        min-width: 32px;
        min-height: 32px;
    }

    /* Dashboard financial summary — stack on mobile */
    .card-body .d-flex.justify-content-between {
        flex-direction: column;
        gap: 4px;
    }

    /* Finance table footer */
    .table tfoot td {
        font-size: .78rem;
        line-height: 1.8;
    }

    .table tfoot td[colspan] {
        text-align: left !important;
    }

    /* Page heading buttons */
    .content-area > .row:first-child > .col-12 .btn {
        flex: 0 0 auto;
    }

    /* Distribution stock cards inner numbers */
    .card-body .row.text-center h5 {
        font-size: 1rem;
    }

    .card-body .row.text-center small {
        font-size: .7rem;
    }

    /* Filter form — remove empty label trick */
    .card-body form.row .form-label:empty,
    .card-body form.row label.form-label:has(+ .btn) {
        display: none;
    }

    /* Forms inside modals */
    .modal-body .row > [class*="col-md-"] {
        margin-bottom: 0;
    }

    /* Dashboard h4 financial numbers */
    .card-body .row.text-center h4 {
        font-size: 1rem;
    }

    /* List group items tighter */
    .list-group-item {
        padding: 10px 0;
        font-size: .84rem;
    }
}

/* =============================================
   RESPONSIVE — Small Mobile (<=480px)
   ============================================= */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .content-area {
        padding: 12px 8px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card h3 {
        font-size: 1.15rem;
    }

    .stat-card p {
        font-size: .75rem;
    }

    .card-header {
        font-size: .82rem;
        padding: 11px 14px;
    }

    .card-body {
        padding: 14px;
    }

    .top-navbar {
        height: 52px;
        padding: 0 10px;
    }

    .top-navbar h1 {
        font-size: .88rem;
    }

    /* Sidebar */
    .sidebar {
        width: 260px;
    }

    .sidebar-header {
        padding: 18px 14px;
    }

    .sidebar-header i {
        font-size: 1.6rem;
    }

    .sidebar-header h4 {
        font-size: 1rem;
    }

    .sidebar-menu a {
        font-size: .84rem;
        padding: 10px 14px;
        margin: 1px 6px;
    }

    /* Tables — minimum touch targets */
    .table thead th {
        padding: 8px 6px;
        font-size: .65rem;
    }

    .table tbody td {
        padding: 9px 6px;
        font-size: .78rem;
    }

    .btn-sm {
        padding: 6px 8px;
        font-size: .72rem;
        min-width: 34px;
        min-height: 34px;
    }

    /* Modals full screen on small mobile */
    .modal-dialog {
        margin: 6px;
    }

    .modal-body {
        padding: 14px;
    }

    .modal-header {
        padding: 12px 14px;
    }

    .modal-title {
        font-size: .92rem;
    }

    .modal-footer {
        padding: 10px 14px;
    }

    .modal-footer .btn {
        font-size: .8rem;
        padding: 9px 12px;
    }

    /* Login page */
    .login-header {
        padding: 28px 20px;
    }

    .login-header h1 {
        font-size: 1.3rem;
    }

    .login-header i {
        font-size: 2.2rem;
    }

    .login-body {
        padding: 24px 20px;
    }

    /* Forms */
    .form-control,
    .form-select {
        font-size: .85rem;
        padding: 9px 11px;
    }

    .form-label {
        font-size: .8rem;
    }

    /* Dashboard financial cards */
    .card-body .row.text-center h4 {
        font-size: .92rem;
    }

    .card-body .row.text-center .col-4 small {
        font-size: .68rem;
    }

    /* Finance stat card values with decimals */
    .stat-card h3 {
        letter-spacing: -.8px;
    }

    h4 {
        font-size: 1rem;
    }

    /* Badge */
    .badge {
        font-size: .68rem;
        padding: 4px 7px;
    }

    /* Alerts */
    .alert {
        padding: 11px 14px;
        font-size: .82rem;
    }

    .alert i {
        font-size: .95rem;
    }

    /* Page heading */
    .content-area > .row:first-child h2 {
        font-size: 1.15rem;
    }

    .content-area > .row:first-child h2 i {
        font-size: 1rem;
    }
}

/* =============================================
   RESPONSIVE — Extra Small (<=360px)
   ============================================= */
@media (max-width: 360px) {
    .content-area {
        padding: 10px 6px;
    }

    .stat-card h3 {
        font-size: 1.05rem;
    }

    .card-body {
        padding: 12px;
    }

    .top-navbar h1 {
        font-size: .82rem;
    }

    .sidebar {
        width: 240px;
    }

    .modal-footer .btn {
        min-width: 0;
        flex: 1;
    }

    /* Finance table footer — stack items */
    .table tfoot td strong {
        display: block;
    }

    .card-body .row.text-center .col-4 {
        padding-left: 4px;
        padding-right: 4px;
    }

    .card-body .row.text-center h4,
    .card-body .row.text-center h5 {
        font-size: .88rem;
    }
}

/* =============================================
   SAFE AREA — notched devices
   ============================================= */
@supports (padding: env(safe-area-inset-bottom)) {
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .content-area {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .modal-footer {
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }
}

/* =============================================
   TOUCH IMPROVEMENTS
   ============================================= */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 40px;
    }

    .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }

    .sidebar-menu a {
        min-height: 44px;
    }

    .form-control,
    .form-select {
        min-height: 44px;
    }

    .dropdown-item {
        min-height: 42px;
        display: flex;
        align-items: center;
    }

    .table tbody tr:hover {
        background: transparent;
    }

    .table tbody tr:active {
        background: var(--brand-50);
    }

    .stat-card:hover {
        transform: none;
    }

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

    .btn:hover {
        transform: none;
    }

    .btn-primary:hover {
        transform: none;
    }

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

/* =============================================
   PRINT
   ============================================= */
@media print {
    .sidebar,
    .sidebar-overlay,
    .top-navbar,
    .mobile-menu-btn,
    .btn,
    .modal {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .content-area {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    body {
        background: #fff;
        font-size: 12px;
    }
}
