:root {
  --bg: #eef3f5;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #687385;
  --line: #d6dee6;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --soft: #e8eef3;
  --danger: #b42318;
  --warning: #a16207;
  --complete: #2f6f4e;
  --surface: #f8fafc;
  --shadow: 0 12px 28px rgba(31, 41, 51, 0.07);
  --shadow-soft: 0 6px 18px rgba(31, 41, 51, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f8fafc 0, var(--bg) 360px),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.hidden,
[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  background: var(--primary);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 40px;
  padding: 0 14px;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

button:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-soft);
}

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

button:disabled:hover {
  background: var(--soft);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #eef2f6;
  color: var(--muted);
  cursor: not-allowed;
}

.secondary {
  background: #e9eff5;
  border: 1px solid #dbe3eb;
  color: var(--ink);
}

.secondary:hover {
  background: #d9e1e9;
}

.danger {
  background: #fde2df;
  border: 1px solid #fac8c2;
  color: var(--danger);
}

.danger:hover {
  background: #fac8c2;
}

.danger-soft {
  background: #fff4f2;
  border-color: #fac8c2;
  color: var(--danger);
}

.danger-soft:hover {
  background: #fde2df;
}

.app {
  margin: 0 auto;
  max-width: 1280px;
  padding: 30px;
}

.login-screen {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  justify-items: stretch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-width: 430px;
  padding: 34px;
  width: 100%;
}

.login-card h1 {
  font-size: 2rem;
  margin-bottom: 4px;
  text-align: center;
}

.login-card .eyebrow {
  text-align: center;
}

.login-logo {
  justify-self: center;
  height: 120px;
  object-fit: contain;
  width: 120px;
}

.login-error {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 800;
  min-height: 18px;
  margin: 0;
}

.demo-users {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 5px;
  font-size: 0.84rem;
  padding: 12px;
}

.demo-users strong {
  color: var(--ink);
}

.topbar,
.top-actions,
.panel-header,
.dialog-header,
.dialog-actions {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.topbar {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(214, 222, 230, 0.9);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
  padding: 16px;
}

.brand-header {
  align-items: center;
  display: flex;
  gap: 16px;
  min-width: 0;
}

.brand-logo {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 72px;
  object-fit: contain;
  padding: 8px;
  width: 72px;
}

.top-actions {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions button,
.top-actions span {
  flex: 0 0 auto;
}

.top-notification-button,
.top-orders-button {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.production-mode #topOrders {
  display: inline-flex !important;
}

.production-mode #topNotifications {
  display: inline-flex !important;
}

.production-mode #exportCsv,
.production-mode #newOrder {
  display: none !important;
}

.sales-mode #citiesTab,
.sales-mode #collaboratorsTab,
.sales-mode #productsTab,
.sales-mode #salesTab,
.sales-mode #exportCsv,
.sales-mode .summary {
  display: none !important;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.brand-name {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0 0 6px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 2.05rem;
  line-height: 1.05;
  margin-bottom: 0;
  white-space: nowrap;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 0;
}

.storage-badge {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  color: #9a3412;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 9px 12px;
}

.user-badge {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  color: #3730a3;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 9px 12px;
}

.storage-badge.cloud {
  background: #e6f6ef;
  border-color: #b7e4cf;
  color: #166534;
}

.app-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.production-mode .app-tabs {
  display: none !important;
}

.tab-button {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 38px;
}

.tab-button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.summary {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.summary article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.summary strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1;
}

.summary span,
.muted,
.panel-header span {
  color: var(--muted);
}

.filters {
  align-items: end;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 14px;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  margin-bottom: 16px;
  padding: 14px;
}

.order-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.order-status-tab {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  min-height: 40px;
}

.order-status-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.order-status-tab span {
  background: var(--soft);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  justify-content: center;
  min-width: 24px;
  padding: 3px 7px;
}

.order-status-tab.active span {
  background: #fff;
  color: var(--primary);
}

label {
  color: var(--muted);
  display: grid;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
  outline: none;
}

textarea {
  resize: vertical;
}

.orders-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.collaborator-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: 340px minmax(0, 1fr);
}

.collaborator-layout.single-column {
  grid-template-columns: 1fr;
}

.collaborator-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.collaborator-form {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.collaborator-list {
  display: grid;
  gap: 8px;
}

.collaborator-list-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px;
}

.collaborator-list-item span {
  font-weight: 800;
}

.collaborator-filters,
.collaborator-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0;
}

.collaborator-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.collaborator-summary article {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.collaborator-summary strong {
  display: block;
  font-size: 1.45rem;
}

.collaborator-summary span {
  color: var(--muted);
}

.sales-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 260px);
  margin: 16px 0;
}

