/* ============================================================
   Specialvask Admin — Shopify-inspired Dashboard Styles
   Built on top of Basecoat UI (Tailwind CSS component library)
   ============================================================ */

/* --- CSS Custom Properties (Shopify color palette) --- */
:root {
  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 56px;

  /* Backgrounds */
  --bg-page: #f1f0ee;
  /* From the screenshots */
  --bg-surface: #ffffff;
  --bg-surface-hover: #f3f3f3;
  --bg-surface-active: #ebebeb;

  /* Borders */
  --border-subdued: #e3e3e3;
  --border-base: #cccccc;
  --border-focus: #1a1a1a;

  /* Typography */
  --text-primary: #1a1a1a;
  --text-secondary: #616161;
  --font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  /* Interactive / Accent */
  --accent-base: #1a1a1a;
  --accent-hover: #333333;
  --bg-interactive: #ffffff;
  --bg-interactive-hover: #f1f2f3;

  /* Status Badges */
  --badge-bg-neutral: #ebebeb;
  --badge-text-neutral: #1a1a1a;
  --badge-bg-success: #aee9d1;
  --badge-text-success: #0d542b;
  --badge-bg-warning: #ffea8a;
  --badge-text-warning: #594611;
  --badge-bg-critical: #fed3d1;
  --badge-text-critical: #72191e;
  --badge-bg-info: #a4e8f2;
  --badge-text-info: #003135;
}

/* --- Global resets --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background: #f1f0ee;
  /* Precise Shopify page background */
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
}

/* --- Layout shell --- */
.admin-shell {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
  /* Allows full height below topbar */
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-width);
  min-width: 0;
  /* prevent flex blowout */
}

.admin-content {
  flex: 1;
  padding: 24px 32px;
  background: var(--bg-page);
  overflow-x: auto;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.admin-sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
  border-right: 1px solid var(--border-subdued);
  transition: transform 0.2s ease;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.sidebar-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}

.sidebar-nav-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  background: var(--badge-bg-neutral);
  color: var(--text-primary);
  font-weight: 600;
}

.sidebar-nav-item svg {
  flex-shrink: 0;
  color: #8c9196;
}

.sidebar-nav-item.active svg {
  color: var(--text-primary);
}

/* Footer / settings */
.sidebar-footer {
  padding: 8px 12px 16px;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  background: #1a1a1a;
  /* Shopify totally dark top row */
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  min-width: calc(var(--sidebar-width) - 24px);
  /* Pushes center to exact center alongside sidebar width */
}

/* Logo block inside topbar */
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  border-radius: 4px;
  transition: opacity 0.15s;
}

.topbar-logo:hover {
  opacity: 0.8;
}

.topbar-logo-icon {
  width: 24px;
  height: 24px;
  background: #95bf47;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.topbar-menu-toggle {
  display: none;
  /* shown on mobile */
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  margin-right: 12px;
}

.topbar-menu-toggle:hover {
  background: #333;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 500px;
  margin: 0 auto;
}

.topbar-search {
  position: relative;
  width: 100%;
}

.topbar-search-icon {
  position: absolute;
  left: 12px;
  top: 16px;
  /* Explicit positioning instead of translateY hack to fix glitch vertically on 32h height */
  transform: translateY(-50%);
  color: #999;
  pointer-events: none;
}

.topbar-search-input {
  width: 100%;
  height: 32px;
  padding: 0 12px 0 36px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #2a2a2a;
  color: #fff;
  font-size: 14px;
  font-family: var(--font-family);
  outline: none;
}

.topbar-search-input:hover {
  background: #333;
}

.topbar-search-input:focus {
  background: #2a2a2a;
  border-color: #555;
  box-shadow: 0 0 0 1px #555;
}

.topbar-search-input::placeholder {
  color: #999;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 6px;
  color: #ccc;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.topbar-icon-btn:hover {
  background: #333;
  color: #fff;
}

.topbar-avatar {
  background: none;
  border: none;
  padding: 2px;
  height: 32px;
  display: flex;
  align-items: center;
  cursor: pointer;
  border-radius: 16px;
}

.topbar-avatar:hover {
  background: var(--bg-surface-hover);
}

