* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'IvarText-Regular', Georgia, 'Times New Roman', serif;
  background: #f7f5f1;
  color: #080605;
  line-height: 1.5;
}

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: #fff;
  border: 1px solid #f4f0e8;
  padding: 40px;
  width: 360px;
}

.login-card h1 {
  font-family: 'IvarSoft-Regular', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 24px;
  text-align: center;
}

.login-card label {
  display: block;
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #f4f0e8;
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 14px;
  margin-bottom: 16px;
}

.login-card input:focus {
  outline: none;
  border-color: #080605;
}

.login-card button {
  width: 100%;
  padding: 13px 20px;
  background: #080605;
  color: #fff;
  border: 1px solid #080605;
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.2s;
}

.login-card button:hover { background: #e3dbd2; border-color: #e3dbd2; color: #080605; }

.error { color: #d72c0d; font-size: 13px; margin-top: 12px; text-align: center; }

/* App layout */
.app-header {
  background: #fff;
  border-bottom: 1px solid #f4f0e8;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header h1 {
  font-family: 'IvarSoft-Regular', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
}

.app-header a {
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #080605;
  text-decoration: none;
}

.app-header a:hover { text-decoration: underline; }

.container {
  max-width: 800px;
  margin: 24px auto;
  padding: 0 16px;
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid #f4f0e8;
  padding: 24px;
  margin-bottom: 16px;
}

.card h2 {
  font-family: 'IvarSoft-Regular', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  margin-bottom: 16px;
}

.card h3 {
  font-family: 'IvarSoft-Regular', Georgia, serif;
  font-size: 15px;
  font-weight: 400;
  margin-bottom: 8px;
}

/* Forms */
label {
  display: block;
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: #080605;
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
  padding: 8px 10px;
  border: 1px solid #f4f0e8;
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 14px;
  width: 100%;
  color: #080605;
  background: #fff;
}

input:focus, select:focus {
  outline: none;
  border-color: #080605;
  box-shadow: none;
}

.help-text {
  font-family: 'IvarText-Italic', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: #6d7175;
  margin-top: 2px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: 1px solid #080605;
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  background: #fff;
  color: #080605;
  transition: all 0.2s;
}

.btn:hover { background: #f4f0e8; }

.btn-primary {
  background: #080605;
  color: #fff;
  border-color: #080605;
}

.btn-primary:hover { background: #e3dbd2; border-color: #e3dbd2; color: #080605; }

.btn-danger {
  color: #d72c0d;
  border-color: transparent;
  background: none;
  padding: 4px 8px;
  font-size: 11px;
}

.btn-danger:hover { background: #fef2f2; }

.btn-link {
  background: none;
  border: none;
  color: #080605;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 13px;
  text-decoration: underline;
  text-transform: none;
  letter-spacing: 0;
  font-family: 'IvarText-Regular', Georgia, serif;
}

.btn-link:hover { color: #6d7175; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Search row */
.search-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.search-row .field { flex: 1; }

/* Results */
.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f4f0e8;
}

.result-item:last-child { border-bottom: none; }

.result-title {
  font-family: 'IvarText-Regular', Georgia, serif;
  font-weight: 400;
  font-size: 15px;
}

.result-type {
  color: #6d7175;
  font-size: 12px;
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f4f0e8;
  color: #080605;
}

.badge-info { background: #f4f0e8; color: #080605; }
.badge-success { background: #e3f9e5; color: #1a7a2e; }
.badge-warning { background: #fff8e6; color: #8a6500; }
.badge-danger { background: #fef2f2; color: #d72c0d; }

/* Selected product */
.selected-product {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

/* Slot card */
.slot-card {
  background: #faf8f5;
  border: 1px solid #f4f0e8;
  padding: 16px;
  margin-bottom: 12px;
}

.slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.slot-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.slot-fields .field:first-child {
  grid-column: 1 / -1;
}

@media (min-width: 500px) {
  .slot-fields {
    grid-template-columns: 1fr 1fr;
  }
  .slot-fields .field:first-child {
    grid-column: 1 / -1;
  }
}

.field { margin-bottom: 0; }

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 20px;
}

.checkbox-field input { width: auto; }
.checkbox-field label { margin-bottom: 0; }

/* Yarn list */
.yarn-list {
  margin-top: 12px;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid #f4f0e8;
  padding: 8px;
  background: #fff;
}

.yarn-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
}

/* Preview & banners */
.banner {
  padding: 16px;
  margin-bottom: 12px;
  font-size: 14px;
}

.banner-info { background: #f4f0e8; border: 1px solid #e3dbd2; }
.banner-success { background: #e3f9e5; border: 1px solid #a6e9ad; }
.banner-error { background: #fef2f2; border: 1px solid #f9c4c4; color: #d72c0d; }
.banner-warning { background: #fff8e6; border: 1px solid #ffe5a0; }

.banner h4 {
  font-family: 'IvarSoft-Regular', Georgia, serif;
  font-weight: 400;
  margin-bottom: 8px;
}

.metafield-line {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 13px;
  margin: 4px 0;
  word-break: break-all;
}

.metafield-key { font-weight: 700; }

/* Actions row */
.actions-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

/* Divider */
.divider {
  height: 1px;
  background: #f4f0e8;
  margin: 16px 0;
}

/* Loading */
.loading { opacity: 0.6; pointer-events: none; }

/* SKU Picker */
.sku-picker {
  position: relative;
}

.sku-selected {
  padding: 8px 10px;
  border: 1px solid #f4f0e8;
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 14px;
  background: #fff;
  min-height: 38px;
  cursor: pointer;
}

.sku-search {
  margin-top: 4px;
}

.sku-dropdown {
  position: absolute;
  z-index: 100;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #f4f0e8;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  margin-top: 2px;
}

.sku-group-header {
  padding: 6px 10px;
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6d7175;
  background: #faf8f5;
  border-bottom: 1px solid #f4f0e8;
  position: sticky;
  top: 0;
}

.sku-item {
  padding: 8px 10px;
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #f4f0e8;
}

.sku-item:hover {
  background: #faf8f5;
}

.sku-item-selected {
  background: #f4f0e8;
}

.sku-item:last-child {
  border-bottom: none;
}

.sku-code {
  color: #6d7175;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
}

.sku-no-results {
  padding: 12px 10px;
  color: #6d7175;
  font-family: 'IvarText-Italic', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  text-align: center;
}

/* Tabs */
.app-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #f4f0e8;
  padding: 0 24px;
}

.app-tab {
  padding: 12px 20px;
  border: none;
  background: none;
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6d7175;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.app-tab:hover { color: #080605; }
.app-tab.active { color: #080605; border-bottom-color: #080605; }

/* Rule product list */
.rule-products {
  margin-bottom: 12px;
}

.rule-product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f4f0e8;
}

.rule-product-item:last-child { border-bottom: none; }

.rule-add-product {
  margin-top: 8px;
}

.fallback-num {
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #6d7175;
  min-width: 20px;
}

/* Filter groups */
.filter-group {
  background: #faf8f5;
  border: 1px solid #f4f0e8;
  padding: 16px;
  margin-bottom: 12px;
}

.filter-group h3 {
  margin-bottom: 10px;
}

.filter-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 10px;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
  cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.filter-add-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 6px;
}

.filter-add-row .filter-add-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
}

.filter-add-row .btn {
  padding: 6px 14px;
  font-size: 11px;
  white-space: nowrap;
}

/* Price Scheduler — Apply All */
.ps-apply-all-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.ps-apply-all-group {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.ps-apply-all-group label {
  white-space: nowrap;
  margin-bottom: 0;
  align-self: center;
}

.ps-apply-all-group input[type="number"] {
  width: 110px;
  padding: 8px 10px;
  font-size: 14px;
}

.ps-apply-all-group .btn {
  padding: 8px 14px;
}

/* Price Scheduler Table */
.ps-table {
  width: 100%;
  border-collapse: collapse;
}

.ps-table th {
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6d7175;
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid #f4f0e8;
}

.ps-table td {
  padding: 6px;
  border-bottom: 1px solid #f4f0e8;
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 14px;
  font-weight: 400;
}

.ps-product-header td {
  font-family: 'IvarSoft-Regular', Georgia, serif;
  font-size: 15px;
  font-weight: 400;
  background: #faf8f5;
  padding: 10px 6px;
}

.ps-variant-title {
  padding-left: 16px !important;
}

.ps-sku {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: #6d7175;
}

.ps-table input[type="number"] {
  width: 100px;
  padding: 4px 6px;
  font-size: 13px;
  border: 1px solid #f4f0e8;
  font-family: 'IvarText-Regular', Georgia, serif;
}

.ps-table input[type="number"]:focus {
  outline: none;
  border-color: #080605;
}

input[type="datetime-local"] {
  padding: 8px 10px;
  border: 1px solid #f4f0e8;
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 14px;
  color: #080605;
  background: #fff;
}

input[type="datetime-local"]:focus {
  outline: none;
  border-color: #080605;
}

/* Schedule list */
.ps-schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f4f0e8;
}

.ps-schedule-item:last-child {
  border-bottom: none;
}

.ps-status-pending { background: #fff8e6; color: #8a6500; }
.ps-status-completed { background: #e3f9e5; color: #1a7a2e; }
.ps-status-failed { background: #fef2f2; color: #d72c0d; }

/* Dashboard — KPI Grid */
.dash-kpi-group h3 {
  margin-bottom: 12px;
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.dash-kpi-card {
  background: #faf8f5;
  border: 1px solid #f4f0e8;
  padding: 14px 16px;
}

.dash-kpi-label {
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6d7175;
  margin-bottom: 6px;
}

.dash-kpi-value {
  font-family: 'IvarSoft-Regular', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  color: #080605;
  margin-bottom: 4px;
}

.dash-change-up {
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #1a7a2e;
}

.dash-change-down {
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #d72c0d;
}

/* Dashboard — Product Sales Table */
.dash-sales-table {
  width: 100%;
  border-collapse: collapse;
}

.dash-sales-table th {
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6d7175;
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid #f4f0e8;
}

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

.dash-sales-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #f4f0e8;
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 14px;
  font-weight: 400;
}

.dash-sales-table tr:hover {
  background: #faf8f5;
}

.dash-yoy-up {
  color: #1a7a2e;
  font-weight: 400;
}

.dash-yoy-down {
  color: #d72c0d;
  font-weight: 400;
}

/* Header user */
.app-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user {
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 14px;
  font-weight: 400;
}

/* Admin — User rows */
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f4f0e8;
}

.admin-user-row:last-child { border-bottom: none; }

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-name {
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 15px;
  font-weight: 400;
}

.admin-user-username {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: #6d7175;
}

.admin-user-email {
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 13px;
  font-weight: 400;
  color: #6d7175;
}

.admin-user-actions {
  display: flex;
  gap: 6px;
}

/* Admin — Activity log */
.admin-activity-list {
  max-height: 400px;
  overflow-y: auto;
}

.admin-activity-row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #f4f0e8;
  font-size: 13px;
  align-items: baseline;
}

.admin-activity-row:last-child { border-bottom: none; }

.admin-activity-time {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
  color: #6d7175;
  min-width: 120px;
  flex-shrink: 0;
}

.admin-activity-user {
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 80px;
  flex-shrink: 0;
}

.admin-activity-action {
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 13px;
  font-weight: 400;
}

.admin-activity-details {
  font-family: 'IvarText-Italic', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: #6d7175;
}

.admin-user-perms {
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 12px;
  font-weight: 400;
  color: #6d7175;
}

/* Banners */
.banner {
  padding: 12px 16px;
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 13px;
  font-weight: 400;
  margin-bottom: 12px;
}

.banner-info {
  background: #f4f0e8;
  color: #080605;
}

.banner-error {
  background: #fef2f2;
  color: #d72c0d;
}

.banner-success {
  background: #f0fdf4;
  color: #15803d;
}

.success {
  color: #15803d;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-danger { background: #fef2f2; color: #d72c0d; }
.badge-info { background: #f4f0e8; color: #080605; }
.badge-success { background: #f0fdf4; color: #15803d; }

/* Permissions grid */
.permissions-grid {
  margin-top: 12px;
  border: 1px solid #f4f0e8;
}

.permissions-header,
.permissions-row {
  display: grid;
  grid-template-columns: 1fr 60px 60px 60px;
  align-items: center;
  padding: 8px 12px;
}

.permissions-header {
  background: #f7f5f1;
  font-family: 'MaisonNeue-Bold', 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.permissions-row {
  border-top: 1px solid #f4f0e8;
}

.permissions-row .permissions-label {
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 14px;
  font-weight: 400;
}

.permissions-option {
  text-align: center;
}

.permissions-row label {
  text-align: center;
  cursor: pointer;
}

.permissions-na {
  text-align: center;
  color: #c0b9ad;
}

/* View-only banner */
.view-only-banner {
  background: #f4f0e8;
  padding: 10px 16px;
  font-family: 'IvarText-Regular', Georgia, serif;
  font-size: 13px;
  font-weight: 400;
  margin-bottom: 16px;
  text-align: center;
}

/* Hidden */
.hidden { display: none; }
