:root {
  /* Палитра A1 Telecom (a1-telecom.am) */
  --brand: #81B441;
  --brand-dark: #6a9836;
  --brand-light: #a5d16a;
  --brand-soft: #f2f8ea;
  --accent: #F47B20;
  --blue: #3B7DDB;
  --ink: #171717;
  --bg: #f5f6f4;
  --card: #fff;
  --text: #333333;
  --muted: #6b6b6b;
  --line: #eaeaea;
  --radius: 14px;
  --grad: linear-gradient(180deg, #A6D65E 0%, #5F8F2C 100%);
  --shadow-sm: 0 4px 14px rgba(20,30,10,.06);
  --new: var(--blue); --processing: var(--accent); --connected: var(--brand-dark); --rejected: #8a8a8a;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 "Noto Sans", "Noto Sans Armenian", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--brand-dark); text-decoration: none; }
.wrap { max-width: 760px; margin: 0 auto; padding: 14px 14px calc(110px + var(--safe-b)); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .5px; }
.h1 { font-size: 22px; margin: 6px 0 14px; color: var(--ink); font-weight: 800; }

/* Шапка */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: #fff; border-bottom: 1px solid var(--line); }
.topbar { border-bottom: 3px solid transparent; border-image: var(--grad) 1; }
.brand { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.brand img { height: 30px; width: auto; }
.brand-word { font-weight: 800; letter-spacing: .5px; font-size: 16px; }
.brand-tag { margin-left: 4px; font-size: 12px; font-weight: 700; color: var(--brand-dark); background: var(--brand-soft);
  padding: 2px 8px; border-radius: 30px; }
@media (max-width: 360px) { .brand-tag { display: none; } }
.topnav { display: flex; align-items: center; gap: 8px; }
.btn-install { border: 1px solid var(--brand); color: var(--brand-dark); background: #fff; border-radius: 20px; padding: 6px 12px; font-weight: 600; font-size: 14px; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 700; }
.menu-pop { position: absolute; right: 0; top: 46px; min-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 11px 12px; border-radius: 8px; color: var(--text);
  background: none; border: 0; font: inherit; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--bg); }
.menu-user { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-weight: 600; }
.menu-user small { display: block; color: var(--muted); font-weight: 400; }

.net-banner { background: #fef3c7; color: #92400e; padding: 8px 14px; font-size: 14px; text-align: center; }
.ios-hint { position: relative; background: #eef2ff; color: #3730a3; padding: 10px 40px 10px 14px; font-size: 14px; }
.ios-hint svg { vertical-align: -3px; }
.x { position: absolute; right: 8px; top: 6px; background: none; border: 0; font-size: 24px; line-height: 1; color: inherit; cursor: pointer; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px;
  border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(129,180,65,.35); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-primary:disabled { opacity: .6; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 14px; }
.btn-ghost { background: transparent; }
.linkbtn { background: none; border: 0; color: var(--brand-dark); font: inherit; font-size: 13px; padding: 0; cursor: pointer; }

/* Сообщения */
.messages { margin-bottom: 12px; display: grid; gap: 8px; }
.msg { padding: 11px 14px; border-radius: 12px; background: #e0f2fe; color: #075985; font-size: 15px; }
.msg-success { background: #dcfce7; color: #166534; }
.msg-error { background: #fee2e2; color: #991b1b; }
.msg-warning { background: #fef3c7; color: #92400e; margin-bottom: 12px; }
.msg-warning a { color: inherit; text-decoration: underline; }

/* Карточки и поля */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.card h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0 0 12px; color: var(--ink); }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 14px; font-weight: 800; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.req { color: var(--accent); font-style: normal; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; font-size: 16px;
  border: 1px solid #d1d5db; border-radius: 10px; background: #fff; color: var(--text); -webkit-appearance: none; appearance: none; }
.field select { background-image: linear-gradient(45deg, transparent 50%, #888 50%), linear-gradient(135deg, #888 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(129,180,65,.22); }
.field .err { display: block; color: #b91c1c; font-size: 13px; font-style: normal; margin-top: 4px; }
.field .err:empty { display: none; }
.has-error input, .has-error select, .has-error textarea { border-color: #dc2626; }
.row2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } }

/* Фото-слоты */
.slot { border: 2px dashed #d1d5db; border-radius: 12px; padding: 12px; margin-bottom: 12px; transition: .15s; }
.slot.done { border-style: solid; border-color: var(--brand-light); background: var(--brand-soft); }
.slot.missing { border-color: #dc2626; background: #fef2f2; }
.slot.busy { opacity: .6; pointer-events: none; }
.slot-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.slot-title { font-weight: 600; }
.slot-hint { color: var(--muted); font-size: 13px; }
.slot-btns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.slot-btns .btn { min-width: 0; padding: 10px 8px; font-size: 15px; line-height: 1.2; text-align: center; }
.slot-btns .btn svg { flex: none; }
.btn-cam { background: var(--ink); color: #fff; border-color: var(--ink); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:not(:empty) { margin-bottom: 10px; }
.thumb { position: relative; width: 104px; }
.thumb img { width: 104px; height: 78px; object-fit: cover; border-radius: 8px; display: block; }
.thumb small { color: var(--muted); font-size: 11px; }
.thumb-x { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: #111827; color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }

.submitbar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 30%); }
.progress { height: 6px; background: var(--line); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }

/* Список */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat { background: #fff; border-radius: 12px; padding: 10px; color: var(--text); border: 2px solid transparent; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }
.stat { box-shadow: var(--shadow-sm); }
.stat.on { border-color: var(--brand); }
.s-new b { color: var(--new); } .s-processing b { color: var(--processing); } .s-connected b { color: var(--connected); } .s-rejected b { color: var(--rejected); }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input { flex: 1; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid #d1d5db; font: inherit; font-size: 16px; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border-radius: 12px; padding: 12px 14px; color: var(--text); box-shadow: var(--shadow-sm); border-left: 4px solid var(--brand-light); }
.item-title { color: var(--ink); }
.item-title { font-weight: 600; }
.item-sub { font-size: 14px; }
.item-meta { font-size: 12px; color: var(--muted); }
.badge { flex: none; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; color: #fff; }
.b-new { background: var(--new); } .b-processing { background: var(--processing); } .b-connected { background: var(--connected); } .b-rejected { background: var(--rejected); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 16px 0; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.fab { position: fixed; right: 16px; bottom: calc(18px + var(--safe-b)); display: flex; align-items: center; gap: 6px; background: var(--grad); color: #fff;
  padding: 14px 20px; border-radius: 30px; font-weight: 700; box-shadow: 0 10px 24px rgba(95,143,44,.4); z-index: 10; }

.outbox { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 12px; padding: 12px; margin-bottom: 12px; text-align: left; }
.outbox-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.outbox ul { margin: 8px 0 0; padding: 0; list-style: none; font-size: 14px; }
.outbox li { padding: 6px 0; border-top: 1px solid #fde4c8; display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between; }
.outbox li small { color: var(--muted); }
.outbox li.bad small { color: #b91c1c; }

/* Детали */
.back { display: inline-block; margin-bottom: 6px; font-weight: 600; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.detail-head .h1 { margin-bottom: 2px; }
.kv { display: grid; grid-template-columns: 1fr; gap: 2px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; margin-top: 8px; }
.kv dd { margin: 0; word-break: break-word; }
@media (min-width: 560px) { .kv { grid-template-columns: 170px 1fr; } .kv dt { margin-top: 0; } .kv dd { margin-bottom: 8px; } }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: var(--bg); display: block; }
.gallery figcaption { font-size: 13px; margin-top: 4px; }
.fig-actions { display: flex; gap: 10px; font-size: 13px; }
.fig-actions form { display: inline; }
.addphotos { margin-top: 14px; }
.addphotos summary { cursor: pointer; color: var(--brand-dark); font-weight: 600; padding: 6px 0; }
.addphotos form { margin-top: 10px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.timeline li:first-child { border-top: 0; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
.lightbox::backdrop { background: rgba(0,0,0,.9); }
.lightbox img { max-width: 96vw; max-height: 92vh; display: block; }
.lightbox .x { position: fixed; color: #fff; font-size: 36px; top: 10px; right: 16px; }

/* Вход */
.login { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.login .card { text-align: left; margin-top: 18px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; color: var(--ink); }
.login-brand img { height: 64px; }
.login-brand span { font-size: 28px; font-weight: 800; letter-spacing: 1px; }
.login h1 { margin: 6px 0 0; font-weight: 800; color: var(--brand-dark); }
.login .lang { justify-content: center; }

/* Переключатель языка */
.lang { display: flex; gap: 4px; padding: 6px; }
.lang button { flex: 1; min-height: 34px; padding: 4px 10px; border-radius: 30px; border: 1px solid var(--line); background: #fff;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.lang button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.menu-pop .lang button { display: block; width: auto; text-align: center; padding: 4px 10px; border-radius: 30px; border: 1px solid var(--line); }
.menu-pop .lang button.on { background: var(--brand); color: #fff; }

/* Выбор типа документа */
.doc-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.doc-choice .err { grid-column: 1 / -1; color: #b91c1c; font-size: 14px; font-style: normal; }
.doc-choice .err:empty { display: none; }
.doc-choice.has-error .doc-card { border-color: #fca5a5; }
.doc-card { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 14px 8px 12px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer;
  color: var(--muted); transition: border-color .15s, background .15s, transform .1s; -webkit-tap-highlight-color: transparent; }
.doc-card:active { transform: scale(.98); }
.doc-card input { position: absolute; opacity: 0; pointer-events: none; }
.doc-card .doc-ico { color: var(--brand-dark); line-height: 0; }
.doc-card .doc-title { font-weight: 700; color: var(--ink); font-size: 15px; line-height: 1.25; }
.doc-card .doc-sub { font-size: 12px; line-height: 1.3; }
.doc-card.on, .doc-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(129,180,65,.18); }
.doc-card.on::after { content: "✓"; position: absolute; top: 6px; right: 8px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 800; display: grid; place-items: center; }
.doc-card input:focus-visible + .doc-ico { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 8px; }
.need-doc .after-doc { display: none; }
.docset.off { display: none; }
.after-doc { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.extra-shots { margin-top: 4px; }
.extra-shots summary { cursor: pointer; color: var(--brand-dark); font-weight: 600; padding: 6px 0; }
.extra-shots .slot { margin-top: 8px; }
.slot-hint { flex: none; }
.req-hint { color: var(--accent); font-weight: 700; }
.extra-shots summary, .addphotos summary { list-style: none; }
.extra-shots summary::-webkit-details-marker, .addphotos summary::-webkit-details-marker { display: none; }

/* Режим съёмки документа */
html.scan-open, html.scan-open body { overflow: hidden; }
.scan { position: fixed; inset: 0; z-index: 1000; background: #000; color: #fff; overflow: hidden; touch-action: none; }
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; border-radius: 14px; box-shadow: 0 0 0 200vmax rgba(0,0,0,.62); outline: 2px solid rgba(255,255,255,.55); }
.scan-frame .corner { position: absolute; width: 30px; height: 30px; border: 4px solid var(--brand-light); }
.scan-frame .tl { top: -4px; left: -4px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.scan-frame .tr { top: -4px; right: -4px; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.scan-frame .bl { bottom: -4px; left: -4px; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.scan-frame .br { bottom: -4px; right: -4px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.scan-hint { position: absolute; left: 20px; right: 20px; text-align: center; font-size: 14px; line-height: 1.4; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.scan-hint b { display: block; font-size: 17px; margin-bottom: 4px; }
.scan-hint span { opacity: .85; }
.scan-top { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; display: flex; justify-content: space-between; }
.scan-round { width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 28px; line-height: 1;
  display: grid; place-items: center; cursor: pointer; }
.scan-torch.on { background: #fff; color: #111; }
.scan-bottom { position: absolute; left: 0; right: 0; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: center; }
.scan-shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: var(--brand); cursor: pointer;
  box-shadow: 0 0 0 4px rgba(0,0,0,.25); }
.scan-shutter:active { transform: scale(.94); background: var(--brand-dark); }
.scan-status { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; }
.scan-review { position: absolute; inset: 0; background: #111; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
.scan-review img { max-width: 100%; max-height: 58vh; border-radius: 10px; box-shadow: 0 6px 30px rgba(0,0,0,.6); }
.scan-warn { width: 100%; max-width: 480px; padding: 10px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; }
.scan-warn.bad { background: #fef3c7; color: #92400e; }
.scan-warn.good { background: var(--brand-soft); color: var(--brand-dark); }
.scan-warn div + div { margin-top: 4px; }
.scan-review-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 480px; }
