/* ============================================================
   BenchTracker Design System
   Dark navy + cyan theme
   ============================================================ */

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

:root {
  /* Brand Colors */
  --navy-950: #060d14;
  --navy-900: #0a1520;
  --navy-800: #0f1f2e;
  --navy-750: #132535;
  --navy-700: #172d3f;
  --navy-600: #1e3a50;
  --navy-500: #255068;
  --navy-400: #2e6585;
  --cyan-500:  #1e90c8;
  --cyan-400:  #29a8e8;
  --cyan-300:  #5cc0f0;
  --cyan-200:  #9ddaf5;
  --cyan-glow: rgba(30, 144, 200, 0.15);

  /* Semantic Colors */
  --bg-base:    var(--navy-950);
  --bg-surface: var(--navy-900);
  --bg-card:    var(--navy-800);
  --bg-input:   var(--navy-750);
  --bg-hover:   var(--navy-700);
  --bg-active:  var(--navy-600);

  --border:       rgba(30, 144, 200, 0.18);
  --border-hover: rgba(30, 144, 200, 0.38);
  --border-focus: var(--cyan-500);

  --text-primary:   #e8f2fa;
  --text-secondary: #8faec8;
  --text-muted:     #4d7090;
  --text-inverse:   #060d14;

  /* Status Colors */
  --status-intake:          #8faec8;
  --status-pending:         #d4a843;
  --status-in_progress:     #29a8e8;
  --status-waiting_parts:   #e07b2a;
  --status-waiting_customer:#9b6fd4;
  --status-ready:           #2ec47a;
  --status-completed:       #2ec47a;
  --status-closed:          #4d7090;
  --status-cancelled:       #c45252;

  --priority-low:    #4d7090;
  --priority-normal: #8faec8;
  --priority-high:   #d4a843;
  --priority-urgent: #c45252;

  --success: #2ec47a;
  --warning: #d4a843;
  --danger:  #c45252;
  --info:    #29a8e8;

  /* Layout */
  --sidebar-width: 230px;
  --topbar-height: 56px;
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Typography */
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', 'Fira Code', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.4);
  --shadow:    0 2px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --glow:      0 0 0 3px var(--cyan-glow);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan-400); text-decoration: none; }
a:hover { color: var(--cyan-300); text-decoration: underline; }

/* ============================================================
   Layout Shell
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 22px 22px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.sidebar-brand .brand-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--cyan-400);
  letter-spacing: -0.01em;
  display: block;
}

.sidebar-brand .brand-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
  display: block;
}

.sidebar-brand img.brand-logo {
  max-height: 132px;
  max-width: 132px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-item.active {
  background: linear-gradient(90deg, var(--cyan-glow), transparent);
  border-left-color: var(--cyan-500);
  color: var(--cyan-300);
  font-weight: 500;
}

.nav-item .nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--cyan-500);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---- Main content ---- */
.main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

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

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.avatar {
  width: 30px;
  height: 30px;
  background: var(--navy-600);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cyan-300);
  flex-shrink: 0;
}

.page-content {
  padding: 28px 28px;
  flex: 1;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-sm { padding: 16px; }
.card-lg { padding: 32px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   Dashboard Stat Cards
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cyan-500);
}

