.container {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}

.card {
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--space-4);
}

@media (hover: hover) {
  .card:hover {
    box-shadow: var(--shadow-2);
    border-color: var(--stroke-strong);
  }
}

.card-title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--text);
  font-weight: 600;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.stack {
  display: grid;
  gap: var(--space-3);
}

.row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.row.between {
  justify-content: space-between;
}

.grid-2 {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(3, 1fr);
}

.chip-group {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.chip {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 138, 61, 0.14);
  border: 1px solid rgba(255, 138, 61, 0.25);
  font-size: 0.8rem;
  color: #8a3a12;
}

.list-item {
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 18px rgba(44, 42, 32, 0.08);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.list-item strong {
  display: block;
}

.list-item small,
.meta {
  color: var(--muted);
  display: block;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border 0.2s, box-shadow 0.2s, background 0.2s;
}

.input::placeholder,
.textarea::placeholder {
  color: rgba(154, 168, 199, 0.7);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--focus);
  background: #ffffff;
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-control,
.form-select,
.form-check-input {
  width: 100%;
  min-height: var(--tap);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-control::placeholder {
  color: rgba(154, 168, 199, 0.7);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--focus);
  background: #ffffff;
}

.form-control[readonly] {
  opacity: 0.75;
}

.form-label {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.label {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.helper {
  font-size: 0.78rem;
  color: var(--muted);
}

.btn {
  min-height: var(--tap);
  border-radius: 20px;
  border: none;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #2a1b11;
  background: linear-gradient(135deg, var(--accent), #ffd06a);
  box-shadow: 0 12px 20px rgba(255, 138, 61, 0.25);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover {
  filter: brightness(1.05);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--stroke);
  box-shadow: none;
}

.btn.secondary:hover,
.btn.ghost:hover {
  border-color: var(--stroke-strong);
}

.btn.btn-primary,
.btn.btn-success,
.btn.btn-warning,
.btn.btn-danger,
.btn.btn-light,
.btn.btn-secondary,
.btn.btn-outline-info,
.btn.btn-outline-danger,
.btn.btn-outline-light {
  border-radius: var(--radius-md);
}

.btn.btn-primary {
  background: linear-gradient(120deg, var(--accent), #ffcc7f);
  color: #0b1118;
}

.btn.btn-secondary {
  background: rgba(17, 26, 39, 0.8);
  color: var(--text);
  border: 1px solid var(--stroke);
  box-shadow: none;
}

.btn.btn-success {
  background: linear-gradient(120deg, #3fe6a1, #85ffd6);
  color: #05120d;
}

.btn.btn-warning {
  background: linear-gradient(120deg, #ffd27c, #ffb14a);
  color: #2b1a07;
}

.btn.btn-danger {
  background: linear-gradient(120deg, #ff6b7d, #ff97a8);
  color: #2b0c12;
}

.btn.btn-light {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--stroke);
}

.btn.btn-outline-info,
.btn.btn-outline-danger,
.btn.btn-outline-light {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--stroke);
  box-shadow: none;
}

.btn.btn-outline-info {
  color: var(--accent-2);
  border-color: rgba(46, 196, 182, 0.45);
}

.btn.btn-outline-danger {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.45);
}

.btn.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn.success {
  background: linear-gradient(120deg, #2ccf82, #8ff0b8);
  color: #0d2b1c;
}

.btn.danger {
  background: linear-gradient(120deg, #ff6b6b, #ff9b9b);
  color: #2b0c12;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border: 1px solid var(--stroke);
  box-shadow: none;
}

.btn.text {
  background: transparent;
  color: var(--muted);
  border: none;
  box-shadow: none;
}

.quick-pay-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.quick-pay-btn.quick-pay-active {
  background: rgba(46, 196, 182, 0.18);
  border-color: rgba(46, 196, 182, 0.45);
  color: #0f5a52;
}

.payment-form {
  gap: var(--space-3);
}

.payment-summary {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 138, 61, 0.22);
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.18), rgba(46, 196, 182, 0.12));
  padding: var(--space-3);
  display: grid;
  gap: var(--space-2);
}

.payment-summary strong {
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.payment-summary #sale-due {
  color: #8a3a12;
}

.payment-summary #sale-change {
  font-weight: 600;
}

.payment-summary #sale-change.has-change {
  color: #0d5d3a;
}

.payment-actions .btn {
  width: 100%;
}

.btn.pulse {
  animation: pulse 1.8s ease-in-out infinite;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--stroke-strong);
}

.badge {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  background: rgba(32, 38, 48, 0.06);
}

.badge.success {
  color: #0d5d3a;
  background: rgba(44, 207, 130, 0.2);
  border-color: rgba(44, 207, 130, 0.35);
}

.badge.warning {
  color: #845400;
  background: rgba(244, 178, 63, 0.22);
  border-color: rgba(244, 178, 63, 0.38);
}

.badge.danger {
  color: #8a1d1d;
  background: rgba(255, 107, 107, 0.2);
  border-color: rgba(255, 107, 107, 0.38);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-1);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  padding: 6px;
}

.tabs label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.tabs input[type="radio"] {
  accent-color: var(--accent);
}

.tabs button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  min-height: 44px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tabs button.active {
  background: rgba(255, 138, 61, 0.18);
  color: #8a3a12;
}

.quick-btns {
  gap: var(--space-2);
}

.quick-btns button.active {
  background: rgba(255, 138, 61, 0.18);
  color: #8a3a12;
}

.chart-wrap {
  position: relative;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  overflow: auto;
  background: var(--surface);
}

#stats-chart {
  display: block;
  width: 100%;
  height: 260px;
}

