:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1c2433;
  --muted: #5c6b84;
  --line: #e2e8f2;
  --accent: #1f5eff;
  --accent-soft: #e8efff;
  --danger: #c0392b;
  --ok: #1e7e46;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans Armenian", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Header */
.topbar {
  background: linear-gradient(135deg, #14265c, #1f5eff);
  color: #fff;
  padding: 22px 0;
  margin-bottom: 24px;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; gap: 14px; align-items: center; }
.brand-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  font-weight: 700;
  font-size: 18px;
  padding: 10px 12px;
  white-space: nowrap;
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 650; }
.subtitle { margin: 2px 0 0; opacity: 0.85; font-size: 13px; }

.lang-switch button {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.lang-switch button:first-child { border-radius: 8px 0 0 8px; }
.lang-switch button:last-child { border-radius: 0 8px 8px 0; }
.lang-switch button.active { background: #fff; color: var(--accent); }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.card h2 { font-size: 16px; margin: 0 0 14px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.field input {
  padding: 9px 12px;
  border: 1px solid #c9d4e8;
  border-radius: 9px;
  font-size: 15px;
  max-width: 220px;
}
.field small { color: var(--muted); font-size: 12px; }

/* Tabs */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.tab {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
  font-family: inherit;
}
.tab strong { font-size: 14.5px; }
.tab span { font-size: 12px; color: var(--muted); }
.tab.active { border-color: var(--accent); background: var(--accent-soft); }
.tab.active strong { color: var(--accent); }

/* Layout */
.layout { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 880px) {
  .layout, .settings-grid { grid-template-columns: 1fr; }
  .tabs { grid-template-columns: 1fr; }
}

.items-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.items-head h2 { margin: 0; }

.btn {
  font-family: inherit;
  border: 1px solid #c9d4e8;
  background: #fff;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #1849c9; }
.btn.icon { padding: 6px 10px; color: var(--danger); }
.btn.icon:hover { background: #fdecea; }

.exemption {
  background: #f2fbf5;
  border: 1px solid #bfe6cd;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.exemption label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }

.item-row {
  display: grid;
  grid-template-columns: 1fr 150px auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.item-row:first-of-type { border-top: none; }
.item-type, .item-qty {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid #c9d4e8;
  border-radius: 9px;
  background: #fff;
  width: 100%;
}
.qty-field { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }
.clause { font-size: 11.5px; color: var(--muted); background: var(--bg); border-radius: 6px; padding: 3px 7px; white-space: nowrap; }

/* Results */
.results-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.results-table th {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
.results-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.results-table .num { text-align: right; white-space: nowrap; }
.results-table tfoot td { border-bottom: none; padding-top: 12px; font-weight: 700; font-size: 15px; }
.total { color: var(--accent); font-size: 17px !important; }
.exempt { color: var(--ok); font-size: 12px; }

.land-note {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
  background: #fff8e8;
  border: 1px solid #f0dfae;
  border-radius: 9px;
  padding: 9px 12px;
}
.hidden { display: none !important; }

.actions { margin-top: 14px; display: flex; gap: 10px; }
.disclaimer { margin-top: 14px; font-size: 12px; color: var(--muted); }

/* Rate reference */
.rate-block { margin-bottom: 18px; }
.rate-block h3 { font-size: 14px; margin: 0 0 8px; color: var(--accent); }
.rate-block table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rate-block th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.rate-block td { padding: 7px 8px; border-bottom: 1px solid var(--line); }

/* Sources */
.sources { padding: 6px 0 30px; font-size: 13px; color: var(--muted); }
.sources h3 { font-size: 14px; color: var(--ink); }
.sources a { color: var(--accent); }

/* Print */
@media print {
  .topbar { background: #14265c !important; -webkit-print-color-adjust: exact; }
  .tabs, .items-head .btn, .actions, .lang-switch, .rates, .sources, .item-row .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .layout { grid-template-columns: 1fr; }
}
