/**
 * PZM Web — общая тема (landing + кабинет).
 * Семантика: спокойный синий акцент, читаемая типографика, focus-visible для a11y.
 */
:root {
  font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
  --pzm-blue-900: #071a5c;
  --pzm-blue-800: #0b2e9b;
  --pzm-blue-600: #2563eb;
  --pzm-blue-50: #eef4ff;
  --pzm-bg-app: #f0f4fa;
  --pzm-bg-card: #fff;
  --pzm-border: #d5dbe7;
  --pzm-border-soft: #e2e8f0;
  --pzm-text: #0f172a;
  --pzm-text-muted: #64748b;
  --pzm-danger: #b91c1c;
  --pzm-danger-bg: #fef2f2;
  --pzm-success: #059669;
  --pzm-radius: 12px;
  --pzm-radius-sm: 8px;
  --pzm-shadow-card: 0 4px 20px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--pzm-text);
  background: var(--pzm-bg-app);
  line-height: 1.5;
}

body.pzm-marketing {
  background: #fff;
}

a {
  color: var(--pzm-blue-600);
}
a:hover {
  color: var(--pzm-blue-800);
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--pzm-blue-600);
  outline-offset: 2px;
}

/* --- Layout --- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 20px;
}

.card {
  background: var(--pzm-bg-card);
  border-radius: var(--pzm-radius);
  box-shadow: var(--pzm-shadow-card);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 860px) {
  .grid.cols-3 {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label,
label {
  font-size: 13px;
  color: #334155;
}

.hint {
  color: var(--pzm-text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.muted {
  color: var(--pzm-text-muted);
}

.status {
  margin-top: 8px;
  font-size: 14px;
  color: #334155;
  min-height: 0;
}

.status.error {
  color: var(--pzm-danger);
}
.status.success {
  color: var(--pzm-success);
}

.hidden {
  display: none;
}

/* --- Forms --- */
input,
select,
textarea {
  border: 1px solid var(--pzm-border);
  border-radius: var(--pzm-radius-sm);
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--pzm-text);
  background: #fff;
}

textarea {
  min-height: 220px;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
}

input[type="date"] {
  padding: 8px 10px;
}

