:root {
  color-scheme: light;
  --ink: #303030;
  --muted: #616161;
  --line: #d4d4d4;
  --surface: #f1f1f1;
  --panel: #ffffff;
  --panel-subdued: #f7f7f7;
  --accent: #008060;
  --accent-strong: #005e46;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --warn: #8a6116;
  --soft: #ebf5f0;
  --focus: #005bd3;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.05), 0 8px 24px rgba(0, 0, 0, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 10;
  padding: 8px 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--focus);
}

.skip-link:focus-visible {
  top: 12px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--ink);
  -webkit-tap-highlight-color: rgba(0, 91, 211, 0.12);
}

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

button,
select,
input,
textarea {
  touch-action: manipulation;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 96px;
  padding: 18px 28px;
  overflow: hidden;
  border-bottom: 1px solid rgba(146, 232, 197, 0.28);
  color: #f4fffb;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, #071f19 0%, #0d3028 52%, #154b3d 100%);
  background-size: 44px 44px, 44px 44px, auto;
  box-shadow: 0 12px 34px rgba(0, 37, 27, 0.22);
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 4px;
  color: #9ee8c7;
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

.topbar h1 {
  color: #ffffff;
  font-weight: 800;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.28);
}

h2 {
  font-size: 18px;
}

.status {
  min-width: 128px;
  padding: 8px 12px;
  border: 1px solid rgba(175, 255, 222, 0.34);
  border-radius: 8px;
  color: #d9fff1;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 96px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #ebebeb;
}

.nav-button,
.primary,
.ghost,
.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.nav-button {
  justify-content: flex-start;
  padding: 10px 12px;
  color: var(--ink);
  background: transparent;
}

.nav-button.active {
  color: var(--ink);
  border-color: #c9c9c9;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.nav-button:hover {
  background: #f7f7f7;
}

.primary {
  padding: 0 14px;
  color: white;
  background: var(--accent);
}

.primary:hover {
  background: var(--accent-strong);
}

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

.ghost,
.danger {
  min-height: 32px;
  padding: 0 10px;
  background: var(--panel);
}

.ghost {
  border-color: var(--line);
  color: var(--ink);
}

.ghost:hover {
  border-color: #a8a8a8;
  background: var(--panel-subdued);
}

.danger {
  border-color: #fed3d1;
  color: var(--danger);
}

.danger:hover {
  background: var(--danger-soft);
}

.workspace {
  padding: 22px;
  min-width: 0;
}

.page-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-section-header .subtle {
  margin-top: 4px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.order-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) repeat(4, minmax(140px, 1fr)) auto;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.logistics-toolbar,
.cost-toolbar {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.logistics-toolbar .search-field,
.cost-toolbar .search-field {
  flex: 1 1 280px;
  min-width: 240px;
}

select,
input,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--panel);
  color: var(--ink);
}

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

.toolbar select {
  max-width: 360px;
}

.order-toolbar select {
  max-width: none;
}

.field {
  min-width: 0;
}

.field.compact {
  max-width: 160px;
}

.toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.orders-table {
  min-width: 1480px;
}

.logistics-table {
  min-width: 1640px;
}

.cost-table {
  min-width: 1040px;
}

.orders-table th:nth-child(1),
.logistics-table th:nth-child(1) {
  width: 46px;
}

.orders-table th:nth-child(2) {
  width: 150px;
}

.orders-table th:nth-child(3) {
  width: 150px;
}

.orders-table th:nth-child(4) {
  width: 130px;
}

.orders-table th:nth-child(5) {
  width: 110px;
}

.orders-table th:nth-child(6) {
  width: 190px;
}

.orders-table th:nth-child(7) {
  width: 120px;
}

.orders-table th:nth-child(8) {
  width: 120px;
}

.orders-table th:nth-child(9) {
  width: 180px;
}

.orders-table th:nth-child(10) {
  width: 124px;
}

.logistics-table th:nth-child(2) {
  width: 190px;
}