.topbar-avatar-initials {
  background: #95bf47;
  color: #fff;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

/* ============================================================
   CARDS
   ============================================================ */
.admin-card {
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-subdued);
}

.admin-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.admin-card-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ============================================================
   DATA TABLE (Reusable .sv-table) & Toolbar
   ============================================================ */
.sv-table-wrapper {
  background: var(--bg-surface);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-subdued);
  overflow: hidden;
}

/* Toolbar: search + filters */
.sv-table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subdued);
  background: var(--bg-surface);
  flex-wrap: wrap;
}

/* Base button style for toolbar actions (handled by .btn now) */
.sv-table-search {
  position: relative;
  min-width: 160px;
}

.sv-table-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  width: 14px;
  height: 14px;
}

.sv-table-search input {
  height: 32px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border-base);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-family);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  width: 100%;
}

.sv-table-search input:hover {
  border-color: #8c9196;
}

.sv-table-search input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.sv-table-search input::placeholder {
  color: var(--text-secondary);
}

/* The actual table */
.sv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--bg-surface);
}

.sv-table thead th {
  height: 36px;
  padding: 8px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f7f7f7;
  /* Matching Shopify grey table header */
  border-bottom: 1px solid var(--border-subdued);
  white-space: nowrap;
  user-select: none;
}

.sv-table thead th.sortable {
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.sv-table thead th.sortable:hover {
  background: #f1f2f3;
  color: var(--text-primary);
}

.sv-table thead th .sort-indicator {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: 0;
}

.sv-table thead th.sortable:hover .sort-indicator {
  opacity: 0.5;
}

.sv-table thead th.sort-asc .sort-indicator,
.sv-table thead th.sort-desc .sort-indicator {
  opacity: 1;
}

.sv-table thead th.sort-asc .sort-indicator::after {
  content: '▲';
}

.sv-table thead th.sort-desc .sort-indicator::after {
  content: '▼';
}

.sv-table tbody tr {
  border-bottom: 1px solid var(--border-subdued);
  transition: background 0.1s;
}

.sv-table tbody tr:last-child {
  border-bottom: none;
}

.sv-table tbody tr:hover {
  background: #fafafa;
}

.sv-table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  color: var(--text-primary);
}

.sv-table tbody td a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
}

.sv-table tbody td a:hover {
  text-decoration: underline;
}

/* Monospaced IDs */
.sv-table .col-id {
  font-family: var(--font-family);
  font-weight: 600;
}

/* Row icons/indicators formatting */
.sv-table .row-icon {
  color: #bd271e;
  /* Example red for warning icons like the screenshot */
  margin-right: 4px;
  vertical-align: middle;
}

/* Numeric / price columns */
.sv-table .col-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Empty state */
.sv-table-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.sv-table-empty-icon {
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.2;
}

.status-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Base states (Shopify uses mostly neutral except for actionable/fulfilled) */
.status-badge {
  background: var(--badge-bg-neutral);
  color: var(--badge-text-neutral);
}

.status-badge::before {
  background: var(--border-base);
}

/* Specific Overrides based on Shopify */
.status-badge.status-pending,
.status-badge.status-unfulfilled {
  background: var(--badge-bg-warning);
  color: var(--badge-text-warning);
}

.status-badge.status-pending::before,
.status-badge.status-unfulfilled::before {
  background: var(--badge-text-warning);
}

.status-badge.status-paid,
.status-badge.status-fulfilled,
.status-badge.status-active {
  background: var(--badge-bg-neutral);
  color: var(--badge-text-neutral);
}

.status-badge.status-paid::before,
.status-badge.status-fulfilled::before,
.status-badge.status-active::before {
  background: var(--text-secondary);
}

.status-badge.status-partially_paid {
  background: #ffd79d;
  color: #8a6116;
}

.status-badge.status-partially_paid::before {
  background: #8a6116;
}

.status-badge.status-cancelled,
.status-badge.status-failed {
  background: var(--badge-bg-critical);
  color: var(--badge-text-critical);
}

.status-badge.status-cancelled::before,
.status-badge.status-failed::before {
  background: var(--badge-text-critical);
}

.status-badge.status-idle,
.status-badge.status-inactive {
  background: var(--badge-bg-neutral);
  color: var(--text-secondary);
}

