:root {
    --background: #f8fafc;
    --sidebar: #020817;
    --sidebar-foreground: #f8fafc;
    --foreground: #0f172a;
    --card: #ffffff;
    --primary: #020817;
    --primary-foreground: #f8fafc;
    --secondary: #f1f5f9;
    --border: #e2e8f0;
    --muted: #64748b;
    --destructive: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 0.75rem;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
    font-size: 16px;
}
body { 
    font-family: 'Inter', sans-serif; 
    background: var(--background); 
    color: var(--foreground);
    font-weight: 400;
    line-height: 1.5;
}

h1, h2, h3, .font-bold { font-weight: 700; }

/* Login Screen - Glassmorphism Edition */
.login-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top right, #f8fafc, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.login-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2rem 1.75rem;
    border-radius: 1.25rem;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.4);
    text-align: left;
}

.login-header { margin-bottom: 1.5rem; text-align: center; }
.login-header h1 { 
    font-size: 1.35rem; 
    font-weight: 700; 
    letter-spacing: -0.05em; 
    color: #020817;
    margin-bottom: 0.35rem;
}
.login-header p { 
    color: #64748b; 
    font-size: 0.75rem; 
    font-weight: 400;
}

/* Login Screen Responsive */
@media (max-width: 768px) and (orientation: landscape) {
    .login-card {
        padding: 1.75rem 1.5rem;
        max-width: 320px;
    }
    
    .login-header {
        margin-bottom: 1.25rem;
    }
    
    .login-header h1 {
        font-size: 1.25rem;
    }
    
    .login-header p {
        font-size: 0.7rem;
    }
    
    .login-card .form-group {
        margin-bottom: 0.75rem;
    }
    
    .login-card input {
        padding: 0.55rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .login-card label {
        font-size: 0.6rem;
    }
    
    .login-card .btn-primary {
        padding: 0.65rem;
        font-size: 0.8rem;
    }
    
    .user-preview {
        padding: 0.6rem;
        margin-bottom: 1rem;
    }
    
    .user-avatar-sm {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .login-card {
        padding: 2.25rem 1.85rem;
    }
}

/* Form Elements - Global Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea,
.search-box input {
    width: 100%;
    padding: 0.62rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 400;
    transition: all 0.3s ease;
    background: white;
    color: var(--foreground);
}

/* Form Elements Responsive */
@media (max-width: 768px) and (orientation: landscape) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.7rem;
        margin-bottom: 0.4rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.7rem 0.9rem;
        font-size: 0.85rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.75rem 0.95rem;
    }
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(2, 8, 23, 0.05);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group textarea.fixed-note {
    height: 96px;
    min-height: 96px;
    max-height: 96px;
    resize: none;
}

.form-group select.compact-select-open {
    position: relative;
    z-index: 20;
    height: auto;
    max-height: 15rem;
    overflow-y: auto;
}

/* Login Screen Form Elements */
.login-card .form-group {
    margin-bottom: 0.9rem;
}

.login-card label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.35rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-card input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 0.7rem;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 400;
    transition: all 0.3s ease;
    background: rgba(248, 250, 252, 0.5);
}

.login-card input:focus {
    outline: none;
    border-color: #020817;
    background: white;
    box-shadow: 0 0 0 4px rgba(2, 8, 23, 0.04);
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    font-size: 0.72rem;
    color: #64748b;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.remember-me input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #020817;
    cursor: pointer;
}

/* Buttons - Global Styles */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(2, 8, 23, 0.15);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 8, 23, 0.25);
}

.btn-secondary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.btn-outline {
    background: white;
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

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

.btn-danger-text {
    background: transparent;
    color: var(--destructive);
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.btn-danger-text:hover {
    background: #fef2f2;
}

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

.login-card .btn-primary {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 0.7rem;
    box-shadow: 0 4px 12px rgba(2, 8, 23, 0.15);
}

.user-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0.85rem;
    animation: fadeIn 0.3s ease;
}

.user-avatar-sm {
    width: 40px;
    height: 40px;
    background: #020817;
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
}

#login-user-id {
    font-size: 0.8rem;
    font-weight: 600;
    color: #020817;
}

