html {
  background: #06111d;
  color-scheme: dark;
}

body.app-shell {
  margin: 0;
  min-height: 100vh;
  color: #e2e8f0;
  font-family: "Segoe UI Variable", "Segoe UI", "Aptos", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 24%),
    linear-gradient(180deg, #07111f 0%, #081425 42%, #050b16 100%);
}

body.app-shell::before,
body.app-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body.app-shell::before {
  background:
    radial-gradient(circle at 18% 18%, rgba(45, 212, 191, 0.16), transparent 22%),
    radial-gradient(circle at 78% 14%, rgba(96, 165, 250, 0.12), transparent 20%),
    radial-gradient(circle at 50% 82%, rgba(15, 23, 42, 0.36), transparent 22%);
  filter: blur(28px);
}

body.app-shell::after {
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.11;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent);
}

.app-layout {
  position: relative;
  z-index: 1;
}

/* Global control system so the entire page matches the card language */
.app-shell button:not(.checkbox-smooth):not(.modal-close):not(.order-link-btn):not(.order-icon-btn):not(.order-processing-toggle),
.app-shell input:not([type="checkbox"]):not([type="radio"]),
.app-shell textarea {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(15, 23, 42, 0.66));
  color: #e2e8f0;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.16);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.app-shell button:not(.checkbox-smooth):not(.modal-close):not(.order-link-btn):not(.order-icon-btn):not(.order-processing-toggle):hover,
.app-shell input:not([type="checkbox"]):not([type="radio"]):hover,
.app-shell textarea:hover,
.app-shell input:not([type="checkbox"]):not([type="radio"]):focus,
.app-shell textarea:focus {
  border-color: rgba(96, 165, 250, 0.34);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.22);
}

.app-shell button:not(.checkbox-smooth):not(.modal-close):not(.order-link-btn):not(.order-icon-btn):not(.order-processing-toggle):hover {
  transform: translateY(-1px);
}

.app-shell input:not([type="checkbox"]):not([type="radio"]),
.app-shell textarea {
  padding: 0.64rem 0.8rem;
}

.app-shell input::placeholder,
.app-shell textarea::placeholder {
  color: rgba(148, 163, 184, 0.85);
}

.surface-panel,
.app-header,
.status-pill,
.modal-content,
.price-card {
  border-radius: 22px;
}

.section-panel,
.sidebar-panel,
.modal-content,
.price-card,
.order-card,
.order-link-btn,
.order-processing-toggle,
.order-icon-btn,
.status-pill {
  backdrop-filter: blur(14px);
}

.section-panel {
  padding: 1rem;
}

.section-panel > .flex.items-center.justify-between,
.section-panel > .w-full.flex.items-center.justify-between {
  min-height: 3rem;
  padding: 0.1rem 0 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  margin-bottom: 1rem;
}

.section-panel h2,
.sidebar-panel .font-medium,
.app-header h1,
.modal-header h3,
.order-card__section-label {
  letter-spacing: 0.01em;
}

.overview-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.overview-split-grid--charts {
  gap: 1.5rem;
}

@media (max-width: 1023px) {
  .overview-split-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.sidebar-panel {
  gap: 0.8rem;
}

.sidebar-panel .price-card,
.sidebar-panel button,
.sidebar-panel .btn-slate,
.sidebar-panel .btn-brand {
  width: 100%;
}

.sidebar-panel button,
.sidebar-panel .btn-slate,
.sidebar-panel .btn-brand {
  min-height: 2.7rem;
  padding: 0.7rem 0.9rem;
  text-align: left;
}

.sidebar-panel #ebayLogin,
.sidebar-panel #syncEbayOrders,
.sidebar-panel #CrunchyrollrefreshResellerPrice {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
}

.sidebar-panel #ebayLogin,
.sidebar-panel #syncEbayOrders {
  font-weight: 700;
}

.sidebar-panel .price-card {
  min-height: 5.2rem;
  padding: 0.85rem;
}

.sidebar-panel .price-card .text-xs,
.sidebar-panel .price-card .text-sm {
  color: #cbd5e1;
}

.app-header input {
  min-height: 2.7rem;
}

.status-pill {
  min-height: 2.7rem;
}

.modal-content {
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.modal-composer .input-dark {
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.5), rgba(15, 23, 42, 0.72));
}

.modal-composer .btn-brand,
.modal-composer .btn-slate {
  min-height: 2.5rem;
}

