:root {
  color-scheme: light;
  --background: #faf7f5;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --card-foreground: #0a0a0a;
  --surface: #ffffff;
  --surface-elevated: #fffaf6;
  --secondary: #f4f4f5;
  --secondary-foreground: #0a0a0a;
  --accent: #f4f4f5;
  --accent-foreground: #0a0a0a;
  --accent-hover: #e7e7e9;
  --border: #e5e7eb;
  --input: #e5e7eb;
  --ring: var(--primary);
  --ring-soft: rgba(var(--primary-rgb), 0.18);
  --primary: #ff8a4c;
  --primary-hover: #ff7a33;
  --primary-rgb: 255, 138, 76;
  --primary-hover-rgb: 255, 122, 51;
  --primary-foreground: #0a0a0a;
  --destructive: #ef4444;
  --destructive-foreground: #fafafa;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: 180ms ease;
  --text: var(--foreground);
  --text-muted: rgba(10, 10, 10, 0.65);
  font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(var(--primary-rgb), 0.12), var(--background) 55%);
  color: var(--foreground);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem clamp(1.5rem, 4vw, 3rem);
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--primary-foreground);
  box-shadow: 0 10px 28px rgba(var(--primary-rgb), 0.22);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  font-size: 1.75rem;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  backdrop-filter: blur(6px);
}

.brand-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.brand-icon span[hidden] {
  display: none;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
}

.brand-text p {
  margin: 0;
  color: rgba(10, 10, 10, 0.7);
}

.session-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.session-user {
  font-weight: 600;
}

.app-body {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.view-card {
  width: min(480px, 100%);
  margin: auto;
  background: var(--surface);
  padding: clamp(1.5rem, 4vw, 2.75rem);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-form h2 {
  margin: 0;
}

.form-description {
  margin: 0;
  color: var(--text-muted);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label {
  font-weight: 600;
  color: var(--text);
}

input,
select,
textarea {
  font: inherit;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--foreground);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px var(--ring-soft);
}

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

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.1rem;
  color: var(--foreground);
  transition: background var(--transition), transform var(--transition), color var(--transition),
    box-shadow var(--transition);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.primary-button {
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(var(--primary-rgb), 0.18);
}

.primary-button:hover {
  background: var(--primary-hover);
  color: var(--primary-foreground);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(var(--primary-rgb), 0.22);
}

.secondary-button {
  background: var(--secondary);
  color: var(--secondary-foreground);
  font-weight: 600;
  border: 1px solid var(--border);
}

.secondary-button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--destructive);
}

.danger:hover {
  background: rgba(239, 68, 68, 0.18);
}

