:root {
  color-scheme: light;
  --ink: #20332b;
  --ink-soft: #53635c;
  --cream: #f7f3ec;
  --paper: #fffdf9;
  --line: #e5dfd5;
  --green: #2c4c63;
  --green-pale: #dceaf5;
  --clay: #6fa8df;
  --clay-pale: #d9ecfb;
  --gold: #9fc9ef;
  --accent-glow: rgba(111, 168, 223, .22);
  --shadow: 0 12px 36px rgba(42, 53, 47, .09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-appearance="dark"] {
  color-scheme: dark;
  --ink: #edf4fb;
  --ink-soft: #aebdca;
  --cream: #0e1724;
  --paper: #142234;
  --line: #2a3a4d;
  --green: #395c78;
  --green-pale: #1a3147;
  --clay: #6fa8df;
  --clay-pale: #20384f;
  --gold: #9fc9ef;
  --accent-glow: rgba(111, 168, 223, .24);
  --shadow: 0 16px 42px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html { background: var(--cream); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -5%, rgba(214, 188, 132, .18), transparent 26rem),
    var(--cream);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  min-height: 100vh;
  padding: env(safe-area-inset-top) 20px calc(36px + env(safe-area-inset-bottom));
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -.02em;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  width: 31px;
  height: 31px;
  place-content: center;
  gap: 4px;
  border-radius: 10px;
  background: var(--green);
}

.brand-mark i { display: block; width: 15px; height: 2px; border-radius: 2px; background: #fff; }
.brand-mark i:last-child { width: 10px; }

.build-badge {
  margin-right: auto;
  margin-left: 8px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,253,249,.72);
  color: #7a857e;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.icon-button, .refresh-button, .sort-button {
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, .78);
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button svg { width: 19px; height: 19px; }

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 21px 0 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--clay);
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 600 38px/1.03 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }

.refresh-button {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.refresh-button svg { width: 16px; height: 16px; }
.refresh-button.loading svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.mode-banner {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 0;
  border-radius: 13px;
  background: var(--green-pale);
  color: #335143;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
}

.mode-banner.demo { background: #f0e6d0; color: #6a552e; }
.mode-banner.error { background: var(--clay-pale); color: #86462f; }
.mode-banner svg { width: 16px; height: 16px; margin-left: auto; }
.live-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #3d8060; box-shadow: 0 0 0 4px rgba(61,128,96,.1); }
.demo .live-dot { background: var(--gold); box-shadow: 0 0 0 4px rgba(199,154,69,.13); }

.shop-brand-card {
  position: relative;
  margin: 14px 0;
  border: 1px solid rgba(224, 218, 207, .75);
  border-radius: 23px;
  background: rgba(255,253,249,.9);
  box-shadow: 0 14px 42px rgba(42,53,47,.08);
  overflow: hidden;
}

.shop-banner {
  position: relative;
  min-height: 54px;
  max-height: 100px;
  aspect-ratio: 7.5 / 1;
  background:
    radial-gradient(circle at 18% 15%, rgba(255,255,255,.3), transparent 7rem),
    linear-gradient(135deg, var(--green), var(--clay) 58%, var(--gold));
}

.shop-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.02), rgba(0,0,0,.24));
}

.shop-banner img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.shop-brand-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 0;
  padding: 14px 16px 17px;
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, rgba(255,253,249,.98), rgba(255,253,249,.92));
}

.shop-avatar {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin-top: -38px;
  border: 4px solid var(--paper);
  border-radius: 19px;
  background: linear-gradient(135deg, var(--green), var(--clay));
  color: white;
  box-shadow: 0 10px 24px rgba(31,43,37,.18);
  overflow: hidden;
  font: 700 18px/1 Georgia, serif;
}