.btn-link {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.75rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

.btn-link:hover { color: #020817; }

#login-step-1, #login-step-2 {
    transition: all 0.3s ease;
}

/* Page transitions */
.fade-out { opacity: 0; transform: translateY(-10px); }
.fade-in { opacity: 1; transform: translateY(0); }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.hidden { display: none !important; }

/* Sidebar */
/* Sidebar */
.sidebar {
    width: 200px;
    background: var(--sidebar);
    color: var(--sidebar-foreground);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    width: 80px;
    padding: 1.5rem 0.75rem;
}

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-header h1,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-links li span {
    display: none;
}

.sidebar.collapsed .nav-links {
    align-items: center;
}

.sidebar.collapsed .nav-links li {
    justify-content: center;
    padding: 0.75rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
}

.sidebar.collapsed .user-profile {
    justify-content: center;
    padding: 0;
}

.sidebar.collapsed .user-avatar {
    margin: 0;
}

.sidebar-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 0.5rem;
    margin-bottom: 1rem;
    transition: transform 0.2s ease;
    width: fit-content;
}

.sidebar-toggle:hover {
    transform: scale(1.1);
}

.sidebar-toggle span {
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.sidebar-header { margin-bottom: 2.5rem; }
.sidebar-header h1 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
.sidebar-header span { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

.nav-links { list-style: none; }
.nav-links li {
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    transition: all 0.2s;
    margin-bottom: 0.4rem;
    color: #94a3b8;
}

.nav-links li:hover, .nav-links li.active { background: #1e293b; color: white; }

/* Main Content */
.main-content {
    margin-left: 200px;
    padding: 2.5rem;
    transition: margin-left 0.3s ease;
}

.main-content.collapsed {
    margin-left: 80px;
}

/* Sidebar Responsive Adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .sidebar.collapsed {
        width: 70px;
        padding: 1.5rem 0.5rem;
    }
    
    .main-content {
        margin-left: 280px;
    }
    
    .main-content.collapsed {
        margin-left: 70px;
    }
    
    .sidebar-header h1 {
        font-size: 1.1rem;
    }
    
    .nav-links li {
        padding: 0.7rem 0.9rem;
        font-size: 0.88rem;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    html {
        font-size: 14px;
    }
    
    .rotate-prompt {
        display: none !important;
    }
    
    .sidebar {
        width: 80px;
        padding: 1rem 0.5rem;
    }
    
    .sidebar.expanded {
        width: 280px;
        padding: 1rem 1.5rem;
    }
    
    .sidebar .sidebar-header span,
    .sidebar .sidebar-header h1,
    .sidebar .user-info,
    .sidebar .nav-links li span {
        display: none;
    }
    
    .sidebar.expanded .sidebar-header span,
    .sidebar.expanded .sidebar-header h1,
    .sidebar.expanded .user-info,
    .sidebar.expanded .nav-links li span {
        display: block;
    }
    
    .sidebar .nav-links {
        align-items: center;
    }
    
    .sidebar.expanded .nav-links {
        align-items: flex-start;
    }
    
    .sidebar .nav-links li {
        justify-content: center;
        padding: 0.75rem;
        width: 48px;
        height: 48px;
        border-radius: 50%;
    }
    
    .sidebar.expanded .nav-links li {
        justify-content: flex-start;
        padding: 0.7rem 0.9rem;
        width: auto;
        height: auto;
        border-radius: var(--radius);
        font-size: 0.9rem;
    }
    
    .sidebar .sidebar-header {
        justify-content: center;
        padding: 0;
    }
    
    .sidebar.expanded .sidebar-header {
        justify-content: space-between;
        padding: 0;
    }
    
    .sidebar .user-profile {
        justify-content: center;
        padding: 0;
    }
    
    .sidebar.expanded .user-profile {
        justify-content: flex-start;
        padding: 0.75rem;
    }
    
    .sidebar .user-avatar {
        margin: 0;
    }
    
    .sidebar.expanded .user-avatar {
        margin-right: 0.75rem;
    }
    
    .main-content {
        margin-left: 80px;
        padding: 1rem 1.5rem;
    }
    
    .main-content.expanded {
        margin-left: 280px;
    }
    
    .section-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card .label {
        font-size: 0.65rem;
    }
    
    .stat-card .value {
        font-size: 1.25rem;
    }
    
    header .header-info h2 {
        font-size: 1.35rem;
    }
    
    table {
        font-size: 0.7rem;
    }
    
    th {
        padding: 0.5rem 0.6rem;
        font-size: 0.68rem;
    }
    
    td {
        padding: 0.5rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .controls-bar {
        gap: 0.75rem;
    }
    
    .search-box input,
    .filter-group select {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .form-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .detail-item {
        grid-column: 1 / -1;
    }
    header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* Sidebar Footer & Profile */
.sidebar-footer {
    border-top: 1px solid #1e293b;
    padding-top: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}
.user-profile:hover { background: #1e293b; }

.user-avatar {
    width: 32px;
    height: 32px;
    background: #334155;
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}

.user-info { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.user-info span:first-child { font-size: 0.85rem; font-weight: 500; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span:last-child { font-size: 0.7rem; color: var(--muted); }

.impersonation-alert {
    background: var(--warning);
    color: #000;
    padding: 0.5rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}
.impersonation-alert button {
    background: black;
    color: white;
    border: none;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 200px;
    padding: 2.5rem;
    max-width: 100%;
    transition: margin-left 0.3s ease;
}

.main-content.collapsed {
    margin-left: 88px;
}

.page-section { display: none; }
.page-section.active { display: block; animation: fadeIn 0.4s ease; }

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

header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 2.5rem;
    gap: 1rem;
}

header .sidebar-toggle {
    background: var(--sidebar);
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: none;
}

header .sidebar-toggle span {
    background: white;
}

header .header-info h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; }
header .header-info p { font-size: 0.9rem; color: var(--muted); margin-top: 0.25rem; }

.page-header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    min-width: max-content;
}

.period-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.period-filter select {
    min-width: 128px;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #fff;
    color: var(--foreground);
    padding: 0.62rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: none;
    outline: none;
}

.period-filter select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(2, 8, 23, 0.05);
}

/* Components */
.dashboard-section {
    margin-bottom: 2.5rem;
}
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--foreground);
}
.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 1.5rem; 
}
.stat-card {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}
.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.stat-card.dashboard-link {
    cursor: pointer;
}
.stat-card.dashboard-link:focus-visible {
    outline: 3px solid rgba(2, 8, 23, 0.18);
    outline-offset: 3px;
}
.stat-card .label { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; margin-bottom: 0.5rem; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; }
.stat-meta {
    display: block;
    margin-top: 0.55rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.35;
}