.dashboard {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: min(1200px, 100%);
  max-width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.dashboard-summary {
  padding: clamp(1.5rem, 4vw, 2.75rem);
  padding-bottom: clamp(1rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.dashboard-summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dashboard-summary-header h2 {
  margin: 0;
}

.dashboard-summary-header p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  max-width: 520px;
}

.dashboard-summary-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-summary-card {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.dashboard-summary-card h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.dashboard-summary-amount {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.dashboard-summary-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.dashboard-monthly {
  padding: clamp(1.5rem, 4vw, 2.75rem);
  padding-top: clamp(1rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.dashboard-monthly-header h2 {
  margin: 0;
}

.dashboard-monthly-header p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  max-width: 520px;
}

.dashboard-monthly-chart {
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  overflow-x: auto;
}

.dashboard-monthly-chart::-webkit-scrollbar {
  height: 8px;
}

.dashboard-monthly-chart::-webkit-scrollbar-thumb {
  background: rgba(10, 10, 10, 0.12);
  border-radius: 999px;
}

.dashboard-monthly-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(3rem, 1fr);
  gap: 1rem;
  align-items: end;
  min-height: 12rem;
}

.dashboard-monthly-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-monthly-bar-track {
  width: 100%;
  height: 10rem;
  border-radius: var(--radius-md);
  background: rgba(10, 10, 10, 0.08);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.dashboard-monthly-bar-fill {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-radius: var(--radius-md);
  transition: height var(--transition);
  height: 0;
}

.dashboard-monthly-bar-amount {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.dashboard-monthly-bar-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.dashboard-monthly-message {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.resource-area {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  padding-bottom: clamp(3.5rem, 6vw, 4.5rem);
  background: var(--surface-elevated);
  overflow-y: auto;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem clamp(1rem, 4vw, 2rem);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(var(--primary-rgb), 0.18);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  z-index: 10;
}

.resource-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 0.75rem;
}

.resource-menu li {
  margin: 0;
}

.resource-menu button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 64px;
  background: transparent;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition),
    border-color var(--transition), transform var(--transition);
}

.resource-menu button:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.resource-menu button.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  box-shadow: 0 12px 28px rgba(var(--primary-rgb), 0.18);
}

.resource-menu button[data-has-icon='true'] .resource-menu-label {
  display: none;
}

.resource-menu-icon {
  width: 28px;
  height: 28px;
  display: block;
  color: inherit;
}

.resource-menu button.active .resource-menu-icon {
  color: inherit;
}

.resource-menu-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.resource-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.resource-header h2 {
  margin: 0;
}

.resource-description {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
}

.resource-header-actions {
  display: flex;
  gap: 0.75rem;
}

.resource-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.search-control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.status {
  min-height: 1.5rem;
  font-weight: 500;
  color: var(--text-muted);
}

.status.status-info {
  color: var(--primary-hover);
}

.status.status-success {
  color: #047857;
}

.status.status-error {
  color: var(--destructive);
}

.table-wrapper {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.data-table thead {
  background: var(--secondary);
}

.data-table th,
.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table tbody tr:hover {
  background: rgba(255, 138, 76, 0.08);
}

.data-table th {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table th.sortable {
  cursor: pointer;
  position: relative;
  user-select: none;
  padding-right: 2rem;
}

.data-table th.sortable::after {
  content: '▴▾';
  position: absolute;
  right: 0.75rem;
  font-size: 0.75rem;
  color: rgba(31, 41, 55, 0.35);
}

.data-table th.sorted-asc::after {
  content: '▴';
  color: var(--accent-hover);
}

.data-table th.sorted-desc::after {
  content: '▾';
  color: var(--accent-hover);
}

.table-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.table-actions .action-button {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.table-actions .danger {
  color: var(--destructive);
  background: rgba(239, 68, 68, 0.12);
}

.table-actions .danger:hover {
  background: rgba(239, 68, 68, 0.18);
}

.order-status-column {
  width: 1%;
  white-space: nowrap;
}

.order-status-cell {
  position: relative;
}

.order-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.08);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.order-status-chip:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.18), 0 6px 18px rgba(15, 23, 42, 0.12);
}

.order-status-chip:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.1);
}

.order-status-chip-empty {
  box-shadow: inset 0 0 0 1px rgba(107, 114, 128, 0.35);
}

.order-status-chip-loading {
  cursor: progress;
}

.order-status-chip-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  flex: 0 0 auto;
}

.order-status-chip-label {
  line-height: 1;
}

.order-status-dropdown {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 30;
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 0.5rem;
}

.order-status-cell-open .order-status-dropdown {
  display: block;
}

.order-status-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.order-status-option-item {
  margin: 0;
  padding: 0;
}

.order-status-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  font-size: 0.85rem;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.order-status-option:hover {
  background: rgba(var(--primary-rgb), 0.06);
  border-color: rgba(var(--primary-rgb), 0.3);
  transform: translateY(-1px);
}

.order-status-option.is-active {
  background: rgba(var(--primary-rgb), 0.12);
  border-color: rgba(var(--primary-rgb), 0.45);
}

.order-status-option-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  flex: 0 0 auto;
}

.order-status-option-label {
  flex: 1;
  text-align: left;
  font-weight: 600;
}

.order-status-option-check {
  opacity: 0;
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.75);
}

.order-status-option.is-active .order-status-option-check {
  opacity: 1;
}