.modal-composer .btn-brand {
  color: #04151f;
}

.surface-panel {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(15, 23, 42, 0.64));
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 22px 50px rgba(2, 6, 23, 0.3);
  backdrop-filter: blur(18px);
}

.sidebar-panel,
.section-panel,
.hero-panel {
  border-radius: 22px;
}

.sidebar-panel {
  padding: 1rem;
}

.app-header {
  padding: 1rem 1.1rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.76), rgba(15, 23, 42, 0.6));
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 16px 38px rgba(2, 6, 23, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
}

.search-shell {
  position: relative;
}

.search-shell input {
  padding-right: 2.6rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.76), rgba(15, 23, 42, 0.6));
  color: #cbd5e1;
}

.sidebar-panel > .mt-4,
.sidebar-panel > .mt-4 > div,
.sidebar-panel > .mt-4 > button,
.sidebar-panel > .mt-4 > .price-card {
  border-radius: 16px;
}

.sidebar-panel button,
.app-header input,
.status-pill,
.price-card,
.btn-brand,
.btn-slate,
.input-dark {
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.16);
}

.sidebar-panel button,
#CrunchyrollrefreshResellerPrice,
.app-header input {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(15, 23, 42, 0.66));
  color: #e2e8f0;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.sidebar-panel button:hover,
#CrunchyrollrefreshResellerPrice:hover,
.app-header input:focus {
  border-color: rgba(96, 165, 250, 0.34);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.22);
}

#syncEbayOrders {
  background: linear-gradient(180deg, rgba(51, 65, 85, 0.86), rgba(30, 41, 59, 0.78));
}

#ebayLogin {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.86), rgba(6, 182, 212, 0.76));
  color: #04151f;
  font-weight: 700;
}

#CrunchyrollrefreshResellerPrice {
  width: 100%;
  font-size: 0.75rem;
}

.app-header input {
  border-radius: 14px;
}

.sidebar-panel .price-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.84), rgba(15, 23, 42, 0.68));
}

.sidebar-panel .price-card--good,
.sidebar-panel .price-card--warn,
.sidebar-panel .price-card--bad {
  border-radius: 16px;
}

#ordersView > section {
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

#ordersView > section:hover {
  border-color: rgba(20, 184, 166, 0.26);
  box-shadow: 0 26px 60px rgba(2, 6, 23, 0.36);
}

.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  align-items: start;
  justify-items: start;
}

/* Default column width when we want fixed-width columns */
:root {
  --order-card-width: 340px;
}

/* When there are fewer than 3 cards, use a 3-column placeholder grid
   so single or two cards keep the same size and spacing. JS will add
   the `grid-packed` class and set gridColumn on the actual items. */
.orders-grid.grid-packed {
  grid-template-columns: repeat(3, var(--order-card-width));
  justify-content: flex-start;
}

.orders-grid.grid-packed > .order-card {
  width: var(--order-card-width);
}

.orders-grid > .order-card {
  width: 100%;
}

.price-card{
  padding:0.65rem 0.75rem;
  border-radius:10px;
  background: rgba(10,14,20,0.32);
  border:1px solid rgba(148,163,184,0.06);
  color:#cbd5e1;
}
.price-card{ transition: transform 140ms ease, box-shadow 160ms ease; }
.price-card:hover{ transform: translateY(-3px); }