.status-badge.status-idle::before,
.status-badge.status-inactive::before {
  background: var(--text-secondary);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s, box-shadow 0.1s;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-base);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: #8c9196;
}

.btn-secondary:active {
  background: var(--bg-surface-active);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary {
  background: var(--accent-base);
  color: #ffffff;
  border: 1px solid var(--border-focus);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

/* Base Link */
a {
  color: #2c6ecb;
  /* Shopify blue link */
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================================
   ANALYTICS CARDS
   ============================================================ */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-section {
  margin-bottom: 32px;
}

.settings-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
}

/* ============================================================
   EDITOR LAYOUT (Universal Create / Edit Forms)
   ============================================================ */
.editor-topbar {
  background: #1a1a1a;
  color: #fff;
}

.editor-topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e3e3e3;
  font-size: 14px;
  font-weight: 500;
}

.editor-topbar-status svg {
  color: #a1a1a1;
}

.btn-discard {
  background: transparent;
  color: #e3e3e3;
  border: none;
  font-weight: 500;
  padding: 6px 16px;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
  font-size: 14px;
}

.btn-discard:hover {
  opacity: 0.8;
  color: #fff;
  text-decoration: none;
}

.btn-save {
  background: #fff;
  color: #1a1a1a;
  border: none;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 14px;
}

.btn-save:hover {
  background: #f1f2f3;
}

/* Editor Wrapper & Grid Layout */
.editor-wrap {
  max-width: 1040px;
  margin: 0 auto;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.editor-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border-radius: 4px;
  width: 32px;
  height: 32px;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.editor-back-link:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  text-decoration: none;
}

.editor-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* 2-column layout mapping exactly to Shopify reference */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
  margin-bottom: 32px;
}

.editor-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.editor-section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row>.form-group {
  flex: 1;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #8c9196;
  /* Shopify grey border */
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-family);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-input:hover,
.form-select:hover {
  border-color: #5c5f62;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.form-input::placeholder {
  color: var(--text-secondary);
}

.form-checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
}

.form-checkbox {
  width: 16px;
  height: 16px;
  border: 1px solid #8c9196;
  border-radius: 4px;
  margin-top: 2px;
}

.form-checkbox-label {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.form-checkbox-label span {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
  font-size: 14px;
}

/* ============================================================
   ERROR PAGES
   ============================================================ */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}

.error-page h1 {
  font-size: 72px;
  font-weight: 700;
  margin: 0;
  color: var(--text-disabled);
}

.error-page p {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 8px 0 24px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
  }

  .topbar-menu-toggle {
    display: flex;
  }

  .admin-content {
    padding: 16px;
  }

  .topbar-search-kbd {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .topbar-center {
    display: none;
  }
}

/* ============================================================
   MACHINE GRID (Dashboard)
   ============================================================ */
.machine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .machine-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* New Machine Card Design */
.machine-card-new {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-subdued);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.machine-card-new:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.machine-card-new.is-running {
  border: 1.5px solid #2ecc71;
}

/* Header */
.machine-card-new-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.machine-card-new-title-group {
  display: flex;
  flex-direction: column;
}

.machine-card-new-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.machine-card-new-model {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  margin-top: 2px;
}

