:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.06);
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--font); background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  overflow: hidden;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 24px 16px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { font-size: 1.1rem; font-weight: 700; margin: 0; }
.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 24px;
  min-height: 28px;
}
.notif-bell {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.notif-bell:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px #1e1b4b;
}
.sidebar nav a {
  display: block;
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
  text-decoration: none;
}
.sidebar nav a:hover, .sidebar nav a.active { background: #1e293b; color: #fff; text-decoration: none; }

.main {
  padding: 24px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.main > #view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.main > #view::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.main > #view:has(.orders-page--kanban),
.main > #view:has(.jobs-page) {
  overflow: hidden;
}
.page-title { margin: 0 0 8px; font-size: 1.6rem; }
.page-sub { color: var(--muted); margin: 0 0 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 1rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 8px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--primary); color: #fff;
}
.btn:hover { background: var(--primary-hover); }
.btn.secondary { background: #e2e8f0; color: #0f172a; }
.btn.secondary:hover { background: #cbd5e1; }
.btn.danger { background: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 13px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #334155; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid #93c5fd; border-color: #60a5fa;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: #f8fafc; cursor: pointer; }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge.new { background: #dbeafe; color: #1d4ed8; }
.badge.on_estimation { background: #fef3c7; color: #b45309; }
.badge.approved { background: #dcfce7; color: #15803d; }
.badge.in_production { background: #e0e7ff; color: #4338ca; }
.badge.ready { background: #ccfbf1; color: #0f766e; }
.badge.delivered { background: #f1f5f9; color: #475569; }
.badge.paid { background: #dcfce7; color: #15803d; }

.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  padding: 0;
}
.color-swatch.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px #93c5fd;
}
.color-custom-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  font-size: 13px;
  cursor: pointer;
}
.color-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  vertical-align: middle;
  margin-right: 4px;
}
.iteration-warn {
  color: #b45309;
  font-size: 13px;
  margin-top: 8px;
}
.badge.active { background: #dcfce7; color: #15803d; }
.badge.queued { background: #fef3c7; color: #b45309; }
.badge.printing { background: #dbeafe; color: #1d4ed8; }
.badge.done { background: #dcfce7; color: #15803d; }

.stat {
  background: linear-gradient(135deg, #eff6ff, #fff);
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  padding: 16px;
}
.stat .value { font-size: 1.8rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.dash-stats {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 16px;
}
.dash-stats .stat {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
}
@media (max-width: 700px) {
  .dash-stats {
    flex-wrap: wrap;
  }
  .dash-stats .stat {
    flex: 1 1 calc(50% - 4px);
  }
}
.dash-stats .stat .value {
  font-size: 1.25rem;
  line-height: 1.2;
}
.dash-stats .stat .label {
  font-size: 11px;
  margin-top: 2px;
  line-height: 1.25;
}

.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #fff;
  padding: 64px 0;
}
.hero h1 { font-size: 2.4rem; margin: 0 0 12px; }
.hero p { font-size: 1.1rem; color: #cbd5e1; max-width: 640px; }
.hero-actions { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn.secondary { background: rgba(255,255,255,0.15); color: #fff; }
.hero .btn.secondary:hover { background: rgba(255,255,255,0.25); }
.hero-company { background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%); }
.hero-eyebrow {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a5b4fc;
}

.section-title { margin: 0 0 16px; font-size: 1.25rem; }

.launch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  max-width: 520px;
}
.launch-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.launch-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.12);
  text-decoration: none;
}
.launch-card h3 { margin: 0; font-size: 1.1rem; }
.launch-card p { margin: 0; color: var(--muted); line-height: 1.55; flex: 1; }
.launch-card .btn { align-self: flex-start; margin-top: 4px; }

.steps-list { line-height: 1.8; color: #334155; padding-left: 1.25rem; margin: 0; }

.site-footer {
  padding: 24px 20px 48px;
  color: #64748b;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}
.site-footer-note { color: #94a3b8; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.topbar .links a { margin-left: 16px; color: var(--muted); font-weight: 600; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 1000;
  background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 8px;
  box-shadow: var(--shadow); animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.preview-3d {
  width: 100%; height: 360px; border-radius: var(--radius);
  background: #0f172a; border: 1px solid #1e293b;
}
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-weight: 600; font-size: 13px;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline .time { font-size: 12px; color: var(--muted); }
.timeline .action { font-weight: 600; }

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
}
.login-card { width: 100%; max-width: 420px; }

.iframe-wrap {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: #fff; min-height: 600px;
}
.iframe-wrap iframe { width: 100%; height: 70vh; border: 0; }

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-header-row .page-title { margin-bottom: 4px; }
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.orders-view-tabs { margin-bottom: 0; }

.orders-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.orders-page--kanban .orders-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.orders-kanban-shell {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.kanban-hscroll {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: auto;
  width: min(320px, 45%);
  z-index: 5;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(6px);
}
.kanban-hscroll[hidden] {
  display: none;
}
.kanban-hscroll-inner {
  overflow-x: auto;
  overflow-y: hidden;
  height: 12px;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
}
.kanban-hscroll-inner::-webkit-scrollbar {
  display: block;
  height: 8px;
}
.kanban-hscroll-inner::-webkit-scrollbar-track {
  background: transparent;
}
.kanban-hscroll-inner::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
}
.kanban-hscroll-inner::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}
.kanban-hscroll-spacer {
  height: 1px;
}

.scrollbar-hidden,
.kanban-board,
.kanban-column-body,
.orders-page .table-wrap {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scrollbar-hidden::-webkit-scrollbar,
.kanban-board::-webkit-scrollbar,
.kanban-column-body::-webkit-scrollbar,
.orders-page .table-wrap::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.kanban-board {
  display: flex;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  align-items: stretch;
}
.kanban-column {
  flex: 0 0 240px;
  min-width: 240px;
  height: 100%;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.kanban-column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  position: sticky;
  top: 0;
}
.kanban-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kanban-column-body {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  cursor: grab;
  user-select: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  font: inherit;
  color: inherit;
}
.kanban-card:active {
  cursor: grabbing;
}
.kanban-card.is-dragging {
  opacity: 0.45;
}
.kanban-column-body.is-drag-over {
  background: #e0f2fe;
  outline: 2px dashed #3b82f6;
  outline-offset: -2px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.kanban-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}
.kanban-card-id {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}
.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.kanban-card-client {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
}
.kanban-card-desc {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 10px;
  min-height: 2.8em;
}
.kanban-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.kanban-empty {
  font-size: 12px;
  color: #94a3b8;
  padding: 12px 4px;
  text-align: center;
}

.order-header-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.order-status-field {
  margin: 0;
  min-width: 180px;
}
.order-status-field label {
  font-size: 12px;
  color: var(--muted);
}
.order-card-compact {
  margin-top: 12px;
  padding: 14px 16px;
}
.order-card-compact h3 {
  margin: 0;
  font-size: 1rem;
}
.order-edit-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 10px;
}
.print-time-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}
.print-time-inputs input {
  width: 64px;
  min-width: 0;
}
@media (max-width: 900px) {
  .order-edit-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 800px) {
  .order-edit-grid {
    grid-template-columns: 1fr;
  }
  .order-header-actions {
    width: 100%;
  }
  .order-status-field {
    flex: 1;
  }
}
.order-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.cost-plastic-section {
  margin: 12px 0;
}
.cost-related-section {
  margin: 12px 0;
}
.cost-summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}
.cost-total-field input,
.cost-margin-field input {
  font-size: 1.15rem;
  font-weight: 600;
  background: var(--surface-2, #f8fafc);
}
.cost-margin-field input {
  color: var(--success, #16a34a);
}
@media (max-width: 700px) {
  .cost-summary-row {
    grid-template-columns: 1fr;
  }
}
.cost-related-row {
  display: grid;
  grid-template-columns: 1.6fr 0.7fr 0.7fr auto;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.cost-related-line {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 88px;
  padding-bottom: 2px;
}
.cost-related-line .cost-related-remove {
  padding: 2px 8px;
  min-width: 0;
}
.cost-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.cost-section-head h4 {
  margin: 0;
  font-size: 0.95rem;
}
.cost-plastic-slot {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.cost-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.cost-slot-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.cost-slot-fields.field-span-2 {
  grid-template-columns: 1fr;
}
.cost-qty-row {
  margin-top: 8px;
  grid-template-columns: 1fr 1fr;
}
.cost-breakdown {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #e2e8f0);
}
.cost-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: 14px;
}
.cost-breakdown-row.cost-total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border, #e2e8f0);
  font-size: 15px;
}
.cost-breakdown-row.cost-margin strong {
  color: var(--success, #16a34a);
}
@media (max-width: 700px) {
  .cost-slot-fields {
    grid-template-columns: 1fr;
  }
  .cost-related-row {
    grid-template-columns: 1fr 1fr;
  }
  .cost-related-name {
    grid-column: 1 / -1;
  }
  .cost-related-line {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
.order-client-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.order-client-row select {
  flex: 1;
  min-width: 0;
}
.client-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.client-form-grid .field-span-2 {
  grid-column: 1 / -1;
}
@media (max-width: 700px) {
  .client-form-grid {
    grid-template-columns: 1fr;
  }
  .client-form-grid .field-span-2 {
    grid-column: auto;
  }
}
.order-files-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.order-file-upload {
  cursor: pointer;
  margin: 0;
}
.order-file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.order-file-row:last-child {
  border-bottom: 0;
}
.order-file-name {
  min-width: 0;
  word-break: break-word;
}
.order-file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.machine-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
@media (max-width: 1100px) {
  .machine-grid {
    grid-template-columns: 1fr;
  }
}
.machine-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 108px;
  min-width: 0;
}
.machine-card-media {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  min-height: 108px;
  background: linear-gradient(160deg, #eef2f7 0%, #f8fafc 55%, #e8eef5 100%);
  align-self: stretch;
}
.machine-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 6px;
  box-sizing: border-box;
}
.machine-card-media .badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 10px;
  padding: 2px 6px;
}
.machine-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.machine-card-head-text {
  min-width: 0;
  flex: 1;
}
.machine-ams-badge {
  flex: 0 0 auto;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 6px;
  background: #0f172a;
  color: #fff;
  white-space: nowrap;
  max-width: 100%;
}
.badge.machine-idle { background: #e2e8f0; color: #334155; }
.badge.machine-busy { background: #dbeafe; color: #1d4ed8; }
.badge.machine-repair { background: #fee2e2; color: #b91c1c; }
.machine-card-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.machine-card-title {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.25;
}
.machine-card-meta {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}
.machine-order {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e40af;
}
.machine-print-eta {
  font-size: 11px;
  color: #0f766e;
}
.machine-hours {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 11px;
}
.machine-hours .muted {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 1px;
}
.machine-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.machine-card-actions .btn.sm {
  padding: 3px 7px;
  font-size: 11px;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}
.checkbox-row input {
  width: auto;
  margin: 0;
}
.material-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
@media (max-width: 1200px) {
  .material-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 800px) {
  .material-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .material-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.material-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.material-card-media {
  position: relative;
  background: linear-gradient(160deg, #eef2f7 0%, #f8fafc 100%);
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.material-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #f4f6f9;
}
.material-spool-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
}
.material-card-body {
  padding: 6px 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.material-card-title {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.material-card-meta {
  margin: 0;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.material-color-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  min-width: 0;
}
.material-color-line span:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.material-color-line .muted {
  display: none;
}
.material-color-line .color-dot {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.material-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.material-card-actions .btn.sm {
  padding: 2px 6px;
  font-size: 10px;
}
.notif-modal-card {
  width: min(640px, 100%);
}
.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(60vh, 480px);
  overflow: auto;
}
.notif-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}
.notif-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 4px;
}
.notif-item-subject {
  font-weight: 600;
  font-size: 14px;
}
.notif-item-meta {
  font-size: 12px;
  color: var(--muted);
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  background: #fff;
  border-radius: 12px;
  width: min(480px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.modal-actions-split {
  justify-content: space-between;
  align-items: center;
}
.modal-actions-right {
  display: flex;
  gap: 8px;
}
.job-status-select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: #fff;
}

.jobs-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.jobs-page-header {
  flex-shrink: 0;
}
.jobs-page-header .page-title {
  margin-bottom: 2px;
  font-size: 1.35rem;
}
.jobs-page-header .page-sub {
  margin: 0;
  font-size: 13px;
}
.jobs-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.jobs-main {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jobs-create {
  padding: 12px;
  margin: 0;
}
.jobs-create-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 1fr 90px;
  gap: 8px 10px;
  align-items: end;
}
.jobs-create .field {
  margin: 0;
}
.jobs-create .field label {
  font-size: 12px;
  margin-bottom: 4px;
}
.jobs-create .field input,
.jobs-create .field select {
  padding: 7px 9px;
  font-size: 13px;
}
.jobs-create-actions {
  margin-top: 8px;
}
.job-machine-preview-wrap {
  margin-top: 8px;
}
.job-machine-preview.empty {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 0;
}
.job-machine-card {
  max-width: 360px;
  min-height: 84px;
}
.job-machine-card .machine-card-media {
  flex-basis: 76px;
  width: 76px;
  min-height: 84px;
}
.job-machine-card .machine-card-body {
  padding: 6px 8px;
  gap: 2px;
}
.job-machine-card .machine-card-title {
  font-size: 0.8rem;
}
.job-machine-card .machine-card-meta {
  font-size: 10px;
}
.jobs-dup-warn {
  margin-top: 6px;
  font-size: 12px;
  color: #92400e;
  background: #fef3c7;
  border-radius: 6px;
  padding: 4px 8px;
}
.jobs-list {
  min-height: 0;
}
.jobs-table table {
  font-size: 13px;
}
.jobs-events-rail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
}
.jobs-events-rail .btn.block {
  margin-top: 8px;
  flex-shrink: 0;
}
.jobs-recent-block {
  flex-shrink: 0;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.jobs-recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.jobs-recent-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: #f8fafc;
}
.jobs-recent-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.jobs-recent-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.jobs-recent-meta .badge {
  font-size: 10px;
  padding: 1px 6px;
}
.jobs-events-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.jobs-events-head h3 {
  margin: 0;
  font-size: 0.95rem;
}
.jobs-events-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}
.jobs-event-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}
.jobs-event-type {
  font-weight: 700;
  font-size: 12px;
}
.jobs-event-job {
  font-size: 12px;
  color: #334155;
  margin-top: 2px;
}
.jobs-event-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.jobs-event-time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
@media (max-width: 1000px) {
  .jobs-body {
    grid-template-columns: 1fr;
  }
  .jobs-events-rail {
    max-height: 320px;
  }
  .jobs-create-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .jobs-create-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card h3 { margin: 0 0 12px; }
.chart-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.chart-card-head h3 { margin: 0; }
.stat-inline .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #15803d;
}
.stat-inline-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: baseline;
}
.stat-inline {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.stat-inline-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-inline-margin .value {
  color: #1d4ed8;
}
.chart-wrap {
  position: relative;
  height: 280px;
  margin-top: 8px;
}
.chart-wrap-sm { height: 240px; }
.chart-wrap-revenue { height: 240px; }
.dash-revenue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 16px;
}
.dash-revenue-chart {
  min-width: 0;
  margin-bottom: 0;
}
.dash-order-icons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dash-order-icon {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  min-height: 0;
}
.dash-order-icon-glyph {
  width: 28px;
  height: 28px;
  color: var(--primary);
  display: grid;
  place-items: center;
}
.dash-order-icon-glyph svg {
  width: 24px;
  height: 24px;
}
.dash-order-icon-value {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
}
.dash-order-icon-label {
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 800px) {
  .dash-revenue-row {
    grid-template-columns: 1fr;
  }
  .dash-order-icons {
    flex-direction: row;
  }
  .dash-order-icon {
    min-height: 96px;
  }
}
.revenue-custom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin: 0 0 12px;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 280px;
}

