/* =====================================================
   Truelove's Laser WorX — CRM Dashboard Styles
   Matches brand: Montserrat, clean white, warm accents
   ===================================================== */

/* Font loaded via <link> in base.html for performance (preconnect + no render-blocking @import) */

:root {
  --bg:          #f4f2ef;
  --surface:     #ffffff;
  --surface2:    #f9f8f6;
  --border:      #e5e0d8;
  --accent:      #c45c14;
  --accent-light: rgba(196,92,20,0.1);
  --accent-hover: #a84e10;
  --sidebar-bg:  #1a1a1a;
  --sidebar-text: #c8c0b4;
  --sidebar-active: #c45c14;
  --text:        #1a1a1a;
  --text-muted:  #6b6560;
  --text-dim:    #a8a09a;
  --green:       #2d7a3a;
  --green-bg:    rgba(45,122,58,0.1);
  --red:         #c0392b;
  --red-bg:      rgba(192,57,43,0.1);
  --yellow:      #b7860a;
  --yellow-bg:   rgba(183,134,10,0.1);
  --blue:        #1a5fa8;
  --blue-bg:     rgba(26,95,168,0.1);
  --purple:      #7c3aed;
  --purple-bg:   rgba(124,58,237,0.1);
  --pink:        #db2777;
  --pink-bg:     rgba(219,39,119,0.1);
  --warning:     #e67e22;
  --warning-bg:  rgba(230,126,34,0.1);
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.12);
  --sidebar-w:   230px;
  --font:        'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
button { touch-action: manipulation; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 2px 0 16px rgba(0,0,0,0.2);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  width: 100%;
  max-width: 180px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
  object-fit: contain;
}

.nav-links {
  list-style: none;
  padding: 16px 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-links li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
  letter-spacing: 0.2px;
}

.nav-links li a:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.06);
}

.nav-links li a.active {
  color: #ffffff;
  background: rgba(196,92,20,0.15);
  border-left-color: var(--sidebar-active);
}

.nav-links li a span { font-size: 16px; width: 20px; }

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}

.artchi-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 12px auto;
  border: 2px solid rgba(255,255,255,0.15);
}

.artchi-badge {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
}

.page-inner {
  padding: 36px;
  max-width: 1280px;
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 400;
}

/* ---- KPI Cards ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.kpi-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.kpi-card:hover::before { opacity: 1; }
.kpi-card:active { transform: scale(0.98); }
a.kpi-card { text-decoration: none; color: inherit; display: block; }

.kpi-icon { font-size: 22px; margin-bottom: 12px; }

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.5px;
}

.kpi-value.accent { color: var(--accent); }
.kpi-value.green  { color: var(--green); }
.kpi-value.yellow { color: var(--yellow); }

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

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

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-body { padding: 22px; }

/* ---- Grid Layouts ---- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* Compact 2-col for inline forms (modals, detail panels) */
.two-col-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* 3-col variant for wider form rows */
.three-col-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.chart-plus-list {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 2px solid var(--border);
  background: var(--surface2);
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Don't clip FullCalendar day cells */
.fc td {
  max-width: none;
  overflow: visible;
  white-space: normal;
  padding: 0;
  border-bottom: none;
}
td.td-wrap {
  white-space: normal;
  word-break: break-word;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }

.td-muted { color: var(--text-muted); font-size: 12px; font-weight: 500; }
.td-mono  { font-variant-numeric: tabular-nums; }
.td-red   { color: var(--red); font-size: 12px; font-weight: 600; }

/* ---- Status Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-orange { background: var(--accent-light); color: var(--accent); }
.badge-gray   { background: #f0ece6; color: var(--text-muted); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-family: var(--font);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  letter-spacing: 0.2px;
  touch-action: manipulation;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover { color: var(--text); border-color: var(--text-muted); text-decoration: none; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-secondary { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }
.btn-danger  { background: var(--red-bg);   color: var(--red);   border: 1px solid transparent; }
.btn-danger:hover  { background: var(--red);   color: #fff; }
.btn-success { background: var(--green-bg); color: var(--green); border: 1px solid transparent; }
.btn-success:hover { background: var(--green); color: #fff; }

/* ---- Forms ---- */
.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type=text],
input[type=email],
input[type=number],
input[type=date],
select,
textarea {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 13px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

textarea { resize: vertical; min-height: 80px; }

/* Alias for inline form inputs that need explicit class */
.form-input {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 13px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---- Filter select (standalone year/period pickers) ---- */
.filter-select {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 13px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
}
.filter-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* ---- Filter bar ---- */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar input[type=text] { min-width: 240px; }

/* ---- Customer profile ---- */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.profile-field { display: flex; flex-direction: column; gap: 4px; }

.profile-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
}

.profile-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.profile-value.big {
  font-size: 26px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.5px;
}

.profile-value.muted { color: var(--text-muted); font-weight: 400; }

/* ---- Chart containers ---- */
.chart-wrap { position: relative; height: 250px; }

/* ---- P&L table ---- */
.pl-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.pl-table td.pos { color: var(--green); font-weight: 600; }
.pl-table td.neg { color: var(--red); font-weight: 600; }

.pl-table tr.subtotal td {
  border-top: 2px solid var(--border);
  font-weight: 700;
  background: var(--surface2);
}

.pl-table tr.section-header td {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-top: 20px;
  font-weight: 800;
  background: transparent;
}

/* ---- Follow-up priority ---- */
.priority-high   { color: var(--red); font-weight: 700; }
.priority-medium { color: var(--yellow); font-weight: 600; }
.priority-low    { color: var(--text-muted); }

/* ---- Flash messages ---- */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
}
.flash-success { background: rgba(45,122,58,0.1); color: var(--green); }
.flash-error   { background: rgba(192,57,43,0.1); color: var(--red); }
.flash-warning { background: var(--warning-bg); color: var(--warning); }
.flash-info    { background: var(--blue-bg); color: var(--blue); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; font-weight: 500; }