.chart-tooltip {
  position: absolute;
  transform: translate(-50%, -120%);
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.78rem;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-plot {
  fill: rgba(255, 138, 61, 0.05);
  stroke: rgba(32, 38, 48, 0.12);
}

.chart-grid {
  stroke: rgba(32, 38, 48, 0.12);
}

.chart-label {
  fill: var(--muted);
}

.stats-today-card {
  border-color: var(--stroke);
}

.stats-today-card.tone-cold {
  box-shadow: 0 0 0 1px rgba(96, 140, 255, 0.25);
}

.stats-today-card.tone-cool {
  box-shadow: 0 0 0 1px rgba(46, 196, 182, 0.3);
}

.stats-today-card.tone-warm {
  box-shadow: 0 0 0 1px rgba(255, 138, 61, 0.35);
}

.stats-today-card.tone-hot {
  box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.35);
}

.bar-cb {
  fill: rgba(46, 196, 182, 0.8);
}

.bar-cash {
  fill: rgba(255, 138, 61, 0.85);
}

.bar-service {
  fill: rgba(44, 207, 130, 0.85);
}

.bar-accessory {
  fill: rgba(255, 107, 107, 0.8);
}

.profits-threshold {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--surface);
}

.threshold-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(32, 38, 48, 0.08);
  overflow: hidden;
  margin: 10px 0;
}

.threshold-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 138, 61, 0.9), rgba(44, 207, 130, 0.9));
  transition: width 0.3s ease;
}

.threshold-badge {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  background: rgba(32, 38, 48, 0.06);
}

.threshold-badge.is-reached {
  color: #0d5d3a;
  border-color: rgba(44, 207, 130, 0.35);
  background: rgba(44, 207, 130, 0.18);
}

.threshold-badge.is-near {
  color: #845400;
  border-color: rgba(244, 178, 63, 0.35);
  background: rgba(244, 178, 63, 0.18);
}

.threshold-badge.is-far {
  color: #8a1d1d;
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.18);
}

.exception-list {
  display: grid;
  gap: 8px;
  margin-top: var(--space-2);
}

.exception-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1.2fr 1fr 1fr 1fr auto;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  background: rgba(10, 16, 26, 0.7);
}

.exception-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.exception-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.profits-error {
  margin: var(--space-2) 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 107, 125, 0.35);
  color: var(--danger);
  background: rgba(255, 107, 125, 0.08);
}

@media (max-width: 900px) {
  .exception-row {
    grid-template-columns: 1fr;
  }
}

.suggestions,
.autocomplete-list {
  display: grid;
  gap: 6px;
}

.suggestions button,
.autocomplete-list button,
.autocomplete-list div {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.suggestions button:hover,
.autocomplete-list button:hover,
.autocomplete-list div:hover {
  border-color: var(--stroke-strong);
}

.autocomplete-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  margin-top: 6px;
  padding: 6px;
}

.line-item {
  display: grid;
  gap: var(--space-2);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  background: var(--surface-2);
}

.line-field {
  display: grid;
  gap: 6px;
}

.line-actions {
  display: flex;
  justify-content: flex-end;
}

.line-field.position-relative {
  position: relative;
}

.table-wrap {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  overflow: auto;
  max-height: 420px;
  background: var(--surface);
}

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

.table th,
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke);
  text-align: left;
}

.table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: #8a3a12;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  z-index: 1;
}

.table tr:hover td {
  background: rgba(255, 138, 61, 0.08);
}

.empty {
  padding: 18px;
  border: 1px dashed var(--stroke);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.loader::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(32, 38, 48, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.toast {
  position: fixed;
  right: 16px;
  top: 16px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-2);
  display: none;
  z-index: 90;
  min-width: 180px;
}

.toast.show {
  display: block;
  animation: slide-in 0.35s ease;
}

.toast[data-type="success"] {
  border-color: rgba(44, 207, 130, 0.4);
  box-shadow: 0 18px 40px rgba(44, 207, 130, 0.18);
}

.toast[data-type="danger"] {
  border-color: rgba(255, 107, 107, 0.4);
  box-shadow: 0 18px 40px rgba(255, 107, 107, 0.18);
}

.toast[data-type="warning"] {
  border-color: rgba(244, 178, 63, 0.4);
  box-shadow: 0 18px 40px rgba(244, 178, 63, 0.18);
}

.drawer {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: min(380px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--stroke);
  transform: translateX(105%);
  transition: transform 0.2s ease;
  z-index: 90;
  padding: var(--space-4);
}

.drawer.open {
  transform: translateX(0);
}

.drawer.bottom {
  right: 0;
  left: 0;
  top: auto;
  bottom: 0;
  height: min(75vh, 560px);
  width: 100%;
  border-left: none;
  border-top: 1px solid var(--stroke);
  transform: translateY(105%);
}

.drawer.bottom.open {
  transform: translateY(0);
}

.app-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(16, 20, 28, 0.35);
  z-index: 100;
}

.app-overlay.active {
  display: flex;
}

.app-overlay .panel {
  width: min(520px, 94vw);
}

.ticket-preview-panel {
  width: min(720px, 94vw);
  height: min(82vh, 720px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--space-3);
  overscroll-behavior: contain;
}

.ticket-preview-body {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  display: grid;
}

.ticket-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.ticket-preview-note {
  font-size: 0.78rem;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 28, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 80;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 28, 0.3);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.open {
  display: flex;
}

.modal .panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  padding: var(--space-4);
  width: min(420px, 92vw);
}

.kbd {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  color: var(--muted);
}

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

@media (prefers-reduced-motion: no-preference) {
  .card,
  .list-item {
    animation: rise-in 0.45s ease both;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 138, 61, 0.35);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 138, 61, 0.08);
  }
}

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