:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-subtle: #f8f9fb;
  --surface-strong: #eef1f4;
  --text: #202832;
  --text-strong: #111820;
  --muted: #66717f;
  --muted-strong: #4d5967;
  --line: #dfe4ea;
  --line-strong: #cdd4dc;
  --blue: #2468d8;
  --blue-hover: #1e56b2;
  --blue-soft: #edf4ff;
  --green: #18794e;
  --green-soft: #eaf6ef;
  --amber: #a96812;
  --amber-soft: #fff5df;
  --red: #bd3d38;
  --red-soft: #fff0ef;
  --charcoal: #252d36;
  --shadow: 0 12px 32px rgba(28, 39, 52, 0.12);
  --sidebar-width: 232px;
  --sidebar-collapsed-width: 68px;
  --topbar-height: 72px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

body.drawer-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

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

button,
select,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  min-height: 34px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  padding: 6px 13px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

button:hover {
  border-color: var(--blue-hover);
  background: var(--blue-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

button.secondary:hover {
  border-color: #aeb8c3;
  background: var(--surface-subtle);
}

.listing-assistant-download {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(36, 104, 216, 0.26);
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  color: var(--blue);
  padding: 8px 14px 8px 12px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
  font-weight: 700;
  white-space: nowrap;
}

.listing-assistant-download:hover {
  border-color: rgba(36, 104, 216, 0.4);
  background: linear-gradient(180deg, #f3f8ff 0%, #e8f1ff 100%);
  color: var(--blue-hover);
  box-shadow: 0 8px 18px rgba(36, 104, 216, 0.12);
}

.listing-assistant-download__icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 7px;
  background: rgba(36, 104, 216, 0.12);
}

.listing-assistant-download__icon svg {
  width: 16px;
  height: 16px;
}

.listing-assistant-download__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.listing-assistant-download__copy strong {
  font-size: 13px;
}

.listing-assistant-download__copy small {
  margin-top: 2px;
  color: rgba(36, 104, 216, 0.78);
  font-size: 11px;
  font-weight: 600;
}

button.danger-button {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

button.danger-button:hover {
  border-color: #9f302c;
  background: #9f302c;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(36, 104, 216, 0.23);
  outline-offset: 2px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 2px;
  color: var(--text-strong);
  font-size: 21px;
  line-height: 1.3;
}

h2 {
  margin-bottom: 0;
  color: var(--text-strong);
  font-size: 16px;
  line-height: 1.4;
}

h3 {
  font-size: 14px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  transform: translateY(-160%);
  border-radius: 4px;
  background: var(--charcoal);
  color: #fff;
  padding: 8px 12px;
}

.skip-link:focus {
  transform: translateY(0);
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-width: 0;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 14px 10px 12px;
}

.brand-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  padding: 0 2px 14px;
}

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

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 7px;
  background: var(--charcoal);
  color: #fff;
  font-weight: 700;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong,
.brand-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy strong {
  color: var(--text-strong);
  font-size: 15px;
}

.brand-copy small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted-strong);
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
  color: var(--text-strong);
}

.sidebar-toggle span {
  transform: translateX(-1px);
}

.nav {
  display: grid;
  gap: 3px;
}

.nav-item {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  border-color: transparent;
  background: transparent;
  color: var(--muted-strong);
  padding: 8px 10px;
  text-align: left;
}

.nav-item:hover {
  border-color: transparent;
  background: var(--surface-strong);
  color: var(--text-strong);
}

.nav-item.active {
  border-color: #d8e5fa;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border-radius: 5px;
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

.nav-item.active .nav-icon {
  background: var(--blue);
  color: #fff;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 14px 9px 8px;
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--green);
}

.sidebar-footer {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  padding: 4px 9px;
  font-size: 11px;
}