/* Modal for messages */
/* Modal for messages and buyer details */
#messagesModal, #buyerDetailsModal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; }
#messagesModal.hidden, #buyerDetailsModal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,6,23,0.8); backdrop-filter: blur(4px); transition: all 240ms ease; }
.modal-content { position: relative; width: 92%; max-width: 720px; background: linear-gradient(180deg,rgba(15,23,42,0.95),rgba(10,18,35,0.9)); border: 1px solid rgba(148,163,184,0.12); border-radius: 16px; padding: 1.2rem; z-index: 70; box-shadow: 0 20px 60px rgba(2,6,23,0.4); backdrop-filter: blur(12px); animation: modalSlideIn 280ms cubic-bezier(0.23, 1, 0.32, 1); }
.modal-header { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:0.8rem; }
.modal-close { background:transparent; border:0; color:#94a3b8; font-size:16px; cursor:pointer; transition: all 200ms ease; }
.modal-close:hover { color: #e2e8f0; transform: scale(1.1); }
.modal-body { max-height: 56vh; overflow:auto; display:flex; flex-direction:column; gap:0.5rem; }
.msg { padding:0.7rem; border-radius:8px; background: rgba(255,255,255,0.02); border:1px solid rgba(255,255,255,0.04); animation: fadeUp 300ms cubic-bezier(0.23, 1, 0.32, 1) both; }
.msg .meta { color:#94a3b8; font-size:12px; margin-bottom:6px; }
.msg .text { color:#e6eef8; font-size:13px; white-space:pre-wrap; }

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Composer styles inside modal */
.modal-composer { margin-top: 0.8rem; padding-top: 0.6rem; border-top: 1px solid rgba(148,163,184,0.03); }
.modal-composer textarea.input-dark { min-height: 68px; resize: vertical; padding: 0.6rem; border-radius:8px; background: rgba(255,255,255,0.02); color: #e6eef8; border: 1px solid rgba(148,163,184,0.04); }
.modal-composer .btn-brand { background: linear-gradient(135deg,#06b6d4,#06d6a0); color: #042029; padding: 0.65rem 1rem; border-radius: 8px; font-weight:600; }
.modal-composer .btn-brand:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(6, 182, 212, 0.25); }
.modal-composer .btn-slate { background: linear-gradient(135deg, #64748b, #475569); color: white; border: none; }
.modal-composer .btn-slate:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(100, 116, 139, 0.2); }

.price-card--good{
  border-color: rgba(34,197,94,0.22);
  box-shadow: 0 6px 18px rgba(16,185,129,0.06);
  background: linear-gradient(180deg, rgba(20,184,166,0.06), rgba(15,23,42,0.4));
}

.price-card--warn{
  border-color: rgba(234,179,8,0.22);
  box-shadow: 0 6px 18px rgba(250,204,21,0.04);
  background: linear-gradient(180deg, rgba(250,204,21,0.03), rgba(15,23,42,0.28));
}
.price-card--bad{
  border-color: rgba(239,68,68,0.22);
  box-shadow: 0 6px 18px rgba(239,68,68,0.06);
  background: linear-gradient(180deg, rgba(239,68,68,0.03), rgba(15,23,42,0.28));
}

.order-card {
  position: relative;
  overflow: auto;
  border-radius: 18px;
  padding: 1rem;
  background:
    radial-gradient(circle at top right, rgba(148, 163, 184, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.72));
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow:
    0 16px 38px rgba(2, 6, 23, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 220ms cubic-bezier(0.23, 1, 0.32, 1), border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
  backdrop-filter: blur(10px);
  --order-accent: rgba(56, 189, 248, 0.9);
}

/* Let each card fit its content instead of reserving fixed empty space */
.orders-grid > .order-card {
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Slightly tighten internal spacing so content fits better */
.order-card {
  padding: 0.72rem;
  gap: 0.5rem;
  overflow: hidden;
}
.order-card__summary { padding: 0.65rem; }
.order-chip { padding: 0.26rem 0.58rem; font-size: 0.67rem; }
.order-link-btn { padding: 0.58rem 0.72rem; min-height: 2.4rem; }
.order-processing-toggle { padding: 0.48rem 0.6rem; min-height: 2rem; }
.order-card__id-row { gap: 0.45rem; }

.order-card[data-status="open"] {
  --order-accent: rgba(56, 189, 248, 0.92);
}

.order-card[data-status="processing"] {
  --order-accent: rgba(251, 191, 36, 0.92);
}

.order-card[data-status="done"] {
  --order-accent: rgba(52, 211, 153, 0.92);
}

.order-card[data-status="reopened"] {
  --order-accent: rgba(248, 113, 113, 0.96);
}

.order-card:hover {
  transform: translateY(-5px);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow:
    0 20px 48px rgba(2, 6, 23, 0.34),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top right, rgba(148, 163, 184, 0.1), transparent 36%),
    linear-gradient(180deg, rgba(18, 27, 44, 0.96), rgba(15, 23, 42, 0.78));
}

.order-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--order-accent), rgba(255, 255, 255, 0.14));
  opacity: 0.95;
  pointer-events: none;
  border-radius: 18px 18px 0 0;
}

.order-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 110% -10%, rgba(255, 255, 255, 0.08), transparent 28%);
  pointer-events: none;
}

.order-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.order-card__summary {
  position: relative;
  z-index: 1;
  padding: 0.85rem;
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.26);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.order-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.order-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: #dbe7f4;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.order-chip--price {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.2);
  color: #c8fbff;
}

.order-chip--messages {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.18);
  color: #d8ebff;
}

.order-id-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

.order-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.7rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.order-status-pill--open {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.28);
  color: #dbeafe;
}

