/* Citadel admin — shadcn/ui-style design system, dependency-free. */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --popover: 0 0% 100%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --success: 142 71% 35%;
  --warning: 32 95% 44%;
  --info: 217 91% 50%;
  --sidebar: 0 0% 98%;
  --radius: 8px;
  --shadow: 0 1px 2px rgb(0 0 0 / 5%);
  --shadow-lg: 0 10px 38px -10px rgb(22 23 24 / 35%), 0 10px 20px -15px rgb(22 23 24 / 20%);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar-width: 232px;
  --topbar: 48px;
  color-scheme: light;
}

[data-theme="dark"] {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 5.5%;
  --popover: 240 10% 5.5%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --destructive: 0 72% 55%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 19%;
  --ring: 240 4.9% 83.9%;
  --success: 142 69% 50%;
  --warning: 38 92% 55%;
  --info: 213 94% 64%;
  --sidebar: 240 10% 5%;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-lg: 0 10px 38px -10px rgb(0 0 0 / 70%);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: 13px/1.45 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

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

:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.muted {
  color: hsl(var(--muted-foreground));
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.nowrap {
  white-space: nowrap;
}

.right {
  text-align: right;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.link {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: hsl(var(--muted-foreground) / 50%);
}

.link:hover {
  text-decoration-color: currentColor;
}

/* Layout */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 160ms ease;
}

[data-sidebar="collapsed"] .shell {
  grid-template-columns: 56px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--sidebar));
  overflow: hidden;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar);
  padding: 0 14px;
  border-bottom: 1px solid hsl(var(--border));
  font-weight: 600;
  white-space: nowrap;
}

