:root {
  --ink: #15211d;
  --muted: #68746f;
  --paper: #f4f5f0;
  --panel: #ffffff;
  --line: #dfe3dc;
  --green: #196b4b;
  --green-soft: #dff2e8;
  --amber: #a85c00;
  --amber-soft: #fff0d8;
  --blue-soft: #e5eefc;
  --shadow: 0 16px 38px rgba(31, 45, 39, .09);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
.login-page { display: grid; min-height: 100vh; place-items: center; overflow: auto; padding: 24px; background: linear-gradient(135deg, #e3eee8, #f7f1e7); }
.login-card { width: min(420px, 100%); padding: 30px; border: 1px solid #dce5dd; border-radius: 16px; background: #fff; box-shadow: 0 20px 60px rgba(22, 39, 31, .16); }
.login-card h1 { margin: 7px 0 8px; font-size: 26px; }
.login-card > p { margin: 0 0 22px; color: var(--muted); line-height: 1.45; }
.login-message { padding: 10px 12px; border-radius: 8px; color: #8a3900 !important; background: #fff0d8; }
.login-submit { width: 100%; margin-top: 4px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  color: white;
  background: #16271f;
}
.topbar h1, .dialog-header h2 { margin: 1px 0 0; font-size: 23px; }
.eyebrow { color: #8fd4b3; font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions form { margin: 0; }
.save-state { margin-right: 10px; color: #bed0c8; font-size: 13px; }

.button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 650;
}
.button.primary { background: #42a777; color: white; }
.button.secondary { background: transparent; color: inherit; border-color: #9ba8a2; }
.topbar .button.secondary { color: white; border-color: #587064; }
.button.small { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.button:hover { filter: brightness(.96); }

.layout { display: grid; grid-template-columns: 385px 1fr; height: calc(100vh - 82px); min-height: 0; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); background: var(--panel); }
.summary { display: grid; grid-template-columns: repeat(3,1fr); border-bottom: 1px solid var(--line); }
.summary div { padding: 15px 9px; text-align: center; border-right: 1px solid var(--line); }
.summary div:last-child { border-right: 0; }
.summary strong, .summary span { display: block; }
.summary strong { font-size: 19px; }
.summary span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.search { display: block; padding: 14px 14px 8px; }
.search span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #ccd3cc;
  border-radius: 8px;
  color: var(--ink);
  background: white;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #8bc7aa; border-color: transparent; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 14px 12px; }
.filters select { font-size: 12px; }
.equipment-list { flex: 1; overflow: auto; border-top: 1px solid var(--line); }
.equipment-item { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 12px 13px; border-bottom: 1px solid #edf0eb; }
.equipment-item:hover { background: #f5f8f5; }
.equipment-item.active { background: #e9f5ee; box-shadow: inset 3px 0 var(--green); }
.equipment-item input { width: 16px; height: 16px; margin-top: 4px; }
.equipment-item button { width: 100%; padding: 0; text-align: left; border: 0; color: inherit; background: transparent; }
.equipment-name { display: block; line-height: 1.3; font-size: 13px; font-weight: 700; }
.equipment-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.dot { width: 7px; height: 7px; margin-top: 3px; border-radius: 50%; background: #adb5b0; }
.dot.ai_suggested { background: #e39a35; }
.dot.in_review { background: #5c8ed7; }
.dot.verified { background: #2a9665; }

.bulk-bar { padding: 11px 14px; border-top: 1px solid var(--line); background: #f2f8f4; }
.bulk-bar strong { display: block; margin-bottom: 7px; font-size: 12px; }
.bulk-bar select { margin-bottom: 6px; padding: 6px 8px; font-size: 12px; }
.hidden { display: none !important; }

.editor { min-width: 0; min-height: 0; height: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 28px; }
.empty-editor { display: grid; place-items: center; }
.empty-message { max-width: 430px; text-align: center; color: var(--muted); }
.empty-message > span { color: #94a49c; font-size: 42px; }
.empty-message h2 { margin-bottom: 5px; color: var(--ink); }
.editor-shell { max-width: 1120px; margin: 0 auto; }
.editor-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.editor-head h2 { margin: 3px 0 7px; line-height: 1.18; font-size: 26px; }
.subtitle { color: var(--muted); font-size: 13px; }
.status-select { width: 220px; align-self: flex-start; }
.grid { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 18px; }
.grid > * { min-width: 0; }
.card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card h3 { margin: 0 0 16px; font-size: 16px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.tag-section { margin-top: 22px; }
.tag-section h4 { margin: 0 0 4px; font-size: 14px; }
.tag-section p { margin: 0 0 10px; color: var(--muted); font-size: 11px; }
.tag-tools { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(230px, 1fr); gap: 8px; margin: 11px 0; }
.tag-tools input { min-width: 0; padding: 7px 9px; font-size: 12px; }
.tag-add-row { display: flex; gap: 7px; }
.tag-add-row .button { flex: 0 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 7px 10px; border: 1px solid #d4dad4; border-radius: 999px; color: #53605b; background: #fafbf9; font-size: 12px; }
.chip input:checked + span { color: #135f41; border-color: #68b58d; background: var(--green-soft); font-weight: 700; }
.no-tag-results { color: var(--amber) !important; }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.detail dt { margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.detail dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; }
.spec { margin: 15px 0 0; padding: 13px; white-space: pre-wrap; border-radius: 9px; color: #35423c; background: #f4f6f2; line-height: 1.5; font: 12px/1.5 Consolas, monospace; }
.price-title { margin: 20px 0 8px; font-size: 13px; }
.pricing-panel { overflow: hidden; border: 1px solid #e8dfcf; border-radius: 11px; background: #fffdfa; }
.price-base-row { display: flex; align-items: center; gap: 11px; padding: 11px; background: #fff5e5; }
.price-base-copy strong, .price-base-copy span { display: block; }
.price-base-copy strong { font-size: 12px; }
.price-base-copy span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.price-group { padding: 12px 11px 0; }
.price-group + .price-group { border-top: 1px solid #f0ebe2; margin-top: 12px; }
.price-group-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; color: #57645e; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.price-group-head small { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.price-grid { display: grid; gap: 7px; margin-top: 0; }
.price-grid-hourly { grid-template-columns: repeat(3, 1fr); }
.price-grid-monthly { grid-template-columns: repeat(2, 1fr); }
.price-grid-other { grid-template-columns: repeat(2, 1fr); }
.price { min-width: 0; padding: 9px; border: 1px solid #eee7dc; border-radius: 8px; background: #fff; }
.price-base { flex: 0 0 124px; border-color: #dbb576; background: #fff; box-shadow: 0 3px 12px rgba(137, 83, 0, .08); }
.price span, .price b { display: block; }
.price span { min-height: 25px; margin-bottom: 3px; color: var(--muted); font-size: 10px; line-height: 1.25; }
.price b { min-height: 16px; margin-top: 3px; color: #89601f; font-size: 11px; }
.price input { padding: 5px 6px; font-size: 13px; font-weight: 700; }
.price-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 11px; margin-top: 12px; border-top: 1px solid #f0ebe2; color: var(--muted); font-size: 11px; }
.discount-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
textarea { min-height: 92px; resize: vertical; }
.source-note { padding: 12px; border-radius: 9px; color: #6c522c; background: var(--amber-soft); font-size: 12px; line-height: 1.45; }

dialog { width: min(940px, 94vw); max-height: 90vh; padding: 0; border: 0; border-radius: 15px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15,27,21,.62); }
.dialog-card { padding: 22px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-header .eyebrow { color: var(--green); }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #68746f; background: #edf0eb; font-size: 22px; }
.hint { color: var(--muted); font-size: 12px; }
.taxonomy-editors { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-height: 58vh; overflow: auto; padding-right: 4px; }
.taxonomy-editors textarea { min-height: 170px; }
.price-calculation-dialog { width: min(760px, 94vw); }
.price-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.price-preset { min-height: 78px; padding: 10px; border: 1px solid #dce3dc; border-radius: 9px; color: var(--ink); background: #fff; text-align: left; }
.price-preset strong, .price-preset span { display: block; }
.price-preset strong { font-size: 12px; }
.price-preset span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.price-preset:hover, .price-preset.active { border-color: #54a77c; background: var(--green-soft); }
.calculation-body { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; padding: 16px; border-radius: 10px; background: #f5f7f3; }
.calculation-body h3 { margin: 0 0 10px; font-size: 13px; }
.calculation-preview { display: grid; gap: 7px; }
.calculation-preview div { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 9px; border-radius: 7px; background: #fff; }
.calculation-preview span, .calculation-preview small { color: var(--muted); font-size: 10px; }
.calculation-preview strong { grid-row: span 2; grid-column: 2; align-self: center; color: var(--green); font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 520px; padding: 13px 17px; transform: translateY(20px); opacity: 0; pointer-events: none; border-radius: 9px; color: white; background: #17372a; box-shadow: var(--shadow); transition: .2s; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 320px 1fr; }
  .grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .save-state { display: none; }
}

@media (max-width: 620px) {
  .tag-tools { grid-template-columns: 1fr; }
  .discount-fields, .price-grid, .price-presets, .calculation-body { grid-template-columns: 1fr; }
  .price-base-row { align-items: flex-start; flex-direction: column; }
  .price-base { flex-basis: auto; width: 100%; }
}