.order-status-pill--processing {
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.32);
  color: #fef3c7;
}

.order-status-pill--done {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.32);
  color: #d1fae5;
}

.order-status-pill--reopened {
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.98), rgba(153, 27, 27, 0.98));
  border-color: rgba(248, 113, 113, 0.95);
  color: #fff1f2;
  box-shadow: 0 8px 18px rgba(127, 29, 29, 0.28), 0 0 0 1px rgba(248, 113, 113, 0.28);
}

.order-status-pill--reopened i {
  font-size: 0.66rem;
}

.order-status-pill--reopened small {
  display: block;
  margin-left: 0.15rem;
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.92;
}

.order-card__status {
  width: 12px;
  height: 12px;
  margin-top: 0.25rem;
  border-radius: 999px;
  background: var(--order-accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--order-accent) 18%, transparent);
  flex: none;
}

.order-card__status--done {
  box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.12);
}

.order-card__status--processing {
  box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.12);
}

.order-card__status--open {
  box-shadow: 0 0 0 5px rgba(56, 189, 248, 0.12);
}

.order-card__status--reopened {
  box-shadow: 0 0 0 5px rgba(248, 113, 113, 0.14);
}

.order-link-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.order-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  min-height: 2.65rem;
  padding: 0.68rem 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(15, 23, 42, 0.66));
  color: #e2e8f0;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  text-decoration: none;
  text-align: center;
  transition: all 160ms cubic-bezier(0.22, 0.9, 0.31, 1);
  position: relative;
  overflow: hidden;
}

.order-link-btn,
.order-icon-btn,
.order-card [data-action="mark-done"],
.order-card [data-action="unmark-done"],
.order-card [data-action="open-chat-modal"],
.order-card [data-action="save-custom"] {
  --action-surface: rgba(15, 23, 42, 0.82);
  --action-surface-hover: rgba(15, 23, 42, 0.94);
  --action-border: rgba(148, 163, 184, 0.16);
  --action-shadow: 0 8px 18px rgba(2, 6, 23, 0.18);
  background: linear-gradient(180deg, var(--action-surface), rgba(15, 23, 42, 0.64));
  border: 1px solid var(--action-border);
  box-shadow: var(--action-shadow);
}

.order-link-btn::after,
.order-icon-btn::after,
.order-card [data-action="mark-done"]::after,
.order-card [data-action="unmark-done"]::after,
.order-card [data-action="open-chat-modal"]::after,
.order-card [data-action="save-custom"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 45%);
  opacity: 0.75;
  pointer-events: none;
}

.order-link-btn__icon {
  width: 1.9rem;
  height: 1.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  flex: none;
}

.order-link-btn__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.05;
}

.order-link-btn__text strong {
  font-size: 0.78rem;
  font-weight: 700;
}

.order-link-btn__text small {
  font-size: 0.67rem;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.72);
}

.order-link-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-100%);
  transition: transform 300ms ease-out;
}

.order-link-btn:hover::before {
  transform: translateX(100%);
}

.order-link-btn:hover {
  transform: translateY(-3px);
  border-color: rgba(148, 163, 184, 0.3);
  background: linear-gradient(180deg, var(--action-surface-hover), rgba(15, 23, 42, 0.82));
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.26);
}

.order-link-btn--ebay {
  --action-surface: rgba(30, 41, 59, 0.82);
  --action-surface-hover: rgba(30, 41, 59, 0.96);
}

.order-link-btn--reseller {
  --action-surface: rgba(14, 62, 68, 0.82);
  --action-surface-hover: rgba(14, 62, 68, 0.96);
}

.order-link-btn--reseller:hover {
  color: #ffffff;
}

.order-link-btn--chat {
  --action-surface: rgba(18, 39, 63, 0.82);
  --action-surface-hover: rgba(18, 39, 63, 0.96);
  justify-content: space-between;
}

.order-link-btn__badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.42rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(96, 165, 250, 0.34);
  color: #dbeafe;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.order-link-btn__badge--unknown {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
}

.order-link-btn--disabled {
  pointer-events: none;
  opacity: 0.42;
}