.stat-card.warning::before { background: var(--warning); }
.stat-card.success::before { background: var(--success); }
.stat-card.danger::before  { background: var(--danger); }

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.stat-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--cyan-500);
  color: #fff;
  border-color: var(--cyan-500);
}
.btn-primary:hover:not(:disabled) {
  background: var(--cyan-400);
  border-color: var(--cyan-400);
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  text-decoration: none;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(196, 82, 82, 0.12);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.btn-sm  { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg  { padding: 11px 22px; font-size: 0.95rem; }
.btn-xl  { padding: 13px 28px; font-size: 1rem; }
.btn-icon { padding: 7px; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-label .required { color: var(--danger); margin-left: 3px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.88rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: var(--glow);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234d7090' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 4px;
}

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

/* Toggle / Checkbox */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--cyan-500);
  cursor: pointer;
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table.bt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.bt-table thead tr {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.bt-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.bt-table td {
  padding: 12px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(30, 144, 200, 0.07);
  vertical-align: middle;
}

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

.bt-table tbody tr {
  transition: background 0.1s;
}

.bt-table tbody tr:hover {
  background: var(--bg-hover);
  cursor: pointer;
}

.bt-table .col-actions {
  text-align: right;
  white-space: nowrap;
}

/* ============================================================
   Badges / Status Pills
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Status badges */
.badge-intake          { background: rgba(143,174,200,0.15); color: var(--status-intake); }
.badge-pending         { background: rgba(212,168,67,0.15);  color: var(--status-pending); }
.badge-in_progress     { background: rgba(41,168,232,0.15);  color: var(--status-in_progress); }
.badge-waiting_parts   { background: rgba(224,123,42,0.15);  color: var(--status-waiting_parts); }
.badge-waiting_customer{ background: rgba(155,111,212,0.15); color: var(--status-waiting_customer); }
.badge-ready           { background: rgba(46,196,122,0.15);  color: var(--status-ready); }
.badge-completed       { background: rgba(46,196,122,0.15);  color: var(--status-completed); }
.badge-closed          { background: rgba(77,112,144,0.15);  color: var(--status-closed); }
.badge-cancelled       { background: rgba(196,82,82,0.15);   color: var(--status-cancelled); }

/* Payment status */
.badge-draft    { background: rgba(77,112,144,0.15); color: var(--text-muted); }
.badge-unpaid   { background: rgba(41,168,232,0.12); color: var(--info); }
.badge-sent     { background: rgba(41,168,232,0.15); color: var(--info); }
.badge-partial  { background: rgba(212,168,67,0.15); color: var(--warning); }
.badge-paid     { background: rgba(46,196,122,0.15); color: var(--success); }
.badge-void     { background: rgba(196,82,82,0.1);   color: var(--danger); }
.badge-overdue  { background: rgba(196,82,82,0.15);  color: var(--danger); }

/* Priority */
.badge-low    { background: rgba(77,112,144,0.15);  color: var(--priority-low); }
.badge-normal { background: rgba(143,174,200,0.12); color: var(--priority-normal); }
.badge-high   { background: rgba(212,168,67,0.15);  color: var(--priority-high); }
.badge-urgent { background: rgba(196,82,82,0.15);   color: var(--priority-urgent); }

/* Tax exempt */
.badge-exempt { background: rgba(155,111,212,0.15); color: #a87ddc; }

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

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap input {
  padding-left: 34px;
}

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

.page-header-left h1 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-header-left p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--cyan-300); text-decoration: none; }
.breadcrumb .sep { color: var(--text-muted); opacity: 0.5; }

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active {
  color: var(--cyan-400);
  border-bottom-color: var(--cyan-500);
}

/* ============================================================
   Modals
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 13, 20, 0.8);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 600;
}

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

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-success { background: rgba(46,196,122,0.12); border: 1px solid rgba(46,196,122,0.3); color: #4fe09a; }
.alert-warning { background: rgba(212,168,67,0.12); border: 1px solid rgba(212,168,67,0.3); color: #e0b84a; }
.alert-danger  { background: rgba(196,82,82,0.12);  border: 1px solid rgba(196,82,82,0.3);  color: #d97070; }
.alert-info    { background: rgba(41,168,232,0.12); border: 1px solid rgba(41,168,232,0.3); color: #5cc0f0; }

/* ============================================================
   Invoice-specific
   ============================================================ */
.invoice-totals {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.total-row.final {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================================
   Ticket timeline
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--navy-700);
  border: 2px solid var(--cyan-500);
}

.timeline-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline-content {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.85rem;
}

/* ============================================================
   Utilities
   ============================================================ */
.text-muted    { color: var(--text-muted) !important; }
.text-secondary{ color: var(--text-secondary) !important; }
.text-success  { color: var(--success) !important; }
.text-warning  { color: var(--warning) !important; }
.text-danger   { color: var(--danger) !important; }
.text-cyan     { color: var(--cyan-400) !important; }
.text-sm       { font-size: 0.8rem; }
.text-xs       { font-size: 0.72rem; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.mono          { font-family: var(--mono); }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.w-100 { width: 100%; }
.mw-400 { max-width: 400px; }
.mw-600 { max-width: 600px; }
.mw-800 { max-width: 800px; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 0.82rem; }

/* ============================================================
   Login page (standalone)
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30,144,200,0.07) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-brand-image {
  display: block;
  margin: 0 auto 16px;
  max-width: 300px;
  max-height: 150px;
  width: auto;
  height: auto;
  object-fit: contain;
}


.login-logo .brand-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--cyan-400);
  letter-spacing: -0.02em;
}

.login-logo .brand-tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}


.login-restricted-notice {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 184, 77, 0.35);
  background: rgba(255, 184, 77, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.45;
}

.login-restricted-notice strong {
  display: block;
  color: var(--warning);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.login-restricted-notice p {
  margin: 0 0 8px;
}

.login-ip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.login-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

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

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); width: 240px; }
  .main-wrap { margin-left: 0; }
  .page-content { padding: 16px; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   Invoice View Polish - v0.5.2
   ============================================================ */
.invoice-view-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.invoice-side-card {
  position: sticky;
  top: 20px;
}

.invoice-key-values {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
}

.invoice-key-values > div,
.invoice-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: baseline;
}

.invoice-key-values span,
.invoice-summary-row span {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.invoice-key-values strong,
.invoice-summary-row strong,
.bt-table .money,
.bt-table .num {
  font-variant-numeric: tabular-nums;
}

.invoice-key-values .balance strong,
.invoice-summary-row.balance strong {
  color: var(--cyan-400);
}

.invoice-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.invoice-side-form {
  margin-top: 14px;
}

.invoice-main-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.invoice-table-wrap {
  margin-top: 4px;
}

.invoice-items-table {
  table-layout: fixed;
}

.invoice-items-table th,
.invoice-items-table td {
  vertical-align: top;
}

.invoice-items-table .invoice-col-type { width: 105px; }
.invoice-items-table .invoice-col-qty { width: 80px; }
.invoice-items-table .invoice-col-money { width: 125px; }
.invoice-items-table .invoice-col-tax { width: 95px; }

.bt-table th.money,
.bt-table td.money,
.bt-table th.num,
.bt-table td.num {
  text-align: right;
  white-space: nowrap;
}

.invoice-description {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.invoice-summary-box {
  width: 360px;
  max-width: 100%;
  margin-left: auto;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  padding: 14px 16px;
}

.invoice-summary-row {
  padding: 5px 0;
}

.invoice-summary-row.total {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 1rem;
}

.invoice-summary-row.balance {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(30, 144, 200, 0.22);
  font-size: 1.05rem;
}

@media (max-width: 980px) {
  .invoice-view-grid {
    grid-template-columns: 1fr;
  }
  .invoice-side-card {
    position: static;
  }
}


/* =========================================================
   BenchTracker UI Foundation Polish v0.5.3
   Adds stronger spacing, contrast layers, and consistent section separation.
   ========================================================= */

:root {
  --bt-page-gap: 24px;
  --bt-section-gap: 22px;
  --bt-card-pad: 22px;
  --bt-card-pad-sm: 16px;
  --bt-surface-strong: rgba(15, 28, 42, 0.96);
  --bt-surface-soft: rgba(20, 36, 52, 0.92);
  --bt-border-strong: rgba(126, 200, 240, 0.18);
  --bt-border-soft: rgba(255, 255, 255, 0.08);
  --bt-shadow-card: 0 14px 35px rgba(0, 0, 0, 0.22);
}

.main-content,
.content,
.page-content {
  gap: var(--bt-page-gap);
}

.page-header,
.content-header {
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bt-border-soft);
}

.page-header h1,
.content-header h1,
h1.page-title {
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.page-header p,
.content-header p,
.page-subtitle {
  color: var(--text-muted);
  line-height: 1.55;
}

.card,
.panel,
.bt-card,
.stat-card,
.invoice-card,
.ticket-card,
.customer-card,
.device-card {
  background: linear-gradient(180deg, var(--bt-surface-soft), var(--bt-surface-strong));
  border: 1px solid var(--bt-border-strong);
  box-shadow: var(--bt-shadow-card);
}

.card,
.panel,
.bt-card,
.invoice-card,
.ticket-card,
.customer-card,
.device-card {
  margin-bottom: var(--bt-section-gap);
  padding: var(--bt-card-pad);
}

.card + .card,
.panel + .panel,
.bt-card + .bt-card,
.invoice-card + .invoice-card,
.ticket-card + .ticket-card,
.customer-card + .customer-card,
.device-card + .device-card {
  margin-top: var(--bt-section-gap);
}

.card-header,
.panel-header,
.bt-card-header,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: calc(var(--bt-card-pad) * -1) calc(var(--bt-card-pad) * -1) 18px;
  padding: 16px var(--bt-card-pad);
  border-bottom: 1px solid var(--bt-border-soft);
  background: rgba(255, 255, 255, 0.025);
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.card-title,
.panel-title,
.bt-card-title,
.section-title,
h2, h3 {
  letter-spacing: -0.01em;
}

.section-spacer,
.form-section,
.table-section,
.invoice-section {
  margin-top: var(--bt-section-gap);
  margin-bottom: var(--bt-section-gap);
}

.form-grid,
.grid,
.actions-row,
.button-row {
  gap: 16px;
}

.form-group,
.field,
.input-group {
  margin-bottom: 16px;
}

label,
.form-label {
  margin-bottom: 6px;
  color: rgba(226, 241, 255, 0.88);
  font-weight: 600;
}

input,
select,
textarea,
.form-control {
  background-color: rgba(8, 18, 29, 0.72);
  border-color: rgba(126, 200, 240, 0.20);
  color: var(--text-primary);
  caret-color: var(--cyan-300);
}

input::placeholder,
textarea::placeholder,
.form-control::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

select option {
  background-color: var(--navy-900);
  color: var(--text-primary);
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
  border-color: rgba(126, 200, 240, 0.55);
  box-shadow: 0 0 0 3px rgba(30, 144, 200, 0.14);
}

.table-wrap,
.bt-table-wrap,
.invoice-table-wrap {
  border: 1px solid var(--bt-border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(8, 18, 29, 0.35);
}

.bt-table,
table {
  border-collapse: collapse;
}

.bt-table th,
.bt-table td,
table th,
table td {
  padding: 12px 14px;
}

.bt-table thead th,
table thead th {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(226, 241, 255, 0.90);
  font-size: 0.78rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.bt-table tbody tr + tr,
table tbody tr + tr {
  border-top: 1px solid var(--bt-border-soft);
}

.bt-table tbody tr:hover,
table tbody tr:hover {
  background: rgba(126, 200, 240, 0.045);
}

.btn,
.button,
button {
  transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.btn:hover,
.button:hover,
button:hover {
  transform: translateY(-1px);
}

.status-badge,
.badge {
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.invoice-view-grid {
  gap: 26px;
}

.invoice-main-stack {
  gap: 26px;
}

.invoice-print-header,
.invoice-meta-grid,
.invoice-section,
.invoice-summary-box,
.invoice-history,
.invoice-actions,
.invoice-side-form {
  margin-bottom: 24px;
}

.invoice-key-values {
  gap: 10px;
}

.invoice-summary-box {
  margin-top: 24px;
  background: linear-gradient(180deg, rgba(20, 36, 52, 0.98), rgba(11, 24, 38, 0.98));
  border-color: rgba(126, 200, 240, 0.22);
}

.invoice-summary-row {
  padding: 7px 0;
}

.invoice-summary-row.total,
.invoice-summary-row.balance {
  margin-top: 10px;
}

.alert,
.notice,
.flash,
.empty-state {
  margin-bottom: 20px;
  border: 1px solid var(--bt-border-strong);
  background: rgba(126, 200, 240, 0.06);
}

@media (max-width: 760px) {
  :root {
    --bt-page-gap: 18px;
    --bt-section-gap: 18px;
    --bt-card-pad: 16px;
  }

  .card-header,
  .panel-header,
  .bt-card-header,
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   v0.6 Global Live Search / Workflow Speed Polish
   ============================================================ */
.global-search-wrap {
  width: min(480px, 42vw);
  max-width: 480px;
  min-width: 300px;
}

.global-search-results {
  position: fixed;
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: min(70vh, 620px);
  overflow-y: auto;
  padding: 8px;
}

.global-search-results[hidden] {
  display: none !important;
}

.global-search-group + .global-search-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.global-search-group-title {
  padding: 6px 10px 4px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.global-search-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.global-search-item:hover,
.global-search-item.active {
  background: rgba(30, 144, 200, 0.14);
}

.global-search-title {
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1.25;
}

.global-search-subtitle {
  margin-top: 3px;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.global-search-meta {
  flex: 0 0 auto;
  align-self: center;
  font-size: 0.68rem;
  color: var(--cyan-400, var(--accent));
  opacity: 0.9;
  white-space: nowrap;
}

.global-search-empty,
.global-search-loading,
.global-search-hint {
  padding: 14px 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.global-search-hint {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding: 8px 10px 4px;
  font-size: 0.68rem;
  text-align: left;
}

.workflow-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 22px;
  align-items: start;
}

.quick-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.quick-list-item:last-child {
  border-bottom: 0;
}

.quick-list-item:hover .quick-list-title {
  color: var(--cyan-400, var(--accent));
}

.quick-list-title {
  font-size: 0.87rem;
  font-weight: 650;
  color: var(--text-primary);
}

.quick-list-subtitle {
  margin-top: 2px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.quick-open-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 1100px) {
  .workflow-grid {
    grid-template-columns: 1fr;
  }
  .global-search-wrap {
    width: min(420px, 48vw);
    min-width: 240px;
  }
}

@media (max-width: 768px) {
  .topbar-actions {
    gap: 8px;
  }
  .global-search-wrap {
    width: 100%;
    min-width: 0;
  }
  .global-search-results {
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
  }
  .quick-open-grid {
    grid-template-columns: 1fr;
  }
}

/* BenchTracker v0.7 payment/Square readiness */
.square-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.inline-form {
  display: inline;
}
.mt-2 { margin-top: 8px; }
.payment-muted-row td { opacity: 0.72; }

/* v0.9 staff / permissions */
.check-card {
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:rgba(255,255,255,.025);
  color:var(--text-primary);
  cursor:pointer;
}
.check-card:hover { background:rgba(255,255,255,.045); border-color:rgba(125,211,252,.28); }
.check-card input { width:16px; height:16px; accent-color:var(--cyan-500); }

/* ============================================================
   Quick Quote System - v1.1
   ============================================================ */
.form-row.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.badge-primary { background: rgba(41,168,232,0.15); color: var(--info); }
@media (max-width: 980px) { .form-row.cols-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .form-row.cols-4 { grid-template-columns: 1fr; } }


/* BenchTracker v1.1.1 - Quick Quote search readability fix */
.quick-quote-search,
.inventory-search,
.part-search,
.quote-search,
.search-wrapper {
    position: relative;
    z-index: 50;
}

.quick-quote-results,
.inventory-search-results,
.part-search-results,
.quote-search-results,
.search-results-dropdown,
.live-search-results {
    background: #102235 !important;
    border: 1px solid rgba(62, 169, 245, 0.45) !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
    z-index: 9999 !important;
}

.quick-quote-results *,
.inventory-search-results *,
.part-search-results *,
.quote-search-results *,
.search-results-dropdown *,
.live-search-results * {
    opacity: 1 !important;
}

.quick-quote-results .result-item,
.inventory-search-results .result-item,
.part-search-results .result-item,
.quote-search-results .result-item,
.search-results-dropdown .result-item,
.live-search-results .result-item,
.quick-quote-results button,
.inventory-search-results button,
.part-search-results button,
.quote-search-results button {
    background: #13283d !important;
    color: #f3f8ff !important;
    border-bottom: 1px solid rgba(110, 178, 230, 0.18) !important;
}

.quick-quote-results .result-item:hover,
.inventory-search-results .result-item:hover,
.part-search-results .result-item:hover,
.quote-search-results .result-item:hover,
.search-results-dropdown .result-item:hover,
.live-search-results .result-item:hover,
.quick-quote-results button:hover,
.inventory-search-results button:hover,
.part-search-results button:hover,
.quote-search-results button:hover {
    background: #1b3853 !important;
}

.quick-quote-results small,
.inventory-search-results small,
.part-search-results small,
.quote-search-results small,
.search-results-dropdown small,
.live-search-results small,
.quick-quote-results .muted,
.inventory-search-results .muted,
.part-search-results .muted,
.quote-search-results .muted {
    color: #9fc4e4 !important;
}

/* Ensure labor preset cards do not visually bleed through dropdowns */
.labor-presets,
.quote-labor-presets,
.preset-grid {
    position: relative;
    z-index: 1;
}

/* ============================================================
   v1.4 Top Quick Action Bar
   ============================================================ */
.quick-action-bar {
  position: sticky;
  top: var(--topbar-height);
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 24px;
  background: rgba(10, 21, 32, 0.96);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-card), var(--bg-surface));
  color: var(--text-primary);
  font-size: .86rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.quick-action-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
  color: var(--cyan-300);
  text-decoration: none;
}
.payment-live-status {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: var(--radius);
  background: rgba(41,168,232,.08);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .84rem;
}
.payment-live-status.is-paid {
  background: rgba(46,196,122,.10);
  border-color: rgba(46,196,122,.35);
  color: var(--text-primary);
}
.contract-status-active { background: var(--success); color: #04130b; }
.contract-status-pending { background: var(--warning); color: #120d02; }
.contract-status-paused { background: var(--priority-high); color: #130c02; }
.contract-status-cancelled, .contract-status-expired { background: var(--danger); color: #fff; }
.contract-summary-grid { display:grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap:12px; margin-bottom:16px; }
.contract-summary-grid .stat { padding:14px; border:1px solid var(--border); border-radius:var(--radius); background:var(--bg-card); }
.contract-summary-grid .stat span { display:block; color:var(--text-muted); font-size:.78rem; text-transform:uppercase; letter-spacing:.06em; }
.contract-summary-grid .stat strong { display:block; font-size:1.25rem; margin-top:4px; }
@media (max-width: 768px) {
  .quick-action-bar { padding: 8px 12px; overflow-x: auto; flex-wrap: nowrap; }
  .quick-action-btn { font-size: .82rem; }
}

/* v1.5.4 SMS conversations */
.sms-row-unread {
  background: rgba(41,168,232,0.06);
  border-left: 3px solid var(--info);
  padding-left: 10px !important;
}
.topbar-sms-alert {
  margin-left: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(41,168,232,0.14);
  color: var(--info);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.badge-new, .badge-received { background: rgba(41,168,232,0.15); color: var(--info); }
.badge-read, .badge-replied { background: rgba(46,196,122,0.15); color: var(--success); }
.badge-follow_up { background: rgba(212,168,67,0.15); color: var(--warning); }
.badge-archived { background: rgba(77,112,144,0.15); color: var(--text-muted); }
.badge-spam, .badge-deleted { background: rgba(196,82,82,0.15); color: var(--danger); }


/* v1.5.5 customer SMS tabs */
.sms-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.sms-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(8, 22, 34, .55);
  color: var(--text-secondary);
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 700;
}
.sms-tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(41,168,232,.12);
  color: var(--info);
  font-size: .72rem;
}
.sms-tab.active,
.sms-tab:hover {
  border-color: rgba(41,168,232,.6);
  color: var(--text-primary);
  background: rgba(41,168,232,.13);
}
.sms-thread { padding-top: 4px; }
.sms-message {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.sms-message:last-child { border-bottom: 0; }
.sms-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--text-primary);
  font-size: .86rem;
}
.sms-message-meta .badge { margin-left: 6px; }
.sms-message-meta > span,
.sms-message-route {
  color: var(--text-muted);
  font-size: .75rem;
}
.sms-message-route { margin-top: 4px; }
.sms-message-body {
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: .9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.sms-ticket-link { margin-left: 6px; }
.sms-message-inbound .sms-message-body { color: var(--text-primary); }
.sms-message-outbound { opacity: .94; }
@media (max-width: 720px) {
  .sms-message-meta { align-items: flex-start; flex-direction: column; gap: 4px; }
  .sms-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 8px; }
  .sms-tab { white-space: nowrap; }
}

/* v1.5.6e ticket polish */
.ticket-view-grid{display:grid;grid-template-columns:380px 1fr;gap:20px;align-items:start;}
.ticket-main-stack{display:flex;flex-direction:column;gap:20px;}
.bt-collapse{padding:0;overflow:hidden;}
.bt-collapse-summary{display:flex;align-items:center;justify-content:space-between;gap:14px;cursor:pointer;list-style:none;padding:18px 22px;border-bottom:1px solid var(--border);}
.bt-collapse-summary::-webkit-details-marker{display:none;}
.bt-collapse-summary::after{content:'▾';color:var(--text-muted);font-size:.9rem;transition:transform .15s ease;}
.bt-collapse:not([open]) .bt-collapse-summary{border-bottom:0;}
.bt-collapse:not([open]) .bt-collapse-summary::after{transform:rotate(-90deg);}
.bt-collapse-body{padding:18px 22px;}
.bt-collapse-hint{font-size:.75rem;color:var(--text-muted);font-weight:400;margin-left:auto;}
.bt-section-action{display:flex;justify-content:flex-end;margin-bottom:12px;}
.status-link-actions{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0;}
.status-link-panel .mono{overflow-wrap:anywhere;word-break:break-word;}
.ticket-sms-row,.ticket-history-row{border-bottom:1px solid var(--border);padding:10px 0;}
.ticket-sms-row:last-child,.ticket-history-row:last-child{border-bottom:0;}
@media (max-width: 980px){.ticket-view-grid{grid-template-columns:1fr;}.ticket-side-card{position:static;}}

/* v1.5.9 operational polish */
.customer-sms-header { align-items: center; gap: 12px; }
.customer-sms-toggle {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: rgba(13, 36, 55, .72) !important;
  border: 1px solid rgba(72, 140, 184, .32) !important;
  border-radius: 14px;
  color: var(--text) !important;
  padding: 10px 12px;
  cursor: pointer;
  min-width: 0;
  flex: 1 1 auto;
  width: auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}
.customer-sms-toggle:hover { border-color: rgba(41,168,232,.58) !important; background: rgba(17, 50, 75, .92) !important; }
.customer-sms-toggle:focus { outline: 2px solid rgba(41,168,232,.35); outline-offset: 2px; }
.customer-sms-toggle .card-title,
.customer-sms-toggle .card-subtitle { display: block; color: inherit; background: transparent !important; }
.customer-sms-toggle .card-subtitle { color: var(--text-muted) !important; margin-top: 2px; }
.customer-sms-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 999px;
  color: #9ed8ff;
  background: rgba(41,168,232,.14);
  border: 1px solid rgba(41,168,232,.24);
  transition: transform .15s ease;
  font-size: .85rem;
  line-height: 1;
}
.sms-collapsed .customer-sms-chevron { transform: rotate(-90deg); }
.customer-sms-body { padding-top: 2px; }
.sms-thread.sms-thread-scrollable {
  max-height: 520px;
  overflow: auto;
  padding-right: 6px;
}
.sms-row-unread,
.sms-message-inbound[data-sms-filters~="active"] {
  border-left: 3px solid rgba(41,168,232,.65);
  padding-left: 10px;
}
.sms-quick-reply-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  flex: 1 1 100%;
  margin-bottom: 4px;
  width: 100%;
}
.sms-template-btn {
  font-size: .78rem;
  line-height: 1.25;
  padding: 8px 10px;
  min-height: 42px;
  height: auto;
  white-space: normal;
  text-align: left;
  justify-content: flex-start;
  align-items: center;
}
@media (max-width: 720px) {
  .customer-sms-header { align-items: stretch; flex-direction: column; }
  .customer-sms-toggle { width: 100%; }
  .sms-quick-reply-form { min-width: 100% !important; }
  .sms-quick-reply-buttons { grid-template-columns: 1fr; }
}

/* v1.5.9b SMS conversation inbox */
.sms-conversation-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 16px;
  min-height: 560px;
}
.sms-conversation-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(5, 18, 29, .32);
  overflow: auto;
  max-height: 72vh;
}
.sms-conversation-card {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 12px 13px;
  border-bottom: 1px solid rgba(90, 140, 175, .16);
  transition: background .12s ease, border-color .12s ease;
}
.sms-conversation-card:hover { background: rgba(41,168,232,.08); }
.sms-conversation-card.active {
  background: rgba(41,168,232,.14);
  box-shadow: inset 3px 0 0 rgba(41,168,232,.9);
}
.sms-conversation-card.has-unread .sms-conversation-name { color: #dff4ff; font-weight: 800; }
.sms-conversation-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sms-conversation-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.sms-unread-count {
  flex: 0 0 auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: var(--primary);
  font-size: .75rem;
  font-weight: 800;
}
.sms-conversation-meta,
.sms-conversation-count {
  color: var(--text-muted);
  font-size: .76rem;
  margin-top: 3px;
}
.sms-conversation-preview {
  color: var(--text-muted);
  font-size: .84rem;
  line-height: 1.35;
  margin-top: 7px;
}
.sms-conversation-thread {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(9, 27, 41, .36);
  overflow: hidden;
  min-width: 0;
}
.sms-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 34, 53, .66);
}
.sms-thread-title { font-size: 1rem; font-weight: 800; }
.sms-thread-messages {
  max-height: 68vh;
  overflow: auto;
  padding: 14px;
}
.sms-message-bubble {
  border: 1px solid rgba(90, 140, 175, .20);
  border-radius: 14px;
  padding: 12px 13px;
  margin-bottom: 12px;
  background: rgba(7, 22, 34, .52);
}
.sms-message-bubble.inbound { border-left: 3px solid rgba(41,168,232,.42); }
.sms-message-bubble.outbound { margin-left: 28px; background: rgba(12, 36, 52, .42); }
.sms-message-bubble.unread { border-left-color: rgba(41,168,232,.9); background: rgba(41,168,232,.09); }
.sms-message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 4px;
}
.sms-message-text {
  white-space: pre-wrap;
  margin-top: 8px;
  line-height: 1.48;
}
.sms-message-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  margin-top: 10px;
}
@media (max-width: 900px) {
  .sms-conversation-layout { grid-template-columns: 1fr; }
  .sms-conversation-list { max-height: 310px; }
  .sms-thread-messages { max-height: none; }
  .sms-message-bubble.outbound { margin-left: 0; }
}

/* v1.5.9c SMS pop-out workspace */
.sms-popout-body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
}
.sms-popout-wrap {
  height: 100vh;
  padding: 0;
}
.sms-popout-wrap .sms-inbox-card {
  height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  border-bottom: 0;
}
.sms-popout-wrap .sms-conversation-layout {
  flex: 1;
  min-height: 0;
}
.sms-popout-wrap .sms-conversation-list,
.sms-popout-wrap .sms-thread-messages {
  max-height: none;
  height: 100%;
}
.sms-popout-wrap .sms-conversation-thread {
  min-height: 0;
}
.sms-popout-wrap .card-header {
  align-items: flex-start;
}
@media (max-width: 820px) {
  .sms-popout-body { overflow: auto; }
  .sms-popout-wrap { height: auto; min-height: 100vh; padding: 0; }
  .sms-popout-wrap .sms-inbox-card { height: auto; min-height: 100vh; }
}


/* v1.6.0b sidebar collapse behavior */
.app-shell.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.app-shell.sidebar-collapsed .main-wrap { margin-left: 0; }
.sidebar { transition: transform 0.22s ease; }
.main-wrap { transition: margin-left 0.22s ease; }

/* v1.6.0 account/user menu */
.user-menu{position:relative;}
.user-menu-trigger{display:flex;align-items:center;gap:9px;border:1px solid var(--border);background:rgba(255,255,255,.03);color:var(--text-primary);border-radius:999px;padding:5px 10px 5px 5px;cursor:pointer;min-height:40px;}
.user-menu-trigger:hover{background:rgba(255,255,255,.06);border-color:rgba(70,211,255,.35);}
.user-menu-name{font-size:.88rem;font-weight:600;max-width:140px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.user-menu-caret{font-size:.75rem;color:var(--text-muted);}
.user-menu-panel{position:absolute;right:0;top:calc(100% + 10px);min-width:230px;background:var(--surface);border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow-lg);padding:8px;z-index:1000;}
.user-menu-header{padding:10px 10px 8px;border-bottom:1px solid var(--border);margin-bottom:6px;display:flex;flex-direction:column;gap:2px;}
.user-menu-header span{font-size:.78rem;color:var(--text-muted);}
.user-menu-panel a{display:flex;align-items:center;gap:8px;padding:9px 10px;border-radius:10px;color:var(--text-primary);text-decoration:none;font-size:.9rem;}
.user-menu-panel a:hover{background:rgba(255,255,255,.06);}
.user-menu-panel a.danger{color:var(--danger);}
.user-menu-divider{height:1px;background:var(--border);margin:6px 4px;}
.info-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:14px;}
.info-grid>div{padding:14px;border:1px solid var(--border);border-radius:14px;background:rgba(255,255,255,.025);display:flex;flex-direction:column;gap:5px;}
.button-row-wrap{display:flex;flex-wrap:wrap;gap:10px;align-items:center;}
.check-row{display:flex;align-items:center;gap:8px;color:var(--text-primary);font-size:.92rem;}
@media (max-width:900px){.user-menu-name{display:none}.user-menu-trigger{padding-right:7px}.user-menu-panel{right:-8px}}

/* v1.6.0c account menu visual/layering fix */
.user-menu{position:relative;z-index:10050;}
.user-menu-panel{
  background:#0f1f2e !important;
  border:1px solid rgba(70,211,255,.28) !important;
  box-shadow:0 18px 48px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.03) inset !important;
  z-index:10060 !important;
  overflow:hidden;
  backdrop-filter:none !important;
}
.user-menu-panel[hidden]{display:none !important;}
.user-menu-panel a{position:relative;z-index:1;}
.user-menu-panel a:hover{background:rgba(41,168,232,.14) !important;color:#e8f2fa;}
.topbar{z-index:10000;}


/* BenchTracker v1.6.0e - account profile card sizing polish */
.account-info-grid{
  display:grid;
  grid-template-columns: 1.05fr 1.75fr .7fr 1.1fr 1.1fr 1.1fr;
  gap:14px;
  align-items:stretch;
}
.account-info-grid > .info-card{
  min-width:0;
}
.account-info-grid .account-email strong{
  overflow-wrap:anywhere;
  word-break:break-word;
}
.account-info-grid .account-role{
  max-width:160px;
}
@media (max-width: 1450px){
  .account-info-grid{grid-template-columns: repeat(4, minmax(0, 1fr));}
  .account-info-grid .account-email{grid-column: span 2;}
  .account-info-grid .account-role{max-width:none;}
}
@media (max-width: 850px){
  .account-info-grid{grid-template-columns: 1fr;}
  .account-info-grid .account-email{grid-column:auto;}
}


/* BenchTracker v1.6.0h - remove unreliable Login IP display from My Account */
.account-info-grid .account-session,
.account-info-grid .account-previous,
.account-info-grid .account-activity{
  min-width:0;
}

/* Legacy import / migration support */
.grid.grid-3 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
.metric-card { background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08); border-radius:14px; padding:16px; }
.metric-label { font-size:0.8rem; color:var(--text-muted); margin-bottom:6px; }
.metric-value { font-size:1.7rem; font-weight:700; color:var(--cyan-400); }
.badge-info { background:rgba(30,144,200,0.16); color:var(--cyan-400); border:1px solid rgba(30,144,200,0.35); }
.badge-success { background:rgba(34,197,94,0.14); color:#86efac; border:1px solid rgba(34,197,94,0.35); }
.badge-danger { background:rgba(239,68,68,0.14); color:#fca5a5; border:1px solid rgba(239,68,68,0.35); }
@media (max-width: 900px) { .grid.grid-3 { grid-template-columns:1fr; } }


/* v1.6.3g: Dark theme form readability hardening */
input, select, textarea, .form-control,
input[type="text"], input[type="number"], input[type="email"], input[type="tel"], input[type="password"], input[type="search"], input[type="file"] {
  color: var(--text-primary) !important;
  background-color: rgba(8, 18, 29, 0.88) !important;
  border-color: rgba(126, 200, 240, 0.28) !important;
}
input::file-selector-button {
  color: var(--text-primary) !important;
  background: rgba(30, 144, 200, 0.28) !important;
  border: 1px solid rgba(126, 200, 240, 0.35) !important;
  border-radius: 8px;
  padding: 7px 10px;
  margin-right: 10px;
}
select option { color: #e2f1ff !important; background: #07111f !important; }
input::placeholder, textarea::placeholder, .form-control::placeholder { color: rgba(168, 194, 218, 0.82) !important; }

/* ============================================================
   v1.6.5 Dashboard polish / message attention system
   ============================================================ */
.dashboard-action-grid .action-card {
  color: var(--text-primary);
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.dashboard-action-grid .action-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-hover);
  box-shadow: 0 0 0 1px rgba(41,168,232,.12), var(--shadow);
  text-decoration: none;
}
.dashboard-workflow-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
}
.ops-alert-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -8px 0 24px;
}
.ops-alert-strip a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(19,37,53,.75);
  color: var(--text-secondary);
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
}
.ops-alert-strip a:hover {
  color: var(--cyan-300);
  border-color: var(--border-hover);
  text-decoration: none;
}
.attention-card {
  border-color: rgba(196,82,82,.55) !important;
  box-shadow: 0 0 0 1px rgba(196,82,82,.12), 0 0 24px rgba(196,82,82,.10);
}
.attention-pulse {
  animation: btAttentionPulse 1.45s ease-in-out infinite;
}
.attention-pulse-soft,
.attention-pulse-nav .nav-badge {
  animation: btAttentionPulseSoft 1.6s ease-in-out infinite;
}
.attention-pulse-nav {
  background: linear-gradient(90deg, rgba(196,82,82,.13), transparent);
  border-left-color: var(--danger) !important;
}
.topbar-sms-alert.attention-pulse-soft {
  background: rgba(196,82,82,.16);
  border: 1px solid rgba(196,82,82,.42);
  color: #ffb7b7;
}
@keyframes btAttentionPulse {
  0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 0 0 0 rgba(196,82,82,.0); }
  50% { transform: translateY(-1px) scale(1.012); box-shadow: 0 0 0 3px rgba(196,82,82,.12), 0 0 22px rgba(196,82,82,.24); }
}
@keyframes btAttentionPulseSoft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196,82,82,.0); }
  50% { box-shadow: 0 0 0 3px rgba(196,82,82,.18), 0 0 14px rgba(196,82,82,.22); }
}
@media (prefers-reduced-motion: reduce) {
  .attention-pulse,
  .attention-pulse-soft,
  .attention-pulse-nav .nav-badge { animation: none; }
}
@media (max-width: 1100px) {
  .dashboard-workflow-grid { grid-template-columns: 1fr; }
}