/* --- Buttons --- */
button {
  border: none;
  border-radius: var(--pzm-radius-sm);
  padding: 10px 14px;
  background: var(--pzm-blue-600);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

button.secondary {
  background: #fff;
  color: var(--pzm-text);
  border: 1px solid var(--pzm-border);
}


/* --- Marketing (index) --- */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e7ecf5;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}
.brand {
  font-weight: 800;
  font-size: 28px;
  text-decoration: none;
  color: #12358e;
  letter-spacing: -0.02em;
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav a {
  text-decoration: none;
  color: #25324b;
  font-size: 14px;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
a.btn {
  background: var(--pzm-blue-600);
  color: #fff;
  border: none;
  border-radius: var(--pzm-radius-sm);
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
}
a.btn.btn-primary {
  background: var(--pzm-blue-600);
  color: #fff;
}
a.btn.btn-outline {
  background: #fff;
  color: #26407e;
  border: 1px solid #d4deef;
}
.btn-primary {
  background: var(--pzm-blue-600);
  color: #fff;
}
.btn-outline {
  border: 1px solid #d4deef;
  color: #26407e;
  background: #fff;
}

.section {
  padding: 72px 0;
}
.section-light {
  background: #eef2f8;
}
.section-title {
  margin: 0 0 8px;
  text-align: center;
  font-size: 34px;
  letter-spacing: -0.02em;
}
.section-subtitle {
  margin: 0 auto 36px;
  text-align: center;
  color: #5f6f8e;
  max-width: 760px;
}

.hero {
  background: radial-gradient(circle at 15% 20%, #1a3db7, var(--pzm-blue-900));
  color: #fff;
  padding: 78px 0;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 30px;
  align-items: center;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: 48px;
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.hero p {
  margin: 0 0 24px;
  color: #dbe6ff;
  max-width: 520px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.hero-actions .btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}
.hero-visual {
  border-radius: 16px;
  min-height: 280px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}
.hero-visual img {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
  display: block;
}
.hero-chip {
  position: absolute;
  background: #fff;
  color: #1f2f4d;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.chip-top {
  top: 18px;
  right: 18px;
}
.chip-bottom {
  left: 18px;
  bottom: 18px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.feature-card {
  border: 1px solid #e5ebf5;
  border-radius: var(--pzm-radius);
  padding: 14px;
  background: #fff;
}
.feature-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.feature-card p {
  margin: 0;
  color: #5f6f8e;
  font-size: 14px;
}

.work-row {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  margin-bottom: 16px;
}
.work-card {
  background: #fff;
  border: 1px solid #dfe7f4;
  border-radius: 14px;
  padding: 16px;
}
.work-card h3 {
  margin: 0 0 8px;
}
.work-card ul {
  margin: 0;
  padding-left: 18px;
  color: #5f6f8e;
  line-height: 1.6;
}
.work-image {
  border-radius: 14px;
  border: 1px solid #dfe7f4;
  overflow: hidden;
  min-height: 180px;
}
.work-image img {
  width: 100%;
  height: 100%;
  min-height: 180px;
  object-fit: cover;
  display: block;
}

.tariff-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.tariff {
  background: #fff;
  border: 1px solid #e5ebf5;
  border-radius: 14px;
  padding: 18px;
}
.tariff h3 {
  margin: 0 0 8px;
}
.price {
  font-size: 38px;
  font-weight: 800;
  margin: 8px 0 10px;
  letter-spacing: -0.02em;
}
.tariff ul {
  margin: 0 0 14px;
  padding-left: 18px;
  color: #5f6f8e;
}
.tariff.highlight {
  border-color: #3f6cff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.2);
}
.tariff-badge {
  display: inline-block;
  font-size: 12px;
  color: #1f4db8;
  background: #e4edff;
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 8px;
}

.cta {
  background: radial-gradient(circle at 50% 25%, #1e40af, #0b1b5b);
  color: #fff;
}
.cta-inner {
  text-align: center;
}
.cta h2 {
  margin: 0 0 8px;
  font-size: 40px;
  letter-spacing: -0.02em;
}
.cta p {
  color: #d6e3ff;
  margin: 0 0 20px;
}

footer {
  background: #fff;
  border-top: 1px solid #e7ecf5;
  padding: 32px 0 28px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, 1fr);
  gap: 16px;
}
.footer-title {
  margin: 0 0 8px;
  font-weight: 700;
}
.footer-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #5f6f8e;
  line-height: 1.8;
  font-size: 14px;
}

@media (max-width: 980px) {
  .hero-grid,
  .work-row,
  .tariff-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero h1 {
    font-size: 40px;
  }
}
@media (max-width: 640px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .section-title {
    font-size: 28px;
  }
  .cta h2 {
    font-size: 30px;
  }
}

/* --- App hub (app.html) --- */
.nav-card {
  border: 1px solid var(--pzm-border);
  border-radius: 10px;
  padding: 12px;
}
.nav-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.nav-card p {
  margin: 0 0 10px;
  color: var(--pzm-text-muted);
  font-size: 13px;
}
.nav-card a.btn {
  padding: 8px 12px;
  font-size: 13px;
  margin-right: 6px;
  margin-bottom: 6px;
}
.top-actions {
  margin-top: 10px;
}
#paywall-block {
  border: 1px solid #fecaca;
  background: var(--pzm-danger-bg);
}

/* --- History page --- */
.title-page,
h1.title {
  margin: 0 0 8px;
  font-size: 26px;
}
.history-search.row {
  align-items: stretch;
}
.history-search input {
  flex: 1;
}
@media (max-width: 680px) {
  .history-search.row {
    flex-direction: column;
  }
}

/* --- Billing --- */
.locked-banner {
  background: var(--pzm-danger-bg);
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  color: #991b1b;
  font-size: 14px;
}
.billing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 720px) {
  .billing-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Products / list items --- */
.item {
  border: 1px solid var(--pzm-border);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  margin-top: 8px;
  background: #fafcff;
}
.item-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}
.item-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.item-line {
  color: #334155;
}
.item-line b {
  color: var(--pzm-text);
  margin-right: 4px;
}
.item-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* --- List cards (receipts, sales, products, suppliers, inventory) --- */
.list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.item.item-card,
.sale.item-card {
  margin-top: 0;
  padding: 12px 14px;
  background: var(--pzm-bg-card);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  border-left: 3px solid var(--pzm-blue-600);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.item.item-card:hover,
.sale.item-card:hover {
  border-color: var(--pzm-blue-600);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}
.item-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.item-header .item-title {
  margin-bottom: 0;
  flex: 1 1 12rem;
  font-size: 15px;
  line-height: 1.35;
}
.item-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-success {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.badge-warn {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}
.badge-danger {
  color: var(--pzm-danger);
  background: var(--pzm-danger-bg);
  border-color: #fecaca;
}
.badge-muted {
  color: var(--pzm-text-muted);
  background: #f1f5f9;
  border-color: var(--pzm-border-soft);
}
.item-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}
.item-kv-row {
  margin: 0;
  min-width: 0;
}
.item-kv-row dt {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--pzm-text-muted);
}
.item-kv-row dd {
  margin: 0;
  font-size: 13px;
  color: var(--pzm-text);
  word-break: break-word;
}
.item-kv-row--wide {
  grid-column: 1 / -1;
}
.item-kv-row--highlight dd {
  font-weight: 700;
  color: var(--pzm-blue-800);
}
.item-notes {
  margin-top: 8px;
  font-size: 12px;
  color: var(--pzm-text-muted);
  line-height: 1.45;
}
.sale.item-card .sale-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  flex: 1 1 12rem;
  line-height: 1.35;
}
.sale.item-card .item-kv {
  margin-top: 0;
}
.sale-nested.item-card {
  border-left-width: 2px;
  border-left-color: var(--pzm-border);
  padding: 10px 12px;
  box-shadow: none;
}
.sale-nested.item-card:hover {
  border-left-color: var(--pzm-blue-600);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.sale-nested .item-title {
  font-size: 13px;
  font-weight: 600;
}
.sale .items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--pzm-border-soft);
}

