:root {
  --sanh-canvas: #f6f7f9;
  --sanh-surface: #ffffff;
  --sanh-subtle: #f5f6f8;
  --sanh-text: #22252a;
  --sanh-muted: #59616d;
  --sanh-border: #dce0e5;
  --sanh-action: #bc4209;
  --sanh-action-hover: #963608;
  --sanh-selected: #a63b0b;
  --sanh-selected-bg: #fff3e9;
  --sanh-error: #b42318;
  --sanh-focus: #a63b0b;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-control: 8px;
  --radius-panel: 12px;
  --workspace-header-height: 76px;
}

body {
  background: var(--sanh-canvas);
  color: var(--sanh-text);
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible,
.market-table-scroll:focus-visible {
  outline: 3px solid var(--sanh-focus);
  outline-offset: 2px;
}

#workspace>nav button[aria-current="page"] {
  background: var(--sanh-selected-bg);
  color: var(--sanh-selected);
  font-weight: 600;
}

#workspace section>h2:focus {
  outline: none;
}

.market-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-color: var(--sanh-border) var(--sanh-surface);
}

.market-table td,
.market-table th {
  line-height: 1.5;
}

.market-table {
  border-collapse: separate;
  border-spacing: 0;
}

.market-table th:first-child,
.market-table td:first-child {
  position: sticky;
  left: 0;
  min-width: 190px;
  background: var(--sanh-surface);
  z-index: 1;
}

.market-table th:first-child {
  background: var(--sanh-subtle);
  z-index: 2;
}

.market-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-4);
}

.market-pagination p {
  margin: 0 auto 0 0;
  font-variant-numeric: tabular-nums;
}

#notifications article {
  border-left: 1px solid var(--sanh-border);
}

.draft-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.draft-queue {
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid var(--sanh-border);
  border-radius: var(--radius-control);
  background: var(--sanh-surface);
}

.draft-queue-item {
  display: block;
  width: 100%;
  min-height: 64px;
  margin: 0;
  padding: var(--space-3);
  border: 0;
  border-bottom: 1px solid var(--sanh-border);
  border-radius: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.draft-queue-item:last-child { border-bottom: 0; }
.draft-queue-item strong, .draft-queue-item small { display: block; }
.draft-queue-item small { margin-top: var(--space-1); color: var(--sanh-muted); }
.draft-queue-item[aria-current="true"] { background: var(--sanh-selected-bg); color: var(--sanh-selected); }
.draft-editor { min-width: 0; margin: 0; padding: 0; border: 0; background: transparent; }
.draft-editor h3 { margin-top: 0; }
.draft-status { margin: 0 0 var(--space-4); color: var(--sanh-muted); }
.draft-version-label, .draft-content-label { display: block; margin-top: var(--space-4); }
.draft-editor textarea { min-height: min(55vh, 600px); font-size: 16px; line-height: 1.6; }
.draft-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-4) 0; }
.draft-actions button { margin: 0; }
.draft-actions .primary-action { background: var(--sanh-action); border-color: var(--sanh-action); color: white; }
.draft-actions .primary-action:hover { background: var(--sanh-action-hover); }
.draft-media { border-top: 1px solid var(--sanh-border); padding-top: var(--space-4); }
.draft-media summary { cursor: pointer; font-weight: 600; }
.draft-media figure { margin: 0; }
.draft-media figcaption { margin-top: var(--space-2); font-size: 13px; color: var(--sanh-muted); }

@media (max-width: 760px) {
  .draft-workspace { grid-template-columns: 1fr; }
  .draft-queue { max-height: 170px; }
  .draft-editor textarea { min-height: 44vh; }

  #workspace>nav {
    top: var(--workspace-header-height);
    bottom: 0;
    max-height: calc(100dvh - var(--workspace-header-height));
  }

  body.menu-open #menu-backdrop {
    top: var(--workspace-header-height);
    height: calc(100dvh - var(--workspace-header-height));
  }

  button,
  select,
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  #workspace>nav button {
    min-height: 48px;
  }

  .header-actions,
  .market-controls,
  .price-actions,
  .price-update-tabs {
    gap: 8px;
  }

  .header-actions button {
    flex: 1 1 auto;
    min-height: 48px;
  }

  #notification-bell {
    min-height: 48px;
    padding: 8px 10px;
  }

  .market-table-scroll {
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .market-table button {
    min-height: 48px;
  }

  #quick-teach {
    position: static;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
