@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@600;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #1a2744;
    --primary-light: #243656;
    --primary-hover: #0f1a30;
    --accent: #c8a45c;
    --accent-hover: #b8923f;
    --accent-light: #f5ecd7;
    --danger: #c53030;
    --danger-hover: #9b2c2c;
    --danger-light: #fef2f2;
    --success: #276749;
    --success-hover: #1e5240;
    --success-light: #f0fdf4;
    --warning: #b7791f;
    --warning-light: #fffbeb;
    --info: #2b6cb0;
    --info-light: #eff6ff;
    --bg: #f7f5f0;
    --bg-alt: #ede8df;
    --card-bg: #ffffff;
    --text: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --border: #e2ddd4;
    --border-light: #f0ebe3;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-xs: 0 1px 2px rgba(26, 39, 68, 0.04);
    --shadow-sm: 0 1px 3px rgba(26, 39, 68, 0.06), 0 1px 2px rgba(26, 39, 68, 0.04);
    --shadow: 0 4px 6px rgba(26, 39, 68, 0.05), 0 2px 4px rgba(26, 39, 68, 0.04);
    --shadow-md: 0 10px 15px -3px rgba(26, 39, 68, 0.08), 0 4px 6px -2px rgba(26, 39, 68, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(26, 39, 68, 0.1), 0 10px 10px -5px rgba(26, 39, 68, 0.04);
    --shadow-xl: 0 25px 50px -12px rgba(26, 39, 68, 0.15);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(200, 164, 92, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(26, 39, 68, 0.03) 0%, transparent 50%);
}

/* --- Navbar --- */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.92);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 2px;
    transform: rotate(45deg);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition);
    position: relative;
}

.nav-links a:hover {
    background: var(--bg);
    color: var(--primary);
}

.nav-links a:last-child {
    color: var(--text-muted);
}

.nav-links a:last-child:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* --- Main --- */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 2.5rem auto;
    padding: 0 2rem;
    animation: fadeInUp 0.4s ease-out;
}

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

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 1.75rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
    letter-spacing: 0.02em;
}