/* --- POS sale lines (only under .lines) --- */
.lines {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.lines .line {
  border: 1px solid var(--pzm-border);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  background: #fafcff;
}
.line-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}
.line-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.line-entry {
  color: #334155;
}
.line-entry b {
  color: var(--pzm-text);
  margin-right: 4px;
}

/* Salary/detail text rows (not inside .lines) */
.item .line,
.nested .line {
  border: none;
  padding: 0;
  background: transparent;
  font-size: 13px;
  color: #334155;
}
.item .line b,
.nested .line b {
  color: var(--pzm-text);
  margin-right: 4px;
}

.product-preview {
  margin-top: 10px;
  border: 1px solid var(--pzm-border);
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
}
.product-preview-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}
.product-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.product-preview-line {
  font-size: 13px;
  color: #334155;
}
.product-preview-line b {
  color: var(--pzm-text);
  margin-right: 4px;
}

.barcode-suggestions {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}
.barcode-suggestion {
  width: 100%;
  text-align: left;
  border: 1px solid var(--pzm-border);
  border-radius: var(--pzm-radius-sm);
  background: #fff;
  color: var(--pzm-text);
  padding: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.barcode-suggestion:hover {
  background: var(--pzm-blue-50);
}
.barcode-suggestion-main {
  font-size: 13px;
  font-weight: 700;
}
.barcode-suggestion-sub {
  font-size: 12px;
  color: #475569;
  margin-top: 2px;
}

.product-picker-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}
.product-picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--pzm-border);
  border-radius: var(--pzm-radius-sm);
  background: #fff;
  color: var(--pzm-text);
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
}
.product-picker-item:hover:not(:disabled) {
  background: var(--pzm-blue-50);
  border-color: var(--pzm-blue-600);
}
.product-picker-item:disabled {
  opacity: 0.6;
  cursor: wait;
}
.product-picker-main {
  flex: 1;
  min-width: 0;
}
.product-picker-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}
.product-picker-meta {
  font-size: 12px;
  color: var(--pzm-text-muted);
  margin-top: 3px;
}
.product-picker-price {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--pzm-blue-800);
  white-space: nowrap;
}
.product-picker-add-hint {
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--pzm-blue-600);
  opacity: 0;
  transition: opacity 0.15s;
}
.product-picker-item:hover:not(:disabled) .product-picker-add-hint {
  opacity: 1;
}
.product-picker-empty {
  padding: 8px 0;
}

.totals {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.totals .metric {
  border: 1px solid var(--pzm-border-soft);
  border-radius: var(--pzm-radius-sm);
  padding: 8px;
  background: #fff;
}

@media (max-width: 720px) {
  .grid,
  .line-grid,
  .totals,
  .item-grid,
  .item-kv,
  .product-preview-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Stats --- */
.stats-total {
  font-size: 16px;
}
.stats-total b {
  font-size: 24px;
}
.stats-item {
  border: 1px solid var(--pzm-border);
  border-radius: 10px;
  padding: 10px;
  margin-top: 8px;
}
.stats-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.stats-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}
.stats-record-row {
  border: 1px dashed var(--pzm-border);
  border-radius: var(--pzm-radius-sm);
  padding: 8px;
  font-size: 13px;
  display: grid;
  gap: 4px;
}
.stats-record-row-line b {
  margin-right: 6px;
}
.stats-more {
  margin-top: 8px;
}
a.btn-link {
  display: inline-block;
  margin-top: 8px;
  text-decoration: none;
  color: var(--pzm-blue-600);
  font-weight: 600;
}

/* --- CMS --- */
.revision-list {
  margin-top: 10px;
}
.revision-item {
  border: 1px solid #dbe1ee;
  border-radius: var(--pzm-radius-sm);
  padding: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

/* --- Salary metrics --- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.metric {
  border: 1px solid var(--pzm-border);
  border-radius: 10px;
  background: #fafcff;
  padding: 10px;
}
.metric-title {
  font-size: 12px;
  color: var(--pzm-text-muted);
  margin-bottom: 4px;
}
.metric-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--pzm-text);
}
details.item {
  padding: 0;
  overflow: hidden;
}
details.item > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px;
}
details.item > summary::-webkit-details-marker {
  display: none;
}
.nested {
  margin: 0 10px 10px 10px;
  padding-left: 10px;
  border-left: 2px solid var(--pzm-border-soft);
}
.nested .item {
  margin-top: 6px;
}

@media (max-width: 860px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Login / register spinner --- */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  animation: pzm-spin 0.8s linear infinite;
  margin-right: 6px;
}
@keyframes pzm-spin {
  to {
    transform: rotate(360deg);
  }
}

.error-text {
  color: var(--pzm-danger);
}
