:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-green: #22c55e;
    --accent-yellow: #eab308;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --border-color: #334155;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --header-height: 64px;
    --nav-height: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 4px; }
input, select, textarea { font-family: inherit; font-size: 14px; }
input::placeholder { color: var(--text-muted); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.app { display: flex; flex-direction: column; height: 100%; }

.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent-blue), #8b5cf6);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.search-container { position: relative; flex: 1; }
.search-container svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input {
    width: 100%; height: 44px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0 16px 0 44px;
    color: var(--text-primary);
}
.search-input:focus { border-color: var(--accent-blue); outline: none; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.header-center { flex: 1; display: flex; justify-content: center; max-width: 500px; margin: 0 auto; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.user-menu { display: flex; align-items: center; gap: 12px; }
.user-avatar {
    width: 36px; height: 36px;
    background: var(--accent-blue);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
}

@media (max-width: 768px) {
    .header { padding: 0 12px; gap: 8px; }
    .logo span { display: none; }
    .header-center { max-width: none; }
    .search-input { height: 40px; }
    .user-avatar { display: none; }
}

.main { flex: 1; display: flex; overflow: hidden; }

.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 16px 0;
}
@media (max-width: 768px) { .sidebar { display: none; } }
.nav-section { padding: 0 12px; margin-bottom: 24px; }
.nav-label {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0 12px; margin-bottom: 8px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 14px; font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-blue); color: white; }
.nav-item .badge {
    margin-left: auto;
    background: var(--accent-red);
    color: white;
    font-size: 11px; font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.content { flex: 1; overflow-y: auto; padding: 24px; }
@media (max-width: 768px) { .content { padding: 16px; padding-bottom: calc(var(--nav-height) + 20px); } }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.page-title { font-size: 24px; font-weight: 700; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 14px; font-weight: 600;
    transition: all 0.15s;
}
.btn-primary { background: var(--accent-blue); color: white; }
.btn-primary:hover { background: var(--accent-blue-hover); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-success { background: var(--accent-green); color: white; }
.btn-danger { background: var(--accent-red); color: white; }
.btn-icon { width: 40px; height: 40px; padding: 0; }

.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--border-radius); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.card-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { 
    background: var(--bg-card); border: 1px solid var(--border-color); 
    border-radius: var(--border-radius); padding: 20px; 
    display: flex; align-items: center; gap: 16px; 
    cursor: pointer; transition: transform 0.15s; 
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-icon.gray { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.stat-icon.yellow { background: rgba(234, 179, 8, 0.2); color: #eab308; }
.stat-icon.blue { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.stat-icon.green { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.stat-icon.red { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.stat-content h3 { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-content p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: var(--bg-primary); border-bottom: 1px solid var(--border-color); }
td { padding: 16px; border-bottom: 1px solid var(--border-color); font-size: 14px; }
tr:hover { background: var(--bg-hover); }
tr.clickable { cursor: pointer; }

.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-badge.nou { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.status-badge.la_furnizor { background: rgba(234, 179, 8, 0.2); color: #eab308; }
.status-badge.gata { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.status-badge.finalizat { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.deadline { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.deadline.urgent { color: var(--accent-red); }
.deadline.warning { color: var(--accent-orange); }
.deadline.ok { color: var(--text-muted); }

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.form-input { width: 100%; height: 44px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 0 14px; color: var(--text-primary); transition: all 0.2s; }
.form-input:focus { border-color: var(--accent-blue); outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }
.form-textarea { min-height: 100px; padding: 12px 14px; resize: vertical; }
.form-select { 
    appearance: none; 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); 
    background-repeat: no-repeat; 
    background-position: right 12px center; 
    background-size: 18px;
    padding-right: 40px;
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.tag-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.tag-item:hover { border-color: var(--accent-blue); }
.tag-item.selected { background: rgba(59, 130, 246, 0.2); border-color: var(--accent-blue); color: var(--accent-blue); }
.tag-checkbox {
    width: 18px; height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
}
.tag-item.selected .tag-checkbox { background: var(--accent-blue); border-color: var(--accent-blue); }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.modal-large { max-width: 900px; }
.modal-header { padding: 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--border-radius-sm); color: var(--text-muted); }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 12px; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-primary); border-radius: var(--border-radius-sm); margin-bottom: 20px; }
.tab { flex: 1; padding: 10px 16px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--text-secondary); text-align: center; }
.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--accent-blue); color: white; }

.filter-tabs { display: flex; gap: 8px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 4px; }
.filter-tab { padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 500; color: var(--text-secondary); background: var(--bg-tertiary); white-space: nowrap; }
.filter-tab:hover { background: var(--bg-hover); }
.filter-tab.active { background: var(--accent-blue); color: white; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }

.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border-color); border-top-color: var(--accent-blue); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 14px 20px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); box-shadow: 0 10px 25px rgba(0,0,0,0.3); display: flex; align-items: center; gap: 12px; animation: slideIn 0.3s ease; }
.toast.success { border-left: 4px solid var(--accent-green); }
.toast.error { border-left: 4px solid var(--accent-red); }
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-height); background: var(--bg-secondary); border-top: 1px solid var(--border-color); z-index: 100; }
@media (max-width: 768px) { .mobile-nav { display: flex; } }
.mobile-nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-muted); font-size: 11px; font-weight: 500; }
.mobile-nav-item.active { color: var(--accent-blue); }

.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, var(--bg-primary) 0%, #1e1b4b 100%); }
.login-card { width: 100%; max-width: 400px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 40px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon { width: 64px; height: 64px; font-size: 32px; margin: 0 auto 16px; }
.login-logo h1 { font-size: 24px; font-weight: 700; }
.login-logo p { color: var(--text-muted); margin-top: 8px; }

.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.detail-title { display: flex; align-items: center; gap: 16px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.info-list { display: flex; flex-direction: column; gap: 12px; }
.info-item { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.info-item:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); font-size: 13px; }
.info-value { font-weight: 500; text-align: right; }

.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--border-color); }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: -21px; top: 6px; width: 12px; height: 12px; background: var(--bg-tertiary); border: 2px solid var(--border-color); border-radius: 50%; }
.timeline-item.status-change::before { background: var(--accent-blue); border-color: var(--accent-blue); }
.timeline-date { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-content { font-size: 14px; }
.timeline-operator { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.public-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, var(--bg-primary) 0%, #0c4a6e 100%); }
.public-card { width: 100%; max-width: 500px; background: var(--bg-secondary); border-radius: var(--border-radius); overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,0.4); }
.public-header { padding: 24px; text-align: center; background: linear-gradient(135deg, var(--accent-blue), #8b5cf6); }
.public-header h1 { font-size: 20px; margin-bottom: 8px; }
.public-status { padding: 30px; text-align: center; }
.status-icon { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; font-size: 36px; }
.status-icon.nou { background: rgba(107, 114, 128, 0.2); }
.status-icon.la_furnizor { background: rgba(234, 179, 8, 0.2); }
.status-icon.gata { background: rgba(59, 130, 246, 0.2); }
.status-icon.finalizat { background: rgba(34, 197, 94, 0.2); }
.public-info { padding: 0 24px 24px; }

.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.suggestions-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); margin-top: 4px; z-index: 10; overflow: hidden; }
.suggestion-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border-color); }
.suggestion-item:hover { background: var(--bg-hover); }
.suggestion-item:last-child { border-bottom: none; }