/* --- Login --- */
.login-page {
    background:
        linear-gradient(160deg, #1a2744 0%, #243656 40%, #2d4a6f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 164, 92, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 164, 92, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-xl);
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.login-card h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.login-form {
    text-align: left;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form .form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.login-form .form-group input {
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: var(--bg);
    transition: all var(--transition);
}

.login-form .form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 164, 92, 0.12);
    background: var(--card-bg);
}

.login-form .btn {
    margin-top: 0.5rem;
    padding: 0.85rem;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* --- Dashboard --- */
.dashboard h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.welcome {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.welcome strong {
    color: var(--primary);
}

/* --- Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.5rem;
    box-shadow: var(--shadow-sm);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all var(--transition-slow);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 0 0 0 80px;
    opacity: 0.06;
    transition: all var(--transition-slow);
}

.stat-card:nth-child(1)::after { background: var(--info); }
.stat-card:nth-child(2)::after { background: var(--success); }
.stat-card:nth-child(3)::after { background: var(--accent); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::after {
    width: 100px;
    height: 100px;
}

.stat-icon {
    font-size: 2.25rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.stat-card:nth-child(1) .stat-icon { background: var(--info-light); }
.stat-card:nth-child(2) .stat-icon { background: var(--success-light); }
.stat-card:nth-child(3) .stat-icon { background: var(--accent-light); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    letter-spacing: -0.03em;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.3rem;
}

.quick-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* --- Users page --- */
.users-page h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.toolbar {
    margin-bottom: 1.25rem;
}

/* --- Cards --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-light);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.form-card h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--primary);
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1.15rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.93rem;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition);
    background: var(--bg);
    color: var(--text);
}

.form-group input:hover,
.form-group select:hover {
    border-color: #d4cdc0;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 164, 92, 0.1);
    background: var(--card-bg);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.4rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(26, 39, 68, 0.2);
}

.btn-primary:hover {
    background: var(--primary-light);
    box-shadow: 0 4px 8px rgba(26, 39, 68, 0.25);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: #d4cdc0;
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 2px 4px rgba(197, 48, 48, 0.2);
}

.btn-danger:hover {
    background: var(--danger-hover);
    box-shadow: 0 4px 8px rgba(197, 48, 48, 0.25);
    transform: translateY(-1px);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* --- Table --- */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th,
.table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
}

.table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.table tbody tr {
    transition: background var(--transition);
}

.table tbody tr:hover {
    background: rgba(247, 245, 240, 0.6);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.actions {
    display: flex;
    gap: 0.4rem;
}

.inline-form {
    display: inline;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
}

.badge-admin {
    background: var(--primary);
    color: #fff;
}

.badge-user {
    background: var(--bg-alt);
    color: var(--text-secondary);
}

/* --- Alerts --- */
.alert {
    padding: 0.9rem 1.15rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: fadeInUp 0.3s ease-out;
}

.alert::before {
    content: '';
    width: 4px;
    height: 100%;
    border-radius: 2px;
    position: absolute;
    left: 0;
    top: 0;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
    position: relative;
    padding-left: 1.5rem;
}

.alert-error::before {
    background: var(--danger);
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #bbf7d0;
    position: relative;
    padding-left: 1.5rem;
}

.alert-success::before {
    background: var(--success);
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

/* --- Add Task --- */
.add-task-card {
    margin-bottom: 1.5rem;
}

.add-task-form {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
    animation: fadeInUp 0.3s ease-out;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

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

.form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.93rem;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    transition: all var(--transition);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.form-group textarea:hover {
    border-color: #d4cdc0;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 164, 92, 0.1);
    background: var(--card-bg);
}

.section-title {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* --- Odoo --- */
.odoo-card {
    margin-bottom: 1.5rem;
}

.odoo-grid {
    margin-bottom: 0.75rem;
}

.odoo-stat .stat-value {
    font-size: 2rem;
}

.odoo-updated {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* --- Todo Toolbar --- */
.todo-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toggle-group {
    display: flex;
    gap: 0.35rem;
    background: var(--bg);
    padding: 0.25rem;
    border-radius: var(--radius);
}

.toggle-group .btn {
    border-radius: var(--radius-sm);
    border: none;
    box-shadow: none;
}

.toggle-group .btn-primary {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
}

.toggle-group .btn-secondary {
    background: transparent;
    border: none;
    color: var(--text-muted);
}

.toggle-group .btn-secondary:hover {
    background: rgba(0,0,0,0.03);
    color: var(--text-secondary);
}

/* --- Sort links --- */
.sort-link {
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sort-link:hover {
    color: var(--accent);
}

/* --- Todo Table --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

.todo-table th,
.todo-table td {
    vertical-align: middle;
}

.todo-table .td-date {
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.todo-table .td-name {
    font-weight: 600;
    color: var(--text);
}

.todo-table .td-desc {
    max-width: 260px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.row-done {
    opacity: 0.55;
    transition: opacity var(--transition-slow);
}

.row-done:hover {
    opacity: 0.75;
}

.row-done .td-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* --- Field selects (priority / status) --- */
.field-select {
    padding: 0.35rem 0.6rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--card-bg);
    cursor: pointer;
    transition: all var(--transition);
    font-family: 'Inter', sans-serif;
    color: var(--text-secondary);
}

.field-select:hover {
    border-color: #d4cdc0;
}

.field-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(200, 164, 92, 0.15);
}

.priority-select {
    min-width: 95px;
}

.status-select {
    min-width: 105px;
}

/* --- Edit row --- */
.edit-row td {
    padding: 0 !important;
    border-bottom: 2px solid var(--accent);
    background: rgba(247, 245, 240, 0.4);
}

.edit-panel {
    background: var(--bg);
    padding: 1.5rem 1.75rem;
    border-left: 4px solid var(--accent);
    animation: fadeInUp 0.25s ease-out;
}

.edit-panel h4 {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Priority & Status badges --- */
.badge-low {
    background: var(--info-light);
    color: var(--info);
}

.badge-normal {
    background: var(--success-light);
    color: var(--success);
}

.badge-urgent {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-todo {
    background: var(--bg-alt);
    color: var(--text-muted);
}

.badge-progress {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-done {
    background: var(--success-light);
    color: var(--success);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }

    .nav-brand {
        font-size: 1.2rem;
    }

    .nav-links a {
        padding: 0.4rem 0.7rem;
        font-size: 0.82rem;
    }

    .main-content {
        padding: 0 1rem;
        margin: 1.5rem auto;
    }

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

    .stat-card {
        padding: 1.25rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }

    .card {
        padding: 1.25rem;
    }

    .actions {
        flex-direction: column;
    }

    .table {
        font-size: 0.82rem;
    }

    .table th,
    .table td {
        padding: 0.6rem 0.5rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .dashboard h2,
    .users-page h2 {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .toggle-group {
        width: 100%;
    }

    .toggle-group .btn {
        flex: 1;
        text-align: center;
    }
}