.sidebar__logo {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 6px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sidebar__brand small {
  display: block;
  color: hsl(var(--muted-foreground));
  font-size: 11px;
  font-weight: 400;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar__group + .sidebar__group {
  margin-top: 14px;
}

.sidebar__label {
  padding: 0 8px 4px;
  color: hsl(var(--muted-foreground));
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  color: hsl(var(--foreground) / 80%);
  white-space: nowrap;
}

.sidebar__item:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.sidebar__item[aria-current="page"] {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
  font-weight: 500;
}

.sidebar__footer {
  padding: 8px;
  border-top: 1px solid hsl(var(--border));
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px;
  border-radius: 6px;
}

.user__meta {
  min-width: 0;
  line-height: 1.25;
}

.user__meta strong,
.user__meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user__meta span {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

[data-sidebar="collapsed"] .sidebar__label,
[data-sidebar="collapsed"] .sidebar__item span,
[data-sidebar="collapsed"] .sidebar__brand div,
[data-sidebar="collapsed"] .user__meta,
[data-sidebar="collapsed"] .sidebar__footer form {
  display: none;
}

[data-sidebar="collapsed"] .sidebar__item {
  justify-content: center;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar);
  padding: 0 16px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 85%);
  backdrop-filter: blur(8px);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

.crumbs a:hover {
  color: hsl(var(--foreground));
}

.crumbs span:last-child {
  overflow: hidden;
  color: hsl(var(--foreground));
  text-overflow: ellipsis;
}

.crumbs .icon {
  width: 14px;
  height: 14px;
}

.topbar__spacer {
  flex: 1;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 240px;
  height: 32px;
  padding: 0 8px 0 10px;
  border: 1px solid hsl(var(--input));
  border-radius: 6px;
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.search-trigger:hover {
  background: hsl(var(--accent));
}

.search-trigger .kbd {
  margin-left: auto;
}

.kbd {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 5px;
  border: 1px solid hsl(var(--border));
  border-radius: 4px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font: 500 11px var(--mono);
}

.content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 20px 48px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-head h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-head p {
  margin-top: 4px;
  color: hsl(var(--muted-foreground));
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stack {
  display: grid;
  gap: 16px;
}

.stack-sm {
  display: grid;
  gap: 8px;
}

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

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

.wrap {
  flex-wrap: wrap;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 16px;
}

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

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

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

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 120ms ease, opacity 120ms ease, border-color 120ms ease;
  user-select: none;
}

.btn:hover {
  background: hsl(var(--primary) / 90%);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.btn--secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
}

.btn--secondary:hover {
  background: hsl(var(--secondary) / 80%);
}

.btn--outline {
  border-color: hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: var(--shadow);
}

.btn--outline:hover,
.btn--ghost:hover {
  background: hsl(var(--accent));
}

.btn--ghost {
  background: transparent;
  color: hsl(var(--foreground));
}

.btn--destructive {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.btn--destructive:hover {
  background: hsl(var(--destructive) / 90%);
}

.btn--danger-ghost {
  background: transparent;
  color: hsl(var(--destructive));
}

.btn--danger-ghost:hover {
  background: hsl(var(--destructive) / 10%);
}

.btn--sm {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.btn--icon {
  width: 32px;
  padding: 0;
}

.btn--sm.btn--icon {
  width: 28px;
}

.btn--block {
  width: 100%;
}

.btn.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid hsl(var(--primary-foreground));
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

.btn--outline.is-loading::after,
.btn--ghost.is-loading::after,
.btn--secondary.is-loading::after {
  border-color: hsl(var(--foreground));
  border-right-color: transparent;
}

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

/* Forms */
.field {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}

.field > label,
.label {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

.field__hint {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.field__error {
  color: hsl(var(--destructive));
  font-size: 12px;
}

.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea {
  border-color: hsl(var(--destructive));
}

.input,
.select,
.textarea {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid hsl(var(--input));
  border-radius: 6px;
  background: hsl(var(--background));
  box-shadow: var(--shadow);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.input::placeholder,
.textarea::placeholder {
  color: hsl(var(--muted-foreground) / 80%);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: hsl(var(--ring) / 60%);
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--ring) / 12%);
}

.input[readonly],
.textarea[readonly] {
  background: hsl(var(--muted) / 60%);
  color: hsl(var(--muted-foreground));
}

.input--sm {
  height: 28px;
  font-size: 12px;
}

.input--num {
  width: 76px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.select {
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
  background-position: right 8px center;
  background-repeat: no-repeat;
  cursor: pointer;
}

.textarea {
  height: auto;
  min-height: 80px;
  padding: 8px 10px;
  resize: vertical;
}

.textarea--code {
  font: 12px/1.5 var(--mono);
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group > .icon {
  position: absolute;
  left: 10px;
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}

.input-group > .icon + .input {
  padding-left: 32px;
}

.input-group__suffix {
  position: absolute;
  right: 10px;
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: hsl(var(--primary));
}

.check small {
  display: block;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch__track {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: hsl(var(--input));
  transition: background 150ms ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: hsl(var(--background));
  box-shadow: 0 1px 2px rgb(0 0 0 / 25%);
  transition: transform 150ms ease;
}

.switch input:checked + .switch__track {
  background: hsl(var(--primary));
}

.switch input:checked + .switch__track::after {
  transform: translateX(14px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

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

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

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

.span-all {
  grid-column: 1 / -1;
}

/* Cards */
.card {
  min-width: 0;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
  background: hsl(var(--card));
  box-shadow: var(--shadow);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 0;
}

.card__title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card__desc {
  margin-top: 2px;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.card__body {
  padding: 14px 16px 16px;
}

.card__body--flush {
  padding: 8px 0 0;
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid hsl(var(--border));
}

.kpi {
  padding: 14px 16px;
}

.kpi__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 500;
}

.kpi__value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi__foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.delta--up {
  color: hsl(var(--success));
}

.delta--down {
  color: hsl(var(--destructive));
}

.delta--flat {
  color: hsl(var(--muted-foreground));
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.badge--plain::before {
  display: none;
}

.badge--success {
  background: hsl(var(--success) / 12%);
  color: hsl(var(--success));
}

.badge--warning {
  background: hsl(var(--warning) / 14%);
  color: hsl(var(--warning));
}

.badge--danger {
  background: hsl(var(--destructive) / 12%);
  color: hsl(var(--destructive));
}

.badge--info {
  background: hsl(var(--info) / 12%);
  color: hsl(var(--info));
}

.badge--muted {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

.badge--outline {
  border-color: hsl(var(--border));
  background: transparent;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Tabs and toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar .input-group {
  flex: 1 1 260px;
  max-width: 360px;
}

.toolbar__end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  border-radius: 8px;
  background: hsl(var(--muted));
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  white-space: nowrap;
}

.tab:hover {
  color: hsl(var(--foreground));
}

.tab[aria-current="true"] {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: var(--shadow);
}

.tab .count {
  height: 16px;
  min-width: 16px;
  background: hsl(var(--foreground) / 8%);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 4px 0 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--background));
  font-weight: 500;
}

.chip button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.chip button:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.chip--add {
  padding-right: 10px;
  border-style: dashed;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.chip--add:hover,
.chip--add.is-on {
  border-style: solid;
  color: hsl(var(--foreground));
}

/* Quantity per size: the storefront hides a size whose count reaches 0. */
.size-quantities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.size-qty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--muted));
}

.size-qty span {
  font-weight: 600;
  font-size: 12px;
}

.size-qty input {
  width: 62px;
  border: 0;
  border-radius: 999px;
  background: hsl(var(--background));
  text-align: right;
}

.size-qty input[data-out],
.size-qty input:invalid {
  color: hsl(var(--destructive));
}

.size-inputs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
  background: hsl(var(--card));
  box-shadow: var(--shadow);
}

.card .table-wrap {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.table th {
  position: sticky;
  top: 0;
  height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 50%);
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.table td {
  height: 40px;
  padding: 6px 12px;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover td {
  background: hsl(var(--muted) / 45%);
}

.table tr[data-href] {
  cursor: pointer;
}

.table th.right,
.table td.right {
  text-align: right;
}

.table th a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.table th a:hover {
  color: hsl(var(--foreground));
}

.table--compact td {
  height: 34px;
  padding: 4px 12px;
}

.cell-title {
  display: block;
  font-weight: 500;
}

.cell-sub {
  display: block;
  overflow: hidden;
  max-width: 320px;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-media {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.thumb {
  width: 36px;
  height: 44px;
  flex: none;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  background: hsl(var(--muted));
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb--empty {
  display: grid;
  place-items: center;
  color: hsl(var(--muted-foreground));
}

.thumb--sm {
  width: 28px;
  height: 34px;
}

.table .actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.data-cell {
  display: block;
  overflow: hidden;
  max-width: 260px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 2px 0;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.pager__nav {
  display: flex;
  gap: 6px;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.product-tile {
  position: relative;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
  background: hsl(var(--card));
  box-shadow: var(--shadow);
  transition: border-color 120ms ease;
}

.product-tile:hover {
  border-color: hsl(var(--foreground) / 25%);
}

/* Bulk selection */
.bulk-check {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: hsl(var(--primary));
  cursor: pointer;
}

.bulk-head {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.cell-media > .bulk-check {
  margin-right: 2px;
}

.table tr.is-picked td {
  background: hsl(var(--primary) / 8%);
}

.product-tile-wrap {
  position: relative;
  display: grid;
}

.product-tile__check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: 18px;
  height: 18px;
}

.product-tile-wrap.is-picked .product-tile {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 1px hsl(var(--primary));
}

.bulkbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 16px;
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  background: hsl(var(--popover));
  box-shadow: var(--shadow-lg);
  translate: -50% 0;
  animation: toast-in 180ms ease-out;
}

.bulkbar__count {
  white-space: nowrap;
}

.bulkbar__sep {
  width: 1px;
  height: 20px;
  background: hsl(var(--border));
}

@media (max-width: 640px) {
  .bulkbar {
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    flex-wrap: wrap;
    max-width: none;
    translate: none;
  }

  .bulkbar [data-bulk-select-all],
  .bulkbar__sep {
    display: none;
  }
}

.product-tile__media {
  aspect-ratio: 4 / 5;
  background: hsl(var(--muted));
}

.product-tile__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-tile__badge {
  position: absolute;
  top: 8px;
  left: 8px;
}

.product-tile__body {
  display: grid;
  gap: 2px;
  padding: 10px 12px 12px;
}

.product-tile__name {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty and notices */
.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 40px 16px;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

.empty .icon {
  width: 28px;
  height: 28px;
  margin-bottom: 4px;
}

.empty strong {
  color: hsl(var(--foreground));
  font-size: 14px;
  font-weight: 600;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
}

.notice--warning {
  border-color: hsl(var(--warning) / 40%);
  background: hsl(var(--warning) / 8%);
}

.notice--danger {
  border-color: hsl(var(--destructive) / 40%);
  background: hsl(var(--destructive) / 7%);
}

.notice--info {
  border-color: hsl(var(--info) / 35%);
  background: hsl(var(--info) / 7%);
}

/* Description lists and timelines */
.dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}

.dl dt {
  color: hsl(var(--muted-foreground));
}

.dl dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.lines {
  display: grid;
}

.line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid hsl(var(--border));
}

.line:last-child {
  border-bottom: 0;
}

.totals {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid hsl(var(--border));
}

.totals div {
  display: flex;
  justify-content: space-between;
}

.totals strong {
  font-size: 15px;
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  position: relative;
  padding-left: 18px;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(var(--foreground) / 60%);
}

.timeline li + li::after {
  content: "";
  position: absolute;
  top: -10px;
  left: 5px;
  height: 14px;
  border-left: 1px solid hsl(var(--border));
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: hsl(var(--muted));
  font-size: 12px;
  font-weight: 600;
}

.avatar--lg {
  width: 44px;
  height: 44px;
  font-size: 15px;
}

/* Charts */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 180px;
  padding-top: 8px;
}

.chart__bar {
  position: relative;
  flex: 1;
  min-width: 2px;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.chart__bar span {
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: hsl(var(--primary));
  transition: opacity 120ms ease;
}

.chart__bar:hover span {
  opacity: 0.7;
}

.chart__bar[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  z-index: 5;
  padding: 4px 8px;
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  background: hsl(var(--popover));
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: hsl(var(--muted-foreground));
  font-size: 11px;
}

.spark {
  width: 100%;
  height: 160px;
  overflow: visible;
}

.spark path.area {
  fill: hsl(var(--info) / 12%);
}

.spark path.stroke {
  fill: none;
  stroke: hsl(var(--info));
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.meter {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: hsl(var(--muted));
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: hsl(var(--primary));
}

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

.rank__item {
  display: grid;
  gap: 4px;
}

/* Overlays */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  visibility: hidden;
  pointer-events: none;
}

.sheet.is-open {
  visibility: visible;
  pointer-events: auto;
}

.sheet__backdrop,
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 45%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.sheet.is-open .sheet__backdrop {
  opacity: 1;
}

.sheet__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  height: 100%;
  border-left: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet.is-open .sheet__panel {
  transform: none;
}

.sheet__head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid hsl(var(--border));
}

.sheet__head strong {
  flex: 1;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  overscroll-behavior: contain;
}

.sheet__body .page-head {
  display: none;
}

.sheet .split,
.sheet .grid-2 {
  grid-template-columns: 1fr;
}

dialog.dialog {
  width: min(480px, calc(100% - 24px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: var(--shadow-lg);
}

dialog.dialog--wide {
  width: min(680px, calc(100% - 24px));
}

dialog.dialog::backdrop {
  background: rgb(0 0 0 / 50%);
}

dialog.dialog[open] {
  animation: pop 140ms ease-out;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

.dialog__head {
  display: grid;
  gap: 4px;
  padding: 18px 20px 0;
}

.dialog__head h2 {
  font-size: 16px;
  font-weight: 600;
}

.dialog__head p {
  color: hsl(var(--muted-foreground));
}

.dialog__body {
  display: grid;
  gap: 12px;
  padding: 16px 20px;
}

.dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 20px 18px;
}

.menu {
  position: relative;
  display: inline-block;
}

.menu > summary {
  list-style: none;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu__list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  display: grid;
  min-width: 200px;
  padding: 4px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--popover));
  box-shadow: var(--shadow-lg);
}

.menu__list--up {
  top: auto;
  bottom: calc(100% + 4px);
  left: 0;
  right: auto;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.menu__item:hover {
  background: hsl(var(--accent));
}

.menu__item--danger {
  color: hsl(var(--destructive));
}

.menu__sep {
  height: 1px;
  margin: 4px -4px;
  background: hsl(var(--border));
}

.palette {
  width: min(560px, calc(100% - 24px));
  margin-top: 12vh;
}

.palette__input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.palette__input input {
  flex: 1;
  height: 46px;
  border: 0;
  background: transparent;
  color: hsl(var(--foreground));
  outline: none;
}

.palette__results {
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
}

.palette__group {
  padding: 8px 8px 4px;
  color: hsl(var(--muted-foreground));
  font-size: 11px;
  font-weight: 500;
}

.palette__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}

.palette__item[aria-selected="true"] {
  background: hsl(var(--accent));
}

.palette__item small {
  margin-left: auto;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100% - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  background: hsl(var(--popover));
  box-shadow: var(--shadow-lg);
  animation: toast-in 180ms ease-out;
}

.toast--error .icon {
  color: hsl(var(--destructive));
}

.toast--success .icon {
  color: hsl(var(--success));
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* Product editor */
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.editor__side {
  position: sticky;
  top: calc(var(--topbar) + 16px);
  display: grid;
  gap: 16px;
}

.savebar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 16px -20px -48px;
  padding: 10px 20px;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 92%);
  backdrop-filter: blur(8px);
}

.savebar__state {
  margin-right: auto;
  color: hsl(var(--muted-foreground));
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}

.gallery__item {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--muted));
  cursor: grab;
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.gallery__item.is-dragging {
  opacity: 0.4;
}

.gallery__item:first-child::after {
  content: "Обложка";
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgb(0 0 0 / 65%);
  color: #fff;
  font-size: 11px;
}

.gallery__tools {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
}

.gallery__tools button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 5px;
  background: rgb(0 0 0 / 60%);
  color: #fff;
  cursor: pointer;
}

.gallery__tools .icon {
  width: 14px;
  height: 14px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  aspect-ratio: 4 / 5;
  padding: 10px;
  border: 1px dashed hsl(var(--input));
  border-radius: 8px;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: hsl(var(--foreground) / 40%);
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.dropzone input {
  display: none;
}

.dropzone--wide {
  aspect-ratio: auto;
  min-height: 96px;
}

.uploading {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--muted));
}

.uploading::after {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid hsl(var(--foreground));
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

.option-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
}

.option-card strong {
  display: block;
  font-weight: 500;
}

.option-card small {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.preview-soon,
.preview-sold {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.preview-sold {
  color: #c62828;
}

.stat-inline {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: hsl(var(--muted-foreground));
}

.stat-inline strong {
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}

.console-output {
  min-height: 240px;
  max-height: 60vh;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--muted) / 50%);
  font: 12px/1.5 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: hsl(var(--muted) / 40%);
}

.auth__card {
  width: min(380px, 100%);
}

.auth__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 15px;
  font-weight: 600;
}

.mobile-only {
  display: none;
}

.drawer-backdrop {
  z-index: 39;
  display: none;
}

@media (max-width: 1100px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split,
  .editor {
    grid-template-columns: 1fr;
  }

  .editor__side {
    position: static;
  }

  /* One column: interleave sections so price and labels follow the basics. */
  .editor > .stack,
  .editor__side {
    display: contents;
  }
}

@media (max-width: 860px) {
  .shell,
  [data-sidebar="collapsed"] .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 85vw);
    transform: translateX(-100%);
    transition: transform 200ms cubic-bezier(0.32, 0.72, 0, 1);
  }

  [data-drawer="open"] .sidebar {
    transform: none;
    box-shadow: var(--shadow-lg);
  }

  [data-drawer="open"] .drawer-backdrop {
    display: block;
    opacity: 1;
  }

  [data-sidebar="collapsed"] .sidebar__label,
  [data-sidebar="collapsed"] .sidebar__item span,
  [data-sidebar="collapsed"] .sidebar__brand div,
  [data-sidebar="collapsed"] .user__meta,
  [data-sidebar="collapsed"] .sidebar__footer form {
    display: revert;
  }

  [data-sidebar="collapsed"] .sidebar__item {
    justify-content: flex-start;
  }

  .mobile-only {
    display: inline-flex;
  }

  .desktop-only {
    display: none !important;
  }

  .topbar {
    padding: 0 10px;
  }

  .search-trigger {
    width: 32px;
    padding: 0;
    justify-content: center;
  }

  .search-trigger span,
  .search-trigger .kbd {
    display: none;
  }

  .content {
    padding: 14px 12px 40px;
  }

  .savebar {
    margin: 16px -12px -40px;
    padding: 10px 12px;
  }

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

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

  .toolbar .input-group {
    max-width: none;
    flex-basis: 100%;
  }

  .toolbar__end {
    margin-left: 0;
  }

  .page-head h1 {
    font-size: 18px;
  }

  .page-head__actions {
    width: 100%;
  }

  .page-head__actions .btn {
    flex: 1;
  }

  /* Tables become stacked cards on phones. */
  .table--cards thead {
    display: none;
  }

  .table--cards,
  .table--cards tbody,
  .table--cards tr,
  .table--cards td {
    display: block;
    width: 100%;
  }

  .table--cards tr {
    position: relative;
    padding: 10px 12px;
    border-bottom: 1px solid hsl(var(--border));
  }

  .table--cards tbody tr:last-child {
    border-bottom: 0;
  }

  .table--cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: auto;
    min-height: 26px;
    padding: 2px 0;
    border: 0;
  }

  .table--cards td[data-label]::before {
    content: attr(data-label);
    color: hsl(var(--muted-foreground));
    font-size: 12px;
  }

  .table--cards td.primary {
    display: block;
    margin-bottom: 4px;
  }

  .table--cards td.actions {
    justify-content: flex-end;
    width: 100%;
  }

  .table--cards tbody tr:hover td {
    background: transparent;
  }

  .cell-sub {
    max-width: none;
  }

  /* Compact phone cards: main facts on the first line, details below. */
  .table--stacked tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-auto-flow: row dense;
    align-items: center;
    gap: 4px 12px;
  }

  .table--stacked td,
  .table--stacked td.primary {
    grid-column: 1 / -1;
    display: block;
    min-height: 0;
    margin: 0;
  }

  .table--stacked td,
  .table--stacked td.right {
    text-align: left;
  }

  .table--stacked td.m-left {
    grid-column: 1;
  }

  .table--stacked td.m-right {
    grid-column: 2;
    justify-self: end;
    text-align: right;
  }

  .table--stacked td.m-muted,
  .table--stacked td.m-muted .cell-sub {
    color: hsl(var(--muted-foreground));
    font-size: 12px;
  }

  .table--stacked td.m-hide {
    display: none;
  }

  .table--stacked td[data-label]::before {
    content: attr(data-label);
    margin-right: 6px;
  }

  .table--stacked td.m-flex {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
  }

  .table--stacked td.m-right.m-flex {
    justify-content: flex-end;
  }

  .table--stacked td.actions {
    position: absolute;
    top: 6px;
    right: 6px;
    width: auto;
  }

  .table--stacked td.primary:has(~ td.actions) {
    padding-right: 34px;
  }

  .table--stacked .cell-sub {
    white-space: normal;
  }

  .table--inventory tr {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .table--inventory td.m-cell {
    grid-column: auto;
    display: grid;
    gap: 4px;
  }

  .table--inventory td.m-cell::before {
    display: block;
  }

  .table--inventory .input--num {
    width: 100%;
    text-align: left;
  }

  .table--inventory td.actions {
    position: static;
    grid-column: 1 / -1;
  }

  .table--inventory td.actions .btn {
    width: 100%;
  }

  .sheet__panel {
    width: 100%;
    border-left: 0;
  }

  .kpi__value {
    font-size: 19px;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart {
    height: 140px;
  }

  dialog.dialog {
    margin: auto auto 0;
    width: 100%;
    max-width: none;
    border-radius: 14px 14px 0 0;
  }

  .palette {
    margin-top: 8px;
  }
}

@media (max-width: 520px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi {
    padding: 12px;
  }

  .dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .dl dd {
    margin-bottom: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

.product-tile__badge .badge {
  background: hsl(var(--background) / 92%);
  box-shadow: var(--shadow);
}

/* Bar charts with a value over each bar and the day under it */
.chart--values {
  padding-top: 20px;
}

.chart--dense {
  padding-top: 34px;
}

.chart--values .chart__bar span {
  position: relative;
}

.chart--values .chart__bar em {
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  color: hsl(var(--foreground));
  font-size: 11px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.chart--dense .chart__bar em {
  font-size: 10px;
  writing-mode: vertical-rl;
  transform: translateX(-50%) rotate(180deg);
}

.chart-days {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  color: hsl(var(--muted-foreground));
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.chart-days span {
  flex: 1;
  min-width: 2px;
  overflow: hidden;
  text-align: center;
}

.daily-table {
  max-height: 420px;
  overflow-y: auto;
}

.daily-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: hsl(var(--card));
}

.daily-table tr.is-weekend td:first-child {
  color: hsl(var(--muted-foreground));
}

@media (max-width: 640px) {
  .chart--dense .chart__bar em {
    font-size: 9px;
    font-weight: 500;
  }

  .chart--dense ~ .chart-days span {
    overflow: visible;
  }

  .chart--dense ~ .chart-days span:nth-child(even) {
    visibility: hidden;
  }
}

.payment-reason {
  display: block;
  max-width: 360px;
  margin-top: 4px;
  white-space: normal;
}
