:root {
    /* Color Palette - Light Mode Brand Theme */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(241, 245, 249, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.9);
    --bg-input: #ffffff;

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    /* Accent Colors (Orange & Dark Green based on logo) */
    --accent-primary: #f97316;
    /* Brand Orange */
    --accent-primary-hover: #ea580c;
    --accent-primary-glow: rgba(249, 115, 22, 0.2);
    --accent-success: #15803d;
    /* Brand Green */
    --accent-success-bg: rgba(21, 128, 61, 0.12);
    --accent-warning: #eab308;
    --accent-warning-bg: rgba(234, 179, 8, 0.12);
    --accent-danger: #ef4444;
    --accent-danger-bg: rgba(239, 68, 68, 0.12);
    --accent-info: #0284c7;
    --accent-info-bg: rgba(2, 132, 199, 0.12);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #f97316, #fb923c);
    --gradient-success: linear-gradient(135deg, #15803d, #22c55e);
    --gradient-warning: linear-gradient(135deg, #eab308, #facc15);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f87171);
    --gradient-info: linear-gradient(135deg, #0284c7, #38bdf8);
    --gradient-hero: linear-gradient(135deg, #15803d 0%, #16a34a 50%, #f97316 100%);

    /* Borders */
    --border-color: rgba(15, 23, 42, 0.1);
    --border-light: rgba(15, 23, 42, 0.05);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px var(--accent-primary-glow);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 100px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-xs: 0.75rem;
    --font-sm: 0.8125rem;
    --font-base: 0.875rem;
    --font-md: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.25rem;
    --font-2xl: 1.5rem;
    --font-3xl: 2rem;

    /* Layout */
    --header-height: 56px;
    --bottom-nav-height: 64px;
    --sidebar-width: 260px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

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

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

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

input,
select,
textarea,
button {
    font-family: inherit;
    font-size: inherit;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

ul,
ol {
    list-style: none;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== SCREEN MANAGEMENT ===== */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* ===== LOGIN SCREEN ===== */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding: var(--space-lg);
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(249, 115, 22, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(21, 128, 61, 0.06) 0%, transparent 50%);
    animation: loginBgPulse 8s ease-in-out infinite;
}

@keyframes loginBgPulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.05) rotate(2deg);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-2xl);
    position: relative;
    z-index: 1;
}

.logo-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    box-shadow: var(--shadow-glow);
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

.logo-icon .material-symbols-rounded {
    font-size: 40px;
    color: white;
}

.login-logo h1 {
    font-size: var(--font-3xl);
    font-weight: 800;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: var(--font-base);
    margin-top: var(--space-xs);
}

.login-form {
    width: 100%;
    max-width: 380px;
    position: relative;
    z-index: 1;
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper .material-symbols-rounded {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 20px;
    pointer-events: none;
    transition: color var(--transition-fast);
}

.input-icon-wrapper input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-base);
    transition: all var(--transition-fast);
    outline: none;
}

.input-icon-wrapper input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.input-icon-wrapper input:focus+.material-symbols-rounded,
.input-icon-wrapper:focus-within .material-symbols-rounded {
    color: var(--accent-primary);
}

.login-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-xs);
    margin-top: var(--space-md);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn .material-symbols-rounded {
    font-size: 20px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

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

.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
}

.btn-warning {
    background: var(--gradient-warning);
    color: var(--text-inverse);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 8px 14px;
    font-size: var(--font-sm);
}

.btn-sm .material-symbols-rounded {
    font-size: 18px;
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== APP HEADER ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md);
    z-index: 100;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-title {
    font-size: var(--font-lg);
    font-weight: 700;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.user-badge .material-symbols-rounded {
    font-size: 18px;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    pointer-events: none;
}

.sidebar.open {
    pointer-events: auto;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar.open .sidebar-overlay {
    opacity: 1;
}

.sidebar-content {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    overflow-y: auto;
    z-index: 201;
}

.sidebar.open .sidebar-content {
    transform: translateX(0);
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.sidebar-logo .material-symbols-rounded {
    font-size: 28px;
    color: var(--accent-primary);
}

.nav-list {
    padding: var(--space-sm);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 12px var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-primary-glow);
    color: var(--accent-primary-hover);
}

.nav-item .material-symbols-rounded {
    font-size: 22px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding-top: var(--header-height);
    padding-bottom: calc(var(--bottom-nav-height) + 16px);
    min-height: 100vh;
}

.page {
    display: none;
    padding: var(--space-md);
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: var(--font-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    border-radius: var(--radius-sm);
    min-width: 60px;
}

.bottom-nav-item .material-symbols-rounded {
    font-size: 24px;
    transition: all var(--transition-fast);
}

.bottom-nav-item.active {
    color: var(--accent-primary);
}

.bottom-nav-item.active .material-symbols-rounded {
    transform: scale(1.1);
}

/* ===== MORE MENU ===== */
.more-menu {
    position: fixed;
    inset: 0;
    z-index: 300;
}

.more-menu-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.more-menu-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.more-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.more-menu-header h3 {
    font-size: var(--font-lg);
    font-weight: 600;
}

.more-menu-list li {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 14px var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.more-menu-list li:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 8px);
    right: var(--space-md);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-sm);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    max-width: 320px;
}

.toast-success {
    border-left: 3px solid var(--accent-success);
}

.toast-error {
    border-left: 3px solid var(--accent-danger);
}

.toast-warning {
    border-left: 3px solid var(--accent-warning);
}

.toast-info {
    border-left: 3px solid var(--accent-info);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ===== MODAL ===== */
.modal-container {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--space-lg);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.modal-header h3 {
    font-size: var(--font-xl);
    font-weight: 700;
}

.modal-body .form-group {
    margin-bottom: var(--space-md);
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-base);
    transition: all var(--transition-fast);
    outline: none;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.modal-body textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-body select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.modal-actions .btn {
    flex: 1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* ===== DESKTOP LAYOUT ===== */
@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }

    .more-menu {
        display: none !important;
    }

    .sidebar {
        pointer-events: auto;
    }

    .sidebar-overlay {
        display: none;
    }

    .sidebar-content {
        transform: translateX(0);
        border-right: 1px solid var(--border-color);
        transition: transform var(--transition-base);
    }

    .main-content {
        margin-left: var(--sidebar-width);
        padding-bottom: var(--space-lg);
        transition: margin-left var(--transition-base);
    }

    .app-header {
        left: var(--sidebar-width);
        transition: left var(--transition-base);
    }

    #menuToggle {
        display: none;
    }

    .modal-container {
        align-items: center;
    }

    .modal-content {
        border-radius: var(--radius-xl);
        max-width: 560px;
    }

    .page {
        padding: var(--space-xl);
    }

    /* Sidebar collapse button */
    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .sidebar-collapse-btn {
        display: flex;
        width: 32px;
        height: 32px;
    }

    /* Collapsed state */
    .sidebar-collapsed .sidebar {
        pointer-events: none;
    }

    .sidebar-collapsed .sidebar-content {
        transform: translateX(-100%);
    }

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

    .sidebar-collapsed .app-header {
        left: 0;
    }

    .sidebar-collapsed #menuToggle {
        display: flex;
    }
}

/* Hide collapse btn on mobile */
@media (max-width: 767px) {
    .sidebar-collapse-btn {
        display: none !important;
    }
}

@media (min-width: 1200px) {
    .page {
        max-width: 1200px;
        margin: 0 auto;
    }
}