.logistics-table th:nth-child(3) {
  width: 160px;
}

.logistics-table th:nth-child(4),
.logistics-table th:nth-child(5),
.logistics-table th:nth-child(6) {
  width: 210px;
}

.logistics-table th:nth-child(7) {
  width: 230px;
}

.logistics-table th:nth-child(8),
.logistics-table th:nth-child(9) {
  width: 140px;
}

.logistics-table th:nth-child(10) {
  width: 190px;
}

.cost-table th:nth-child(1) {
  width: 180px;
}

.cost-table th:nth-child(2) {
  width: 150px;
}

.cost-table th:nth-child(3) {
  width: 260px;
}

.cost-table th:nth-child(4),
.cost-table th:nth-child(5) {
  width: 130px;
}

.cost-table th:nth-child(6) {
  width: 190px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: var(--panel-subdued);
}

.cost-table th,
.cost-table td {
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.25;
}

.cost-table th {
  height: 38px;
}

.cost-table .title {
  line-height: 1.25;
}

.cost-table .subtle {
  font-size: 12px;
  line-height: 1.25;
}

.cost-table .badge {
  padding: 2px 7px;
  min-height: 22px;
}

.cost-table .number-block + .number-block {
  margin-top: 3px;
}

.cost-date-line {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.select-col {
  width: 42px;
  text-align: center;
}

.select-col input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.selection-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-info {
  margin-left: auto;
}

.pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.empty {
  height: 160px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

.split {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
}

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

.rules-layout > .panel {
  min-width: 0;
}

.rules-tools-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(380px, 1.05fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.rules-list-panel,
.rate-quote-panel {
  min-height: 520px;
  min-width: 0;
}

.compact-list {
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.compact-list .item {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 10px;
}

.compact-list .item-row {
  align-items: flex-start;
}

.compact-list .item-copy {
  min-width: 0;
  overflow: hidden;
}

.compact-list .title,
.compact-list .subtle {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.compact-list .row-actions {
  flex: 0 0 auto;
}

.panel-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.small-action {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.quote-input-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

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

.country-field {
  position: relative;
}

.country-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
}

.country-picker-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  width: min(540px, 78vw);
  max-height: 390px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #b7c7bf;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 45px rgba(0, 46, 33, 0.18);
}

.country-picker-panel.hidden {
  display: none;
}

.country-picker-list {
  display: grid;
  gap: 4px;
  max-height: 300px;
  overflow: auto;
}

.country-picker-option {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) 42px;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.country-picker-option:hover {
  border-color: #b7d7ca;
  background: #edf7f2;
}

.country-picker-option span,
.country-picker-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-picker-option b {
  justify-self: end;
  color: #005e46;
  font-size: 12px;
}

.rate-results {
  min-height: 120px;
}

.rate-quote-table-shell {
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.rate-quote-table {
  min-width: 440px;
  table-layout: fixed;
}

.rate-quote-table th,
.rate-quote-table td {
  padding: 7px 8px;
  font-size: 12px;
  line-height: 1.25;
}

.rate-quote-table th:nth-child(1) {
  width: 42%;
}

.rate-quote-table th:nth-child(2) {
  width: 54px;
}

.rate-quote-table th:nth-child(3) {
  width: 92px;
}

.rate-quote-table th:nth-child(4) {
  width: 78px;
}

.rate-quote-table th:nth-child(5) {
  width: 78px;
}

.rate-quote-table tr.priced {
  background: #f7fcf9;
}

.rate-quote-table tr.missing {
  color: var(--muted);
}

.rate-channel-name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rate-service-code {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.carrier-short {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  min-height: 22px;
  padding: 0 6px;
  border: 1px solid #bdd9ce;
  border-radius: 999px;
  color: #005e46;
  background: #edf7f2;
  font-size: 12px;
  font-weight: 800;
}

.rate-price {
  color: var(--accent-strong);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quote-rule-button {
  gap: 4px;
  min-height: 28px;
  padding: 0 7px;
  font-size: 12px;
}

.quote-rule-button svg {
  width: 14px;
  height: 14px;
}

.compact-empty {
  height: auto;
  min-height: 120px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

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

.cost-toolbar {
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
}

.cost-toolbar label {
  gap: 4px;
}

.metric-card {
  display: grid;
  gap: 4px;
  min-height: 60px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  font-size: 21px;
  line-height: 1.2;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--ink);
}

.inline-check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subdued);
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-copy {
  min-width: 0;
}

.title {
  font-weight: 700;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid #c9d8d1;
  color: #005e46;
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

.badge.status-fulfilled {
  border-color: #d4d4d4;
  color: #616161;
  background: #f1f1f1;
}

.badge.status-partial {
  border-color: #ffd79d;
  color: #8a6116;
  background: #fff4e5;
}

.badge.status-unfulfilled {
  border-color: #ffe08a;
  color: #5f4b00;
  background: #fff8db;
}

.badge.warning {
  border-color: #ffd79d;
  color: #8a6116;
  background: #fff4e5;
}

.badge.soft {
  border-color: #c9d8d1;
  color: #005e46;
  background: #ebf5f0;
}

.badge.status-canceled,
.badge.status-failed {
  border-color: #d4d4d4;
  color: #616161;
  background: #f1f1f1;
}

.badge.shipping-express {
  border-color: #b8d8ff;
  color: #084e8a;
  background: #eef6ff;
}

.badge.shipping-standard {
  border-color: #c9d8d1;
  color: #005e46;
  background: #ebf5f0;
}

.badge.shipping-other {
  border-color: #d4d4d4;
  color: var(--muted);
  background: #f7f7f7;
}

.tags-cell {
  min-width: 150px;
}

.tag-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag-chip {
  display: inline-flex;
  max-width: 150px;
  min-height: 22px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid #d4d4d4;
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel-subdued);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-button,
.icon-button {
  min-height: 30px;
  padding: 0 8px;
}

.icon-button {
  width: 34px;
}

.order-cell,
.line-items {
  min-width: 0;
}

.line-item-row {
  display: block;
  margin-bottom: 8px;
}

.line-item-code {
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient-summary-cell {
  vertical-align: middle;
}

.expand-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 700;
  cursor: pointer;
}

.expand-button:hover {
  border-color: #9fb5aa;
  background: var(--panel-subdued);
}

.expand-glyph {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #c9d8d1;
  border-radius: 4px;
  color: #005e46;
  background: var(--soft);
  font-size: 14px;
  line-height: 1;
}

.order-row.expanded td {
  border-bottom-color: transparent;
}

.order-detail-row > td {
  padding: 0 16px 16px 62px;
  background: #fbfaf7;
}

.order-detail-panel {
  display: grid;
  grid-template-columns: minmax(360px, 1.4fr) minmax(280px, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subdued);
}

.detail-section-heading {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.order-product-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  max-width: 520px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.order-product-card .line-item-thumb {
  width: 42px;
  height: 42px;
}

.order-product-copy {
  min-width: 0;
}

.recipient-detail {
  display: grid;
  gap: 6px;
  align-content: start;
}

.empty.compact {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.line-item-thumb,
.split-item-thumb {
  display: block;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-subdued);
}

.split-item-thumb {
  width: 54px;
  height: 54px;
}

.empty-thumb::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, transparent 48%, #d4d4d4 49%, #d4d4d4 51%, transparent 52%);
}

.tracking-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.tracking-summary {
  display: grid;
  gap: 3px;
  margin-top: 6px;
  font-size: 13px;
}

.numeric {
  font-variant-numeric: tabular-nums;
}

.number-block + .number-block {
  margin-top: 6px;
}

.number-block .title {
  max-width: 100%;
  word-break: break-word;
}

.row-actions {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
}

.orders-table .row-actions {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  align-items: center;
  gap: 6px;
}

.orders-table .row-actions .mini-button {
  position: relative;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 7px;
}

.orders-table .row-actions .mini-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.email-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(280px, 0.9fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
}

.social-settings-layout {
  grid-template-columns: repeat(2, minmax(320px, 1fr));
}

.social-config-header {
  align-items: center;
}

.social-desktop {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  gap: 18px;
  margin-bottom: 18px;
}

.social-groups-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  align-content: start;
}

.social-folder-card,
.social-empty-folder,
.social-callback-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(7, 31, 25, 0.08);
}

.social-folder-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.social-folder-card-unfiled {
  align-self: start;
  background:
    linear-gradient(180deg, rgba(236, 253, 245, 0.82), rgba(255, 255, 255, 0.94)),
    var(--panel);
}

.social-folder-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.social-folder-head h3 {
  margin: 0 0 3px;
  font-size: 16px;
}

.social-folder-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.social-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  min-height: 132px;
}

.social-drop-zone {
  padding: 10px;
  border: 1px dashed #b7c9c0;
  border-radius: 8px;
  background: #f7faf8;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.social-drop-zone.drag-over {
  border-color: var(--shopify-green);
  background: #eefcf6;
  box-shadow: inset 0 0 0 1px rgba(0, 128, 96, 0.18);
}

.social-drop-empty {
  display: grid;
  place-items: center;
  min-height: 86px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.social-account-card,
.social-add-tile {
  min-width: 0;
  width: 100%;
  border: 1px solid #d7e2dd;
  border-radius: 8px;
  background: #ffffff;
}

.social-account-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  cursor: grab;
  user-select: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.social-account-card:hover {
  border-color: #9fb7ad;
  box-shadow: 0 8px 20px rgba(7, 31, 25, 0.08);
  transform: translateY(-1px);
}

.social-account-card.dragging {
  opacity: 0.58;
  cursor: grabbing;
}

.social-account-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0;
  background: #008060;
}

.social-account-icon.facebook {
  background: #1877f2;
}

.social-account-icon.threads {
  background: #111111;
}

.social-account-icon.tiktok {
  background: #0f172a;
}

.social-account-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.social-account-title {
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-account-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.social-card-actions {
  display: grid;
  gap: 6px;
}

.social-add-tile {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 96px;
  color: var(--shopify-green);
  border-style: dashed;
  cursor: pointer;
}

.social-add-tile:hover {
  background: #f1fbf6;
}

.social-empty-folder {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px;
}

.social-empty-folder svg {
  color: var(--shopify-green);
}

.social-empty-folder div {
  display: grid;
  gap: 3px;
}

.social-empty-folder span {
  color: var(--muted);
  font-size: 13px;
}

.social-callback-card {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(220px, 1fr) minmax(260px, 1fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: end;
  padding: 14px;
}

.social-callback-card h2 {
  margin: 0 0 4px;
}

.meta-callback-panel {
  min-width: 0;
}

.copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.copy-field input[readonly] {
  color: var(--ink);
  background: var(--panel-subdued);
  overflow: hidden;
  text-overflow: ellipsis;
}

.mailbox-toolbar {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.mailbox-toolbar .search-field {
  flex: 1 1 260px;
}

.mailbox-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.42fr) minmax(0, 1fr);
  height: calc(100vh - 285px);
  min-height: 460px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.mailbox-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #f8faf9;
}

.mailbox-message-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  scrollbar-gutter: stable;
  overflow: auto;
}

.mailbox-message-card {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 88px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  text-align: left;
  white-space: normal;
}

.mailbox-message-card.active {
  border-color: #78bca4;
  background: #eef8f3;
}

.mailbox-message-title {
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mailbox-message-meta,
.mailbox-message-foot {
  color: var(--muted);
  font-size: 12px;
}

.mailbox-message-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mailbox-detail-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 14px;
}

.mailbox-message-detail {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  padding-right: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  font-size: 14px;
  line-height: 1.48;
  overscroll-behavior: contain;
}

.mailbox-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.mailbox-detail-head h3 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.25;
}

.mailbox-body {
  margin: 12px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.5;
}

.mailbox-body-html {
  margin: 12px 0 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.5;
}

.mailbox-body-html p,
.mailbox-body-html div {
  margin-top: 0;
}

.mailbox-body-html img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.mailbox-summary-chip,
.mailbox-contact-button,
.mailbox-load-more {
  font: inherit;
}

.mailbox-summary-chip {
  margin-left: 8px;
  padding: 4px 8px;
  border: 1px solid #a9d7c5;
  border-radius: 999px;
  color: var(--green);
  background: #eef8f3;
  cursor: pointer;
}

.mailbox-contact-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.mailbox-contact-button {
  padding: 0;
  border: 0;
  color: var(--accent-strong);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.mailbox-classification {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.mailbox-list-status {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.mailbox-load-more {
  width: 100%;
  min-height: 38px;
  border: 1px dashed #a9d7c5;
  border-radius: 8px;
  color: var(--green);
  background: #f3fbf7;
  cursor: pointer;
}

.mailbox-reply-form {
  display: grid;
  gap: 8px;
  min-height: 0;
  max-height: 260px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.mailbox-reply-form label {
  gap: 4px;
}

.mailbox-reply-form input,
.mailbox-reply-form textarea {
  min-height: 34px;
  font-size: 13px;
}

.mailbox-reply-form textarea {
  min-height: 86px;
  max-height: 128px;
}

.mapping-list,
.mailbox-list {
  display: grid;
  gap: 8px;
}

.mapping-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(160px, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0;
}

.mailbox-pill {
  width: fit-content;
  padding: 6px 10px;
  border: 1px solid #a9d7c5;
  border-radius: 999px;
  color: var(--green);
  background: #eef8f3;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.modal {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal.wide,
.modal:has(.modal-panel.wide) {
  width: min(760px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(48, 48, 48, 0.36);
}

.modal-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.warning-box {
  padding: 10px 12px;
  border: 1px solid #ffd79d;
  border-radius: 8px;
  color: #8a6116;
  background: #fff4e5;
  line-height: 1.5;
}

.failure-list {
  display: grid;
  max-height: 50vh;
  overflow: auto;
  gap: 8px;
}

.failure-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9faf9;
}

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

.span-2 {
  grid-column: span 2;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.split-items {
  display: grid;
  gap: 10px;
  max-height: min(58vh, 520px);
  overflow: auto;
}

.split-item {
  display: grid;
  grid-template-columns: 24px 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subdued);
  color: var(--ink);
}

.split-item-check {
  width: 18px;
  min-height: 18px;
  justify-self: center;
  cursor: pointer;
}

.split-item-copy {
  min-width: 0;
}

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

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.operation-status {
  position: fixed;
  right: 20px;
  bottom: 76px;
  z-index: 20;
  display: inline-flex;
  max-width: 460px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #9bc5b1;
  border-radius: 8px;
  color: #005e46;
  background: #ebf5f0;
  box-shadow: var(--shadow);
  font-weight: 650;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 94, 70, 0.25);
  border-top-color: #005e46;
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none;
}

svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}

@media (max-width: 880px) {
  .layout,
  .split,
  .email-layout,
  .social-desktop,
  .social-callback-card,
  .mailbox-shell,
  .rules-layout,
  .rules-tools-grid {
    grid-template-columns: 1fr;
  }

  .mailbox-list-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .page-section-header,
  .selection-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .order-toolbar {
    grid-template-columns: 1fr;
  }

  .field.compact,
  .toolbar-actions,
  .bulk-actions {
    max-width: none;
    width: 100%;
  }

  .toolbar-actions > *,
  .bulk-actions > * {
    flex: 1 1 auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .quote-input-grid,
  .quote-dimension-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}