.order-link-btn i {
  font-size: 0.78rem;
}

.order-card__controls {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.order-card__status-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.order-processing-toggle {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.2rem;
  padding: 0.52rem 0.72rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.24);
  color: #dbe7f4;
  cursor: pointer;
}

.order-processing-toggle span {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.order-processing-toggle strong {
  font-size: 0.75rem;
  font-weight: 700;
}

.order-processing-toggle small {
  color: #94a3b8;
  font-size: 0.64rem;
  margin-top: 0.12rem;
}

.order-processing-toggle:hover {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.32);
}

.order-card__id-panel {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.order-card__section-label {
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.order-card__id-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.order-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: #dbe7f4;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.18);
  transition: transform 180ms cubic-bezier(0.22, 0.9, 0.31, 1), box-shadow 180ms ease, filter 180ms ease, border-color 180ms ease;
  flex: none;
}

.order-icon-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.02);
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
}

.order-icon-btn:disabled {
  opacity: 0.7;
}

.order-icon-btn i {
  font-size: 0.9rem;
}

.order-icon-btn--save {
  --action-surface: rgba(18, 39, 63, 0.82);
  --action-surface-hover: rgba(18, 39, 63, 0.96);
}

.order-link-btn__icon,
.order-icon-btn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.order-card .input-dark {
  background: rgba(2, 6, 23, 0.42);
  border-color: rgba(148, 163, 184, 0.2);
}

.order-card a,
.order-card button {
  min-height: 2rem;
}

.order-card [data-action="mark-done"],
.order-card [data-action="unmark-done"],
.order-card [data-action="save-custom"] {
  box-shadow: 0 8px 16px rgba(2, 6, 23, 0.18);
}

#orders-open > div.text-slate-500,
#orders-processing > div.text-slate-500,
#orders-done > div.text-slate-500 {
  padding: 1.5rem 0;
  text-align: center;
}

.toast-enter {
  opacity: 0;
  transform: translateY(10px);
}

.toast-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: all 180ms ease-out;
}

.toast-leave-active {
  opacity: 0;
  transform: translateY(-6px);
  transition: all 180ms ease-in;
}

.transition-smooth {
  transition: all 180ms cubic-bezier(0.22, 0.9, 0.31, 1);
}

.shadow-soft {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-fade-up {
  animation: fadeUp 360ms cubic-bezier(0.22, 0.9, 0.31, 1) both;
}

.animate-float-in {
  animation: floatIn 340ms cubic-bezier(0.22, 0.9, 0.31, 1) both;
}

@layer components {
  .btn-brand {
    @apply px-3 py-2 rounded bg-brand text-white font-medium;
    @apply transition-all duration-200 ease-out;
    @apply hover:bg-brand/90 hover:shadow-lg hover:scale-[1.02];
    @apply active:scale-[0.98];
    @apply disabled:opacity-60 disabled:cursor-not-allowed;
    position: relative;
  }

  .btn-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    border-radius: inherit;
  }

  .btn-brand:active::after {
    animation: ripple 0.6s ease-out;
  }

  .btn-slate {
    @apply px-3 py-2 rounded bg-slate-700 text-white font-medium;
    @apply transition-all duration-200 ease-out;
    @apply hover:bg-slate-600 hover:shadow-lg hover:scale-[1.02];
    @apply active:scale-[0.98];
    @apply disabled:opacity-60 disabled:cursor-not-allowed;
  }

  .input-dark {
    @apply border border-slate-600 bg-slate-700 rounded px-3 py-2 text-sm text-white;
    @apply placeholder:text-slate-500;
    @apply focus:outline-none focus:ring-2 focus:ring-brand/50 focus:border-slate-600;
    @apply transition-all duration-150;
  }

  .checkbox-smooth {
    @apply appearance-none w-4 h-4 border-2 border-slate-600 rounded;
    @apply cursor-pointer transition-all duration-200;
    @apply bg-slate-700 checked:bg-emerald-500 checked:border-emerald-500;
    @apply hover:border-slate-500;
  }

  .messages-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Push messages area to bottom of fixed-height cards */
  .order-card .messages-section {
    margin-top: auto;
    padding-bottom: 0.25rem;
    margin-bottom: 0; /* ensure no extra gap */
  }

  /* Reduce card bottom padding so footer content sits closer to card edge */
  .orders-grid > .order-card {
    padding-bottom: 0.6rem;
  }

  /* Ensure the chat/message button inside messages-section has no extra bottom margin */
  .order-card .messages-section .order-link-btn--chat {
    margin-bottom: 0;
  }

  /* Make chat button span full width to remove horizontal gap */
  .order-card .messages-section .order-link-btn--chat {
    width: 100%;
    box-sizing: border-box;
    align-self: stretch;
    justify-content: flex-start; /* keep icon+text left aligned */
  }

  [data-section="messages-content"] {
    transition: max-height 200ms ease, opacity 200ms ease;
  }

  [data-section="messages-content"].hidden {
    max-height: 0;
    overflow: hidden;
  }

  [data-action="toggle-messages"] {
    @apply w-full flex items-center justify-between;
    @apply cursor-pointer transition-all duration-200;
  }

  [data-action="toggle-messages"]:hover {
    @apply text-white;
  }

  [data-action="toggle-messages"] i.fa-chevron-down {
    transition: transform 200ms ease;
  }

  [data-action="refresh-messages"] {
    @apply btn-slate text-xs w-full;
  }

  [data-action="refresh-messages"]:disabled {
    @apply opacity-50 cursor-not-allowed;
  }
}