.controls-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.active-filter-pill {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--foreground);
    font-size: 0.78rem;
    font-weight: 700;
}

.filter-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-group select {
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(2, 8, 23, 0.05);
}

.table-container { background: white; border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th { text-align: left; padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--border); background: #fafafa; font-weight: 600; color: var(--muted); user-select: none; font-size: 0.75rem; white-space: nowrap; }
th.sortable { cursor: pointer; transition: background 0.2s; }
th.sortable:hover { background: #f0f0f0; }
.sort-icon { display: inline-block; margin-left: 0.25rem; font-size: 0.65rem; opacity: 0.3; }
.sort-icon.asc::after { content: '↑'; }
.sort-icon.desc::after { content: '↓'; }
th.sortable.active .sort-icon { opacity: 1; }
td { padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
tr:last-child td { border-bottom: none; }
tr:hover { background: #fcfcfc; cursor: pointer; }
.phone-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.phone-link:hover {
    text-decoration: underline;
}

table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.expense-lines-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 1rem 0 0.75rem;
}

.expense-lines-container {
    box-shadow: none;
    max-height: 56vh;
    overflow: auto;
}

.expense-lines-table {
    min-width: 1500px;
}

.expense-lines-table th,
.expense-lines-table td {
    padding: 0.45rem;
    vertical-align: top;
}

.expense-lines-table input {
    width: 100%;
    min-width: 96px;
    padding: 0.48rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font: inherit;
    font-size: 0.78rem;
}

.expense-lines-table input[readonly] {
    background: #f8fafc;
    color: var(--muted);
}

.expense-lines-table tfoot th {
    position: sticky;
    bottom: 0;
    background: #f8fafc;
    z-index: 1;
    color: var(--foreground);
}

.w-full { width: 100%; }
.mt-2 { margin-top: 1rem; }

/* Status Badges */
.status-badge { padding: 0.3rem 0.8rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.status-yapilacak { background: #f1f5f9; color: #475569; }
.status-yapilmakta { background: #eff6ff; color: #2563eb; }
.status-yapilmis { background: #f0fdf4; color: #16a34a; }

.status-active { color: var(--success); font-weight: 600; }
.status-inactive { color: var(--muted); }

/* Modals */
.modal { 
    display: none; 
    position: fixed; 
    inset: 0; 
    background: rgba(2, 8, 23, 0.4); 
    backdrop-filter: blur(8px); 
    z-index: 1500; 
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 1.5rem auto;
    border-radius: 1.25rem;
    padding: 1.75rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    max-width: 650px;
    width: 95%;
    animation: slideUp 0.3s ease;
}

#customer-modal .modal-content,
#expense-modal .modal-content,
#planned-meeting-modal .modal-content {
    max-width: 980px;
}

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

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

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.close-modal {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
}

.close-modal:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: start;
}

.form-grid .form-group {
    margin-bottom: 0;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: 1 / -1; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f1f5f9;
}

/* Profile Modal - Redesign */
.profile-settings-card {
    max-width: 440px;
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.user-avatar-lg {
    width: 52px;
    height: 52px;
    background: #020817;
    color: white;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
}

.user-details h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #020817;
    margin-bottom: 0.25rem;
}

.role-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.settings-section h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #020817;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
}

.modal-footer-simple {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--muted);
}

.tab-btn:hover {
    background: var(--secondary);
}

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

/* Profile View Modal */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--border);
}

.profile-content {
    max-width: 980px;
}

.detail-item {
    min-height: 64px;
    padding: 0.62rem 0.75rem;
    background: #fff;
    min-width: 0;
}

.detail-item .label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.detail-item .value {
    display: block;
    color: var(--foreground);
    font-size: 0.9rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.detail-select {
    width: 100%;
    padding: 0.62rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #f8fafc;
    color: var(--foreground);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 1;
}

.detail-note {
    min-height: 96px;
}

.profile-sections {
    margin-bottom: 1.5rem;
}

.section {
    margin-bottom: 1.5rem;
}

.section h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.status-btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.status-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: white;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-btn:hover {
    background: var(--secondary);
}

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

.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--muted); }
.text-destructive { color: var(--destructive); }
.text-success { color: var(--success); }