.sidebar-footer a:hover {
  color: var(--blue);
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .sidebar .nav-label,
body.sidebar-collapsed .sidebar-footer {
  display: none;
}

body.sidebar-collapsed .brand-row {
  display: grid;
  justify-items: center;
}

body.sidebar-collapsed .brand {
  flex: 0 0 auto;
}

body.sidebar-collapsed .sidebar-toggle span {
  transform: rotate(180deg);
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding-inline: 7px;
}

body.sidebar-collapsed .sidebar-status {
  justify-content: center;
  padding-inline: 0;
}

.sidebar-backdrop,
.drawer-backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(23, 31, 40, 0.42);
  padding: 0;
}

.sidebar-backdrop {
  z-index: 40;
}

.drawer-backdrop {
  z-index: 55;
}

.main {
  min-width: 0;
  max-width: 100vw;
  padding: 0 24px 32px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 -24px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  padding: 10px 24px;
}

.page-context,
.page-heading,
.topbar-tools {
  min-width: 0;
}

.page-context {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-heading p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-menu-button {
  display: none;
  font-size: 17px;
}

.topbar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.compact-field {
  display: grid;
  grid-template-columns: auto minmax(100px, 148px);
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.compact-field-wide {
  grid-template-columns: auto minmax(190px, 220px);
}

.compact-field input,
.compact-field select {
  height: 34px;
  min-height: 34px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 9px;
}

input::placeholder,
textarea::placeholder {
  color: #929ca8;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aeb8c3;
}

textarea {
  resize: vertical;
}

.sync-button {
  display: inline-flex;
  min-width: 112px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--muted-strong);
  white-space: nowrap;
}

.sync-button:hover {
  border-color: #aeb8c3;
  background: var(--surface-subtle);
  color: var(--text-strong);
}

.sync-state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa4af;
}

.sync-button[data-state="syncing"] .sync-icon {
  animation: spin 900ms linear infinite;
}

.sync-button[data-state="syncing"] .sync-state-dot {
  background: var(--blue);
}

.sync-button[data-state="success"] .sync-state-dot {
  background: var(--green);
}

.sync-button[data-state="error"] {
  border-color: #e5aaa6;
  color: var(--red);
}

.sync-button[data-state="error"] .sync-state-dot {
  background: var(--red);
}

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

.user-menu {
  position: relative;
}

.user-menu summary {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 5px;
  cursor: pointer;
  list-style: none;
}

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

.user-menu summary:hover,
.user-menu[open] summary {
  border-color: var(--line);
  background: var(--surface-subtle);
}

.user-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--charcoal);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.user-summary {
  display: block;
  max-width: 92px;
  min-width: 0;
}

.user-summary strong,
.user-summary small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-summary strong {
  color: var(--text-strong);
  font-size: 12px;
}

.user-summary small {
  color: var(--muted);
  font-size: 10px;
}

.user-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: 210px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 8px;
}

.user-menu-meta {
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding: 7px 8px 10px;
}

.user-menu-meta span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.user-menu-popover a,
.logout-button {
  display: block;
  width: 100%;
  margin-top: 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--red);
  padding: 8px;
  text-align: left;
}

.user-menu-popover a:hover,
.logout-button:hover {
  border-color: transparent;
  background: var(--red-soft);
}

.logout-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: block;
}

.system-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 10px 12px;
}

.system-banner > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.system-banner span {
  overflow-wrap: anywhere;
  color: var(--muted-strong);
  font-size: 12px;
}

.system-banner.error {
  border-color: #edbfbc;
  background: var(--red-soft);
  color: var(--red);
}

