@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg: #0f1117;
  --surface: #181c27;
  --surface2: #1f2435;
  --border: #2a2f42;
  --accent: #e8a020;
  --accent2: #f0c060;
  --text: #e2e6f0;
  --muted: #7a8099;
  --danger: #e05252;

  --status-design: #6c7aff;
  --status-punch: #ff9040;
  --status-fab: #40c8ff;
  --status-paint: #b060ff;
  --status-assembly: #40d090;
  --status-qc: #ffd040;
  --status-ready: #60e080;
  --status-dispatched: #a0aab8;
  --status-hold: #e05252;
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --status-design: #4f46e5;
  --status-punch: #ea580c;
  --status-fab: #0284c7;
  --status-paint: #9333ea;
  --status-assembly: #16a34a;
  --status-qc: #ca8a04;
  --status-ready: #16a34a;
  --status-dispatched: #475569;
  --status-hold: #dc2626;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 0.2s;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px !important;
}

/* HEADER */
header {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.logo-box {
  width: 36px; height: 36px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  color: #0f1117;
  letter-spacing: 1px;
}

.app-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--text);
  line-height: 1;
}

.app-subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-icon {
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all .15s;
  text-decoration: none;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
  height: 38px;
  padding: 0 18px;
  background: var(--accent);
  color: #0f1117;
  border: none;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .5px;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  text-decoration: none;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accent2); }

/* TOOLBAR */
.toolbar {
  padding: 16px 28px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 340px;
  position: relative;
}

.search-box input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px 8px 36px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.search-box input:focus { border-color: var(--accent); }
.search-box input::placeholder { color: var(--muted); }
.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
}

.filter-group {
  display: flex;
  gap: 4px;
}

.filter-btn {
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all .15s;
  text-transform: uppercase;
}
.filter-btn.active, .filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232,160,32,.08);
}

.sort-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
}
.sort-select:focus { border-color: var(--accent); color: var(--text); }

/* PIPELINE STATS */
.pipeline {
  padding: 16px 28px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.pipe-item {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s;
}
.pipe-item:hover { border-color: var(--muted); }
.pipe-item.active { border-color: currentColor; }

.pipe-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pipe-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.pipe-count {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  margin-left: 2px;
}

/* MAIN CONTENT */
main {
  padding: 24px 28px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--text);
}

.job-count {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* JOB CARDS GRID */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  position: relative;
  display: flex;
  flex-direction: column;
}
.job-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

.card-accent-bar {
  height: 3px;
  width: 100%;
}

.card-body {
  padding: 16px;
  flex: 1;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.job-id {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
}

.status-pill {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid currentColor;
  opacity: .9;
}

.card-company {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.card-product {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
}

.meta-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.card-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface2);
}

.team-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.team-avatar {
  width: 20px;
  height: 20px;
  background: var(--accent);
  color: #0f1117;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 12px;
  font-weight: bold;
}
.team-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  background: var(--border);
  padding: 4px 10px;
  border-radius: 20px;
}

.card-date {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .5px;
}

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  margin: 20px;
  animation: slideUp .2s ease;
}

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

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
}

.modal-close {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  background: none;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.modal-close:hover { border-color: var(--danger); color: var(--danger); }

.modal-body { padding: 24px; }

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group.full { grid-column: 1/-1; }

label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
}

input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 13px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--surface); }

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-ghost {
  padding: 9px 18px;
  border: 1px solid var(--border);
  background: none;
  border-radius: 7px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }

.btn-danger {
  padding: 9px 18px;
  border: 1px solid var(--danger);
  background: none;
  border-radius: 7px;
  color: var(--danger);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.btn-danger:hover { background: rgba(224,82,82,.1); }

.btn-save {
  padding: 9px 22px;
  background: var(--accent);
  border: none;
  border-radius: 7px;
  color: #0f1117;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.btn-save:hover { background: var(--accent2); }

/* STATUS COLORS */
.s-design    { color: var(--status-design); }
.s-punch     { color: var(--status-punch); }
.s-fab       { color: var(--status-fab); }
.s-paint     { color: var(--status-paint); }
.s-assembly  { color: var(--status-assembly); }
.s-qc        { color: var(--status-qc); }
.s-ready     { color: var(--status-ready); }
.s-dispatch  { color: var(--status-dispatched); }
.s-hold      { color: var(--status-hold); }

.bg-design    { background: var(--status-design); }
.bg-punch     { background: var(--status-punch); }
.bg-fab       { background: var(--status-fab); }
.bg-paint     { background: var(--status-paint); }
.bg-assembly  { background: var(--status-assembly); }
.bg-qc        { background: var(--status-qc); }
.bg-ready     { background: var(--status-ready); }
.bg-dispatch  { background: var(--status-dispatched); }
.bg-hold      { background: var(--status-hold); }

/* TOAST */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
  z-index: 999;
  animation: toastIn .3s ease;
  display: none;
}
.toast.show { display: block; }

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

/* FOOTER */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 42px;
  background-color: rgba(24, 28, 39, 0.98);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
  backdrop-filter: blur(10px);
  z-index: 100;
}
.site-footer a { color: var(--accent); text-decoration: none; font-weight: 600; margin-left: 4px; }

/* SETTINGS SPECIFIC */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}
.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 1.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title .icon {
  width: 4px; height: 20px; border-radius: 2px;
}

.input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 8px 0;
}
.delete-x {
  cursor: pointer;
  color: var(--muted);
  font-weight: bold;
}
.delete-x:hover { color: var(--danger); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

@media (max-width: 600px) {
  header { padding: 0 16px; }
  .toolbar, .pipeline, main { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { margin: 0; border-radius: 14px 14px 0 0; align-self: flex-end; max-height: 95vh; }
  .modal-overlay { align-items: flex-end; }
}

/* BACK TO TOP */
.back-to-top { 
  position: fixed; bottom: 100px; right: 35px; 
  width: 50px; height: 50px; 
  background: var(--accent); color: #0f1117; 
  border-radius: 50%; display: none; align-items: center; justify-content: center; 
  cursor: pointer; font-size: 20px; 
  box-shadow: 0 5px 15px rgba(0,0,0,0.1); z-index: 899; 
  border: 1px solid rgba(0,0,0,0.1); 
}
.back-to-top:hover { background: var(--accent2); }

@keyframes pulseHighlight {
  0% { filter: brightness(1); box-shadow: 0 0 0px rgba(232, 160, 32, 0); }
  50% { filter: brightness(1.2); box-shadow: 0 0 15px rgba(232, 160, 32, 0.8); }
  100% { filter: brightness(1); box-shadow: 0 0 0px rgba(232, 160, 32, 0); }
}
.pulse-button {
  animation: pulseHighlight 2s infinite;
  background: #0f1117;
  color: var(--accent, #ff6b00);
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-transform: uppercase;
  margin-right: 8px;
  transition: transform 0.2s;
}
.pulse-button:hover {
  transform: scale(1.05);
}
