/* ArcForeman App Styles — matches landing page design tokens */
:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --bg-card: #1a1a1a;
  --fg: #e8e4df;
  --fg-muted: #8a8580;
  --fg-dim: #5a5652;
  --accent: #e8712a;
  --accent-glow: #ff8c3a;
  --accent-dim: rgba(232,113,42,0.12);
  --spark: #ffc857;
  --danger: #ef4444;
  --success: #22c55e;
  --warn: #f59e0b;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 8px;
  --transition: 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── LAYOUT ── */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-elevated);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand .logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand .logo span { color: var(--fg); }
.sidebar-brand .logo-icon {
  width: 32px; height: 32px;
  background: var(--accent-dim);
  border: 1px solid rgba(232,113,42,0.3);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.nav { padding: 16px 12px; flex: 1; }
.nav-section { margin-bottom: 24px; }
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  padding: 0 8px;
  margin-bottom: 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { color: var(--fg); background: rgba(255,255,255,0.05); }
.nav-item.active { color: var(--accent); background: var(--accent-dim); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  font-family: var(--font-mono);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 60px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}
.page-content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* ── STATS ROW ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}
.stat-value.accent { color: var(--accent); }
.stat-value.success { color: var(--success); }
.stat-label {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── CARDS / TABLES ── */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}
.card-body { padding: 0; }

table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 14px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.tr-clickable { cursor: pointer; }

/* ── STATUS BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.badge-quoted    { background: rgba(100,116,139,0.15); color: #94a3b8; }
.badge-scheduled { background: rgba(99,102,241,0.15);  color: #818cf8; }
.badge-in_progress { background: rgba(232,113,42,0.15); color: var(--accent); }
.badge-complete  { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge-invoiced  { background: rgba(255,200,87,0.15);  color: var(--spark); }
.badge-draft     { background: rgba(100,116,139,0.15); color: #94a3b8; }
.badge-sent      { background: rgba(232,113,42,0.15);  color: var(--accent); }
.badge-paid      { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge-overdue   { background: rgba(239,68,68,0.15);   color: var(--danger); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-glow); border-color: var(--accent-glow); }
.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--fg-muted);
  border-color: rgba(255,255,255,0.1);
}
.btn-secondary:hover { color: var(--fg); background: rgba(255,255,255,0.1); }
.btn-ghost {
  background: none;
  color: var(--fg-muted);
  border-color: transparent;
  padding: 6px 12px;
  font-size: 13px;
}
.btn-ghost:hover { color: var(--accent); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-success { background: rgba(34,197,94,0.15); color: var(--success); border-color: rgba(34,197,94,0.2); }
.btn-sm { padding: 6px 14px; font-size: 12px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.modal-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; gap: 12px; justify-content: flex-end;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--fg-muted); font-size: 20px; line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--fg); }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--bg-elevated); }

/* ── INVOICE LINE ITEMS ── */
.items-table-wrap { overflow-x: auto; }
.items-header {
  display: grid;
  grid-template-columns: 1fr 80px 100px 100px 40px;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-dim);
}
.item-row {
  display: grid;
  grid-template-columns: 1fr 80px 100px 100px 40px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.item-row input { padding: 7px 10px; font-size: 13px; }
.item-total { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--accent); }
.items-total-row {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 16px; padding: 14px 0 0;
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
}
.items-total-label { color: var(--fg-muted); font-size: 13px; font-family: var(--font-body); font-weight: 500; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 16px; }
.empty-state h3 { font-family: var(--font-display); font-size: 17px; color: var(--fg); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 300px; margin: 0 auto 20px; }

/* ── TOAST ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  font-size: 14px;
  min-width: 280px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease;
}
.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error   { border-color: rgba(239,68,68,0.3); }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon   { color: var(--danger); }
@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── DETAIL PANEL ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.detail-field { }
.detail-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--fg-dim); margin-bottom: 4px;
}
.detail-value { font-size: 14px; color: var(--fg); }

/* ── MOBILE ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open {
    display: flex;
    position: fixed; inset: 0 auto 0 0;
    width: 240px;
    z-index: 500;
  }
  .page-content { padding: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .hamburger { display: flex !important; }
  .items-header, .item-row { grid-template-columns: 1fr 60px 80px 80px 32px; }
}

.hamburger {
  display: none;
  background: none; border: none; color: var(--fg-muted); cursor: pointer;
  font-size: 20px; padding: 4px;
}
.mobile-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 499;
}
.mobile-overlay.show { display: block; }