/* ---- Breadcrumb ---- */
.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 18px;
  font-weight: 500;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 6px; }

/* ---- Divider ---- */
hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }

/* ---- Mobile header (hidden on desktop) ---- */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--sidebar-bg);
  z-index: 200;
  align-items: center;
  padding: 0 14px;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.mobile-header-brand {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}
.mobile-hamburger {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

/* ---- Sidebar overlay backdrop ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .two-col, .chart-plus-list { grid-template-columns: 1fr; }
  .two-col-form, .three-col-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .two-col-form, .three-col-form { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .brand-name, .sidebar .brand-sub, .nav-links li a span:not(:first-child) { display: none; }
  .main-content { margin-left: 60px; }
  .page-inner { padding: 20px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  /* Show mobile header bar */
  .mobile-header { display: flex; }

  /* Sidebar becomes a slide-in overlay */
  .sidebar {
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 160;
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-overlay.sidebar-open { display: block; }

  /* Nav labels visible again inside slide-out sidebar */
  .sidebar .brand-name, .sidebar .brand-sub,
  .nav-links li a span:not(:first-child) { display: unset; }

  /* Main content: full width, top padding for mobile header */
  .main-content { margin-left: 0; padding-top: 52px; }
  .page-inner { padding: 14px; }

  /* Page header: stack title above action buttons */
  .page-header { flex-direction: column; gap: 10px; align-items: flex-start; }
  .page-header > div, .page-header > form { width: 100%; }

  /* KPI grid: 2 columns on phone */
  .kpi-grid { grid-template-columns: 1fr 1fr; }

  /* Filter bars wrap */
  .filter-bar { flex-wrap: wrap; }

  /* Artchi popup: full screen */
  #artchi-popup {
    left: 0 !important;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 85vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-inner { padding: 12px; }
}

/* ---- Misc ---- */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.mt-0 { margin-top: 0 !important; }

/* ---- Progress bar ---- */
.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.progress-fill.green  { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }

/* ---- Stat box (mini KPI tile) ---- */
.stat-box {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-box-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
}
.stat-box-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Tag chip ---- */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  text-transform: lowercase;
}
.tag-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
  opacity: 0.7;
}
.tag-chip-remove:hover { opacity: 1; }

/* ---- Section dividers ---- */
.section-gap { margin-bottom: 24px; }

/* ---- Production Queue ---- */
.prod-summary-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.prod-summary-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  text-align: center;
  min-width: 90px;
}
.prod-summary-count { display: block; font-size: 24px; font-weight: 800; color: var(--accent); }
.prod-summary-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.prod-queue { display: flex; flex-direction: column; gap: 12px; }

.prod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.prod-overdue   { border-left-color: var(--red); background: rgba(192,57,43,0.03); }
.prod-due-soon  { border-left-color: var(--yellow); }

