/* ================== SKIP LINK (A11y) ================== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--primary-color, #3b82f6);
    color: #fff;
    padding: 0.75rem 1.5rem;
    z-index: 10000;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 0.5rem 0;
}
.skip-link:focus {
    top: 0;
}

/* ================== LAYOUT ================== */
.app-container { display: flex; height: 100vh; overflow: hidden; }
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* ================== AUTH SCREEN ================== */
.auth-screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    padding: 24px;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background:
        radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.16), transparent 45%),
        radial-gradient(circle at 80% 10%, rgba(16, 185, 129, 0.12), transparent 45%),
        linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
}

.auth-screen.active {
    display: flex;
}

body.auth-required {
    overflow: hidden;
}

body.auth-required .app-container {
    display: none;
}

body.auth-visible #app,
body.auth-visible .app-shell,
body.auth-visible .main-content {
    filter: blur(4px);
    pointer-events: none;
    user-select: none;
}

.auth-screen__panel {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.16);
    padding: 30px;
}

.auth-screen__brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-screen__logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1d4ed8;
    color: #ffffff;
    font-size: 22px;
}

.auth-screen__brand h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-screen__brand p {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-screen__helper {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 2px 0 10px;
}

.auth-screen__error {
    font-size: 13px;
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.28);
    border-radius: 8px;
    padding: 9px 10px;
    margin: 0 0 12px;
}

.auth-screen__submit {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.auth-field {
    position: relative;
    margin-bottom: 10px;
}

.auth-field > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 14px;
    width: 16px;
    text-align: center;
    pointer-events: none;
}

.auth-screen .auth-field input[type="text"],
.auth-screen .auth-field input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    height: 48px;
    line-height: 1.2;
    margin-bottom: 0;
    padding-left: 46px;
    padding-right: 52px;
    color: var(--text-primary);
    background: #fff;
    caret-color: var(--text-primary);
}

.auth-toggle-password {
    all: unset;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    color: #64748b;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
}

.auth-toggle-password:hover {
    background: #f1f5f9;
    color: #334155;
}

.auth-toggle-password:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.35);
    outline-offset: 1px;
}

/* ================== SIDEBAR ================== */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
    transition: width 0.25s ease;
}
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width, 64px);
}
.logo {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}
.logo-inner {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.brand-logo-img {
    display: block;
    width: min(120px, 100%);
    height: auto;
    object-fit: contain;
}
.logo h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}
.logo .tagline {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}
.sidebar-collapse-toggle {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-size: 12px;
}
.sidebar-collapse-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}
.sidebar-collapse-toggle i {
    transition: transform 0.25s ease;
}
.sidebar.collapsed .sidebar-collapse-toggle i {
    transform: rotate(180deg);
}
/* Collapsed logo: yalnızca toggle butonu görünür, ortalı */
.sidebar.collapsed .logo {
    justify-content: center;
    padding: 16px 8px;
}
.sidebar.collapsed .logo-inner {
    display: none;
}
.main-nav {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
    overflow-x: hidden;
}
.main-nav .nav-item[hidden] {
    display: none !important;
}
.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 4px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    white-space: nowrap;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.1); color: white; }
.nav-item.active { background: var(--primary-color); color: white; }
.nav-item i { width: 20px; text-align: center; }

.nav-group[hidden] {
    display: none !important;
}

.nav-parent-item {
    justify-content: space-between;
}

.nav-parent-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.nav-parent-caret {
    width: 14px !important;
    font-size: 12px;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.nav-parent-item.expanded .nav-parent-caret {
    transform: rotate(180deg);
}

.nav-submenu {
    display: none;
    margin: -2px 0 6px 0;
    padding-left: 10px;
}

.nav-submenu.open {
    display: block;
}

.nav-sub-item {
    padding-left: 34px;
    margin-bottom: 2px;
    font-size: 13px;
}
/* ================== SIDEBAR COLLAPSED NAV ================== */
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
    gap: 0;
}
.sidebar.collapsed .nav-item .text {
    display: none;
}
.sidebar.collapsed .nav-parent-label {
    justify-content: center;
}
.sidebar.collapsed .nav-parent-caret {
    display: none;
}
.sidebar.collapsed .nav-submenu {
    display: none !important;
}
.sidebar.collapsed .sidebar-footer .export-btn,
.sidebar.collapsed .sidebar-footer .import-btn {
    padding: 10px;
    gap: 0;
}
.sidebar.collapsed .btn-text {
    display: none;
}

/* ================== SIDEBAR FLYOUT (COLLAPSED DROPDOWN) ================== */
.sidebar-flyout {
    position: fixed;
    left: var(--sidebar-collapsed-width, 64px);
    top: 0;
    width: 200px;
    background: var(--bg-sidebar);
    color: white;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: 4px 4px 20px rgba(0, 0, 0, 0.35);
    z-index: 201;
    display: none;
    padding: 6px;
}
.sidebar-flyout.visible {
    display: block;
}
.sidebar-flyout-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 8px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.sidebar-flyout .nav-item {
    white-space: nowrap;
    padding: 10px 14px;
    gap: 10px;
    justify-content: flex-start;
    font-size: 13px;
}
.sidebar-flyout--label .sidebar-flyout-header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 10px;
}

/* ================== SIDEBAR FOOTER ================== */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.export-btn, .import-btn {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.export-btn:hover, .import-btn:hover { background: rgba(255, 255, 255, 0.15); }

/* ================== MAIN CONTENT ================== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.top-bar {
    background: white;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.top-bar-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.page-title { font-size: 24px; font-weight: 600; }
.breadcrumb-trail {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 18px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.breadcrumb-trail .crumb {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.breadcrumb-trail .crumb-btn {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.breadcrumb-trail .crumb-btn:hover {
    color: var(--primary-color);
}
.breadcrumb-trail .crumb-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}
.breadcrumb-trail .crumb.current {
    color: var(--text-primary);
    font-weight: 600;
}
.breadcrumb-trail .sep {
    opacity: 0.5;
}
.user-info {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}
.mobile-nav-toggle {
    display: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.top-search-btn {
    white-space: nowrap;
}
.user-role {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
}
.logout-btn {
    height: 30px;
    padding: 0 10px;
}
.page {
    display: none;
    padding: 32px;
    overflow-y: auto;
    height: calc(100vh - 80px);
}
.page.active { display: block; }

.module-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 46;
    padding: 8px 0;
    background: rgba(248, 250, 252, 0.96);
    backdrop-filter: blur(12px);
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* ================== TWO COLUMN LAYOUT ================== */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.column {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}
.column-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.income-column .column-header {
    border-bottom-color: var(--success-color);
}
.expense-column .column-header {
    border-bottom-color: var(--danger-color);
}

/* ================== STATS GRID ================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* ================== DASHBOARD GRID ================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}