@media (max-width: 768px) {
    .mobile-only { display: flex; }
    .sidebar-toggle { display: flex; }
    .sidebar { 
        width: 300px; 
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    .sidebar.expanded {
        transform: translateX(0);
    }
    .sidebar h1, .sidebar span, .nav-links li span, .user-info, .sidebar-header span { display: block; }
    .main-content { margin-left: 0; padding: 1.5rem; }
    .form-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .detail-item,
    .span-2,
    .span-3,
    .span-4,
    .span-5,
    .span-6,
    .span-8,
    .span-12 {
        grid-column: 1 / -1;
    }
    header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .page-header-actions {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
        min-width: 0;
        flex-wrap: wrap;
    }
    .period-filter {
        width: 100%;
        justify-content: space-between;
    }
    .period-filter select {
        flex: 1;
        min-width: 0;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 768px) {
    .form-grid,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .span-2,
    .span-3,
    .span-4,
    .span-5,
    .span-6,
    .span-8,
    .span-12,
    .detail-item {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) and (orientation: portrait) {
    .sidebar {
        width: 68px;
        padding: 0.85rem 0.5rem;
        transform: translateX(0);
        box-shadow: 1px 0 8px rgba(2, 8, 23, 0.16);
    }

    .sidebar.expanded {
        width: 260px;
        padding: 0.85rem 1rem;
        box-shadow: 2px 0 16px rgba(2, 8, 23, 0.28);
    }

    .sidebar .sidebar-header span,
    .sidebar .sidebar-header h1,
    .sidebar .user-info,
    .sidebar .nav-links li span {
        display: none;
    }

    .sidebar.expanded .sidebar-header span,
    .sidebar.expanded .sidebar-header h1,
    .sidebar.expanded .user-info,
    .sidebar.expanded .nav-links li span {
        display: block;
    }

    .sidebar .sidebar-toggle,
    .sidebar .sidebar-header,
    .sidebar .user-profile {
        justify-content: center;
    }

    .sidebar:not(.expanded) .user-profile > svg {
        display: none;
    }

    .sidebar.expanded .sidebar-toggle,
    .sidebar.expanded .sidebar-header,
    .sidebar.expanded .user-profile {
        justify-content: flex-start;
    }

    .sidebar .nav-links {
        align-items: center;
    }

    .sidebar.expanded .nav-links {
        align-items: stretch;
    }

    .sidebar .nav-links li {
        width: 44px;
        height: 44px;
        justify-content: center;
        padding: 0;
        border-radius: 50%;
    }

    .sidebar.expanded .nav-links li {
        width: auto;
        height: auto;
        justify-content: flex-start;
        padding: 0.75rem 0.9rem;
        border-radius: var(--radius);
    }

    .main-content {
        margin-left: 68px;
        padding: 1rem 0.85rem;
    }

    .main-content.expanded {
        margin-left: 68px;
    }

    #home-page header {
        margin-bottom: 1rem;
    }

    .dashboard-section {
        margin-bottom: 1rem;
    }

    .section-title {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    .stat-card {
        min-height: 54px;
        padding: 0.65rem 0.85rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .stat-card .label {
        margin-bottom: 0;
        font-size: 0.68rem;
    }

    .stat-card .value {
        font-size: 1.05rem;
        white-space: nowrap;
    }
}

/* Rotate Screen Prompt */
.rotate-prompt {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--sidebar);
    color: white;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 99999;
    padding: 2rem;
}

.rotate-prompt .rotate-icon {
    margin-bottom: 2rem;
    animation: rotateAnimation 2s infinite ease-in-out;
    color: var(--primary);
}

@keyframes rotateAnimation {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.rotate-brand {
    margin-bottom: 2rem;
}

.rotate-brand h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.rotate-prompt h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.rotate-prompt p {
    font-size: 1rem;
    color: #94a3b8;
    max-width: 400px;
}

/* Rotate Prompt Decorative Elements */
.rotate-prompt::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

@media (max-width: 768px) and (orientation: landscape) {
    .rotate-prompt {
        display: none !important;
    }
    
    .mobile-only { display: flex; }
    .sidebar-toggle { display: flex; }
    .sidebar { 
        width: 240px; 
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    .sidebar.expanded {
        transform: translateX(0);
    }
    .sidebar h1, .sidebar span, .nav-links li span, .user-info, .sidebar-header span { display: block; }
    .main-content { margin-left: 0; padding: 1rem 1.5rem; }
    
    .section-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card .label {
        font-size: 0.65rem;
    }
    
    .stat-card .value {
        font-size: 1.25rem;
    }
    
    header .header-info h2 {
        font-size: 1.35rem;
    }
    
    table {
        font-size: 0.7rem;
    }
    
    th {
        padding: 0.5rem 0.6rem;
        font-size: 0.68rem;
    }
    
    td {
        padding: 0.5rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .controls-bar {
        gap: 0.75rem;
    }
    
    .search-box input,
    .filter-group select {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .form-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .detail-item {
        grid-column: 1 / -1;
    }
    header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* Tablet responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    html {
        font-size: 15px;
    }
    
    .sidebar { width: 260px; }
    .main-content { margin-left: 260px; padding: 2rem; }
    
    .section-title {
        font-size: 1.15rem;
    }
    
    .stats-grid {
        gap: 1.25rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-card .value {
        font-size: 1.4rem;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    html {
        font-size: 14px;
    }
    
    .rotate-prompt {
        display: none !important;
    }
    
    .mobile-only { display: flex; }
    .sidebar-toggle { display: flex; }
    .sidebar { 
        width: 240px; 
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    .sidebar.expanded {
        transform: translateX(0);
    }
    .sidebar h1, .sidebar span, .nav-links li span, .user-info, .sidebar-header span { display: block; }
    .main-content { margin-left: 0; padding: 1rem 1.5rem; }
    
    .section-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card .label {
        font-size: 0.65rem;
    }
    
    .stat-card .value {
        font-size: 1.25rem;
    }
    
    header .header-info h2 {
        font-size: 1.35rem;
    }
    
    table {
        font-size: 0.7rem;
    }
    
    th {
        padding: 0.5rem 0.6rem;
        font-size: 0.68rem;
    }
    
    td {
        padding: 0.5rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .controls-bar {
        gap: 0.75rem;
    }
    
    .search-box input,
    .filter-group select {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .form-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .detail-item {
        grid-column: 1 / -1;
    }
    header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    
    .sidebar-overlay.active {
        display: block;
    }
}