.section-toolbar {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.section-toolbar > div:first-child {
  min-width: 0;
}

.section-toolbar strong,
.section-toolbar span {
  display: block;
}

.section-toolbar strong {
  color: var(--text-strong);
  font-size: 15px;
}

.section-toolbar span {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
}

.dashboard-toolbar {
  min-height: 40px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.updated-at {
  flex: 0 0 auto;
}

.metric-grid {
  display: grid;
  gap: 10px;
}

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

.metric-grid-secondary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
}

.metric-grid-income {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.metric-grid-cost {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
}

.metric-grid-profit {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.listing-summary-grid,
.content-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

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

.listing-summary-card {
  position: relative;
  min-width: 0;
  min-height: 88px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 13px;
}

.listing-summary-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--blue);
  content: "";
}

.listing-summary-card.warning::before {
  background: var(--amber);
}

.listing-summary-card.danger::before {
  background: var(--red);
}

.listing-summary-card.success::before {
  background: var(--green);
}

.listing-summary-card.info::before {
  background: var(--blue);
}

.listing-summary-card.info strong {
  color: var(--blue);
}

.listing-summary-card span,
.listing-summary-card small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listing-summary-card span {
  font-size: 12px;
}

.listing-summary-card strong {
  display: block;
  overflow: hidden;
  margin: 6px 0 2px;
  color: var(--text-strong);
  font-size: 22px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listing-summary-card.success strong {
  color: var(--green);
}

.listing-summary-card.warning strong {
  color: var(--amber);
}

.listing-summary-card.danger strong {
  color: var(--red);
}

.listing-plan-layout,
.content-plan-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

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

.listing-plan-panel {
  min-height: 190px;
}

.content-plan-panel {
  min-height: 180px;
}

.listing-plan-list {
  display: grid;
  gap: 7px;
}

.listing-plan-item {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.listing-plan-item.is-urgent {
  border-left: 3px solid var(--red);
  padding-left: 8px;
}

.listing-plan-item.is-today {
  border-left: 3px solid var(--amber);
  padding-left: 8px;
}

.listing-plan-item:last-child {
  border-bottom: 0;
}

.listing-plan-item strong,
.listing-plan-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-plan-item strong {
  color: var(--text-strong);
  white-space: nowrap;
}

.listing-plan-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.listing-plan-item .status-badge {
  max-width: 168px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-next-action {
  display: grid;
  min-width: 128px;
  max-width: 190px;
  gap: 2px;
}

.listing-next-action strong,
.listing-next-action span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-next-action strong {
  color: var(--text-strong);
  font-size: 12px;
  white-space: nowrap;
}

.listing-next-action span {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.compact-empty {
  min-height: 92px;
  align-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--surface-subtle);
  padding: 14px;
}

.listing-progress-detail {
  display: grid;
  width: 132px;
  gap: 4px;
}

.listing-progress-detail > span {
  color: var(--muted-strong);
  font-size: 11px;
}

.upload-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
  padding: 12px;
}

.upload-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-box-head strong,
.upload-box-head span {
  display: block;
}

.upload-box-head strong {
  color: var(--text-strong);
}

.upload-box-head span,
.upload-meta {
  color: var(--muted);
  font-size: 12px;
}

.file-button {
  position: relative;
  display: inline-flex;
  min-height: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.3;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.upload-progress span {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: #e8edf2;
}

.upload-progress span::before {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  content: "";
}

.upload-progress strong {
  min-width: 42px;
  color: var(--muted-strong);
  font-size: 12px;
  text-align: right;
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.thumbnail-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  aspect-ratio: 1;
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.thumbnail-more {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 12px;
  aspect-ratio: 1;
}

.listing-package-cell {
  display: grid;
  width: 136px;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.listing-package-cell img {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}

.listing-package-cell strong,
.listing-package-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listing-package-cell strong {
  color: var(--text-strong);
  font-size: 12px;
}

.listing-package-cell small {
  color: var(--muted);
  font-size: 11px;
}

.metric {
  position: relative;
  min-width: 0;
  min-height: 104px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 14px;
}

.metric::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--blue);
  content: "";
}

.metric.risk::before {
  background: var(--red);
}

.metric.success::before {
  background: var(--green);
}

.metric > span,
.metric > small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric > span {
  font-size: 12px;
}

.metric > .metric-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.metric-heading > span {
  flex: 0 0 auto;
}

.metric-heading > em {
  min-width: 0;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-subtle);
  padding: 2px 6px;
  color: var(--muted-strong);
  font-size: 11px;
  font-style: normal;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric > strong {
  display: block;
  overflow: hidden;
  margin: 7px 0 3px;
  color: var(--text-strong);
  font-size: 23px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric.risk > strong {
  color: var(--red);
}

.metric.success > strong {
  color: var(--green);
}

.dashboard-grid,
.profit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 14px;
}

.panel-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-head > div {
  min-width: 0;
}

.panel-head span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-picker {
  position: relative;
  flex: 0 0 auto;
}

.field-picker summary {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 12px;
  list-style: none;
}

.field-picker summary::-webkit-details-marker {
  display: none;
}

.field-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: min(420px, calc(100vw - 28px));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.field-options-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.field-options-head strong {
  color: var(--text-strong);
  font-size: 13px;
}

.field-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.field-option {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 8px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}

.field-option:hover {
  border-color: var(--line);
  background: var(--surface-subtle);
}

.field-option input {
  position: relative;
  width: 15px;
  min-width: 15px;
  height: 15px;
  min-height: 15px;
  flex: 0 0 15px;
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  padding: 0;
}

.field-option input:checked {
  border-color: var(--blue);
  background: var(--blue);
}

.field-option input:checked::after {
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(45deg);
}

.field-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.manual-cost-dialog {
  width: min(560px, calc(100% - 28px));
}

.manual-cost-dialog form {
  display: grid;
  gap: 12px;
}

.manual-cost-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
  padding: 10px 12px;
}

.manual-cost-meta div {
  min-width: 0;
}

.manual-cost-meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.manual-cost-meta strong {
  display: block;
  overflow: hidden;
  color: var(--text-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-panel {
  margin-top: 10px;
}

.table-panel.no-top-margin {
  margin-top: 0;
}

.action-panel,
.warning-panel {
  min-height: 184px;
}

.text-button,
.link-button {
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 3px 5px;
  font-size: 12px;
}

.text-button:hover,
.link-button:hover {
  border: 0;
  background: var(--blue-soft);
  color: var(--blue-hover);
}

.assist-start-button {
  min-height: 28px;
  border-color: rgba(36, 104, 216, 0.35);
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.assist-start-button:hover {
  border-color: var(--blue);
  background: #dfeeff;
  color: var(--blue-hover);
}

.danger-text {
  color: var(--red);
}

.danger-text:hover {
  background: var(--red-soft);
  color: var(--red);
}

.action-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 25px;
}

.action-list li {
  overflow-wrap: anywhere;
  padding-left: 2px;
}

.action-list li::marker {
  color: var(--blue);
  font-weight: 700;
}

.notice-list {
  display: grid;
  gap: 7px;
}

.notice-list p {
  margin: 0;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: var(--muted-strong);
  padding: 8px 10px;
  overflow-wrap: anywhere;
}

.loading-row,
.loading-cell {
  color: var(--muted);
  animation: soft-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes soft-pulse {
  from { opacity: 0.48; }
  to { opacity: 1; }
}

.rank-list,
.store-profit-list {
  display: grid;
}

.rank-item,
.profit-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.rank-item:last-child,
.profit-row:last-child {
  border-bottom: 0;
}

.rank-item > div,
.profit-row > div {
  min-width: 0;
}

.rank-item strong,
.profit-row strong,
.rank-item small,
.profit-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-item small,
.profit-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.profit-value {
  text-align: right;
}

.profit-up {
  color: var(--green) !important;
}

.profit-down {
  color: var(--red) !important;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: -4px 0 14px;
  border-bottom: 1px solid var(--line);
}

.subnav-item {
  min-height: 39px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted-strong);
  padding: 8px 13px;
}

.subnav-item:hover {
  border-color: transparent;
  background: var(--surface-strong);
  color: var(--text-strong);
}

.subnav-item.active {
  border-bottom-color: var(--blue);
  background: transparent;
  color: var(--blue);
  font-weight: 700;
}

.tab-pane {
  min-width: 0;
}

.filter-toolbar {
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.search-field {
  display: block;
  width: min(300px, 100%);
}

.search-field input {
  min-width: 210px;
}

.inline-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.inline-filter select {
  min-width: 112px;
}

.table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-subtle);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

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

.data-table tbody tr:hover:not(:has(.empty-cell)) {
  background: #fafbfd;
}

.data-table td {
  max-width: 280px;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.data-table td:not(:first-child) {
  white-space: nowrap;
}

.data-table td[title] {
  overflow: hidden;
  text-overflow: ellipsis;
}

.wide-table {
  min-width: 980px;
}

.compact-table th,
.compact-table td {
  padding-block: 8px;
}

.action-column {
  width: 148px;
}

.cell-primary,
.cell-secondary {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-primary {
  max-width: 240px;
  color: var(--text-strong);
  white-space: nowrap;
}

.cell-secondary {
  max-width: 280px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  min-width: 86px;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted-strong);
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
}

.status-badge.success {
  border-color: #b9dfc9;
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.info {
  border-color: #c7dafa;
  background: var(--blue-soft);
  color: var(--blue);
}

.status-badge.warning,
.status-badge.priority-normal {
  border-color: #efd49e;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-badge.danger,
.status-badge.priority-high {
  border-color: #edbfbc;
  background: var(--red-soft);
  color: var(--red);
}

.status-badge.priority-low {
  border-color: #b9dfc9;
  background: var(--green-soft);
  color: var(--green);
}

.status-select {
  width: auto;
  min-width: 92px;
  min-height: 30px;
  padding-block: 3px;
  font-size: 12px;
}

.progress-cell {
  display: grid;
  width: 112px;
  gap: 4px;
}

.progress-cell > span {
  color: var(--muted-strong);
  font-size: 11px;
}

.progress {
  overflow: hidden;
  width: 112px;
  height: 6px;
  border-radius: 999px;
  background: #e8edf2;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.empty-cell {
  padding: 34px 12px !important;
  text-align: center !important;
  white-space: normal !important;
}

.empty-inline {
  display: grid;
  min-width: 0;
  gap: 2px;
  color: var(--muted);
  padding: 12px 4px;
}

.empty-inline strong {
  color: var(--muted-strong);
}

.empty-inline span {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  background: var(--surface-subtle);
  padding: 40px 20px;
  text-align: center;
}

.empty-state-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.empty-state-mark.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.empty-state strong {
  color: var(--text-strong);
  font-size: 16px;
}

.empty-state p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.estimate-notice {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  border: 1px solid #efd49e;
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--amber);
  padding: 9px 11px;
}

.estimate-notice span {
  color: var(--muted-strong);
  font-size: 12px;
}

.recalc-notice {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  border: 1px solid #b8d7f5;
  border-radius: 6px;
  background: #eef7ff;
  color: #1f5d99;
  padding: 9px 11px;
}

.recalc-notice[hidden] {
  display: none;
}

.recalc-notice span {
  color: var(--muted-strong);
  font-size: 12px;
}

.profit-layout {
  margin-top: 0;
}

.profit-breakdown {
  display: grid;
}

.profit-breakdown > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.profit-breakdown > div:last-child {
  border-bottom: 0;
}

.profit-breakdown span {
  color: var(--muted);
}

.profit-breakdown strong {
  color: var(--text-strong);
}

.profit-breakdown .total strong {
  color: var(--green);
  font-size: 18px;
}

.settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.settings-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.settings-heading-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.audit-filters {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.audit-filters label {
  width: 140px;
}

.audit-filters input {
  min-height: 34px;
}

.settings-container,
.connection-list {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.state-block {
  display: grid;
  min-height: 178px;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 30px;
  text-align: center;
}

.state-block span {
  max-width: 560px;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 12px;
}

.state-block.forbidden strong,
.state-block.error strong {
  color: var(--red);
}

.state-block.pending strong {
  color: var(--amber);
}

.spinner {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.connection-list {
  min-height: 0;
}

.connection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.connection-row:last-child {
  border-bottom: 0;
}

.connection-row > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.connection-row span:not(.status-badge) {
  color: var(--muted);
  font-size: 12px;
}

.record-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  display: grid;
  width: min(560px, 100vw);
  height: 100vh;
  height: 100svh;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.drawer-header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 11px 16px;
}

.drawer-kicker {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.drawer-form {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 16px 0;
}

.drawer-form > label,
.drawer-form fieldset label,
.form-row > label {
  display: grid;
  min-width: 0;
  gap: 5px;
  margin-bottom: 12px;
  color: var(--muted-strong);
  font-size: 12px;
}

.drawer-form > .check-row,
.scope-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input,
.scope-check input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--blue);
}

.check-row span,
.scope-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.checkbox-list {
  display: grid;
  max-height: 220px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  overflow-y: auto;
  padding-bottom: 10px;
}

.checkbox-list .scope-check {
  margin: 0;
  color: var(--text);
}

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

.drawer-form fieldset {
  min-width: 0;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px 0;
}

.drawer-form legend {
  color: var(--text-strong);
  padding: 0 4px;
  font-weight: 700;
}

.field-help {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.form-error {
  margin-bottom: 12px;
  border: 1px solid #edbfbc;
  border-radius: 6px;
  background: var(--red-soft);
  color: var(--red);
  padding: 9px 10px;
  overflow-wrap: anywhere;
}

.drawer-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: auto -16px 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 16px;
}

.confirm-dialog {
  width: min(420px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}

.confirm-dialog::backdrop {
  background: rgba(23, 31, 40, 0.42);
}

.confirm-dialog form {
  padding: 18px;
}

.confirm-dialog p {
  margin: 8px 0 20px;
  color: var(--muted-strong);
  overflow-wrap: anywhere;
}

.listing-draft-dialog {
  width: min(720px, calc(100% - 28px));
}

.listing-draft-dialog-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.listing-draft-list {
  display: grid;
  max-height: min(56vh, 520px);
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.listing-draft-option,
.listing-draft-empty {
  display: grid;
  min-width: 0;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
  padding: 12px;
}

.listing-draft-option {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.listing-draft-option.is-active {
  border-color: #b9dfc9;
  background: var(--green-soft);
}

.listing-draft-option strong,
.listing-draft-option small,
.listing-draft-option span,
.listing-draft-empty strong,
.listing-draft-empty span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-draft-option strong,
.listing-draft-empty strong {
  color: var(--text-strong);
}

.listing-draft-option small,
.listing-draft-option span,
.listing-draft-empty span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  width: min(360px, calc(100vw - 28px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  border: 1px solid #a9d6bb;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  box-shadow: 0 6px 18px rgba(28, 39, 52, 0.14);
  padding: 10px 12px;
  overflow-wrap: anywhere;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.error {
  border-color: #edbfbc;
  background: var(--red-soft);
  color: var(--red);
}

.toast.leaving {
  transform: translateY(5px);
  opacity: 0;
}

.login-page {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}

.login-shell {
  width: min(408px, 100%);
}

.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 38px rgba(28, 39, 52, 0.1);
  padding: 28px;
}

.login-panel::before {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 7px;
  background: var(--charcoal);
  color: #fff;
  content: "祥";
  font-size: 16px;
  font-weight: 700;
}

.login-panel h1 {
  margin-bottom: 7px;
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-copy {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.login-error {
  margin: 14px 0;
  border: 1px solid #edbfbc;
  border-radius: 6px;
  background: var(--red-soft);
  color: var(--red);
  padding: 9px 10px;
}

.login-form {
  display: grid;
  gap: 7px;
  margin-top: 20px;
}

.login-form label {
  color: var(--muted-strong);
  font-size: 12px;
}

.login-form button {
  width: 100%;
  margin-top: 5px;
}

.login-panel footer {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding-top: 14px;
  font-size: 12px;
}

.login-panel footer a:hover {
  color: var(--blue);
}

@media (max-width: 1240px) {
  .compact-field {
    grid-template-columns: minmax(108px, 138px);
  }

  .compact-field > span {
    display: none;
  }

  .page-heading p {
    max-width: 320px;
  }
}

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

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

  .dashboard-grid,
  .profit-layout,
  .listing-plan-layout,
  .content-plan-layout {
    grid-template-columns: 1fr;
  }

  .user-summary {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-shell,
  body.sidebar-collapsed .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-102%);
    width: min(280px, calc(100vw - 52px));
    z-index: 50;
    box-shadow: var(--shadow);
    transition: transform 160ms ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .sidebar .nav-label {
    display: block;
  }

  body.sidebar-collapsed .sidebar-footer {
    display: flex;
  }

  body.sidebar-collapsed .brand-row {
    display: flex;
    justify-items: initial;
  }

  body.sidebar-collapsed .nav-item {
    justify-content: flex-start;
    padding-inline: 10px;
  }

  body.sidebar-collapsed .sidebar-status {
    justify-content: flex-start;
    padding-inline: 9px;
  }

  .sidebar-toggle {
    display: none;
  }

  .mobile-menu-button {
    display: inline-grid;
  }

  .main {
    padding-inline: 16px;
  }

  .topbar {
    margin-inline: -16px;
    padding-inline: 16px;
  }
}

@media (max-width: 700px) {
  :root {
    --topbar-height: auto;
  }

  .main {
    padding: 0 12px 22px;
  }

  .topbar {
    display: grid;
    gap: 9px;
    margin: 0 -12px 14px;
    padding: 9px 12px 10px;
  }

  .page-heading p {
    display: none;
  }

  .topbar-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(126px, 0.8fr) auto auto;
    width: 100%;
    gap: 6px;
  }

  .compact-field {
    display: block;
    min-width: 0;
  }

  .compact-field input,
  .compact-field select {
    min-width: 0;
  }

  .sync-button {
    min-width: 36px;
    width: 36px;
    padding: 0;
  }

  .sync-button #syncStatusText,
  .sync-state-dot {
    display: none;
  }

  .user-menu summary {
    padding-inline: 2px;
  }

  .metric-grid {
    gap: 8px;
  }

  .metric {
    min-height: 98px;
    padding: 12px;
  }

  .metric > strong {
    font-size: 20px;
  }

  .dashboard-grid,
  .profit-layout {
    gap: 8px;
    margin-top: 8px;
  }

  .panel,
  .table-panel {
    margin-top: 8px;
    padding: 12px;
  }

  .panel-head {
    align-items: center;
  }

  .section-toolbar {
    align-items: flex-end;
  }

  .filter-toolbar {
    align-items: stretch;
  }

  .audit-filters {
    width: 100%;
  }

  .audit-filters label {
    width: auto;
    flex: 1 1 120px;
  }

  .filter-group {
    display: grid;
    flex: 1 1 100%;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .audit-filters {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
  }

  .search-field,
  .search-field input {
    width: 100%;
    min-width: 0;
  }

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

  .data-table {
    min-width: 0;
  }

  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .data-table tbody {
    display: grid;
    gap: 8px;
  }

  .data-table tbody tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    padding: 4px 10px;
  }

  .data-table tbody tr:hover:not(:has(.empty-cell)) {
    background: var(--surface);
  }

  .data-table td,
  .data-table td:not(:first-child) {
    display: grid;
    max-width: none;
    grid-template-columns: minmax(88px, 0.42fr) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
    white-space: normal;
    text-align: right;
  }

  .data-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
    text-align: left;
  }

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

  .data-table .empty-cell {
    display: block;
    border: 0;
    padding: 28px 8px !important;
  }

  .data-table .empty-cell::before {
    display: none;
  }

  .cell-primary,
  .cell-secondary {
    max-width: none;
    text-align: right;
    white-space: normal;
  }

  .row-actions {
    justify-content: flex-end;
  }

  .status-badge {
    justify-self: end;
  }

  .status-select {
    justify-self: end;
  }

  .progress-cell {
    justify-self: end;
    text-align: right;
  }

  .settings-container .table-wrap {
    padding: 8px;
  }

  .record-drawer {
    width: 100vw;
    border-left: 0;
  }

  .drawer-header {
    min-height: 58px;
    padding: 8px 12px;
  }

  .drawer-form {
    padding: 12px 12px 0;
  }

  .drawer-actions {
    margin-inline: -12px;
    padding-inline: 12px;
  }
}

@media (max-width: 480px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .listing-summary-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 88px;
  }

  .topbar-tools {
    grid-template-columns: minmax(0, 1fr) minmax(120px, 1fr) 36px 36px;
  }

  .dashboard-toolbar,
  .section-toolbar:not(.filter-toolbar),
  .settings-heading,
  .system-banner,
  .estimate-notice {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-toolbar .updated-at {
    margin-top: 4px;
  }

  .filter-group {
    grid-template-columns: 1fr;
  }

  .inline-filter {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .inline-filter select {
    min-width: 0;
  }

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

  .audit-filters {
    grid-template-columns: 1fr;
  }

  .settings-heading-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .settings-heading-actions button {
    flex: 1 1 138px;
  }

  .subnav-item {
    overflow: hidden;
    padding-inline: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .checkbox-list {
    grid-template-columns: 1fr;
  }

  .login-page {
    align-items: center;
    padding: 14px;
  }

  .login-panel {
    padding: 22px;
  }

  .toast-region {
    right: 14px;
    bottom: 14px;
  }
}

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

.cost-library-groups {
  display: grid;
  gap: 12px;
}

.cost-library-group {
  margin-top: 0;
}

.store-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
  padding: 2px 0 8px;
}

.store-toolbar .filter-group {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(120px, 150px) minmax(120px, 150px) minmax(170px, 230px) minmax(110px, 130px) auto auto;
  justify-content: start;
  align-items: end;
  gap: 8px;
}

.store-toolbar .search-field {
  width: auto;
}

.store-toolbar .inline-filter {
  display: grid;
  gap: 5px;
}

.store-toolbar .inline-filter span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.store-toolbar .search-field input,
.store-toolbar .inline-filter select {
  width: 100%;
  min-width: 0;
}

.cost-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
  padding: 2px 0 8px;
}

.cost-toolbar .filter-group {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(220px, 240px) max-content;
  justify-content: start;
  align-items: end;
  gap: 10px;
}

.cost-toolbar .search-field {
  width: auto;
}

.cost-toolbar .inline-filter {
  display: grid;
  gap: 5px;
}

.cost-toolbar .inline-filter span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.cost-toolbar .search-field input,
.cost-toolbar .inline-filter input {
  width: 100%;
  min-width: 0;
}

.content-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 10px;
  padding: 2px 0 8px;
}

.content-toolbar .filter-group {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(120px, 150px);
  align-items: end;
  gap: 8px;
}

.content-toolbar .search-field {
  width: auto;
}

.content-toolbar .inline-filter {
  display: grid;
  gap: 5px;
}

.content-toolbar .inline-filter span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.content-toolbar .search-field input,
.content-toolbar .inline-filter select {
  width: 100%;
  min-width: 0;
}

.simple-content-toolbar {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.content-simple-table {
  min-width: 760px;
}

.content-status-stack {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.content-status-stack small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

#contentBatchForm textarea {
  min-height: 360px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.batch-import-help {
  margin-top: -4px;
}

.compact-check {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 0 10px;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .store-toolbar .filter-group,
  .cost-toolbar .filter-group,
  .content-toolbar,
  .content-toolbar .filter-group {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .compact-check {
    justify-content: flex-start;
  }
}
