/* Заявки техотдела — простые крупные элементы, удобно пальцем с телефона. Светлая и тёмная тема. */
:root {
  --bg: #f4f5f7; --fg: #1d2330; --muted: #6b7280; --card: #fff; --line: #e3e6eb;
  --blue: #1f6feb; --blue-bg: #e8f0fe; --green: #1a7f37; --green-bg: #e6f4ea;
  --red: #cf222e; --red-bg: #fde8e8; --amber: #9a6700; --amber-bg: #fff4d6; --grey-bg: #eef0f3;
  --radius: 14px; --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218; --fg: #e6e8ec; --muted: #9aa3b2; --card: #181c24; --line: #2a303b;
    --blue: #4c8dff; --blue-bg: #17243d; --green: #3fb950; --green-bg: #13291a;
    --red: #ff6b6b; --red-bg: #3a1618; --amber: #e3b341; --amber-bg: #33280f; --grey-bg: #222833;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--blue); text-decoration: none; }
h1 { font-size: 1.45rem; margin: .4rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 32px; }
.muted { color: var(--muted); }
.count { color: var(--muted); font-weight: 400; font-size: .9em; }

/* шапка и вкладки */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--fg); }
.tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--card);
  border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.tabs a { padding: 8px 11px; border-radius: 999px; color: var(--muted); white-space: nowrap; font-weight: 500; font-size: .97rem; }
.tabs a.on { background: var(--blue-bg); color: var(--blue); }
footer {
  max-width: 760px; margin: 0 auto; padding: 16px; display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: .9rem;
}

/* кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg);
  font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.1rem; }
.btn-new { background: var(--blue); border-color: var(--blue); color: #fff; min-height: 40px; padding: 8px 14px; }
.btn[disabled] { opacity: .6; }
button.link { background: none; border: 0; color: var(--blue); font: inherit; cursor: pointer; padding: 8px; }

/* сообщения */
.flash, .error { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-weight: 500; }
.flash { background: var(--green-bg); color: var(--green); }
.error { background: var(--red-bg); color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 1.05rem; }

/* карточки списка */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  display: block; background: var(--card); border-radius: var(--radius); padding: 12px 14px; color: var(--fg);
  box-shadow: var(--shadow); border-left: 5px solid var(--line);
}
.card.st-new { border-left-color: var(--blue); }
.card.st-in_progress { border-left-color: var(--amber); }
.card.st-paused { border-left-color: var(--muted); }
.card.st-done { border-left-color: var(--green); opacity: .8; }
.card.st-cancelled { opacity: .6; }
.card.urgent { border-left-color: var(--red); }
.row1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.num { font-weight: 700; }
.ph { color: var(--muted); font-size: .9rem; margin-left: auto; }
.desc {
  font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 4px;
}
.meta { color: var(--muted); font-size: .92rem; }
.tag { font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--grey-bg); color: var(--muted); }
.tag.red { background: var(--red-bg); color: var(--red); }

/* фильтры */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.filters input[type=search] { grid-column: 1 / -1; }
.filters .btn { grid-column: 1 / -1; }
select, input[type=text], input[type=search], textarea {
  width: 100%; font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; }

/* формы */
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 6px; font-weight: 600; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.choice { display: grid; gap: 8px; }
.choice .opt { display: block; }
.choice .opt input { position: absolute; opacity: 0; pointer-events: none; }
.choice .opt span {
  display: block; padding: 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--card);
  font-weight: 500; cursor: pointer;
}
.choice .opt input:checked + span { border-color: var(--blue); background: var(--blue-bg); }
.choice .opt.red input:checked + span { border-color: var(--red); background: var(--red-bg); }
.choice .opt input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.file {
  display: flex !important; align-items: center; justify-content: center; min-height: 54px; border: 2px dashed var(--line);
  border-radius: 12px; background: var(--card); cursor: pointer; color: var(--blue);
}
.file.small { min-height: 44px; }
.file input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.previews { display: flex; flex-wrap: wrap; gap: 6px; }
.previews:empty { display: none; }
.previews img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.inline select, .inline input[type=text] { flex: 1 1 160px; width: auto; }

/* заявка */
.ticket-head h1 { margin-bottom: .3rem; }
.status { display: inline-block; font-weight: 600; padding: 6px 12px; border-radius: 999px; margin-bottom: 12px; background: var(--grey-bg); }
.status.st-new { background: var(--blue-bg); color: var(--blue); }
.status.st-in_progress { background: var(--amber-bg); color: var(--amber); }
.status.st-done { background: var(--green-bg); color: var(--green); }
.box { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.box.result { border: 2px solid var(--green-bg); }
.box.off { opacity: .6; }
.desc-full { white-space: pre-wrap; word-break: break-word; margin: .5rem 0; font-size: 1.05rem; }
.gallery { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.gallery img { width: 104px; height: 104px; object-fit: cover; border-radius: 10px; display: block; }
.ph-wait { display: inline-flex; align-items: center; padding: 0 10px; height: 104px; border-radius: 10px; background: var(--grey-bg); color: var(--muted); font-size: .85rem; }
.actions { display: grid; gap: 10px; margin-bottom: 12px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.row-btns form { flex: 1 1 140px; }
.row-btns .btn { width: 100%; }
.assign { display: flex; gap: 8px; }
.done-form > summary { list-style: none; }
.done-form > summary::-webkit-details-marker { display: none; }
.done-form[open] > summary { margin-bottom: 10px; }
.done-form form { background: var(--card); padding: 14px; border-radius: var(--radius); box-shadow: var(--shadow); }
.timeline { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.timeline .event { font-size: .9rem; color: var(--muted); }
.timeline .comment { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.comment-form textarea { min-height: 60px; }

/* люди, точки */
.people { list-style: none; padding: 0; margin: 0 0 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.btn-row .btn { flex: 1 1 120px; }
.edit > summary { list-style: none; color: var(--blue); font-weight: 600; cursor: pointer; padding: 8px 0 0; }
.edit > summary::-webkit-details-marker { display: none; }
.small { font-size: .9rem; margin: 4px 0 0; }

/* вход */
.login { text-align: center; max-width: 420px; margin: 12vh auto 0; display: grid; gap: 14px; }
.login .logo { font-size: 3rem; }
.code-form { text-align: left; margin-top: 8px; }
.code-form input { font-size: 1.3rem; letter-spacing: .15em; text-align: center; }