/* Customer picker / intake workflow search */
.customer-picker { position: relative; }
.customer-picker-selected {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border:1px solid rgba(148,163,184,.22);
  border-radius:14px;
  background:rgba(15,23,42,.52);
}
.customer-picker-selected-main { min-width:0; }
.customer-picker-name { font-weight:700; color:var(--text-main); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.customer-picker-subtitle { margin-top:2px; font-size:.82rem; color:var(--text-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.customer-picker-actions { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.customer-picker-results {
  position:absolute;
  z-index:80;
  left:0;
  right:0;
  top:calc(100% + 8px);
  max-height:340px;
  overflow:auto;
  border:1px solid rgba(148,163,184,.22);
  border-radius:16px;
  background:#0f172a;
  box-shadow:0 20px 50px rgba(0,0,0,.34);
  padding:6px;
}
.customer-picker-result {
  display:block;
  width:100%;
  text-align:left;
  border:0;
  background:transparent;
  color:inherit;
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
}
.customer-picker-result:hover,
.customer-picker-result.active { background:rgba(14,165,233,.14); }
.customer-picker-result-title { font-weight:700; color:var(--text-main); }
.customer-picker-result-subtitle { margin-top:2px; font-size:.82rem; color:var(--text-muted); }
.customer-picker-empty { padding:12px; color:var(--text-muted); font-size:.9rem; }


/* v2.1.2b topbar menu fixes */
.topbar-actions .user-menu-trigger{
  min-height:40px;
}
.topbar-actions .user-menu:first-of-type .user-menu-trigger,
.user-menu-trigger[title="Administration"]{
  width:40px;
  height:40px;
  min-height:40px;
  padding:0;
  justify-content:center;
  align-items:center;
  gap:0;
}
.gear-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:20px;
  height:20px;
  font-size:1.05rem;
  line-height:1;
  transform:translateY(-0.5px);
}
.user-menu-header.compact{
  padding-top:8px;
  padding-bottom:6px;
}
.comment-visibility-picker{
  display:grid;
  gap:10px;
  margin-bottom:14px;
}
.comment-visibility-option{
  display:flex;
  gap:10px;
  align-items:flex-start;
  border:1px solid var(--border);
  background:rgba(255,255,255,.025);
  border-radius:14px;
  padding:10px 12px;
}
.comment-visibility-option input{margin-top:3px;}
.comment-visibility-option strong{display:block;font-size:.92rem;}
.comment-visibility-option span{display:block;font-size:.78rem;color:var(--text-muted);margin-top:2px;}


/* v2.1.3 Admin menu polish */
.admin-menu .admin-menu-trigger{
  width:auto !important;
  height:40px;
  min-height:40px;
  padding:0 12px !important;
  gap:8px !important;
}
.admin-menu-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:20px;
  height:20px;
  line-height:1;
  font-size:1rem;
  color:var(--cyan-300);
}
.admin-menu-label{font-size:.88rem;font-weight:700;letter-spacing:.01em;}
.org-edit-tabs{margin:0 0 18px;}
.org-edit-section{margin-bottom:18px;}
.row-actions{display:flex;gap:8px;justify-content:flex-end;align-items:center;}
@media (max-width:700px){.admin-menu-label{display:none}.admin-menu .admin-menu-trigger{width:40px!important;padding:0!important;justify-content:center}.admin-menu .user-menu-caret{display:none}}
.topbar-actions .admin-menu .admin-menu-trigger{width:auto !important;padding:0 12px !important;}


/* Service Desk status timeline (v2.1.6d) */
.service-status-timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.34);
}
.service-status-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease, transform .15s ease;
}
.service-status-step:hover {
  border-color: var(--cyan-500);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.service-status-step.done {
  border-color: rgba(34, 197, 94, .35);
  color: var(--text-secondary);
}
.service-status-step.current {
  border-color: var(--cyan-500);
  background: rgba(6, 182, 212, .13);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px rgba(6, 182, 212, .12) inset;
}
.service-status-step.future {
  opacity: .78;
}
.service-status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 0.62rem;
  line-height: 1;
}
.service-status-step.current .service-status-dot {
  background: var(--cyan-500);
  color: var(--navy-950);
  border-color: var(--cyan-500);
}
