/* App shell navigation */
#appRoot {
  max-width: 120rem;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
}

.app-shell {
  background: #fff;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.app-top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.app-top h1 {
  margin: 0;
  font-size: 1.125rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app-top p {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: #6b7280;
}

.app-nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-tab {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 0.45rem 0.85rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-tab.active {
  background: var(--aj-dark);
  color: #fff;
  border-color: var(--aj-dark);
}

.app-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.workspace-shell {
  box-shadow: none;
  border: none;
  padding: 0;
  border-radius: 0;
}

.status-help {
  font-size: 0.65rem;
  color: #6b7280;
  margin: 0.35rem 0 0;
  line-height: 1.4;
  font-weight: 400;
  text-transform: none;
}

.status-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
  margin-top: 0.35rem;
}

.print-status-badge {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.35rem;
  border-radius: 0.2rem;
  background: #f3f4f6;
}

/* Orders hub */
.orders-hub { min-height: 400px; }

.orders-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.orders-search {
  width: 100%;
  max-width: 360px;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.85rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-chip {
  background: #fff;
  border: 1px solid #d1d5db;
  padding: 0.35rem 0.6rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
}

.filter-chip.active {
  background: var(--aj-green);
  border-color: var(--aj-green);
  color: #111;
}

.chip-count {
  opacity: 0.75;
  margin-left: 0.15rem;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.kanban-column {
  min-width: 180px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.kanban-col-head {
  padding: 0.6rem;
  border-top: 3px solid #6b7280;
  border-bottom: 1px solid #e5e7eb;
}

.kanban-col-head h3 {
  margin: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.kanban-col-head p {
  margin: 0.25rem 0 0;
  font-size: 0.55rem;
  color: #6b7280;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-count {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.6rem;
  font-weight: 700;
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}

.kanban-cards {
  padding: 0.5rem;
  overflow-y: auto;
  flex: 1;
}

.kanban-empty {
  font-size: 0.65rem;
  color: #9ca3af;
  font-style: italic;
  margin: 0;
}

.order-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.order-card-open {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.order-card-open:hover { background: #f9fafb; }

.order-card-title {
  display: block;
  font-weight: 700;
  font-size: 0.75rem;
}

.order-card-client {
  display: block;
  font-size: 0.65rem;
  color: #6b7280;
  margin-top: 0.1rem;
}

.order-card-meta {
  display: block;
  font-size: 0.6rem;
  color: #9ca3af;
  margin-top: 0.2rem;
}

.order-card-status {
  display: block;
  padding: 0 0.5rem 0.5rem;
}

.status-select-inline {
  width: 100%;
  font-size: 0.6rem;
  padding: 0.25rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
}

.orders-empty {
  text-align: center;
  color: #9ca3af;
  padding: 2rem;
  font-size: 0.85rem;
}

/* Order detail */
.order-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.order-detail-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.order-detail-client {
  color: #6b7280;
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}

.status-hint {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0.5rem 0 0;
  max-width: 36rem;
}

.order-detail-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.order-detail-stats div {
  text-align: right;
}

.order-detail-stats span {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  color: #9ca3af;
  font-weight: 700;
}

.order-detail-stats strong {
  font-size: 1rem;
}

.order-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.detail-status-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #4b5563;
}

.detail-status-label select {
  display: block;
  margin-top: 0.25rem;
  padding: 0.4rem;
  min-width: 160px;
}

.detail-note {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
}

.timeline-section h3 {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.status-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid #e5e7eb;
  margin-left: 0.5rem;
}

.timeline-item {
  position: relative;
  padding: 0 0 1rem 1.25rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -0.4rem;
  top: 0.2rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--aj-green);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #d1d5db;
}

.timeline-item time {
  font-size: 0.65rem;
  color: #9ca3af;
}

.timeline-item p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
}

.timeline-note {
  font-size: 0.75rem !important;
  color: #6b7280;
  font-style: italic;
}

.timeline-empty {
  color: #9ca3af;
  font-style: italic;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Toast */
.app-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #111827;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  z-index: 100;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-width: 320px;
}

.app-toast.error { background: #991b1b; }

/* Billing + Wave Export */
.billing-panel {
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.billing-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.billing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.5rem 0.75rem;
}

.billing-grid label,
.billing-meta-row label {
  display: block;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #6b7280;
}

.billing-grid input,
.billing-meta-row input,
.billing-meta-row textarea {
  width: 100%;
  margin-top: 0.2rem;
  font-size: 0.8rem;
}

.billing-meta-row {
  margin-top: 0.75rem;
}

.btn-compact {
  margin-top: 0.5rem;
  font-size: 0.65rem;
  padding: 0.35rem 0.65rem;
}

.customer-sell-grid {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #d1d5db;
}

.sell-grid-title {
  margin: 0 0 0.35rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #1d4ed8;
}

.wave-export-page .wave-export-intro {
  margin-bottom: 1.25rem;
}

.wave-export-page .wave-export-intro h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.wave-steps {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.8rem;
  line-height: 1.5;
}

.wave-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.wave-alert {
  font-size: 0.8rem;
  margin: 0.35rem 0;
  padding: 0.5rem 0.75rem;
  border-radius: 0.35rem;
}

.wave-alert.error { background: #fee2e2; color: #991b1b; }
.wave-alert.warn { background: #fef3c7; color: #92400e; }
.wave-alert.ok { background: #dcfce7; color: #166534; }

.wave-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.wave-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.wave-table th,
.wave-table td {
  padding: 0.5rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.wave-table th {
  background: #f3f4f6;
  font-size: 0.6rem;
  text-transform: uppercase;
}

.wave-table td.num,
.wave-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

[data-theme='dark'] .billing-panel {
  background: #1f2937;
  border-color: #374151;
}

[data-theme='dark'] .wave-table th {
  background: #374151;
}

@media (max-width: 1400px) {
  .kanban-board { grid-template-columns: repeat(3, minmax(200px, 1fr)); }
}

@media (max-width: 768px) {
  .kanban-board { grid-template-columns: 1fr; }
  .kanban-column { max-height: none; }
}
