:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2b2b2b;
  --muted: #6b6b6b;
  --accent: #7a4a2b;
  --accent-soft: #f0e3d7;
  --line: #e3dcd2;
  --ok: #2e7d32;
  --warn: #b26a00;
  --danger: #b3261e;
  --header-bg: #3a2a1f;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

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

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  color: #fff;
  padding: 10px 16px;
}
.topbar__inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar__logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  white-space: nowrap;
}
.topbar__nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.topbar__nav a {
  color: #f0e3d7;
  font-size: .85rem;
  padding: 4px 10px;
  border-radius: 6px;
}
.topbar__nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.topbar__lang { display: flex; gap: 4px; margin-left: auto; }

/* ---------- Language switch ---------- */
.lang-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.4);
  color: #fff;
  font-size: .8rem;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
}
.lang-btn.active { background: #fff; color: var(--header-bg); border-color: #fff; font-weight: 600; }

/* ---------- Layout ---------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px;
}
.page { padding: 12px 0 48px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; margin-top: 1.6em; }
h3 { font-size: 1.02rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card--accent { border-left: 4px solid var(--accent); }
.card--warn { border-left: 4px solid var(--warn); }
.card--ok { border-left: 4px solid var(--ok); }

.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge--ok { background: #e5f3e6; color: var(--ok); }
.badge--muted { background: #eceae4; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: 1fr 1fr; }
  .grid--3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- Tables (journals) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 640px;
  background: var(--card);
}
table.data th, table.data td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
table.data thead th {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: .78rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.data tbody tr:nth-child(even) { background: #fbf9f5; }
table.data tbody tr:hover { background: #f5efe7; }
table.data .date-cell { white-space: nowrap; }
table.data td.ok { color: var(--ok); }
table.data td.warn { color: var(--warn); font-weight: 600; }

.rec-count { font-size: .8rem; color: var(--muted); }
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: .85rem; flex-wrap: wrap; }
.pagination button {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: .85rem;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); }
.pagination button:disabled { opacity: .4; cursor: default; }

/* ---------- Contact / phone chips ---------- */
.phone-chip {
  display: inline-block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 4px;
}
.phone-chip .num { font-size: 1.05rem; font-weight: 700; color: var(--accent); display: block; }
.phone-chip .lbl { font-size: .8rem; color: var(--muted); }

/* ---------- Menu / products ---------- */
.product {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 12px;
}
.product__name { font-weight: 600; }
.product__meta { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.product__desc { font-size: .88rem; margin-top: 6px; }

/* ---------- Images ---------- */
.doc-img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
}
.img-caption { text-align: center; font-size: .8rem; color: var(--muted); margin-top: 6px; }

/* ---------- Footer ---------- */
footer {
  background: var(--header-bg);
  color: #d8cdc2;
  font-size: .82rem;
  padding: 20px 16px;
  margin-top: 32px;
}
footer .container { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
footer.container { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
footer.container p { margin: 0; }
.footer-credit {
  color: #f0e3d7;
  font-weight: 600;
  white-space: nowrap;
}
.footer-credit:hover { color: #fff; text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: .9rem;
  cursor: pointer;
}
.btn:hover { background: #6a3f24; text-decoration: none; }
.btn--ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

/* ---------- Details ---------- */
details.journal { margin-bottom: 10px; }
details.journal summary {
  cursor: pointer;
  font-weight: 600;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
details.journal[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
details.journal .body { border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--radius) var(--radius); padding: 12px; background: #fdfbf8; }

.alert { border-radius: var(--radius); padding: 10px 14px; font-size: .88rem; margin: 10px 0; }
.alert--info { background: #e8f0fb; border: 1px solid #c8d9f0; color: #1a4a86; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Form (complaints) ---------- */
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .9rem; }
.form-field input, .form-field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.form-field textarea { resize: vertical; }
.form-error { color: var(--danger); font-size: .85rem; margin: 6px 0 10px; }
#form-success h3 { margin-top: 0; }

/* ---------- Mobile: таблицы -> карточки ---------- */
@media (max-width: 700px) {
  .table-wrap { overflow-x: visible; }
  table.data { min-width: 0; }
  table.data thead { display: none; }
  table.data tbody { display: block; }
  table.data tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: var(--card);
  }
  table.data tbody tr:nth-child(even) { background: var(--card); }
  table.data td {
    display: block;
    width: 100%;
    border: none;
    padding: 3px 0;
    font-size: .86rem;
    vertical-align: baseline;
  }
  table.data td::before {
    content: attr(data-label);
    display: block;
    font-size: .66rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 1px;
  }
  table.data td.no-print { padding-top: 8px; }
  table.data td.ok, table.data td.warn { font-weight: 600; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; font-size: 12px; }
  .topbar, .actions, .pagination, .no-print, footer, .lang-switch { display: none !important; }
  .container { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  table.data { display: table; min-width: 0; font-size: 10px; }
  table.data thead { display: table-header-group; }
  table.data tbody { display: table-row-group; }
  table.data tr { display: table-row; border: none; margin: 0; padding: 0; border-radius: 0; break-inside: avoid; }
  table.data td { display: table-cell; width: auto; border: 1px solid #ccc; padding: 4px 6px; vertical-align: top; }
  table.data td::before { content: none; }
  table.data thead th { position: static; }
  a { color: var(--ink); }
  .page-title { font-size: 16px; }
}
