/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f5f5f0;
    --white: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #999999;
    --border: #e8e8e4;
    --blue-primary: #6db5d8;
    --blue-dark: #1e5f8a;
    --blue-darker: #0f3554;
    --blue-medium: #3c8bbe;
    --blue-accent: #4394c9;
    --blue-light: #93c8e4;
    --positive: #2d6b8a;
    --negative: #d94040;
    --sidebar-bg: #fafaf7;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --topbar-height: 64px;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

.auth-page {
    min-height: 100vh;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #f5f5f0 0%, #eef3f6 100%);
    position: relative;
}

.auth-page {
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('../media/icon-logo.svg');
    background-size: 70% auto;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.08;
    pointer-events: none;
    transform-origin: center;
    will-change: transform;
    animation: authLogoBgZoom 1s ease-in-out forwards;
}

@keyframes authLogoBgZoom {
    0% {
        background-size: 10% auto;
    }
    100% {
        background-size: 150% auto;
    }
}

.auth-container {
    position: relative;
    z-index: 1;
    perspective: 1200px;
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: 36px 34px;
    text-align: center;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.7s ease;
}

.auth-card.is-flipped {
    transform: rotateY(180deg);
}

.auth-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.auth-card-face {
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

.auth-card-back {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
}

.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.auth-logo {
    animation: authLogoIntro 0.6s ease forwards;
    transform: translateY(8px) scale(0.98);
    opacity: 0;
}

.auth-logo .logo-icon {
    animation: authLogoPulse 1.2s ease 0.2s forwards;
    transform: scale(0.9);
}

@keyframes authLogoIntro {
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes authLogoPulse {
    0% { transform: scale(0.9); }
    60% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.auth-logo-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--blue-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 18px rgba(109, 181, 216, 0.25);
}

.auth-logo-mark .material-icons-outlined {
    font-size: 1.3rem;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 4.2rem;
}

.auth-logo .logo-icon {
    width: 54px;
    height: 54px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-error {
    background: rgba(217, 64, 64, 0.12);
    color: #b53333;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

.auth-password-hint {
    background: rgba(109, 181, 216, 0.08);
    border: 1px solid rgba(109, 181, 216, 0.25);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-strength {
    width: 100%;
    height: 6px;
    background: rgba(109, 181, 216, 0.2);
    border-radius: 999px;
    overflow: hidden;
}

.auth-strength-bar {
    display: block;
    height: 100%;
    width: 0;
    background: var(--negative);
    transition: width 0.2s ease, background 0.2s ease;
}

.auth-strength-bar[data-level="medium"] {
    background: #d5a73a;
}

.auth-strength-bar[data-level="strong"] {
    background: #2f8a5a;
}

.auth-strength-text {
    font-weight: 600;
    color: var(--text-primary);
}

.auth-strength-list {
    list-style: none;
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.auth-strength-list li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-strength-list li::before {
    content: '•';
    color: var(--text-muted);
}

.auth-strength-list li.met {
    color: var(--positive);
    font-weight: 600;
}

.auth-strength-list li.met::before {
    content: '✓';
    color: var(--positive);
}

.auth-input {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px 0 42px;
    min-height: 52px;
    background: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-input--password {
    padding-right: 44px;
}

.auth-input:focus-within {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(109, 181, 216, 0.2);
}

.auth-input.is-invalid {
    border-color: var(--negative);
    box-shadow: 0 0 0 3px rgba(240, 96, 96, 0.16);
}

.auth-validation-tooltip {
    position: absolute;
    right: 0px;
    bottom: calc(100% + 10px);
    transform: translateY(6px);
    opacity: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(320px, calc(100vw - 48px));
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--negative);
    background: var(--negative);
    color: #f7f8fa;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.25;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    z-index: 30;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.auth-validation-tooltip::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 100%;
    transform: none;
    border: 6px solid transparent;
    border-top-color: var(--negative);
}

.auth-validation-tooltip.active {
    opacity: 1;
    transform: translateY(0);
}

.auth-validation-tooltip .material-icons-outlined {
    position: static;
    transform: none;
    color: #ffffff !important;
    font-size: 1.05rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-validation-tooltip-text {
    line-height: 1.25;
    padding-left: 23px;
}


.auth-input .material-icons-outlined {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: var(--text-muted);
}

.auth-input input {
    border: none;
    outline: none;
    width: 100%;
    font-family: inherit;
    font-size: 0.95rem;
    background: transparent;
    padding: 0;
    line-height: 1.2;
    color: var(--text-primary);
}

.auth-eye {
    position: absolute;
    right: 36px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-eye:hover {
    color: var(--blue-dark);
}

.auth-input input:-internal-autofill-selected {
    background-color: transparent !important;
}

.auth-input input:-webkit-autofill,
.auth-input input:-webkit-autofill:hover,
.auth-input input:-webkit-autofill:focus,
.auth-input input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    box-shadow: 0 0 0 1000px transparent inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    caret-color: var(--text-primary);
    transition: background-color 9999s ease-in-out 0s;
}

.auth-input input::placeholder {
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.auth-input label {
    position: absolute;
    left: 42px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--white);
    padding: 0 6px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.auth-input input:focus::placeholder,
.auth-input input:not(:placeholder-shown)::placeholder {
    color: transparent;
}

.auth-input input:focus + label,
.auth-input input:not(:placeholder-shown) + label {
    top: -11px;
    transform: translateY(0);
    opacity: 1;
    font-size: 0.7rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    left: 6px;
    background: var(--white);
    color: var(--text-muted);
    padding-top: 2px;

}

.auth-input input:focus + label {
    box-shadow: 0 0 0 3px rgba(109, 181, 216, 0.2);
    border-color: var(--blue-primary);
    background: var(--blue-primary);
    color: var(--white)
}

.auth-input.is-invalid input:focus + label,
.auth-input.is-invalid input:not(:placeholder-shown) + label {
    box-shadow: 0 0 0 3px rgba(240, 96, 96, 0.18);
    border-color: var(--negative);
    background: var(--negative);
    color: #ffffff;
}

html[data-theme="dark"] .auth-input input {
    color: var(--text-primary)
}

html[data-theme="dark"] .auth-input input:-webkit-autofill,
html[data-theme="dark"] .auth-input input:-webkit-autofill:hover,
html[data-theme="dark"] .auth-input input:-webkit-autofill:focus,
html[data-theme="dark"] .auth-input input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text-primary) !important;
    caret-color: var(--text-primary);
}

.auth-button {
    margin-top: 4px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--blue-primary);
    color: var(--white);
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.auth-button-ghost {
    background: transparent;
    color: var(--blue-dark);
    border: 1px solid var(--border);
}

.auth-button:hover {
    opacity: 0.9;
}

.auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.auth-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--blue-primary);
}

.auth-link {
    color: var(--blue-dark);
    text-decoration: none;
    font-weight: 600;
}

.auth-link-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-divider {
    margin: 18px 0 14px;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-social {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.auth-social-btn {
    border: 1px solid var(--border);
    background: var(--white);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-social-btn:hover {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(109, 181, 216, 0.16);
}

.auth-footer {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    gap: 6px;
}

.auth-modal-hint {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: width 0.3s, min-width 0.3s;
}

.sidebar.collapsed {
    width: 68px;
    min-width: 68px;
}

/* Collapsed sidebar: hide text elements */
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .arrow,
.sidebar.collapsed .badge,
.sidebar.collapsed .submenu,
.sidebar.collapsed .sidebar-upgrade {
    display: none !important;
}

.sidebar.collapsed .sidebar-header {
    padding: 20px 0 16px;
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .logo {
    justify-content: center;
}

.sidebar.collapsed .sidebar-nav {
    padding: 0 8px;
}

.sidebar.collapsed .nav-item a {
    justify-content: center;
    padding: 10px;
    position: relative;
}

.sidebar.collapsed .nav-item a .material-icons-outlined {
    margin: 0;
}

.sidebar.collapsed .sidebar-collapse {
    justify-content: center;
    padding: 14px 8px;
}

/* Tooltip on hover for collapsed sidebar */
.sidebar.collapsed .nav-item a[data-tooltip]:hover::after,
.sidebar.collapsed .sidebar-collapse[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-primary);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: tooltipFadeIn 0.15s ease;
}

.sidebar.collapsed .nav-item a[data-tooltip]:hover::before,
.sidebar.collapsed .sidebar-collapse[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: var(--text-primary);
    z-index: 1000;
    pointer-events: none;
    animation: tooltipFadeIn 0.15s ease;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateY(-50%) translateX(-4px); }
    to { opacity: 1; transform: translateY(-50%) translateX(0); }
}

@keyframes swapPop {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

.card.swap-animate {
    animation: swapPop 0.3s ease forwards;
}

.sidebar.collapsed .sidebar-collapse {
    position: relative;
}

.sidebar-header {
    padding: 20px 20px 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 2.3rem;
    font-weight: 700;
}

.logo-text {
    font-family: 'Prosto One', 'Inter', sans-serif;
    font-weight: 400;
    letter-spacing: 0.6px;
}

.logo-icon {
    width: 24px;
    height: 24px;
    display: block;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 12px;
    overflow-y: auto;
}

.nav-list {
    list-style: none;
}

.nav-bottom-list {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.93rem;
    font-weight: 500;
    transition: all 0.15s;
    position: relative;
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s;
}

.nav-item a:hover {
    background: #f0f0ea;
    color: var(--text-primary);
}

.nav-item.active a {
    background: var(--blue-primary);
    color: var(--text-primary);
    font-weight: 600;
}

.nav-item a .material-icons-outlined {
    font-size: 1.25rem;
}

.nav-item .arrow {
    margin-left: auto;
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.nav-item.has-submenu.open .arrow {
    transform: rotate(180deg);
}

.submenu {
    list-style: none;
    padding-left: 42px;
    overflow: hidden;
    max-height: 200px;
    transition: max-height 0.3s;
}

.submenu li a {
    padding: 6px 12px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.submenu li a:hover {
    color: var(--text-primary);
}

.submenu li.active a {
    color: var(--text-primary);
    background: #f0f0ea;
    border-radius: var(--radius-sm);
}

.badge {
    background: var(--blue-primary);
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}

/* Sidebar Upgrade */
.sidebar-upgrade {
    margin: 12px;
    padding: 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    text-align: center;
}

.upgrade-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
}

.upgrade-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.sidebar-upgrade h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.sidebar-upgrade p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.btn-upgrade {
    background: var(--text-primary);
    color: var(--white);
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-upgrade:hover {
    opacity: 0.85;
}

.sidebar-collapse {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    background: none;
    border: none;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.88rem;
    cursor: pointer;
    transition: color 0.15s;
    position: relative;
    overflow: visible;
    font-family: inherit;
}

.sidebar-collapse:hover {
    color: var(--text-primary);
}

.sidebar-collapse .material-icons-outlined {
    font-size: 1.2rem;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ===== Page Navigation (Onsen-like) ===== */
.page-container {
    flex: 1;
    padding: calc(24px + var(--topbar-height)) 28px 40px;
    position: relative;
    overflow-y: auto;
    height: 100vh;
}

.page {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.page.loaded {
    opacity: 1;
    transform: translateY(0);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.page-card {
    padding: 18px;
}

.page-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}

.page-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.page-list-item:last-child {
    border-bottom: none;
}

.page-list-title {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
}

.page-list-subtitle {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.page-list-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.page-list-status {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e8f2f7;
    color: var(--blue-dark);
}

.page-list-status.success {
    background: #e1f2ea;
    color: #1f6d4e;
}

.page-body {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-top: 6px;
}

.page-empty {
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 8px;
}

/* ===== Top Bar ===== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    z-index: 90;
    gap: 16px;
    overflow: visible;
    height: var(--topbar-height);
}

.sidebar.collapsed ~ .main-content .topbar {
    left: 68px;
}

.topbar-loader {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    background: transparent;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.topbar-loader-bar {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--blue-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.topbar-loader.active {
    opacity: 1;
}

.topbar-loader.active .topbar-loader-bar {
    animation: topbarLoader 0.9s ease-in-out infinite;
}

@keyframes topbarLoader {
    0% { transform: scaleX(0.1); }
    50% { transform: scaleX(0.6); }
    100% { transform: scaleX(1); }
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    min-width: 280px;
    max-width: 400px;
    flex: 1;
}

.search-box .material-icons-outlined {
    color: var(--text-muted);
    font-size: 1.2rem;
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    font-size: 0.9rem;
    color: var(--text-primary);
    width: 100%;
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
}

.icon-btn:hover {
    background: var(--bg);
}

.icon-btn .material-icons-outlined {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* ===== Settings Dropdown ===== */
.settings-wrapper {
    position: relative;
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.settings-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-dropdown-header {
    padding: 14px 16px 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    transition: background 0.15s;
}

.settings-item:hover {
    background: var(--bg);
}

.settings-item:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

.settings-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.settings-item-info .material-icons-outlined {
    font-size: 1.15rem;
    color: var(--text-secondary);
}

.settings-value {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--blue-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.user-menu {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}

.user-profile-btn:hover {
    background: var(--bg);
    border-color: var(--border);
}

.user-caret {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 230px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s;
}

.user-dropdown-item:hover {
    background: var(--bg);
}

.user-dropdown-item .material-icons-outlined {
    font-size: 1.15rem;
    color: var(--text-secondary);
}

.user-dropdown-item.danger {
    color: var(--negative);
}

.user-dropdown-item.danger .material-icons-outlined {
    color: var(--negative);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.btn-add-widget {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--white);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-add-widget:hover {
    background: var(--bg);
}

.btn-add-widget .material-icons-outlined {
    font-size: 1.1rem;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 340px;
    grid-template-rows: auto;
    grid-template-areas:
        "summary   summary   mycard"
        "balance   balance   mycard"
        "spending  tips      goals"
        "cost      health    goals"
        "cost      health    transactions";
    gap: 16px;
    padding: 24px 28px;
    align-items: start;
}

/* ===== Cards ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--card-shadow);
    position: relative;
    z-index: 2;
    transition: box-shadow 0.2s, transform 0.2s, opacity 0.2s;
}

/* Drag Handle */
.drag-handle {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 5px;
    border-radius: 3px;
    background: transparent;
    cursor: grab;
    z-index: 10;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-handle::before {
    content: '';
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: transparent;
    transition: background 0.2s;
}

.card:hover .drag-handle::before {
    background: var(--border);
}

.card:hover .drag-handle:hover::before {
    background: #bbb;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Drag states */
.card.dragging {
    opacity: 0.5;
    transform: scale(0.97);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    z-index: 999;
}

.card.drag-over {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 2px rgba(109,181,216,0.3);
}

.drag-placeholder {
    border: 2px dashed var(--blue-primary);
    border-radius: var(--radius);
    background: rgba(109,181,216,0.06);
    min-height: 80px;
    transition: all 0.2s;
}

.drag-slot {
    border: 2px dashed var(--blue-primary);
    border-radius: var(--radius);
    background: rgba(109, 181, 216, 0.12);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    position: relative;
    z-index: 3;
}

.dashboard-grid.is-dragging .drag-slot {
    opacity: 0.35;
    pointer-events: auto;
}

.drag-slot.active {
    opacity: 0.6;
    background: rgba(109, 181, 216, 0.18);
    border-color: var(--blue-dark);
}

/* Grid area assignments */
.card-balance-overview { grid-area: balance; }
.card-summary-group   { grid-area: summary; }
.card-my-card         { grid-area: mycard; }
.card-spending-limit  { grid-area: spending; }
.card-budget-tips     { grid-area: tips; }
.card-cost-analysis   { grid-area: cost; }
.card-financial-health{ grid-area: health; }
.card-goal-tracker    { grid-area: goals; }
.card-transactions    { grid-area: transactions; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.btn-link:hover {
    color: var(--text-primary);
}

.select-sm {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--white);
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-family: inherit;
    cursor: pointer;
}

.icon-btn-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn-sm .material-icons-outlined {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Balance Overview */

.balance-amount {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.balance-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.period-selector {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.period-btn {
    padding: 5px 12px;
    border: none;
    background: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.period-btn.active {
    background: var(--white);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.view-toggle {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.view-btn {
    padding: 4px 8px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.view-btn .material-icons-outlined {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.view-btn.active {
    background: var(--white);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.view-btn.active .material-icons-outlined {
    color: var(--text-primary);
}

.chart-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.legend-dot.savings {
    background: var(--blue-primary);
}

.legend-dot.income {
    background: var(--blue-dark);
}

.legend-dot.expenses {
    background: var(--blue-light);
}

.chart-container {
    height: 200px;
    position: relative;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Summary Cards */
.card-summary-group {
    /* grid-area assigned above */
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
}

.summary-card {
    flex: 1;
    padding: 20px 24px;
}

.summary-divider {
    width: 1px;
    background: var(--border);
}

.summary-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.summary-amount {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.summary-change {
    font-size: 0.78rem;
    font-weight: 500;
    display: block;
    margin-top: 4px;
}

.summary-change.positive {
    color: var(--positive);
}

.summary-change.negative {
    color: var(--negative);
}

/* My Card */

.card-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.card-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.card-tab.active {
    background: var(--text-primary);
    color: var(--white);
}

.credit-card {
    margin-bottom: 16px;
}

.credit-card-inner {
    background: linear-gradient(135deg, #3c8bbe 0%, #1e5f8a 100%);
    border-radius: var(--radius);
    padding: 20px;
    color: white;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.credit-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-chip {
    font-size: 1.5rem;
    opacity: 0.8;
}

.card-brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.credit-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.card-holder-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
}

.card-number-partial {
    font-size: 0.8rem;
    opacity: 0.8;
}

.card-holder-label {
    font-size: 0.8rem;
    opacity: 0.7;
}

.quick-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-secondary);
    transition: color 0.15s;
}

.quick-action-btn:hover {
    color: var(--text-primary);
}

.quick-action-btn .material-icons-outlined {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: background 0.15s;
}

.quick-action-btn:hover .material-icons-outlined {
    background: var(--bg);
}

.quick-action-btn span:last-child {
    font-size: 0.72rem;
    font-weight: 500;
}

.quick-payment h4 {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.payment-contacts {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.contact span {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Spending Limit */

.spending-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 12px;
}

.spending-bar {
    height: 10px;
    background: var(--bg);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 6px;
}

.spending-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue-primary), var(--blue-medium));
    border-radius: 5px;
    transition: width 1s ease;
}

.spending-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Budget Tips */

.card-budget-tips h3 {
    font-size: 0.95rem;
}

.card-budget-tips p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.read-more {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.read-more:hover {
    text-decoration: underline;
}

/* Cost Analysis */

.analysis-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.analysis-amount {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.cost-bars {
    margin-bottom: 14px;
}

.cost-bar-row {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    gap: 2px;
}

.cost-bar-segment {
    border-radius: 4px;
    min-width: 8px;
    transition: flex 0.5s;
}

.cost-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
}

.cost-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.cost-legend-item span:last-child {
    margin-left: auto;
    font-weight: 500;
    color: var(--text-primary);
}

.legend-square {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Financial Health */

.health-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.health-amount {
    font-size: 1.6rem;
    font-weight: 700;
}

.donut-chart-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 12px;
}

.donut-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-percent {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
}

.donut-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    max-width: 100px;
    line-height: 1.3;
}

.health-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

/* Goal Tracker */

.goal-section-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 12px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.goal-section-label:first-child {
    margin-top: 0;
}

.goal-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.goal-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.goal-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.goal-name {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
}

.goal-detail {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.goal-progress-container {
    width: 100%;
}

.goal-progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.goal-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

.goal-amounts {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Transaction History */

.transactions-table {
    width: 100%;
    border-collapse: collapse;
}

.transactions-table thead th {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: left;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
}

.transactions-table thead th:last-child {
    text-align: right;
}

.transactions-table tbody tr {
    transition: background 0.15s;
}

.transactions-table tbody tr:hover {
    background: var(--bg);
}

.transactions-table td {
    padding: 10px 4px;
    vertical-align: middle;
    border-bottom: 1px solid #f5f5f2;
}

.transactions-table td:first-child {
    width: 40px;
}

.transactions-table td:last-child {
    text-align: right;
}

.tx-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.tx-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
}

.tx-date {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.tx-amount {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
}

.tx-amount.positive {
    color: var(--positive);
}

.tx-amount.negative {
    color: var(--text-primary);
}

.tx-status {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
}

.tx-status.completed {
    color: var(--positive);
}

.tx-status.pending {
    color: var(--gold);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.4s ease forwards;
}

.card:nth-child(1) { animation-delay: 0.0s; }
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.15s; }
.card:nth-child(5) { animation-delay: 0.2s; }
.card:nth-child(6) { animation-delay: 0.25s; }
.card:nth-child(7) { animation-delay: 0.3s; }
.card:nth-child(8) { animation-delay: 0.35s; }
.card:nth-child(9) { animation-delay: 0.4s; }
.card:nth-child(10) { animation-delay: 0.45s; }

/* ===== Dark Theme ===== */
[data-theme="dark"] {
    --bg: #111317;
    --white: #1a1d23;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-muted: #6b7280;
    --border: #2d3039;
    --sidebar-bg: #15171c;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --positive: #5cb5d8;
    --negative: #f06060;
}

[data-theme="dark"] body {
    background: var(--bg);
    color: var(--text-primary);
}

[data-theme="dark"] .search-box {
    background: #22252b;
    border-color: var(--border);
}

[data-theme="dark"] .search-box input {
    color: var(--text-primary);
}

[data-theme="dark"] .credit-card-inner {
    background: linear-gradient(135deg, #1e5f8a 0%, #0f3554 100%);
}

[data-theme="dark"] .nav-item.active a {
    background: var(--blue-dark);
    color: #fff;
}

[data-theme="dark"] .nav-item a:hover {
    background: #22252b;
}

[data-theme="dark"] .card-tab.active {
    background: var(--blue-dark);
    color: #fff;
}

[data-theme="dark"] .card-tab {
    background: #22252b;
}

[data-theme="dark"] .period-btn.active,
[data-theme="dark"] .view-btn.active {
    background: #22252b;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

[data-theme="dark"] .period-selector,
[data-theme="dark"] .view-toggle {
    background: #15171c;
}

[data-theme="dark"] .icon-btn {
    border-color: var(--border);
    background: var(--white);
}

[data-theme="dark"] .icon-btn:hover {
    background: #22252b;
}

[data-theme="dark"] .btn-add-widget {
    border-color: var(--border);
    background: var(--white);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-add-widget:hover {
    background: #22252b;
}

[data-theme="dark"] .badge {
    background: var(--blue-dark);
    color: #fff;
}

[data-theme="dark"] .btn-upgrade {
    background: var(--blue-primary);
    color: #111;
}

[data-theme="dark"] .sidebar-upgrade {
    background: #22252b;
    border-color: var(--border);
}

[data-theme="dark"] .select-sm {
    background: #22252b;
    border-color: var(--border);
    color: var(--text-secondary);
}

[data-theme="dark"] .quick-action-btn .material-icons-outlined {
    border-color: var(--border);
}

[data-theme="dark"] .quick-action-btn:hover .material-icons-outlined {
    background: #22252b;
}

[data-theme="dark"] .spending-bar {
    background: #22252b;
}

[data-theme="dark"] .goal-progress-bar {
    background: #22252b;
}

[data-theme="dark"] .transactions-table tbody tr:hover {
    background: #22252b;
}

[data-theme="dark"] .transactions-table td {
    border-bottom-color: var(--border);
}

[data-theme="dark"] .settings-dropdown {
    background: var(--white);
    border-color: var(--border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

[data-theme="dark"] .settings-item:hover {
    background: #22252b;
}

[data-theme="dark"] .user-profile-btn:hover {
    background: #22252b;
    border-color: var(--border);
}

[data-theme="dark"] .user-dropdown {
    background: var(--white);
    border-color: var(--border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

[data-theme="dark"] .user-dropdown-item:hover {
    background: #22252b;
}

[data-theme="dark"] .toggle-slider {
    background: #3d4048;
}

[data-theme="dark"] .cost-bar-segment[style*="#e0dcc8"] {
    filter: brightness(0.5);
}

[data-theme="dark"] .drag-placeholder {
    background: rgba(109,181,216,0.08);
}

[data-theme="dark"] .card:hover .drag-handle::before {
    background: #3d4048;
}

[data-theme="dark"] .card:hover .drag-handle:hover::before {
    background: #555;
}

/* ===== Responsive ===== */
@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "summary   summary"
            "balance   balance"
            "mycard    spending"
            "tips      goals"
            "cost      goals"
            "health    transactions";
    }
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -240px;
        transition: left 0.3s;
    }
    .sidebar.open {
        left: 0;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "summary"
            "balance"
            "mycard"
            "spending"
            "tips"
            "cost"
            "health"
            "goals"
            "transactions";
        padding: 16px;
    }
    .card-summary-group {
        flex-direction: column;
    }
    .summary-divider {
        width: 100%;
        height: 1px;
    }
    .topbar {
        padding: 12px 16px;
    }
    .user-info {
        display: none;
    }
}

@media (max-width: 600px) {
    .search-box {
        min-width: 140px;
    }
    .btn-add-widget span:last-child {
        display: none;
    }
    .balance-amount {
        font-size: 1.5rem;
    }
    .card-header-actions {
        flex-wrap: wrap;
    }
}
