:root {
  /* Фирменная чёрно-оранжевая система ВВЕРХ КАССА (акцент #F47A20).
     Тема зафиксирована — не зависит от светлой/тёмной темы Telegram. */
  --bg: #0d0d0f;            /* нижняя навигация / шапка */
  --secondary-bg: #060607;  /* фон страницы */
  --section-bg: #17171a;    /* карточки, поля */
  --text: #f4f1ea;          /* тёплый белый */
  --hint: #8b8a90;          /* приглушённый серый */
  --accent: #f47a20;        /* фирменный оранжевый */
  --accent-press: #d96a15;
  --link: #f47a20;          /* активная вкладка / ссылки */
  --button: #f47a20;
  --button-text: #ffffff;
  --error: #ff5a4d;
  --separator: rgba(255, 255, 255, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--secondary-bg);
  color: var(--text);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

#topbar {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 14px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#brand-logo { height: 64px; width: auto; display: block; }
#brand-fallback { color: var(--accent); font-weight: 800; letter-spacing: .1em; font-size: 19px; }

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 14px 96px;
}

.center { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.muted { color: var(--hint); }
.hidden, [hidden] { display: none !important; }

h1 { font-size: 20px; margin: 8px 2px 4px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--hint); margin: 20px 4px 8px; font-weight: 600; }
p.sub { margin: 0 2px 14px; color: var(--hint); font-size: 14px; line-height: 1.4; }

.card {
  background: var(--section-bg);
  border-radius: 14px;
  padding: 4px 0;
  margin-bottom: 14px;
  overflow: hidden;
}
.card .row { padding: 12px 16px; border-bottom: 1px solid var(--separator); }
.card .row:last-child { border-bottom: none; }
.row .label { font-size: 13px; color: var(--hint); margin-bottom: 4px; }
.row .value { font-size: 16px; word-break: break-word; }

.field { padding: 12px 16px; border-bottom: 1px solid var(--separator); }
.field:last-child { border-bottom: none; }
.field label { display: block; font-size: 13px; color: var(--hint); margin-bottom: 6px; }
.field .req { color: var(--accent); }
.field input, .field textarea, .field select {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  padding: 0;
}
.field textarea { resize: vertical; min-height: 64px; }
.field select { appearance: none; }
.field.invalid { box-shadow: inset 3px 0 0 var(--error); }

.ac-list { margin-top: 10px; border-top: 1px solid var(--separator); }
.ac-item {
  padding: 11px 2px; border-bottom: 1px solid var(--separator);
  cursor: pointer; font-size: 15px; color: var(--text);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:active { background: rgba(244, 122, 32, .14); }
.ac-id { color: var(--hint); font-size: 13px; }

button.primary {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  background: var(--button);
  color: var(--button-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:active { background: var(--accent-press); }
button.primary:disabled { opacity: .5; }

.obj-switch {
  display: flex; align-items: center; gap: 8px;
  background: var(--section-bg); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px;
}
.obj-switch select { flex: 1; border: none; background: transparent; color: var(--text); font-size: 16px; font-weight: 600; }
.obj-switch .cap { color: var(--hint); font-size: 13px; }

.ticket {
  background: var(--section-bg); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px;
}
.ticket .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ticket .cat { font-weight: 600; }
.ticket .id { color: var(--hint); font-size: 13px; white-space: nowrap; }
.ticket .desc { color: var(--text); margin-top: 4px; font-size: 15px; line-height: 1.35; }
.ticket .date { color: var(--hint); font-size: 12px; margin-top: 6px; }

.empty { text-align: center; color: var(--hint); padding: 40px 20px; font-size: 15px; }

.success {
  background: var(--section-bg); border-radius: 14px; padding: 18px 18px;
  font-size: 15px; line-height: 1.5; color: var(--text); margin-bottom: 14px;
  border-left: 3px solid var(--accent);
}
.success-icon { color: var(--accent); margin-bottom: 12px; }
.success-icon svg { display: block; }

#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  background: var(--bg);
  border-top: 1px solid var(--separator);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 20;
}
#tabbar .tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--hint); font-size: 11px; padding: 4px 0;
}
#tabbar .tab.active { color: var(--link); }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 14px; z-index: 30; max-width: 90%; text-align: center;
}