.order-status-dropdown-message {
  margin: 0;
  padding: 0.35rem 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.order-status-dropdown-message.error {
  color: var(--destructive);
}

.pagination {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.pagination-button,
.pagination span {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.pagination-button {
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.pagination-button:hover:not(:disabled) {
  background: var(--secondary);
  color: var(--foreground);
}

.pagination-button.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.pagination-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-error {
  margin: 0;
  color: var(--destructive);
  min-height: 1.25rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-group + .field-group {
  margin-top: 1rem;
}

.field-group .field-help {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.field-group .field-error {
  margin: 0;
  color: var(--destructive);
  font-size: 0.82rem;
  min-height: 1rem;
}

.field-group.has-error input,
.field-group.has-error select,
.field-group.has-error textarea {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 520px;
  width: min(520px, 90vw);
  background: var(--card);
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.25);
}

.modal::backdrop {
  background: rgba(10, 10, 10, 0.45);
}

.modal-header,
.modal-footer {
  padding: 1.5rem;
  background: var(--secondary);
}

.modal-body {
  position: relative;
  padding: 1.5rem;
  max-height: 60vh;
  overflow: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.detail-list dt {
  font-weight: 600;
  color: var(--text-muted);
}

.detail-list dd {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
  white-space: pre-line;
}

.modal.modal-wide {
  max-width: 760px;
  width: min(760px, 95vw);
}

.modal.modal-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 0;
}

.modal.modal-fullscreen form {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.modal.modal-fullscreen .modal-body {
  flex: 1;
  max-height: none;
  overflow: auto;
}

.modal.modal-fullscreen .modal-footer {
  border-top: 1px solid var(--border);
}

.order-form-message {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 138, 76, 0.12);
  color: var(--primary-hover);
  font-size: 0.9rem;
}

.order-form-message.error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--destructive);
}

.order-form-message.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.order-current-user {
  margin: 0 0 1.25rem;
  font-weight: 600;
  color: var(--text);
}

body.has-loading-overlay {
  overflow: hidden;
}

body.has-product-selector-overlay {
  overflow: hidden;
}

.order-loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(1px);
  z-index: 1400;
}

.order-loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  font-weight: 600;
  color: var(--primary);
}

.order-loading-icon {
  display: inline-block;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  border: 4px solid rgba(var(--primary-rgb), 0.25);
  border-top-color: var(--primary);
  animation: order-loading-spin 1s linear infinite;
}

.order-loading-text {
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

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

.order-items-section {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.order-items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.order-section-title {
  margin: 0;
  font-size: 1.05rem;
}

.order-add-item {
  padding: 0.5rem 0.9rem;
}

.order-items {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.order-item-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(160px, 2fr) minmax(180px, 2fr) minmax(90px, 1fr)
    minmax(120px, 1fr) minmax(110px, 1fr) auto;
  align-items: end;
}

.order-item-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.order-item-field-product {
  grid-column: 1 / -1;
}

.order-product-selector {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.order-product-selector-open {
  border-color: rgba(var(--primary-rgb), 0.5);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.12);
}

.order-product-selector-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: stretch;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2.5rem);
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  z-index: 1450;
}

.order-product-selector-overlay:not([hidden]) {
  display: flex;
}

.order-product-selector-dialog {
  width: min(960px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.97);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 48px -20px rgba(15, 23, 42, 0.45);
  padding: clamp(1.25rem, 4vw, 2.25rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.order-product-selector-dialog .order-selection-step {
  gap: 1rem;
}

.order-product-selector-dialog .order-selector-title {
  font-size: 1.05rem;
}

.order-product-selector-dialog .order-selection-message {
  font-size: 0.95rem;
}

.order-product-selector-dialog .order-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.order-product-selector-dialog .order-card {
  padding: 1rem;
}

@media (max-width: 640px) {
  .order-product-selector-overlay {
    padding: 0;
  }

  .order-product-selector-dialog {
    border-radius: 0;
    min-height: 100%;
    max-height: 100%;
    padding: 1.15rem;
  }

  .order-product-selector-dialog .order-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

.order-selection-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.order-selection-step {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.order-product-selector-showing-products .order-category-step {
  display: none;
}

.order-product-selector-showing-products .order-product-step {
  display: flex;
}

.order-product-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.order-selector-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.order-selection-message {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.order-back-to-categories {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.order-back-to-categories:hover,
.order-back-to-categories:focus-visible {
  background: rgba(var(--primary-rgb), 0.2);
  color: var(--primary-hover);
}

.order-back-to-categories:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.order-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.order-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  background: var(--card);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition),
    box-shadow var(--transition);
}

.order-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(var(--primary-rgb), 0.12);
}

.order-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.order-card:disabled,
.order-card.order-card-disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  border-color: var(--border);
  pointer-events: none;
}

.order-card-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

.order-card-title {
  font-weight: 600;
  color: var(--text);
}

.order-card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.order-selected-product {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.order-selected-product-empty {
  font-weight: 500;
  color: var(--text-muted);
}

.order-product-grid {
  margin-top: 0.25rem;
}

.order-change-selection {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.1;
  box-shadow: none;
  transition: color var(--transition), text-decoration var(--transition);
}

.order-change-selection:hover,
.order-change-selection:focus-visible {
  color: var(--primary-hover);
  text-decoration: underline;
}

.order-change-selection:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.order-product-selector-collapsed {
  gap: 0.5rem;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

.order-product-selector-collapsed .order-selection-step {
  display: none;
}

.order-product-selector-collapsed .order-selection-actions {
  justify-content: space-between;
}

.order-item-field label {
  font-size: 0.9rem;
}

.order-item-field input {
  width: 100%;
}

.order-item-total-field {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.order-item-total {
  font-weight: 600;
  text-align: right;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 138, 76, 0.1);
}

.order-item-remove {
  align-self: center;
}

.order-summary {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.order-summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.order-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}

.order-summary-total-row {
  font-size: 1.05rem;
  font-weight: 600;
}

.order-summary-value {
  font-variant-numeric: tabular-nums;
}

.payment-methods {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.payment-method-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  transition: border-color var(--transition), box-shadow var(--transition),
    transform var(--transition);
}

.payment-method-option:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(var(--primary-rgb), 0.12);
  transform: translateY(-1px);
}

.payment-method-option-selected {
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(var(--primary-rgb), 0.18);
}

.payment-method-option input[type='radio'] {
  margin-top: 0.25rem;
}

.payment-method-details {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.payment-method-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.payment-method-description {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.payment-terminal-select {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.payment-summary {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 138, 76, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.payment-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
}

.payment-summary-label {
  color: var(--text-muted);
  font-weight: 500;
}

.payment-summary-value {
  font-variant-numeric: tabular-nums;
}

.comanda-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.comanda-ticket {
  width: min(420px, 90vw);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 20px;
  background: #ffffff;
  padding: 1.5rem;
  box-shadow: 0 25px 50px rgba(15, 23, 42, 0.4);
  font-family: 'Courier New', 'Menlo', monospace;
  color: #0f172a;
}

.comanda-header {
  text-align: center;
  margin-bottom: 0.35rem;
}

.comanda-order-number {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.comanda-client,
.comanda-time {
  margin: 0;
  font-size: 0.95rem;
  color: #1f2937;
}

.comanda-divider {
  border: none;
  border-top: 1px dashed #d1d5db;
  margin: 1rem 0;
  opacity: 0.7;
}

.comanda-items {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0;
}

.comanda-item-line {
  margin: 0;
  font-size: 1rem;
  white-space: pre-wrap;
}

.comanda-item-notes {
  margin: 0 0 0 1.5rem;
  font-size: 0.85rem;
  color: #475569;
}

.comanda-footer {
  margin: 0;
  text-align: right;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #111827;
}

.comanda-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
}

.comanda-close {
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: 999px;
  padding: 0.45rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(var(--primary-rgb), 0.2);
  transition: transform 180ms ease, background 180ms ease;
}

.comanda-close:hover {
  transform: translateY(-1px);
  background: var(--primary-hover);
}

@media (max-width: 720px) {
  .order-item-row {
    grid-template-columns: 1fr;
  }

  .order-item-remove {
    justify-self: flex-start;
  }
}

.hidden {
  display: none !important;
}

.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;
}

@media (max-width: 1024px) {
  .bottom-nav {
    padding: 0.65rem clamp(0.75rem, 4vw, 1.5rem);
  }
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .resource-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .resource-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .resource-menu {
    gap: 0.5rem;
  }

  .resource-menu button {
    min-height: 56px;
  }

  .data-table {
    min-width: 100%;
  }
}