.sales-summary article {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.sales-summary strong {
  display: block;
  font-size: 1.45rem;
}

.sales-summary span {
  color: var(--muted);
}

.collaborator-entries {
  display: grid;
  gap: 10px;
}

.collaborator-entry {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1.2fr 0.7fr 1fr 90px;
  padding: 12px;
}

.collaborator-entry span {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  margin-top: 4px;
}

.city-list-item {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.city-list-item strong {
  display: block;
}

.city-list-item span {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  margin-top: 4px;
}

.route-filter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
}

.route-filter strong {
  display: block;
}

.route-filter span {
  color: var(--muted);
  display: block;
  font-size: 0.84rem;
  margin-top: 3px;
}

.route-filter-options {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.route-filter-option {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
  min-height: 38px;
  padding: 8px 10px;
}

.route-filter-option input {
  min-height: auto;
  width: auto;
}

.route-filter-toggle {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  font-size: 0.9rem;
  font-weight: 800;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
}

.route-filter-toggle input {
  min-height: auto;
  width: auto;
}

.route-filter-option span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  margin: 0;
}

.city-list-item.active,
.city-list-item:hover {
  border-color: var(--complete);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.08);
}

.city-order-entry {
  cursor: pointer;
  grid-template-columns: 1.3fr 0.65fr 0.8fr 1fr;
}

.city-order-entry:hover {
  border-color: #9fb4c7;
}

.tab-badge {
  background: #e5eef6;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 900;
  justify-content: center;
  margin-left: 6px;
  min-width: 22px;
  padding: 2px 7px;
}

.tab-badge.has-unread {
  background: var(--danger);
  color: #fff;
}

.notification-entry {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 0.9fr 1.2fr 90px;
  padding: 12px;
}

.notification-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.notification-filter-tab {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  min-height: 38px;
  position: relative;
}

.notification-filter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.notification-filter-tab.has-unread::after {
  background: var(--danger);
  border-radius: 999px;
  color: #fff;
  content: attr(data-unread);
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 900;
  justify-content: center;
  min-width: 20px;
  padding: 2px 6px;
}

.notification-filter-tab.active.has-unread::after {
  background: #fff;
  color: var(--danger);
}

.notification-group {
  display: grid;
  gap: 10px;
}

.notification-group + .notification-group {
  margin-top: 18px;
}

.notification-group-title {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
}

.notification-group-title h3 {
  font-size: 1rem;
  margin: 0;
}

.notification-group-title span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.notification-entry.unread {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.08);
}

.notification-entry:hover {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: var(--shadow-soft);
}

.notification-entry span {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  margin-top: 4px;
}

.notification-entry p {
  color: var(--muted);
  margin: 0;
}

.product-entry {
  cursor: pointer;
  grid-template-columns: 1.35fr 0.7fr 1fr 110px;
}

.product-entry:hover {
  border-color: #9fb4c7;
}

.panel-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 13px;
}

.orders-list {
  display: grid;
  gap: 12px;
}

