:root {
  --bg: #0f1419;
  --bg-elevated: #1a222d;
  --bg-soft: #243041;
  --border: #334155;
  --text: #e8eef6;
  --text-muted: #94a3b8;
  --primary: #f59e0b;
  --primary-ink: #1c1405;
  --accent: #38bdf8;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(245, 158, 11, 0.12), transparent 50%),
    radial-gradient(900px 500px at 100% 0%, rgba(56, 189, 248, 0.1), transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

app-shell, .app-shell { display: block; min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #fb923c);
  color: var(--primary-ink);
  font-weight: 800;
}

.top-actions { display: flex; gap: 0.5rem; align-items: center; }

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  padding: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

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

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(36, 48, 65, 0.45);
}
.panel-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}
.panel-body { padding: 1rem; }

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: 0.15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #fb923c);
  color: var(--primary-ink);
  border-color: transparent;
  font-weight: 700;
}
.btn-ghost { background: transparent; }
.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}
.btn-small { padding: 0.35rem 0.6rem; font-size: 0.8rem; }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: #0d1218;
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid rgba(245, 158, 11, 0.35);
  border-color: var(--primary);
}
label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}
.form-grid .full { grid-column: 1 / -1; }

.muted { color: var(--text-muted); }
.mono { font-variant-numeric: tabular-nums; }

.job-list { display: grid; gap: 0.6rem; }
.job-card {
  text-align: left;
  width: 100%;
  border: 1px solid var(--border);
  background: #121923;
  color: inherit;
  border-radius: 12px;
  padding: 0.8rem;
  cursor: pointer;
}
.job-card:hover { border-color: #475569; }
.job-card.active {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.25);
}
.job-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}
.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge.open { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.badge.in_progress { background: rgba(251, 191, 36, 0.15); color: #fde68a; }
.badge.done { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }
.badge.cancelled { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stat {
  background: #121923;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
}
.stat .label { color: var(--text-muted); font-size: 0.75rem; }
.stat .value { font-size: 1.25rem; font-weight: 700; margin-top: 0.2rem; }

.section {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #121923;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: rgba(36, 48, 65, 0.35);
}
.section-header h3 { margin: 0; font-size: 0.9rem; }
.section-body { padding: 0.9rem; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.7);
  vertical-align: top;
}
th {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tr:last-child td { border-bottom: 0; }

.row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.empty {
  padding: 1rem;
  color: var(--text-muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
}
.tab.active {
  color: var(--primary-ink);
  background: var(--primary);
  border-color: transparent;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 12, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(560px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow: auto;
}
.modal-header, .modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-footer { border-bottom: 0; border-top: 1px solid var(--border); }
.modal-body { padding: 1rem; display: grid; gap: 0.75rem; }
.modal h3 { margin: 0; font-size: 1rem; }

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: #102033;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  z-index: 60;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

.pill-note {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.1);
  color: #bae6fd;
  font-size: 0.78rem;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.print-only { display: none; }

@media print {
  body {
    background: white;
    color: black;
  }
  .topbar, .sidebar, .no-print, .toast, .modal-backdrop { display: none !important; }
  .layout { display: block; padding: 0; }
  .panel { box-shadow: none; border: 0; }
  .print-only { display: block; }
  a { color: black; text-decoration: none; }
}