/* Drum Icon Center */
.machine-card-new-center {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

/* SVG Drum Styles */
.drum-icon {
  width: 72px;
  height: 72px;
}

.drum-outer {
  stroke: #e2e8f0;
  stroke-width: 2;
  fill: none;
}

.drum-middle {
  stroke: #cbd5e1;
  stroke-width: 1.5;
  fill: none;
}

.drum-inner-group {
  transform-origin: 36px 36px;
  /* center of 72x72 */
}

.machine-card-new.is-running .drum-inner-group {
  animation: drum-spin 2.5s linear infinite;
}

@keyframes drum-spin {
  100% {
    transform: rotate(360deg);
  }
}

.drum-hole {
  fill: #e2e8f0;
  transition: fill 0.3s;
}

.drum-center-dot {
  fill: #cbd5e1;
  transition: fill 0.3s;
}

.machine-card-new.is-running .drum-hole {
  fill: #2ecc71;
}

.machine-card-new.is-running .drum-center-dot {
  fill: #2ecc71;
}

/* Badge */
.machine-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.machine-status-badge.idle {
  background: #f1f5f9;
  color: #64748b;
}

.machine-status-badge.idle .badge-dot {
  background: #94a3b8;
}

.machine-status-badge.running {
  background: #dcfce7;
  color: #166534;
}

.machine-status-badge.running .badge-dot {
  background: #16a34a;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* Footer */
.machine-card-new-footer {
  border-top: 1px solid var(--border-subdued);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-text-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.footer-info-left {
  color: var(--text-secondary);
}

.footer-info-right {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.machine-progress-bar-bg {
  width: 100%;
  height: 3px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.machine-progress-bar-fill {
  height: 100%;
  background: #2ecc71;
  width: 0%;
  border-radius: 2px;
  transition: width 1s linear;
}

/* ============================================================
   REUSABLE MODAL (sv-modal)
   ============================================================ */
.sv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modal-overlay-in 0.15s ease;
}

.sv-modal-overlay.is-open {
  display: flex;
}

@keyframes modal-overlay-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.sv-modal-dialog {
  background: var(--bg-surface);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  width: 100%;
  animation: modal-slide-in 0.2s ease;
}

.sv-modal-sm {
  max-width: 420px;
}

.sv-modal-md {
  max-width: 560px;
}

.sv-modal-lg {
  max-width: 720px;
}

@keyframes modal-slide-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.sv-modal-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sv-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.sv-modal-back {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.sv-modal-back:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.sv-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
}

.sv-modal-close:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.sv-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.sv-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-subdued);
  flex-shrink: 0;
}

/* Start Machine Flow (SMF) */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.smf-step {
  animation: fadeIn 0.2s ease-out;
}

.smf-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.smf-card {
  border: 1px solid var(--border-subdued);
  background: var(--bg-surface);
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.smf-card:hover {
  border-color: var(--accent-base);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-subdued);
  border-top-color: var(--accent-base);
  border-radius: 50%;
  animation: spinner-spin 0.8s linear infinite;
}

@keyframes spinner-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Machine-specific status badges */
.status-badge.status-running {
  background: var(--badge-bg-success);
  color: var(--badge-text-success);
}

.status-badge.status-running::before {
  background: var(--badge-text-success);
}

.status-badge.status-maintenance {
  background: var(--badge-bg-info);
  color: var(--badge-text-info);
}

.status-badge.status-maintenance::before {
  background: var(--badge-text-info);
}

.status-badge.status-error {
  background: var(--badge-bg-critical);
  color: var(--badge-text-critical);
}

.status-badge.status-error::before {
  background: var(--badge-text-critical);
}

.status-badge.status-offline {
  background: var(--badge-bg-neutral);
  color: var(--text-secondary);
}

.status-badge.status-offline::before {
  background: var(--text-secondary);
}

/* Order-specific status badges */
.status-badge.status-washing {
  background: var(--badge-bg-info);
  color: var(--badge-text-info);
}

.status-badge.status-washing::before {
  background: var(--badge-text-info);
}

.status-badge.status-ready_for_pickup {
  background: var(--badge-bg-success);
  color: var(--badge-text-success);
}

.status-badge.status-ready_for_pickup::before {
  background: var(--badge-text-success);
}

.status-badge.status-completed {
  background: var(--badge-bg-neutral);
  color: var(--text-secondary);
}

.status-badge.status-completed::before {
  background: var(--text-secondary);
}

/* Session-specific status badges */
.status-badge.status-queued {
  background: var(--badge-bg-warning);
  color: var(--badge-text-warning);
}

.status-badge.status-queued::before {
  background: var(--badge-text-warning);
}

.status-badge.status-done {
  background: var(--badge-bg-success);
  color: var(--badge-text-success);
}

.status-badge.status-done::before {
  background: var(--badge-text-success);
}

/* Danger button for finishing a session */
.btn-danger {
  background: #d72c0d;
  color: #ffffff;
  border: 1px solid #b71c1c;
  font-size: 13px;
  font-weight: 500;
  padding: 0 12px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger:hover {
  background: #bc2200;
}

.error-text {
  color: var(--badge-text-critical);
  font-size: 14px;
  text-align: center;
  padding: 24px;
}