/* Buying board demo styles. Light, calm, store-admin look. */
:root {
  --bg: #f4f6f8; --fg: #192e36; --card: #fff; --primary: #184b40; --primary-2: #1f5d50;
  --muted: #eef2f4; --muted-fg: #60717a; --accent: #e8f1ed; --border: #dfe6e9;
  --red: #b94436; --red-bg: #fbeae7; --amber: #9a6200; --amber-bg: #fdf1dc; --green: #1f7a55; --green-bg: #e3f3ea;
  --blue: #2c5f9e; --blue-bg: #e7eef8; --violet: #6b46a8; --violet-bg: #efe9f8; --grey: #56656c; --grey-bg: #eceff1;
  --admin: #1f2124; --bar-h: 64px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); padding-bottom: calc(var(--bar-h) + 16px); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
small { font-size: 12px; color: var(--muted-fg); }
.block { display: block; }
.muted { color: var(--muted-fg); }
.red-t { color: var(--red); } .green-t { color: var(--green); }
.ic { flex: none; vertical-align: middle; }

/* ---- store admin frame (decorative) */
.admin-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 52px; padding: 0 16px; background: var(--admin); color: #f2f4f5; }
.admin-store { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.admin-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: #3b3f45; font-size: 12px; font-weight: 700; }
.admin-store-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-search { flex: 1; max-width: 480px; margin: 0 auto; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 8px; background: #303338; border: 1px solid #45494f; color: #a9afb5; }
.admin-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; border: 1px dashed #6b7077; border-radius: 999px; padding: 4px 10px; color: #cfd3d7; white-space: nowrap; }
.admin-user { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #7a5c48; color: #fff; font-size: 12px; font-weight: 700; }
.avatar.light { background: #f1e6dc; color: #6b4d3a; width: 32px; height: 32px; }
.admin-body { display: flex; min-height: calc(100vh - 52px); }
.admin-side { position: sticky; top: 52px; align-self: flex-start; height: calc(100vh - 52px); width: 62px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0 calc(var(--bar-h) + 12px); background: #ebedef; border-right: 1px solid var(--border); color: #4a5358; }
.side-item { display: grid; place-items: center; width: 40px; height: 36px; border-radius: 8px; }
.side-item.active { background: #fff; color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.side-spacer { flex: 1; }
.admin-content { flex: 1; min-width: 0; }

.app-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 28px; background: #fff; border-bottom: 1px solid var(--border); }
.app-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--primary); color: #fff; }
.app-store { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; white-space: nowrap; }
.app-sep { width: 1px; height: 22px; background: var(--border); }
.app-name { color: var(--muted-fg); white-space: nowrap; }
.app-status { display: flex; align-items: center; gap: 8px; color: var(--muted-fg); white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #2fa46f; }

/* ---- page */
.page { padding: 28px 28px 24px; max-width: 1440px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-fg); }
h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; margin: 6px 0 4px; }
h1 .accent { color: #2f8f6f; }
.lede { color: var(--muted-fg); font-size: 15px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 13px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.spinning .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { background: none; border: 0; padding: 2px 4px; color: var(--primary); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: 13px; }
.link.strong { font-weight: 600; text-decoration: none; padding: 0; font-size: 14px; }
.icon-btn { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--muted-fg); }
.icon-btn:hover { color: var(--red); border-color: #e5c3bd; }

.notes { margin: 20px 0 16px; background: #eaf0f3; border: 1px solid var(--border); border-radius: 10px; }
.notes summary { cursor: pointer; padding: 12px 16px; color: #3c4d55; }
.notes-body { padding: 0 16px 14px 34px; color: #3c4d55; display: grid; gap: 6px; }

/* ---- stat cards */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: #fff; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.stat:hover { border-color: #c9d4d8; box-shadow: 0 2px 8px rgba(25,46,54,.06); }
.stat-top { display: flex; justify-content: space-between; align-items: center; }
.stat-title { font-weight: 600; font-size: 15px; }
.stat-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; }
.stat-icon.red { background: var(--red-bg); color: var(--red); } .stat-icon.blue { background: var(--blue-bg); color: var(--blue); }
.stat-icon.violet { background: var(--violet-bg); color: var(--violet); } .stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-value { display: flex; align-items: baseline; gap: 8px; }
.stat-value strong { font-size: 30px; letter-spacing: -.02em; line-height: 1.1; }
.stat-value small { font-size: 13px; }
.stat-note { font-size: 13px; color: var(--muted-fg); display: flex; align-items: center; gap: 6px; }
.bullet { width: 6px; height: 6px; border-radius: 50%; background: #e0845f; }
.stat.bump { animation: bump .6s ease; }
@keyframes bump { 0% { box-shadow: 0 0 0 0 rgba(47,143,111,.45); } 100% { box-shadow: 0 0 0 10px rgba(47,143,111,0); } }

/* ---- tabs */
.tabs-row { display: flex; align-items: center; gap: 16px; margin: 20px 0 18px; border-bottom: 1px solid var(--border); scroll-margin-top: 64px; }
.tabs { flex: 1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; min-width: 0; }
.tabs [role=tab] { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px 12px; background: #eef1f3; border: 1px solid var(--border); border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--muted-fg); cursor: pointer; font-size: 15px; font-weight: 500; position: relative; white-space: nowrap; }
.tabs [role=tab]:hover { color: var(--fg); }
.tabs [role=tab].on { background: #fff; color: var(--primary); font-weight: 600; }
.tabs [role=tab].on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--muted); color: var(--muted-fg); font-size: 12px; font-weight: 600; }

/* ---- panels */
.panel { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 22px 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2 { font-size: 21px; letter-spacing: -.01em; }
.panel-head p { color: var(--muted-fg); margin-top: 4px; }
.head-total { text-align: right; display: grid; }
.head-total strong { font-size: 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .grow { flex: 1; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; min-width: 280px; color: var(--muted-fg); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; font-size: 16px; color: var(--fg); }
select { height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 16px; max-width: 100%; }
.filter-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; font-size: 13px; color: var(--muted-fg); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { width: 16px; height: 16px; }

.supplier { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.supplier.open { border-color: #c7d6d1; box-shadow: 0 1px 4px rgba(25,46,54,.05); }
.supplier-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 14px; background: #fafbfc; }
.supplier-toggle { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; text-align: left; flex: 1 1 260px; min-width: 0; padding: 4px 0; }
.supplier-toggle > .ic { transition: transform .15s; color: var(--muted-fg); }
.supplier.open .supplier-toggle > .ic { transform: rotate(90deg); }
.supplier-toggle strong { display: block; font-size: 15px; }
.supplier-figs { display: flex; gap: 20px; flex-wrap: wrap; }
.supplier-figs span, .list-figs span { display: grid; font-size: 12px; color: var(--muted-fg); }
.supplier-figs b, .list-figs b { font-size: 15px; color: var(--fg); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid th { text-align: left; font-weight: 600; color: var(--muted-fg); font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fbfcfc; white-space: nowrap; vertical-align: bottom; }
.grid th small { display: block; font-weight: 400; font-size: 11px; }
.grid td { padding: 10px 12px; border-bottom: 1px solid #edf1f3; vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .n { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.actions { white-space: nowrap; }
.muted-row td { opacity: .6; }
.style-btn { display: flex; align-items: flex-start; gap: 6px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.style-btn > .ic { margin-top: 3px; color: var(--muted-fg); transition: transform .15s; }
.style-btn[aria-expanded=true] > .ic { transform: rotate(90deg); }
.style-btn strong { display: block; white-space: nowrap; }
.style-btn small { white-space: nowrap; }
.qty { width: 76px; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; text-align: right; font-size: 16px; background: #fff; }
.on-list { display: inline-flex; align-items: center; gap: 4px; color: var(--green); font-weight: 600; font-size: 13px; margin-right: 4px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.red { background: var(--red-bg); color: var(--red); } .pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.green { background: var(--green-bg); color: var(--green); } .pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.violet { background: var(--violet-bg); color: var(--violet); } .pill.grey { background: var(--grey-bg); color: var(--grey); }
.pill.outline { border: 1px solid var(--border); color: var(--muted-fg); font-weight: 500; }

tr.detail td { background: #f7faf9; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 6px 4px 8px; }
.detail-grid h4 { font-size: 14px; margin-bottom: 6px; }
.detail-grid p { margin-bottom: 6px; max-width: 60ch; }
.sizerun { display: flex; gap: 10px; align-items: flex-end; overflow-x: auto; padding-bottom: 4px; }
.sz { display: grid; justify-items: center; gap: 3px; min-width: 42px; }
.sz .bars { display: flex; align-items: flex-end; gap: 3px; height: 70px; }
.sz .bars i { width: 11px; border-radius: 3px 3px 0 0; min-height: 2px; }
.stock, .legend .stock { background: #9fb8b0; } .sold, .legend .sold { background: var(--primary); }
.sz.me b { color: var(--primary); text-decoration: underline; }
.sz small { font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted-fg); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

.empty { text-align: center; padding: 36px 16px; display: grid; gap: 8px; justify-items: center; color: var(--muted-fg); }
.empty h3 { color: var(--fg); }

/* ---- buying list */
.list-block { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.list-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 14px; background: #fafbfc; }
.list-head > div:first-child { flex: 1 1 260px; }
.list-head strong { font-size: 15px; display: block; }
.list-figs { display: flex; gap: 20px; }
.note { margin: 0; padding: 8px 14px; font-size: 13px; background: #f3f7f5; color: #3c4d55; border-top: 1px solid var(--border); }
.note.warn { background: var(--amber-bg); color: var(--amber); }

/* ---- pending orders */
.orders .po-row td { background: #fafbfc; border-top: 1px solid var(--border); }
.orders .line-row td { color: #3c4d55; }

/* ---- brand trends */
.lenses { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 500; min-height: 34px; }
.chip small { margin-left: 4px; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.on small { color: #cfe3dc; }
.trend-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; margin-bottom: 18px; }
.card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; min-width: 0; }
.card h3 { font-size: 16px; }
.card > p { margin: 4px 0 12px; font-size: 13px; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) auto; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 7px; padding: 6px 8px; cursor: pointer; text-align: left; }
.bar:hover { background: var(--muted); }
.bar.on { border-color: #b9d2c9; background: var(--accent); }
.bar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.bar-name em { font-style: normal; font-size: 11px; color: var(--muted-fg); }
.track { height: 10px; background: var(--muted); border-radius: 5px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.track i.neg { background: var(--red); }
.bar strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chart-wrap { width: 100%; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: #7a8a91; }
.chart .gl { stroke: #edf1f3; }
.chart .ty { fill: none; stroke: var(--primary); stroke-width: 2.5; }
.chart .ly { fill: none; stroke: #a9b8be; stroke-width: 2; stroke-dasharray: 5 4; }
.chart .ty-dot { fill: #fff; stroke: var(--primary); stroke-width: 2; }
.legend .ty-k { background: var(--primary); height: 3px; } .legend .ly-k { background: #a9b8be; height: 3px; }
.guide-note { margin: 0 0 12px; font-size: 13px; }
.table-wrap + .guide-note { margin: 12px 0 0; }

/* ---- modal + toast */
.modal { position: fixed; inset: 0; z-index: 2147483100; background: rgba(15,23,32,.45); display: grid; place-items: center; padding: 16px 16px calc(var(--bar-h) + 16px); }
.modal-card { background: #fff; border-radius: 12px; width: min(620px, 100%); max-height: calc(100vh - var(--bar-h) - 40px); overflow: auto; padding: 20px 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head h3 { font-size: 18px; }
.modal-card > div > p { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.form select, .form input { width: 100%; font-weight: 400; }
.form .qty { width: 120px; text-align: left; }
.ex-row { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + 16px); z-index: 2147483050; background: #17201b; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: min(560px, calc(100vw - 32px)); box-shadow: 0 6px 20px rgba(0,0,0,.2); }

/* ---- demo bar (required on every page) */
#tkbsDemoBar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147483000;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 16px;
  padding: 9px 16px; background: #0F1720; color: #E6EDF5;
  font: 500 13px/1.35 system-ui, -apple-system, "Segoe UI", Arial, sans-serif; border-top: 2px solid #3DDC97;
}
#tkbsDemoBar b { color: #3DDC97; letter-spacing: .06em; font-weight: 700; }
#tkbsDemoBar a { color: #fff; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
#tkbsDemoBar a.cta { background: #3DDC97; color: #0F1720; text-decoration: none; font-weight: 700; padding: 6px 12px; border-radius: 999px; }

/* ---- responsive */
@media (hover: none) { .btn:hover, .bar:hover, .stat:hover { background: inherit; box-shadow: none; } .btn.primary:hover { background: var(--primary); } }
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trend-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-label .more { display: none; }
}
@media (max-width: 760px) {
  .admin-side { display: none; }
  .admin-search, .admin-user-name { display: none; }
  .admin-top { justify-content: space-between; }
  .app-bar { padding: 10px 16px; }
  .app-sep, .app-name, .app-status span:not(.avatar):not(.dot) { display: none; }
  .page { padding: 20px 16px; }
  h1 { font-size: 28px; }
  .head-actions .btn { flex: 1 1 auto; justify-content: center; }
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value strong { font-size: 24px; }
  .stat-title { font-size: 14px; }
  .tabs-row { flex-wrap: wrap; gap: 10px; border-bottom: 0; }
  .tabs { display: flex; overflow-x: auto; flex: 1 1 100%; border-bottom: 1px solid var(--border); scrollbar-width: none; }
  .tabs [role=tab] { flex: none; font-size: 14px; padding: 8px 12px 10px; }
  .panel { padding: 16px 14px; }
  .panel-head h2 { font-size: 18px; }
  .search { min-width: 0; flex: 1 1 100%; }
  .filters select { flex: 1 1 40%; }
  .filters .grow { display: none; }
  .supplier-figs { gap: 14px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .bar { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) auto; }
  .head-total { text-align: left; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stat-note { display: none; }
  .admin-label { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.more-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted-fg); background: #fafbfc; }
.sub-actions { display: flex; gap: 2px; margin-top: 2px; }
.sub-actions .link { font-size: 12px; color: var(--muted-fg); padding: 1px 3px; }
.grid td.actions .link[data-restore], .grid td.actions .link[data-remove] { display: inline-block; }
.detail-grid { position: sticky; left: 0; max-width: calc(100vw - 96px); }
@media (min-width: 761px) { .detail-grid { max-width: calc(100vw - 180px); } }
.grid td:first-child { min-width: 170px; }