/* Modal composer buttons should match card action buttons */
#messagesModal .btn-brand,
#messagesModal .btn-slate {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.64rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(15, 23, 42, 0.66));
  color: #dbe7f4;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

#messagesModal .btn-brand i,
#messagesModal .btn-slate i {
  margin-right: 0.4rem;
  font-size: 0.95rem;
}

#messagesModal .btn-brand:hover,
#messagesModal .btn-slate:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.76));
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
}

/* Make Send slightly accentuated but still within the neutral system */
#messagesModal .btn-brand {
  --accent-border: rgba(56, 189, 248, 0.14);
  border-color: var(--accent-border);
}

/* Ensure small disabled states look consistent */
#messagesModal .btn-brand:disabled,
#messagesModal .btn-slate:disabled {
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  margin-right: 0.5em;
  vertical-align: -0.125em;
}

/* Loading state for buttons */
button:disabled .spinner {
  animation: spin 600ms linear infinite;
}

/* Skeleton loader for chat */
@keyframes skeleton-loading {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton-loader {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.1) 25%,
    rgba(148, 163, 184, 0.2) 50%,
    rgba(148, 163, 184, 0.1) 75%
  );
  background-size: 1000px 100%;
  animation: skeleton-loading 2s infinite;
  border-radius: 8px;
}

.skeleton-msg {
  padding: 0.6rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.02);
  margin-bottom: 0.5rem;
}

.skeleton-msg-line {
  height: 12px;
  margin-bottom: 6px;
  border-radius: 4px;
  width: 80%;
}

.skeleton-msg-line.full {
  width: 100%;
}

.skeleton-msg-meta {
  height: 10px;
  width: 60%;
  border-radius: 4px;
  margin-bottom: 6px;
}

/* Better button sizing in cards */
.order-card [data-action="save-custom"],
.order-card [data-action="mark-done"],
.order-card [data-action="unmark-done"],
.order-card [data-action="open-chat-modal"] {
  min-height: 2.55rem;
  font-size: 0.84rem;
  padding: 0.68rem 1rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  transition: all 240ms cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.18);
}

.order-card [data-action="save-custom"] {
  width: 2.7rem;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.order-card [data-action="save-custom"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
}

.order-card [data-action="save-custom"]:disabled {
  opacity: 0.7;
}

.order-card [data-action="open-chat-modal"] {
  color: #dbe7f4;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.order-card [data-action="open-chat-modal"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
}

.order-card [data-action="open-chat-modal"]:disabled {
  opacity: 0.7;
}

.order-card [data-action="mark-done"] {
  color: #dbe7f4;
  flex: 1;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.order-card [data-action="mark-done"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
}

.order-card [data-action="unmark-done"] {
  color: #dbe7f4;
  flex: 1;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

@media (max-width: 520px) {
  .order-card__status-row {
    flex-direction: column;
  }

  .order-card__id-row {
    grid-template-columns: 1fr;
  }

  .order-card [data-action="save-custom"] {
    width: 100%;
  }
}

.order-card [data-action="unmark-done"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.24);
}

/* Chart styling */
canvas {
  max-width: 100% !important;
  height: auto !important;
}

#productChart,
#profitChart {
  display: block;
  margin: 0 auto;
}
