/* Legacy class names — разметка калькулятора, заказов, банка (без переименования JS) */

:root {
  --tint: #f6f5f9;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 12px 0 6px;
  color: var(--dark);
}

.label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 6px;
}

.label-row > span.lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--dark);
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 14px;
  color: var(--dark);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.4;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-ring);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--coral);
  color: #fff;
  transition: background 0.15s, filter 0.15s;
}

.btn:hover:not(:disabled) {
  background: var(--coral-hover);
}

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

.btn.secondary {
  background: transparent;
  color: var(--coral);
  border: 1px solid var(--coral);
}

.btn.secondary:hover:not(:disabled) {
  background: var(--coral-soft);
}

.btn.ghost {
  background: var(--white);
  color: var(--dark);
  border: 1px solid var(--border-strong);
}

.btn.ghost:hover:not(:disabled) {
  border-color: var(--coral);
  color: var(--coral);
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.err {
  color: var(--bad);
  font-size: 13px;
  margin-top: 8px;
  font-weight: 600;
}

.ok-msg {
  color: var(--ok);
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
}

.login-wrap {
  max-width: 440px;
  margin: 10vh auto 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  border: 1px solid var(--border-strong);
  background: var(--white);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab.active {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral);
}

.panel {
  display: none;
}

.panel.show {
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}

th,
td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

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

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  margin: 0;
}

.checks input {
  width: auto;
}

details {
  margin-top: 12px;
}

details > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--coral);
}

.hint-i {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--coral);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  flex-shrink: 0;
}

.hint-i .tip {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: min(280px, 70vw);
  background: var(--dark);
  color: #fff;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.hint-i:hover .tip,
.hint-i:focus .tip,
.hint-i:focus-within .tip {
  display: block;
}

.preview-box {
  background: var(--coral-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 12px;
  font-size: 13px;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}

.items-table th,
.items-table td {
  border: 1px solid var(--border);
  padding: 6px;
}

.items-table th {
  background: var(--tint);
  font-size: 11px;
  text-transform: none;
  color: var(--muted);
}

.items-table input,
.items-table textarea {
  padding: 6px 8px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.price {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.price.bad {
  color: var(--bad);
}

.price.warn {
  color: var(--warn);
}

.price.ok {
  color: var(--ok);
}

.flag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
  margin-top: 6px;
}

.flag.ok {
  background: #e6f6ee;
  color: var(--ok);
}

.flag.warn {
  background: #fff4e0;
  color: var(--warn);
}

.flag.bad {
  background: #fde8ec;
  color: var(--bad);
}

.flag.draft {
  background: #eee;
  color: #666;
}

.bar {
  height: 8px;
  background: #eee;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 8px;
}

.bar > i {
  display: block;
  height: 100%;
  background: var(--coral);
}

.footer-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 16px;
  text-align: center;
}

.mode {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  flex-wrap: wrap;
}

.pos-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 10px;
  background: var(--coral-soft);
}

.pos-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pos-sum {
  font-size: 22px;
  font-weight: 800;
  color: var(--coral);
  margin-top: 8px;
}

.suggest {
  position: relative;
}

.suggest-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 20;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  max-height: 200px;
  overflow: auto;
  box-shadow: var(--shadow-card);
}

.suggest-item {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
}

.suggest-item:hover {
  background: var(--coral-soft);
}

.chip {
  display: inline-block;
  background: #eee;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  margin-right: 4px;
}

.chip.credit {
  background: #e8f4ec;
  color: var(--ok);
}

.chip.debit {
  background: #fdeceb;
  color: var(--bad);
}

.timeline {
  border-left: 2px solid var(--border);
  margin: 12px 0 0 12px;
  padding-left: 14px;
}

.timeline-item {
  margin-bottom: 12px;
  font-size: 13px;
}

.timeline-item time {
  color: var(--muted);
  font-size: 11px;
  display: block;
}

.timeline-item b {
  color: var(--coral);
}

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 12px;
  font-size: 13px;
  margin-top: 8px;
}

.kv dt {
  color: var(--muted);
  font-weight: 600;
}

.kv dd {
  margin: 0;
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover {
  background: var(--coral-soft);
}

.order-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.cancel-box {
  border: 1px solid rgba(176, 0, 32, 0.25);
  background: #fff8f9;
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 12px;
}

.load-bar {
  height: 8px;
  background: #eee;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 4px;
}

.load-fill {
  height: 100%;
  background: var(--coral);
}

.load-fill.overload {
  background: var(--bad);
}

.day-row.overload td {
  background: #fff8f9;
}

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--tint);
  margin-right: 4px;
}

.candidates {
  margin-top: 6px;
  font-size: 12px;
}

.candidates .cand {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  margin: 2px;
  cursor: pointer;
  background: var(--tint);
}

.candidates .cand:hover {
  background: var(--coral-soft);
}

.status-active {
  color: var(--ok);
  font-weight: 700;
}

.status-cancelled {
  color: var(--bad);
  font-weight: 700;
}

.status-matched {
  color: var(--ok);
  font-weight: 700;
}

.status-unmatched {
  color: var(--warn);
  font-weight: 700;
}

.status-other_income {
  color: var(--coral);
  font-weight: 700;
}

.status-ignored {
  color: #999;
  font-weight: 700;
}

.erp-nav-badge,
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--coral);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

.erp-policy-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.erp-policy-wrap h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.erp-policy-wrap h2 {
  font-size: 1.1rem;
  margin: 24px 0 8px;
  color: var(--coral);
}

.erp-policy-wrap a {
  color: var(--coral);
}

.erp-policy-wrap code {
  background: var(--tint);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