.order-card {
  background: #fff;
  border: 1px solid #dbe3eb;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(220px, 0.76fr) minmax(0, 1.95fr) minmax(80px, 0.24fr);
  padding: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.order-card:hover {
  border-color: rgba(15, 118, 110, 0.55);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.sales-order-card {
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.35fr);
}

.sales-card-note {
  align-self: center;
  border-left: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-left: 14px;
}

.sales-card-note span {
  color: var(--muted);
  font-size: 0.82rem;
}

.order-title {
  color: #0f172a;
  font-size: 1.04rem;
  font-weight: 800;
  margin-bottom: 5px;
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  justify-content: center;
  margin-top: 8px;
  padding: 6px 10px;
  width: fit-content;
}

.approval-ok,
.approval-pending,
.status-pill,
.pdf-pill,
.photo-pill {
  border: 1px solid transparent;
}

.status-nao_iniciado {
  background: #edf2f7;
  border-color: #d8e0ea;
  color: #334155;
}

.status-em_producao {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #075985;
}

.status-finalizado {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: var(--complete);
}

.status-embalado {
  background: #ccfbf1;
  border-color: #99f6e4;
  color: var(--primary);
}

.status-entregue {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.packing-actions {
  display: grid;
  gap: 10px;
}

.pdf-pill {
  background: #fef3c7;
  border-radius: 999px;
  color: #92400e;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  margin-left: 6px;
  padding: 7px 10px;
}

.photo-pill {
  background: #e0f2fe;
  border-radius: 999px;
  color: #075985;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  margin-left: 6px;
  padding: 7px 10px;
}

.due-text {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  margin-top: 10px;
}

.due-ok {
  color: var(--complete);
}

.due-warning {
  color: var(--warning);
}

.due-danger {
  color: var(--danger);
}

.due-danger,
.due-warning,
.due-ok {
  background: rgba(248, 250, 252, 0.85);
  border-radius: 7px;
  display: inline-block;
  padding: 4px 7px;
}

.purchase-summary {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.purchase-summary span {
  color: #607086;
  font-size: 0.8rem;
  font-weight: 800;
}

.mini-timeline {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow: auto;
  padding-right: 4px;
}

.mini-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(145px, 170px) minmax(120px, 170px) minmax(360px, 1fr);
  min-width: 700px;
}

.mini-row-info {
  grid-template-columns: minmax(145px, 170px) minmax(500px, 1fr);
}

.mini-item-title {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  margin-top: 4px;
  min-width: 760px;
  padding: 7px 9px;
}

.mini-name {
  color: #536172;
  font-size: 0.78rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-bar {
  background: #e7edf3;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.mini-fill {
  background: var(--primary);
  height: 100%;
}

.mini-time {
  color: #536172;
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
}

.progress-number {
  align-self: center;
  color: #0f172a;
  font-size: 1.35rem;
  font-weight: 800;
  justify-self: end;
}

dialog {
  border: 0;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
  max-width: 1040px;
  padding: 22px;
  width: calc(100% - 32px);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.report-dialog {
  display: grid;
  gap: 16px;
}

.product-report-content {
  display: grid;
  gap: 16px;
}

.report-summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-summary-grid article {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.report-summary-grid span {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.report-summary-grid strong {
  display: block;
}

.sales-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sales-notes {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.sales-notes h3 {
  font-size: 1rem;
  margin: 0 0 8px;
}

.sales-notes p {
  color: var(--muted);
  margin: 0;
}

.report-section-title {
  font-size: 1rem;
  margin: 0 0 8px;
}

.report-table-wrap {
  overflow-x: auto;
}

.report-table {
  border-collapse: collapse;
  min-width: 720px;
  width: 100%;
}

.report-table th,
.report-table td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

.report-table th {
  background: var(--primary);
  color: #fff;
}

.icon-button {
  background: transparent;
  color: var(--ink);
  min-height: 34px;
  padding: 0 10px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 18px 0;
  padding: 14px;
}

.stage-grid {
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  margin-bottom: 16px;
  overflow: hidden;
}

.stage-row {
  align-items: end;
  background: #fff;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(140px, 0.75fr) 1fr 1fr minmax(140px, 0.8fr);
  padding: 14px;
}

.stage-row:nth-child(even) {
  background: #fbfdff;
}

.stage-row:not(.single-stage) {
  align-items: start;
  grid-template-columns: minmax(140px, 0.24fr) minmax(0, 1fr);
}

.stage-row.single-stage {
  grid-template-columns: minmax(150px, 0.8fr) 1fr;
}

.stage-row + .stage-row {
  border-top: 1px solid var(--line);
}

.stage-name {
  color: var(--ink);
  font-weight: 800;
  padding-bottom: 10px;
}

.stage-step-area,
.stage-step-list {
  display: grid;
  gap: 10px;
}

.stage-step-row {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(110px, 0.55fr) minmax(0, 1fr) minmax(0, 1fr) minmax(130px, 0.9fr) auto;
}

.stage-step-label {
  color: var(--muted);
  font-weight: 800;
  padding-bottom: 10px;
}

.stage-add-step {
  justify-self: start;
  min-height: 36px;
  padding: 0 12px;
}

.stage-remove-step {
  align-self: end;
  color: var(--danger);
  min-width: 64px;
}

.stage-completion {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px;
}

.stage-completion span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.stage-completion span.done {
  color: var(--primary);
}

.stage-complete-button {
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.stage-mode-control,
.collection-control {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px;
}

.stage-mode-control label {
  min-width: 220px;
}

.stage-mode-control span,
.collection-control span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.collection-button {
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.approval-section,
.receipt-section,
.packing-section {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 15px;
}

.order-items-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
  padding: 14px;
}

.order-items-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.order-items-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.order-item-button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  display: grid;
  gap: 4px;
  min-height: 54px;
  min-width: 180px;
  padding: 9px 12px;
  text-align: left;
}

.order-item-button span {
  color: var(--muted);
  font-size: 0.82rem;
}

.order-item-button.active,
.order-item-button:hover {
  background: #eef8f6;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.08);
}

.stage-title-row h3 {
  font-size: 1rem;
  margin: 0 0 10px;
}

.approval-section h3,
.receipt-section h3,
.packing-section h3 {
  font-size: 1rem;
  margin: 0 0 5px;
}

.approval-section p,
.receipt-section p,
.packing-section p {
  color: var(--muted);
  margin: 0;
}

.approval-toggle {
  align-items: center;
  display: flex;
  font-weight: 800;
  gap: 8px;
  white-space: nowrap;
}

.approval-toggle input {
  height: 18px;
  width: 18px;
}

.approval-controls {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-end;
}

.approval-ok {
  background: rgba(47, 111, 78, 0.12);
  color: var(--complete);
}

.approval-pending {
  background: rgba(161, 98, 7, 0.14);
  color: var(--warning);
}

.purchase-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
  padding: 14px;
}

.section-title {
  margin-bottom: 12px;
}

.section-title h3 {
  font-size: 1rem;
  margin: 0 0 5px;
}

.section-title p {
  color: var(--muted);
  margin: 0;
}

.purchase-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.purchase-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.purchase-name {
  color: var(--ink);
  font-weight: 800;
}

.stock-toggle {
  align-items: center;
  display: flex;
  font-weight: 800;
  gap: 8px;
}

.stock-toggle input {
  height: 18px;
  width: 18px;
}

.chat-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
  padding: 14px;
}

.chat-messages {
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding: 12px;
}

.chat-message {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.chat-message span {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-top: 3px;
}

.chat-message p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.chat-compose {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.chat-preview {
  display: grid;
  gap: 10px;
}

.chat-preview article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.chat-preview span {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-top: 3px;
}

.chat-preview p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.sales-notes .chat-preview p {
  color: var(--ink);
}

.attachment-box {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-top: 16px;
  padding: 14px;
}

.attachment-box h3 {
  font-size: 1rem;
  margin: 0 0 5px;
}

.attachment-box p {
  color: var(--muted);
  margin: 0;
}

.attachment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.attachment-actions button {
  min-width: 160px;
}

.additional-photos-section {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
}

.photo-list {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
}

.photo-list-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px;
}

.photo-list-item span {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-top: 3px;
}

.photo-list-item div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.file-button {
  align-items: center;
  background: var(--primary);
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  min-height: 40px;
  padding: 0 14px;
}

.file-button input {
  display: none;
}

.dialog-actions {
  margin-top: 18px;
}

.dialog-actions div {
  display: flex;
  gap: 10px;
}

.empty {
  color: var(--muted);
  margin: 0;
  padding: 20px 0;
}

@media (max-width: 900px) {
  .app {
    padding: 18px;
  }

  .topbar,
  .dialog-actions,
  .approval-section,
  .receipt-section,
  .packing-section {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-header {
    align-items: flex-start;
  }

  .brand-logo {
    height: 58px;
    width: 58px;
  }

  h1 {
    font-size: 1.55rem;
    white-space: normal;
  }

  .top-actions,
  .dialog-actions div {
    justify-content: stretch;
  }

  .top-actions button,
  .dialog-actions button,
  .order-status-tab,
  .notification-filter-tab {
    flex: 1;
  }

  .summary,
  .filters,
  .collaborator-layout,
  .collaborator-filters,
  .collaborator-summary,
  .sales-summary,
  .report-summary-grid,
  .sales-detail-grid,
  .form-grid,
  .purchase-grid,
  .order-card,
  .collaborator-entry,
  .city-order-entry,
  .notification-entry,
  .product-entry,
  .stage-row,
  .stage-row.single-stage {
    grid-template-columns: 1fr;
  }

  .stage-step-row {
    grid-template-columns: 1fr;
  }

  .stage-completion {
    align-items: stretch;
    flex-direction: column;
  }

  .stage-mode-control,
  .collection-control {
    align-items: stretch;
    flex-direction: column;
  }

  .app-tabs {
    flex-direction: column;
  }

  .attachment-box {
    align-items: stretch;
    flex-direction: column;
  }

  .approval-toggle {
    white-space: normal;
  }

  .approval-controls,
  .order-items-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .attachment-actions {
    justify-content: stretch;
  }

  .attachment-actions button,
  .file-button {
    flex: 1;
    justify-content: center;
  }

  .progress-number {
    justify-self: start;
  }

  .mini-row {
    align-items: start;
    grid-template-columns: 130px 1fr;
    min-width: 0;
  }

  .mini-time {
    grid-column: 1 / -1;
    text-align: left;
    white-space: normal;
  }
}
