/* MFF Homebuilder — CA-inspired dark charcoal + green */
:root {
  --bg: #121212;
  --surface: #1e1e1e;
  --surface2: #262626;
  --border: #333333;
  --accent: #5a9e3a;
  --accent-hover: #6db33f;
  --danger: #e05c5c;
  --success: #3cbf7a;
  --warning: #e09a3c;
  --text: #e2e0d8;
  --text-muted: #8a9a7a;
  --radius: 6px;
  --nav-h: 52px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.5; }

/* Nav */
.navbar {
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand a { font-weight: 700; font-size: 1.1rem; color: var(--accent-hover); text-decoration: none; letter-spacing: 0.3px; }
.nav-brand a:hover { color: #8bc44e; }
.nav-links { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.nav-links a { color: var(--text-muted); text-decoration: none; font-size: .9rem; }
.nav-links a:hover { color: var(--text); }
.nav-user { color: var(--text-muted); font-size: .85rem; }

/* Main content */
.main-content { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; }

/* Breadcrumb */
.breadcrumb { font-size: .85rem; color: var(--text-muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text);
  font-size: .9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #c84c4c; }
.btn-outline { background: transparent; }
.btn-sm { padding: .35rem .75rem; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; padding: .75rem; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.danger-zone { border-color: var(--danger); }
.danger-zone h3 { color: var(--danger); margin-bottom: .5rem; }

/* Project grid */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .15s;
}
.project-card:hover { border-color: var(--accent); border-left: 3px solid var(--accent); }
.project-card-body { padding: 1.25rem; flex: 1; }
.project-name { font-size: 1.05rem; font-weight: 600; margin-bottom: .35rem; }
.project-desc { font-size: .85rem; color: var(--text-muted); margin-bottom: .5rem; }
.project-meta { display: flex; gap: 1rem; font-size: .8rem; color: var(--text-muted); }
.project-card-actions { padding: .75rem 1.25rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; flex-wrap: wrap; }

/* Empty state */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h2 { font-size: 1.4rem; color: var(--text); margin-bottom: .5rem; }
.empty-state p { margin-bottom: 1.5rem; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 500; }
.modal { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 480px; box-shadow: 0 16px 48px rgba(0,0,0,0.7); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-header h2 { font-size: 1.15rem; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: .4rem; }
.form-input {
  width: 100%;
  padding: .5rem .75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .9rem;
}
.form-input:focus { outline: none; border-color: var(--accent); }
textarea.form-input { resize: vertical; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }

/* Data table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: .75rem 1rem; text-align: left; font-size: .82rem; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--surface); }
.data-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
.data-table tr:hover td { background: var(--surface2); }

/* Badges */
.badge { padding: .2rem .5rem; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.badge-pdf { background: rgba(79,127,255,.2); color: var(--accent); }
.badge-dxf { background: rgba(60,191,122,.2); color: var(--success); }
.badge-ifc { background: rgba(224,154,60,.2); color: var(--warning); }

/* Status */
.status-ready { color: var(--success); }
.status-pending { color: var(--warning); }
.status-failed { color: var(--danger); }

/* Alerts */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: rgba(224,92,92,.1); border: 1px solid var(--danger); color: var(--danger); }

/* Auth */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; text-align: center; max-width: 380px; width: 100%; }
.auth-logo { font-size: 3rem; margin-bottom: 1rem; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: .5rem; }
.auth-card p { color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-footer { margin-top: 1.5rem; font-size: .8rem; color: var(--text-muted); }
.auth-footer a { color: var(--accent); }

/* HTMX indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }

/* Estimate table */
.estimate-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin: .75rem 0; }
.estimate-table th, .estimate-table td { padding: .4rem .6rem; border-bottom: 1px solid var(--border); }
.estimate-table tfoot td { font-size: .95rem; border-top: 2px solid var(--border); }

/* Export result */
.export-result { padding: .5rem .75rem; border-radius: var(--radius); margin-top: .5rem; font-size: .85rem; }
.export-result.ok { background: rgba(60,191,122,.1); color: var(--success); }
.export-result.error { background: rgba(224,92,92,.1); color: var(--danger); }

/* Spinner */
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 1rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hint text */
.hint { font-size: .82rem; color: var(--text-muted); margin: .2rem 0 .5rem; }

/* Import result */
.import-result { margin-top: .5rem; font-size: .85rem; padding: .4rem .6rem; border-radius: var(--radius); }

/* Responsive */
@media (max-width: 640px) {
  .project-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .data-table { font-size: .8rem; }
  .data-table th, .data-table td { padding: .5rem .4rem; }
}