.prod-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.prod-card-id   { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.prod-card-due  { font-size: 13px; }
.prod-card-body { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.prod-card-main { flex: 1; }
.prod-customer  { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.prod-desc      { color: var(--text-muted); font-size: 13px; margin-bottom: 4px; }
.prod-machine   { font-size: 12px; color: var(--text-dim); margin-bottom: 2px; }
.prod-notes     { font-size: 12px; color: var(--text-muted); font-style: italic; margin-top: 4px; }
.prod-card-value { font-size: 18px; font-weight: 800; color: var(--accent); white-space: nowrap; margin-left: 16px; }

.prod-update-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.prod-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 12px;
  font-family: var(--font);
  background: var(--surface2);
  color: var(--text);
}
.prod-date {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 12px;
  font-family: var(--font);
  background: var(--surface2);
  color: var(--text);
}

/* Status badges for orders */
.badge-status-quote       { background: var(--blue-bg);   color: var(--blue); }
.badge-status-pending     { background: var(--yellow-bg); color: var(--yellow); }
.badge-status-in-progress { background: var(--accent-light); color: var(--accent); }
.badge-status-complete    { background: var(--green-bg);  color: var(--green); }
.badge-status-delivered   { background: rgba(107,101,96,0.1); color: var(--text-muted); }
.badge-status-cancelled   { background: var(--red-bg);    color: var(--red); }

/* ---- Task Manager ---- */
.overdue-row td { background: rgba(192,57,43,0.04); }
.check-btn {
  background: none; border: 2px solid var(--border); border-radius: 50%;
  width: 22px; height: 22px; cursor: pointer; font-size: 0; color: transparent;
  transition: border-color 0.15s, background 0.15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.check-btn:hover { border-color: var(--green); background: var(--green-bg); }

/* Category badges */
.badge-cat-order-production { background: rgba(196,92,20,0.12); color: #c45c14; }
.badge-cat-follow-up        { background: rgba(26,95,168,0.12);  color: #1a5fa8; }
.badge-cat-admin            { background: rgba(107,101,96,0.12); color: #6b6560; }
.badge-cat-marketing        { background: var(--purple-bg); color: var(--purple); }
.badge-cat-maintenance      { background: var(--yellow-bg); color: var(--yellow); }
.badge-cat-finance          { background: var(--green-bg);  color: var(--green); }
.badge-cat-social-media     { background: var(--pink-bg);   color: var(--pink); }

/* Priority badges */
.badge-pri-high   { background: rgba(192,57,43,0.12);  color: var(--red); }
.badge-pri-medium { background: rgba(183,134,10,0.12); color: var(--yellow); }
.badge-pri-low    { background: rgba(107,101,96,0.12); color: var(--text-muted); }

/* ---- Artchi Chat Popup ---- */
.sidebar-footer:hover { background: rgba(255,255,255,0.07); }

#artchi-popup {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  width: 360px;
  max-height: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 9001;
  overflow: hidden;
  overscroll-behavior: contain;
}
#artchi-popup.open { display: flex; }

#artchi-popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--sidebar-bg);
  color: #fff;
}
#artchi-popup-header img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
#artchi-agent-label { font-size: 12px; color: #a0a0a0; margin-left: auto; }
#artchi-clear-btn {
  background: none; border: none; color: #888; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0 4px;
}
#artchi-clear-btn:hover { color: #fff; }

#artchi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface2);
}
.artchi-msg {
  max-width: 90%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.artchi-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.artchi-msg.artchi {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.artchi-msg.thinking {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-style: italic;
  border-bottom-left-radius: 4px;
}

#artchi-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
#artchi-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  resize: none;
  outline: none;
}
#artchi-input:focus { border-color: var(--accent); }
#artchi-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}
#artchi-send:hover { background: var(--accent-hover); }
#artchi-send:disabled { opacity: 0.5; cursor: default; }
#artchi-close-btn {
  background: none; border: none; color: #888; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0 4px;
}

/* ---- Supplies ---- */
.reorder-row { background: rgba(192,57,43,0.04); }
.reorder-row:hover { background: rgba(192,57,43,0.08) !important; }
#artchi-close-btn:hover { color: #fff; }

/* ---- Sticky sidebar on order edit: account for mobile header ---- */
@media (max-width: 600px) {
  .sticky-sidebar { top: 72px !important; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ---- Screen reader only ---- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
