/* ─── Reset & base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  background: #f0f2f5;
  color: #1a1d2e;
  min-height: 100vh;
}

/* ─── Shell layout ─── */
.shell { display: flex; min-height: 100vh; }

/* ─── Sidebar ─── */
.sidebar {
  width: 230px;
  background: #111318;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-logo {
  font-size: 24px;
  font-weight: 900;
  color: #f7c300;
  letter-spacing: 2px;
}
.brand-sub {
  font-size: 11px;
  color: #555;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.sidebar-nav { flex: 1; padding: 14px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: #7a7f94;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.nav-item:hover { color: #d0d3e0; background: rgba(255,255,255,.04); }
.nav-item.active {
  color: #fff;
  background: rgba(247,195,0,.1);
  border-left-color: #f7c300;
}
.nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: .7;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.loc-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #7a7f94;
  margin-bottom: 10px;
}
.loc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #333;
  flex-shrink: 0;
  transition: background .3s;
}
.loc-dot.ready { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,.5); }
.btn-sync {
  width: 100%;
  padding: 7px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: #7a7f94;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all .15s;
  text-align: left;
}
.btn-sync:hover { color: #d0d3e0; background: rgba(255,255,255,.1); }

/* ─── Main ─── */
.main {
  flex: 1;
  margin-left: 230px;
  padding: 36px 40px;
  min-height: 100vh;
}

.view { max-width: 1080px; }

/* ─── Page header ─── */
.page-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.page-sub { font-size: 14px; color: #6b7280; margin-top: 5px; }

/* ─── Breadcrumb ─── */
.breadcrumb { display: flex; align-items: center; gap: 8px; }
.breadcrumb a { color: #6b7280; text-decoration: none; font-size: 14px; }
.breadcrumb a:hover { color: #1a1d2e; text-decoration: underline; }
.bc-sep { color: #9ca3af; font-size: 16px; }
#detail-breadcrumb-title {
  font-size: 14px; font-weight: 600; color: #1a1d2e;
  max-width: 500px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Buttons ─── */
.btn {
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { background: #f9fafb; border-color: #9ca3af; }
.btn-primary {
  background: #f7c300; border-color: #f7c300;
  color: #1a1d2e; font-weight: 700;
}
.btn-primary:hover { background: #e6b700; border-color: #e6b700; }
.btn-danger { border-color: #fca5a5; color: #dc2626; }
.btn-danger:hover { background: #fef2f2; border-color: #f87171; }
.link-sm { font-size: 13px; color: #6b7280; text-decoration: none; }
.link-sm:hover { color: #1a1d2e; text-decoration: underline; }

/* ─── Stat grid ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  border: 1px solid #e5e7eb;
}
.stat-val { font-size: 34px; font-weight: 700; line-height: 1; }
.stat-lbl { font-size: 13px; color: #6b7280; margin-top: 6px; }
.stat-running .stat-val { color: #2563eb; }
.stat-done .stat-val { color: #16a34a; }

/* ─── Cards ─── */
.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 20px;
  overflow: hidden;
}
.card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ─── Job rows (dashboard list) ─── */
.job-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid #f3f4f6;
  transition: background .1s;
}
.job-row:last-child { border-bottom: none; }
.job-row:hover { background: #fafafa; cursor: pointer; }
.job-label { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { font-size: 13px; color: #6b7280; white-space: nowrap; }
.job-time { font-size: 12px; color: #9ca3af; white-space: nowrap; }
.job-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 5px; }

/* ─── Status badges ─── */
.badge-status {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.s-running    { background: #dbeafe; color: #1d4ed8; }
.s-done       { background: #dcfce7; color: #15803d; }
.s-failed     { background: #fee2e2; color: #b91c1c; }
.s-cancelled  { background: #f3f4f6; color: #6b7280; }

/* ─── Filter bar / tabs ─── */
.filter-bar {
  padding: 12px 20px;
  border-bottom: 1px solid #f3f4f6;
}
.filter-tabs { display: flex; gap: 6px; }
.tab {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  transition: all .15s;
}
.tab:hover { background: #f3f4f6; }
.tab.active { background: #f7c300; color: #1a1d2e; }

/* ─── Jobs full table ─── */
.jobs-tbl { width: 100%; border-collapse: collapse; }
.jobs-tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9ca3af;
  padding: 10px 20px;
  border-bottom: 1px solid #f3f4f6;
}
.jobs-tbl td {
  padding: 13px 20px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
  vertical-align: middle;
}
.jobs-tbl tr:last-child td { border-bottom: none; }
.jobs-tbl tr:hover td { background: #fafafa; }

/* ─── Form ─── */
.form-card { padding: 28px 32px; }
.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #9ca3af;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}
.form-section-title:first-child { margin-top: 0; }
.form-row { display: grid; gap: 16px; }
.form-row.four-col { grid-template-columns: repeat(4, 1fr); }
.form-row.two-col  { grid-template-columns: repeat(2, 1fr); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; font-weight: 500; color: #374151; }
.req { color: #ef4444; }
.opt { color: #9ca3af; font-weight: 400; }
input[type="text"],
input[type="date"],
select {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1d2e;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  border-color: #f7c300;
  box-shadow: 0 0 0 3px rgba(247,195,0,.18);
}
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #f3f4f6;
  gap: 16px;
}
.form-note { font-size: 13px; color: #6b7280; }
.btn-start {
  padding: 13px 36px;
  font-size: 15px;
  font-weight: 700;
  background: #f7c300;
  border: none;
  border-radius: 8px;
  color: #1a1d2e;
  cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn-start:hover { background: #e6b700; transform: translateY(-1px); }
.btn-start:active { transform: translateY(0); }

/* ─── Job info bar ─── */
.job-info-bar {
  display: flex;
  gap: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
}
.jib-item {
  flex: 1;
  padding: 16px 20px;
  border-right: 1px solid #f3f4f6;
}
.jib-item:last-child { border-right: none; }
.jib-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #9ca3af; font-weight: 600; margin-bottom: 5px; }
.jib-val { font-size: 15px; font-weight: 600; }

/* ─── Progress card ─── */
.progress-header {
  padding: 20px;
  border-bottom: 1px solid #f3f4f6;
}
.progress-stat-row {
  display: flex;
  gap: 28px;
  margin-bottom: 16px;
}
.pstat-val { font-size: 26px; font-weight: 700; }
.pstat-lbl { font-size: 12px; color: #6b7280; margin-top: 2px; }

.progress-track {
  height: 8px;
  background: #f3f4f6;
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f7c300, #e6b700);
  border-radius: 99px;
  transition: width .5s ease;
}
.progress-lbl { font-size: 12px; color: #9ca3af; margin-top: 8px; }

/* ─── Log feed ─── */
.log-feed {
  max-height: 280px;
  overflow-y: auto;
}
.log-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  border-bottom: 1px solid #f9fafb;
  font-size: 13px;
}
.log-entry:last-child { border-bottom: none; }
.log-icon { width: 18px; text-align: center; font-size: 13px; flex-shrink: 0; }
.log-icon.spin { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.log-loc { font-family: monospace; font-size: 12px; color: #374151; width: 80px; flex-shrink: 0; }
.log-name { color: #6b7280; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-count { font-weight: 600; color: #15803d; white-space: nowrap; }
.log-skip { color: #9ca3af; font-style: italic; }

/* ─── Results filters ─── */
.result-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.result-filters select,
.result-filters input {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
}
.result-filters input { min-width: 180px; }

/* ─── Results table ─── */
.res-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.res-tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9ca3af;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
  white-space: nowrap;
}
.res-tbl td { padding: 11px 16px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.res-tbl tr:last-child td { border-bottom: none; }
.res-tbl tr:hover td { background: #fafafa; }
.cell-loc-city { font-weight: 500; }
.cell-loc-name { font-size: 11px; color: #9ca3af; margin-top: 2px; }
.price-now { color: #15803d; font-weight: 600; }
.price-later { color: #9ca3af; }
.class-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #f3f4f6;
  color: #374151;
  white-space: nowrap;
}

/* ─── Count chip ─── */
.count-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
}

/* ─── Location picker ─── */
.loc-picker {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 4px;
}

.lp-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}
.lp-toolbar input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 6px 10px;
  font-size: 13px;
}
.lp-count-badge {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  margin-left: auto;
}

.lp-body {
  max-height: 340px;
  overflow-y: auto;
}

.lp-state-group { border-bottom: 1px solid #e5e7eb; }
.lp-state-group:last-child { border-bottom: none; }

.lp-state-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f9fafb;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #374151;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid #e5e7eb;
  user-select: none;
}
.lp-state-hd:hover { background: #f3f4f6; }
.lp-state-name { flex: 1; }
.lp-state-count { font-size: 11px; color: #9ca3af; font-weight: 500; }

.lp-loc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 28px;
  border-bottom: 1px solid #f9fafb;
  cursor: pointer;
  transition: background .1s;
}
.lp-loc-row:last-child { border-bottom: none; }
.lp-loc-row:hover { background: #fafafa; }
.lp-loc-row.hidden { display: none; }

.lp-code {
  font-family: monospace;
  font-size: 11px;
  color: #9ca3af;
  width: 68px;
  flex-shrink: 0;
}
.lp-name {
  flex: 1;
  font-size: 13px;
  color: #1a1d2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lp-city {
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  width: 110px;
  text-align: right;
  flex-shrink: 0;
}

/* ─── Empty state ─── */
.empty { text-align: center; padding: 48px 20px; color: #9ca3af; line-height: 1.6; }
