:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1e3a5f;
    --sidebar-hover: #2a4f7a;
    --header-bg: #ffffff;
    --content-bg: #f4f6f9;
    --primary-color: #1e3a5f;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif;
    background: var(--content-bg);
    color: #333;
}

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav { padding: 1rem 0; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: background 0.2s;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link i { width: 20px; text-align: center; }

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: var(--header-bg);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.page-title { font-size: 1.25rem; font-weight: 600; color: var(--primary-color); }

.app-content { flex: 1; padding: 1.5rem; }

.app-footer {
    padding: 1rem 1.5rem;
    background: #fff;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

/* Cards */
.stat-card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-card .stat-label { color: #6c757d; font-size: 0.875rem; }

/* Tables */
.table-card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

.table-card .card-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 1rem 1.25rem;
}

/* Login */
.login-page {
    background: linear-gradient(135deg, #1e3a5f 0%, #2a5298 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }

.login-card { border: none; border-radius: 0.75rem; }

/* Photo gallery */
.photo-gallery { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.photo-item {
    position: relative;
    width: 150px;
}

.photo-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
}

/* Mobile */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .app-main { margin-left: 0; }
}

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

.btn-primary:hover {
    background-color: #2a4f7a;
    border-color: #2a4f7a;
}

.text-primary { color: var(--primary-color) !important; }

.chart-container { position: relative; height: 300px; }