.shop-avatar img { width: 100%; height: 100%; object-fit: cover; }
.shop-brand-info > div { min-width: 0; padding-top: 1px; }
.shop-brand-info .eyebrow { color: var(--clay); }
.shop-brand-info h2 { margin: 0 0 4px; color: var(--ink); font: 600 22px/1.12 Georgia, serif; overflow-wrap: anywhere; }
.shop-brand-info p:last-child { margin: 0; color: #5f6d65; font-size: 10px; line-height: 1.4; }

.summary {
  display: grid;
  grid-template-columns: 1.32fr .9fr;
  gap: 12px;
  margin: 14px 0 21px;
}

.primary-stat, .secondary-stats, .today-stat {
  border: 1px solid rgba(223, 216, 204, .75);
  border-radius: 21px;
  background: rgba(255, 253, 249, .88);
  box-shadow: var(--shadow);
}

.primary-stat { min-height: 146px; padding: 21px 22px 17px; }
.stat-number { display: block; font: 600 52px/.9 Georgia, "Times New Roman", serif; letter-spacing: -.04em; }
.stat-label { display: block; margin-top: 8px; font-size: 14px; font-weight: 760; }
.stat-note { display: block; margin-top: 13px; color: #758078; font-size: 10px; }

.secondary-stats { display: grid; grid-template-rows: 1fr 1fr; overflow: hidden; }
.secondary-stats article { display: flex; align-items: center; justify-content: space-between; padding: 0 17px; }
.secondary-stats article + article { border-top: 1px solid var(--line); }
.secondary-stats strong { font: 600 27px/1 Georgia, "Times New Roman", serif; }
.secondary-stats span { width: 58px; color: var(--ink-soft); font-size: 10px; line-height: 1.25; }

.today-stat {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  overflow: hidden;
}

.today-stat-button {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 16px 18px 13px;
}

.today-stat-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.today-stat-button small { color: var(--clay); font-size: 9px; font-weight: 850; }
.today-stat-button[aria-expanded="true"] small::after { content: " open"; }
.today-stat .stat-kicker { color: var(--clay); font-size: 9px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.today-stat strong { font: 600 36px/.9 Georgia, serif; }
.today-stat span:last-child { color: var(--ink-soft); font-size: 10px; font-weight: 750; }
.today-stat p { grid-column: 1 / -1; margin: 0; padding: 9px 18px 12px; border-top: 1px solid var(--line); color: #758078; font-size: 10px; line-height: 1.35; }

.today-orders-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}

.today-orders-panel[hidden] { display: none; }
.today-order-item {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-radius: 13px;
  background: #f3efe9;
}
.today-order-item .item-thumb { width: 42px; height: 50px; border-radius: 11px; font-size: 16px; }
.today-order-item div { min-width: 0; display: grid; gap: 3px; }
.today-order-item strong { overflow: hidden; font: 800 11px/1.15 inherit; text-overflow: ellipsis; white-space: nowrap; }
.today-order-item span { overflow: hidden; color: #6c7971; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.today-order-item small { color: #8a7b66; font-size: 9px; font-weight: 800; }
.today-order-item b { font: 600 21px/.95 Georgia, serif; }
.today-empty { margin: 0; padding: 12px; border-radius: 12px; background: #f3efe9; color: #7c877f; font-size: 10px; text-align: center; }

.view-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  padding-bottom: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}
.view-tabs::-webkit-scrollbar { display: none; }
.view-tab {
  flex: 0 0 auto;
  min-height: 35px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,253,249,.78);
  color: #617068;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}
.view-tab.active { border-color: var(--green); background: var(--green); color: white; }

.controls { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.search-box {
  height: 45px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 249, .85);
}
.search-box:focus-within { border-color: #9fac9f; box-shadow: 0 0 0 3px rgba(67,104,84,.08); }
.search-box svg { width: 18px; color: #7c887f; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-box input::placeholder { color: #909990; }

.sort-button { min-width: 97px; display: flex; align-items: center; justify-content: center; gap: 7px; border-radius: 14px; font-size: 11px; font-weight: 750; }
.sort-button svg { width: 17px; }

.filter-row { display: flex; gap: 8px; margin: 12px 0 27px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: #69756e; cursor: pointer; font-size: 10px; font-weight: 750; }
.filter-chip.active { border-color: var(--green); background: var(--green); color: white; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 11px; }
.section-heading h2 { margin-bottom: 0; font: 600 21px/1 Georgia, "Times New Roman", serif; }
.section-heading p { margin: 5px 0 0; color: #79857d; font-size: 10px; line-height: 1.35; }
.heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.heading-actions span { color: #7d887f; font-size: 10px; }
.mini-button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,253,249,.82); color: #5f6c65; cursor: pointer; font-size: 10px; font-weight: 800; }
.mini-button[hidden] { display: none; }
.item-list { display: grid; gap: 9px; }

.item-card {
  position: relative;
  width: 100%;
  min-height: 126px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(224, 218, 207, .8);
  border-radius: 17px;
  background: rgba(255, 253, 249, .91);
  box-shadow: 0 5px 20px rgba(50, 58, 53, .045);
  text-align: left;
}
.item-card.status-packed { opacity: .72; }
.item-card:active { transform: scale(.99); }
.item-main {
  width: 100%;
  display: grid;
  grid-template-columns: 51px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  text-align: left;
}
.item-thumb { width: 51px; height: 62px; display: grid; place-items: center; border-radius: 13px; color: rgba(41,72,59,.76); font: 600 20px/1 Georgia, serif; overflow: hidden; }
.item-thumb.has-image { background: #ece7de; }
.item-image { width: 100%; height: 100%; display: block; object-fit: cover; }
.fallback-initials { display: none; }
.item-thumb.image-failed .fallback-initials { display: block; }
.detail-thumb { width: 76px; height: 92px; border-radius: 17px; flex: 0 0 auto; }
.tone-0 { background: #e2eadf; }
.tone-1 { background: #f1dfd5; }
.tone-2 { background: #eee5cc; }
.tone-3 { background: #dce5e7; }
.tone-4 { background: #e8deea; }
.item-info { min-width: 0; }
.item-info h3 { margin: 0 0 6px; font: 700 13px/1.28 inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.variation { margin: 0 0 7px; color: #6c7971; font-size: 10px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { display: flex; align-items: center; gap: 7px; color: #859087; font-size: 9px; flex-wrap: wrap; }
.tag { padding: 3px 6px; border-radius: 5px; background: var(--clay-pale); color: #a15135; font-weight: 750; }
.due-tag { background: #f1e5c6; color: #826523; }
.overdue-tag { background: #efd4cd; color: #99452f; }
.note-tag { background: #dbe6ec; color: #416172; }
.quantity { min-width: 49px; text-align: center; }
.quantity strong { display: block; font: 600 31px/.9 Georgia, serif; }
.quantity span { display: block; margin-top: 6px; color: #7d887f; font-size: 8px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.progress-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; color: #69756e; font-size: 9px; font-weight: 750; }
.progress-track { display: block; height: 6px; margin-top: 5px; border-radius: 999px; background: #eee8de; overflow: hidden; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--clay), var(--gold)); }
.quick-actions { display: grid; grid-template-columns: 38px 1fr 1.2fr; gap: 7px; }
.quick-actions button, .detail-buttons button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8f4ee;
  cursor: pointer;
  color: #4e5b54;
  font-size: 10px;
  font-weight: 800;
}
.detail-buttons button.active, .quick-actions button:last-child { border-color: var(--green); background: var(--green-pale); color: var(--green); }

.empty-state { padding: 44px 24px; border: 1px dashed #d7d0c5; border-radius: 18px; text-align: center; color: var(--ink-soft); }
.empty-state strong { display: block; margin-bottom: 7px; color: var(--ink); font: 600 19px Georgia, serif; }
.empty-state p { margin-bottom: 0; font-size: 12px; line-height: 1.55; }

.loading-card { height: 102px; border-radius: 17px; background: linear-gradient(90deg, #ece7de 25%, #f7f3ec 50%, #ece7de 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.etsy-notice { max-width: 520px; margin: 32px auto 0; color: #9a9f9a; font-size: 8px; line-height: 1.45; text-align: center; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(24, 36, 31, .34); backdrop-filter: blur(2px); }
.bottom-sheet {
  position: fixed;
  z-index: 21;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 720px);
  max-height: 86vh;
  margin: auto;
  padding: 15px 20px calc(23px + env(safe-area-inset-bottom));
  border-radius: 25px 25px 0 0;
  background: var(--paper);
  box-shadow: 0 -18px 50px rgba(31, 43, 37, .18);
  overflow-y: auto;
  animation: sheetUp .24s ease-out;
}
@keyframes sheetUp { from { transform: translateY(35%); opacity: .2; } }
.sheet-handle { width: 38px; height: 4px; margin: 0 auto 18px; border-radius: 4px; background: #d7d2c9; }
.sheet-close { position: absolute; top: 21px; right: 20px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #efebe5; cursor: pointer; font-size: 22px; line-height: 1; }
.sheet-kicker { color: var(--clay); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.bottom-sheet h2 { max-width: 85%; margin: 7px 0 8px; font: 600 27px/1.12 Georgia, serif; }
.sheet-variation { margin-bottom: 20px; color: var(--ink-soft); font-size: 12px; }
.sheet-total { display: flex; align-items: center; justify-content: space-between; margin-bottom: 19px; padding: 16px 18px; border-radius: 16px; background: var(--green); color: white; }
.sheet-total span { font-size: 12px; }
.sheet-total strong { font: 600 28px Georgia, serif; }
.detail-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.detail-hero h2 { max-width: none; margin: 0 0 6px; }
.detail-progress { margin-bottom: 17px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fbf8f2; }
.detail-progress > span:first-child { display: block; margin-bottom: 8px; color: #53635c; font-size: 12px; font-weight: 800; }
.detail-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 11px; }
.note-box { display: grid; gap: 7px; margin-bottom: 16px; color: #5d6b63; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.note-box textarea { width: 100%; resize: vertical; min-height: 76px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf9; color: var(--ink); font: 12px/1.45 inherit; text-transform: none; letter-spacing: 0; outline: 0; }
.note-box textarea:focus { border-color: #9fac9f; box-shadow: 0 0 0 3px rgba(67,104,84,.08); }
.order-list { display: grid; }
.order-detail { padding: 15px 0; border-top: 1px solid var(--line); }
.order-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.order-head strong { font-size: 12px; }
.order-head span { color: #7a857e; font-size: 10px; }
.personalization { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #f3efe9; color: #4e5d55; font-size: 11px; line-height: 1.45; }
.personalization b { display: block; margin-bottom: 3px; color: #947044; font-size: 8px; letter-spacing: .09em; text-transform: uppercase; }
.order-foot { display: flex; justify-content: space-between; margin-top: 9px; color: #859087; font-size: 9px; }

.settings-sheet { max-height: 91vh; }
.settings-content { text-align: center; }
.settings-icon { width: 48px; height: 48px; margin: 2px auto 21px; border-radius: 15px; }
.settings-content h2 { max-width: none; margin: 7px auto 10px; }
.settings-copy { max-width: 340px; margin: 0 auto 21px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.primary-button, .secondary-button { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 14px; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 800; }
.primary-button { border: 0; background: var(--green); color: white; }
.secondary-button { margin-top: 9px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.settings-divider { height: 1px; margin: 23px 0 8px; background: var(--line); }
.settings-row { width: 100%; display: flex; align-items: center; padding: 14px 4px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.settings-row span { display: grid; gap: 4px; }
.settings-row strong { font-size: 12px; }
.settings-row small { color: #7c877f; font-size: 10px; }
.settings-row svg { width: 17px; margin-left: auto; }
.settings-field { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 12px 4px; text-align: left; }
.settings-field-stack { grid-template-columns: 1fr; align-items: stretch; gap: 9px; }
.settings-field span { display: grid; gap: 4px; }
.settings-field strong { font-size: 12px; }
.settings-field small { color: #7c877f; font-size: 10px; line-height: 1.35; }
.settings-field select { max-width: 150px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fffdf9; color: var(--ink); font-size: 11px; font-weight: 800; }
.settings-field input[type="color"] { width: 52px; height: 36px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #fffdf9; cursor: pointer; }
.settings-field input[type="url"] { width: 100%; min-height: 39px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #fffdf9; color: var(--ink); font: 11px/1.2 inherit; outline: 0; }
.settings-field input[type="url"]:focus { border-color: #9fac9f; box-shadow: 0 0 0 3px rgba(67,104,84,.08); }
.version { margin: 21px 0 0; color: #a0a49f; font-size: 8px; }

.toast { position: fixed; z-index: 40; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); left: 20px; max-width: 460px; margin: auto; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: white; opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s ease; text-align: center; font-size: 11px; font-weight: 650; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateY(0); }

.workflow-board { display: grid; gap: 12px; }
.workflow-column { padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,253,249,.62); }
.workflow-column h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; color: var(--ink); font-size: 12px; }
.workflow-column h3 span { color: #7d887f; font-size: 10px; }
.workflow-stack { display: grid; gap: 9px; }
.small-empty { margin: 0; padding: 16px; border-radius: 12px; background: #f3efe9; color: #7c877f; text-align: center; font-size: 11px; }

.panel-list, .diagnostics-grid { display: grid; gap: 10px; }
.panel-card, .material-card, .diagnostic-card {
  border: 1px solid rgba(224, 218, 207, .8);
  border-radius: 17px;
  background: rgba(255,253,249,.91);
  box-shadow: 0 5px 20px rgba(50,58,53,.045);
}
.panel-card { padding: 13px; }
.panel-head { display: grid; grid-template-columns: 51px minmax(0,1fr) auto; align-items: center; gap: 12px; }
.panel-head h3, .diagnostic-card strong { margin: 0 0 4px; font-size: 13px; }
.panel-head p, .diagnostic-card p { margin: 0; color: #78847c; font-size: 10px; line-height: 1.35; }
.panel-head > strong { font: 600 28px/.9 Georgia, serif; }
.mini-list { display: grid; gap: 6px; margin-top: 12px; }
.mini-list button { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 0; border-radius: 10px; background: #f3efe9; color: #526058; cursor: pointer; font-size: 10px; text-align: left; }
.mini-list span { color: #8a7b66; font-weight: 800; }
.archive-list { gap: 12px; }
.archive-head { display: flex; justify-content: space-between; gap: 14px; }
.archive-head h3 { margin: 4px 0; font: 600 20px/1.08 Georgia, serif; }
.archive-head p { margin: 0; color: #78847c; font-size: 10px; line-height: 1.35; }
.archive-head > strong { flex: 0 0 auto; min-width: 42px; text-align: center; font: 600 30px/.95 Georgia, serif; }
.archive-lines button { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; cursor: default; }
.archive-lines .item-thumb { width: 42px; height: 50px; border-radius: 11px; font-size: 16px; }
.archive-lines span { min-width: 0; display: grid; gap: 3px; color: inherit; font-weight: 700; }
.archive-lines strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.archive-lines small { color: #78847c; font-size: 9px; line-height: 1.35; }
.archive-lines b { color: var(--ink); font: 600 19px/.95 Georgia, serif; }
.archive-note { margin: 10px 2px 0; color: #8b968f; font-size: 9px; line-height: 1.4; }
.material-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; }
.material-card strong { display: block; margin-bottom: 4px; font-size: 13px; }
.material-card span { color: #78847c; font-size: 10px; }
.material-card b { font: 600 28px/.9 Georgia, serif; }
.diagnostic-card { padding: 14px; }
.diagnostic-card span { display: block; margin-bottom: 5px; color: var(--clay); font-size: 9px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.diagnostic-card strong { display: block; font: 600 21px/1.1 Georgia, serif; }

.print-sheet { display: grid; gap: 8px; }
.sheet-print-head { padding: 16px 0 8px; }
.sheet-print-head h2 { margin: 0 0 4px; font: 600 28px/1 Georgia, serif; }
.sheet-print-head p { margin: 0; color: #6c7971; font-size: 11px; }
.sheet-row { display: grid; grid-template-columns: 51px minmax(0,1fr) 48px; align-items: center; gap: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; }
.sheet-row h3 { margin: 0 0 4px; font-size: 12px; }
.sheet-row p { margin: 0; color: #6c7971; font-size: 9px; line-height: 1.35; }
.sheet-note { margin-top: 5px !important; color: #9a573c !important; }
.sheet-row strong { display: block; font: 600 26px/.9 Georgia, serif; text-align: center; }
.sheet-row div:last-child span { display: block; margin-top: 4px; color: #7d887f; font-size: 8px; font-weight: 800; text-align: center; text-transform: uppercase; }

:root[data-appearance="dark"] body {
  background:
    radial-gradient(circle at 8% -5%, rgba(111, 168, 223, .18), transparent 26rem),
    radial-gradient(circle at 90% 0%, rgba(199, 154, 69, .08), transparent 22rem),
    var(--cream);
}

:root[data-appearance="dark"] .build-badge,
:root[data-appearance="dark"] .icon-button,
:root[data-appearance="dark"] .refresh-button,
:root[data-appearance="dark"] .sort-button,
:root[data-appearance="dark"] .view-tab,
:root[data-appearance="dark"] .search-box,
:root[data-appearance="dark"] .mini-button {
  background: rgba(20, 34, 52, .78);
  color: var(--ink-soft);
}

:root[data-appearance="dark"] .mode-banner {
  background: rgba(26, 49, 71, .92);
  color: #d9ecff;
}

:root[data-appearance="dark"] .mode-banner.demo {
  background: rgba(68, 53, 25, .84);
  color: #f6d795;
}

:root[data-appearance="dark"] .shop-brand-card,
:root[data-appearance="dark"] .primary-stat,
:root[data-appearance="dark"] .secondary-stats,
:root[data-appearance="dark"] .today-stat,
:root[data-appearance="dark"] .item-card,
:root[data-appearance="dark"] .panel-card,
:root[data-appearance="dark"] .material-card,
:root[data-appearance="dark"] .diagnostic-card,
:root[data-appearance="dark"] .workflow-column,
:root[data-appearance="dark"] .sheet-row {
  border-color: rgba(132, 157, 184, .24);
  background: rgba(20, 34, 52, .86);
  box-shadow: var(--shadow);
}

:root[data-appearance="dark"] .shop-brand-info {
  background: linear-gradient(180deg, rgba(20,34,52,.98), rgba(20,34,52,.92));
}

:root[data-appearance="dark"] .shop-avatar {
  border-color: var(--paper);
}

:root[data-appearance="dark"] .shop-brand-info p:last-child,
:root[data-appearance="dark"] .stat-note,
:root[data-appearance="dark"] .today-stat p,
:root[data-appearance="dark"] .section-heading p,
:root[data-appearance="dark"] .heading-actions span,
:root[data-appearance="dark"] .variation,
:root[data-appearance="dark"] .item-meta,
:root[data-appearance="dark"] .quantity span,
:root[data-appearance="dark"] .progress-line,
:root[data-appearance="dark"] .panel-head p,
:root[data-appearance="dark"] .archive-head p,
:root[data-appearance="dark"] .archive-lines small,
:root[data-appearance="dark"] .archive-note,
:root[data-appearance="dark"] .diagnostic-card p,
:root[data-appearance="dark"] .material-card span,
:root[data-appearance="dark"] .settings-row small,
:root[data-appearance="dark"] .settings-field small,
:root[data-appearance="dark"] .sheet-row p,
:root[data-appearance="dark"] .sheet-row div:last-child span,
:root[data-appearance="dark"] .order-head span,
:root[data-appearance="dark"] .order-foot {
  color: var(--ink-soft);
}

:root[data-appearance="dark"] .filter-chip {
  color: var(--ink-soft);
}

:root[data-appearance="dark"] .view-tab.active,
:root[data-appearance="dark"] .filter-chip.active,
:root[data-appearance="dark"] .detail-buttons button.active,
:root[data-appearance="dark"] .quick-actions button:last-child {
  border-color: var(--clay);
  background: var(--green-pale);
  color: #e9f5ff;
}

:root[data-appearance="dark"] .bottom-sheet,
:root[data-appearance="dark"] .sheet-row,
:root[data-appearance="dark"] .note-box textarea,
:root[data-appearance="dark"] .settings-field select,
:root[data-appearance="dark"] .settings-field input[type="url"],
:root[data-appearance="dark"] .settings-field input[type="color"] {
  background: var(--paper);
  color: var(--ink);
}

:root[data-appearance="dark"] .sheet-close,
:root[data-appearance="dark"] .quick-actions button,
:root[data-appearance="dark"] .detail-buttons button,
:root[data-appearance="dark"] .personalization,
:root[data-appearance="dark"] .small-empty,
:root[data-appearance="dark"] .today-order-item,
:root[data-appearance="dark"] .today-empty,
:root[data-appearance="dark"] .mini-list button,
:root[data-appearance="dark"] .detail-progress {
  background: #101b29;
  color: var(--ink-soft);
}

:root[data-appearance="dark"] .secondary-stats article + article,
:root[data-appearance="dark"] .today-stat > div + div,
:root[data-appearance="dark"] .today-stat p,
:root[data-appearance="dark"] .order-detail {
  border-color: var(--line);
}

:root[data-appearance="dark"] .item-thumb.has-image,
:root[data-appearance="dark"] .progress-track {
  background: #0f1a27;
}

:root[data-appearance="dark"] .today-order-item span,
:root[data-appearance="dark"] .today-order-item small {
  color: var(--ink-soft);
}

:root[data-appearance="dark"] .tone-0 { background: #1b3543; }
:root[data-appearance="dark"] .tone-1 { background: #352738; }
:root[data-appearance="dark"] .tone-2 { background: #37311f; }
:root[data-appearance="dark"] .tone-3 { background: #1f3445; }
:root[data-appearance="dark"] .tone-4 { background: #2d2a44; }

:root[data-appearance="dark"] .tag {
  background: var(--clay-pale);
  color: #d8ecff;
}

:root[data-appearance="dark"] .due-tag { background: rgba(199,154,69,.2); color: #f3d99b; }
:root[data-appearance="dark"] .overdue-tag { background: rgba(200,102,69,.22); color: #ffbca8; }
:root[data-appearance="dark"] .note-tag { background: rgba(111,168,223,.2); color: #c8e5ff; }

:root[data-appearance="dark"] .loading-card {
  background: linear-gradient(90deg, #142234 25%, #1d3048 50%, #142234 75%);
  background-size: 200% 100%;
}

:root[data-appearance="dark"] .toast {
  background: #edf4fb;
  color: #0e1724;
}

@media (min-width: 620px) {
  .app-shell { padding-right: 34px; padding-left: 34px; }
  .item-list { grid-template-columns: 1fr 1fr; }
  .workflow-board { grid-template-columns: 1fr 1fr; }
  .diagnostics-grid { grid-template-columns: 1fr 1fr; }
}

@media print {
  body { background: white; }
  .topbar, .hero, .mode-banner, .summary, .view-tabs, .controls, .filter-row, .etsy-notice, .toast, .heading-actions .mini-button, .sheet-backdrop, .bottom-sheet { display: none !important; }
  .app-shell { width: 100%; padding: 0; }
  .section-heading { margin: 0 0 10px; }
  .section-heading p, .heading-actions { display: none; }
  .item-list { display: block; }
  .sheet-row { break-inside: avoid; page-break-inside: avoid; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
