:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e5e5e8;
  --text: #1a1a1f;
  --text-2: #6b6b76;
  --text-3: #9a9aa4;
  --accent: oklch(55% 0.16 260);
  --accent-hover: oklch(48% 0.17 260);
  --accent-soft: oklch(95% 0.025 260);
  --success: oklch(60% 0.14 150);
  --success-soft: oklch(95% 0.035 150);
  --warning: oklch(78% 0.15 80);
  --warning-soft: oklch(96% 0.045 80);
  --danger: oklch(58% 0.19 25);
  --danger-soft: oklch(96% 0.03 25);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

input::placeholder {
  color: var(--text-3);
}

/* App shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.app-sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

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

.app-topbar {
  height: 64px;
  flex: 0 0 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.app-content {
  flex: 1;
  padding: 28px 32px;
}

/* Primary nav */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
}
.nav-item:hover {
  background: #f2f2f4;
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

/* Settings sub-nav */
.settings-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.settings-item:hover {
  background: var(--bg);
}
.settings-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Forms */
.field-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field-value {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  background: var(--surface);
}

/* Tables */
.row:hover {
  background: var(--bg);
}

/* Toggles */
.toggle-on {
  width: 32px;
  height: 18px;
  border-radius: 10px;
  background: var(--accent);
  position: relative;
  flex: 0 0 32px;
  border: none;
  padding: 0;
  cursor: pointer;
}
.toggle-on div {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  right: 2px;
}
.toggle-off {
  width: 32px;
  height: 18px;
  border-radius: 10px;
  background: var(--border);
  position: relative;
  flex: 0 0 32px;
  border: none;
  padding: 0;
  cursor: pointer;
}
.toggle-off div {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
}

/* Toolbar */
.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.btn-accent {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: none;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* Sales item tabs */
.tab-1 {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
}
.tab-1.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-1 .badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex: 0 0 24px;
}
.tab-1.active .badge {
  background: var(--accent-soft);
  color: var(--accent);
}
.tab-2 {
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
}
.tab-2.active {
  color: var(--text);
  font-weight: 800;
  border-bottom-color: var(--accent);
}
.tab-3 {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
  background: none;
  border: none;
}
.tab-3.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex: 0 0 22px;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Blazor connection banner */
#blazor-error-ui {
  background: var(--danger);
  color: #fff;
  bottom: 0;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
  display: none;
  left: 0;
  padding: 0.75rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
  font-size: 13.5px;
}
#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}
#blazor-error-ui .reload {
  color: #fff;
  text-decoration: underline;
}

.blazor-error-boundary {
  background: var(--danger);
  padding: 1rem;
  color: white;
  border-radius: 8px;
}
.blazor-error-boundary::after {
  content: "An error has occurred.";
}
