:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --error: #dc2626;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.logo { font-size: 20px; }
.env-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--border);
    color: var(--muted);
    text-transform: uppercase;
}

.actions { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--muted); }

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}
button:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-primary { background: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #991b1b; }
.btn-close { background: transparent; color: var(--muted); font-size: 24px; padding: 0 8px; }
.btn-close:hover { background: var(--border); color: var(--text); }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }
.hidden { display: none !important; }

.card {
    background: var(--surface);
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--border);
    max-width: 420px;
    margin: 64px auto;
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}

.card h1 { margin-top: 0; font-size: 22px; }

label {
    display: block;
    margin: 12px 0 4px;
    font-weight: 500;
    font-size: 13px;
}
label input, label textarea, label select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}
label input:focus, label textarea:focus, label select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
label.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}
label.checkbox-label input { width: auto; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.error { color: var(--error); font-size: 13px; margin-top: 12px; min-height: 1.2em; }

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
}
.section-header h1, .section-header h2 { margin: 0; }

/* Projects grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.project-card {
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}
.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,.06);
}
.project-card h3 { margin-top: 0; font-size: 16px; }
.project-card .small { font-size: 12px; }
.project-card button { width: 100%; margin-top: 8px; }

.badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--border);
    color: var(--muted);
    margin-left: 6px;
    text-transform: uppercase;
    font-weight: 600;
}
.badge-archived { background: #fef3c7; color: #92400e; }

.empty-state {
    text-align: center;
    padding: 48px;
    background: var(--surface);
    border-radius: 8px;
    border: 1px dashed var(--border);
}

/* Gantt */
.gantt-container {
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 16px;
    overflow-x: auto;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}
.modal-content {
    background: var(--surface);
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 18px; }
.modal form { padding: 24px; }
.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 300;
    max-width: 400px;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast-error { background: var(--error); }
.toast-success { background: var(--success); }
.toast-warning { background: var(--warning); }

/* frappe-gantt contractor colors */
.bar-wrapper.contractor-galadini---c-s-r-l- .bar { fill: #33ccff; }
.bar-wrapper.contractor-neven-s-r-l- .bar { fill: #92d050; }
