:root {
    --bg: #0f1117;
    --bg2: #1a1d27;
    --bg3: #242836;
    --accent: #6c5ce7;
    --accent2: #a29bfe;
    --text: #e8e8e8;
    --text2: #9ca3af;
    --green: #00b894;
    --red: #e17055;
    --orange: #fdcb6e;
    --border: #2d3348;
    --radius: 12px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

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

.login-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 28px;
    color: var(--accent2);
}

.login-card .subtitle {
    text-align: center;
    color: var(--text2);
    margin-bottom: 30px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text2);
    font-size: 13px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: #fff;
}

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

.btn-primary:hover {
    background: var(--accent2);
}

.btn-success {
    background: var(--green);
}

.btn-success:hover {
    opacity: 0.9;
}

.btn-danger {
    background: var(--red);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.sidebar {
    width: 240px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.sidebar-logo h2 {
    color: var(--accent2);
    font-size: 20px;
}

.sidebar-logo span {
    color: var(--text2);
    font-size: 12px;
}

.sidebar-nav {
    flex: 1;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text2);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 2px;
    font-size: 14px;
}

.nav-item:hover, .nav-item.active {
    background: var(--bg3);
    color: var(--text);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    color: var(--text2);
    font-size: 12px;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Cards */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header h2 {
    font-size: 18px;
}

/* Project list */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.project-card h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.project-card .meta {
    color: var(--text2);
    font-size: 13px;
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-draft { background: var(--bg3); color: var(--text2); }
.status-planning { background: #2d3a8c; color: #818cf8; }
.status-approved { background: #1a4731; color: #34d399; }
.status-in_progress { background: #4a3728; color: var(--orange); }
.status-completed { background: #1a4731; color: var(--green); }

/* Table */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

th {
    color: var(--text2);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

tr:hover td {
    background: var(--bg3);
}

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

.total-row td {
    font-weight: 700;
    font-size: 15px;
    border-top: 2px solid var(--accent);
    color: var(--accent2);
}

/* SVG container */
.svg-container {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    overflow: auto;
    max-height: none;
}

.svg-container svg {
    width: 100%;
    height: auto;
    min-height: 400px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text2);
    padding: 20px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    color: var(--text2);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-size: 14px;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent2); border-bottom-color: var(--accent); }

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 14px 24px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.toast-success { background: var(--green); }
.toast-error { background: var(--red); }

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo h2, .sidebar-logo span, .nav-item span, .sidebar-footer { display: none; }
    .main-content { padding: 16px; }
}

/* Two columns form */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* Estimate summary */
.estimate-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    background: var(--bg3);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.summary-card .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent2);
}

.summary-card .label {
    font-size: 12px;
    color: var(--text2);
    margin-top: 4px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Choice cards (new project) */
.choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.choice-card {
    background: var(--bg3);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.choice-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
}

.choice-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.choice-card h3 { margin-bottom: 8px; }
.choice-card p { color: var(--text2); font-size: 13px; }

/* Wizard steps */
.wizard-steps {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 20px;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text2);
    white-space: nowrap;
}

.wizard-step.active {
    background: var(--accent);
    color: #fff;
}

.wizard-step.done {
    color: var(--green);
    cursor: pointer;
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.wizard-step.active .step-num { background: rgba(255,255,255,0.2); }
.wizard-step.done .step-num { background: var(--green); color: #fff; }

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    min-width: 16px;
}

.step-label { display: inline; }

@media (max-width: 768px) {
    .step-label { display: none; }
    .wizard-steps { padding: 0; }
}

/* Option cards (material/room selection) */
.option-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.option-card {
    background: var(--bg3);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 12px 18px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    min-width: 90px;
    font-size: 14px;
}

.option-card:hover { border-color: var(--accent); }
.option-card.selected { border-color: var(--accent); background: rgba(108,92,231,0.15); color: var(--accent2); }

.opt-icon { font-size: 20px; margin-bottom: 4px; }

/* Check grid */
.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.check-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(108,92,231,0.05);
}

/* Range input */
/* Renders gallery */
.renders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.render-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.2s;
}

.render-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.render-card img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}

.render-label {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text2);
    text-align: center;
}

/* Plan sub-tabs */
.plan-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--bg3);
    border-radius: 8px;
    padding: 4px;
}

.plan-tab {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text2);
    transition: all 0.2s;
}

.plan-tab:hover { color: var(--text); }
.plan-tab.active { background: var(--accent); color: #fff; }

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
    height: 6px;
}

/* Voice input */
.voice-input {
    position: relative;
}

.voice-input textarea {
    width: 100%;
    padding: 10px 50px 10px 14px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    resize: vertical;
    font-family: inherit;
}

.voice-input textarea:focus { border-color: var(--accent); }

.voice-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg2);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-btn:hover { background: var(--accent); }
.voice-btn.recording {
    background: var(--red);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(225,112,85,0.4); }
    50% { box-shadow: 0 0 0 10px rgba(225,112,85,0); }
}
