/* TAS — тёмная тема по макету заказчика */
:root {
  --bg: #0a1020;
  --panel: #10192e;
  --panel-2: #0d1526;
  --border: #1d2a47;
  --text: #e8eefb;
  --muted: #8593b3;
  --primary: #2563eb;
  --primary-2: #3b82f6;
  --gray: #64748b;
  --yellow: #facc15;
  --green: #22c55e;
  --green-dark: #15803d;
  --red: #ef4444;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 30px; margin: 0 0 4px; letter-spacing: -.5px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }

/* ---------- каркас ---------- */
.layout { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--panel-2); border-right: 1px solid var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo .mark {
  font-size: 34px; font-weight: 900; letter-spacing: -1px; line-height: 1;
  background: linear-gradient(135deg, #ffffff 30%, #7aa7ff 100%); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}
.logo .word { font-size: 12px; line-height: 1.15; color: #cdd7ee; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
  color: #cdd7ee; font-weight: 500; margin-bottom: 4px;
}
.nav a:hover { background: #14203a; text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, #1d4ed8, #2563eb); color: #fff; }
.nav .badge {
  margin-left: auto; background: var(--red); color: #fff; border-radius: 999px;
  font-size: 11px; padding: 1px 7px;
}
.side-widgets { margin-top: auto; display: grid; gap: 10px; padding-top: 14px; }
.widget { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.widget h3 { font-size: 13px; margin: 0 0 4px; }
.side-foot { color: var(--muted); font-size: 11px; padding: 10px 6px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--border);
  background: rgba(10,16,32,.9); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px);
}
.topbar form { flex: 1; max-width: 540px; }
.topbar input[type=search] { width: 100%; }
.topbar form.langswitch { flex: none; max-width: none; }
.bell { position: relative; color: var(--text); padding: 6px 8px; border-radius: 10px; font-size: 20px; }
.bell:hover { background: #14203a; text-decoration: none; }
.bell .badge {
  position: absolute; top: -2px; right: -2px; background: var(--red); color: #fff;
  border-radius: 999px; font-size: 10px; padding: 1px 5px; font-weight: 700;
}
.userchip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.userchip form { flex: none; max-width: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary); display: grid;
  place-items: center; font-weight: 700; font-size: 12px; flex: none; overflow: hidden;
}
.userchip .who { line-height: 1.2; min-width: 0; }
.userchip .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userchip .who span { font-size: 11px; color: var(--muted); }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 4px; }
.linkbtn:hover { color: var(--text); }
.content { padding: 24px; max-width: 1500px; width: 100%; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- формы и кнопки ---------- */
input[type=text], input[type=search], input[type=number], input[type=password], input[type=datetime-local],
select, textarea {
  background: #0c1426; border: 1px solid var(--border); color: var(--text); border-radius: 10px;
  padding: 10px 12px; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #2b4fb3; border-color: #2b4fb3; }
input[type=file] { color: var(--muted); width: 100%; }
.filepick { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filepick-btn { padding: 8px 14px; }
.filepick-status { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; min-width: 0; }
.filepick-native { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
input[type=range] { width: 100%; accent-color: var(--primary); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: #131f38;
  color: var(--text); padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: #182747; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: #1f56d4; }
.btn.danger { background: #3a1620; border-color: #6b2130; color: #ff9aa9; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 16px; }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 12px; border: 1px solid; }
.flash.success { background: #0f2a1b; border-color: #1d5a37; color: #9be7b7; }
.flash.error { background: #2d1319; border-color: #6b2130; color: #ffb0bd; }
.flash.warning { background: #2b2410; border-color: #6d5a1a; color: #f4de8d; }
.errorbox { background: #2d1319; border: 1px solid #6b2130; color: #ffb0bd; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; }
.fielderr { color: #ff9aa9; font-size: 12px; margin-top: 4px; }

/* ---------- статус-плашки ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  font-weight: 700; font-size: 12px; white-space: nowrap; cursor: default;
}
.pill.gray { background: #46546e; color: #dfe7f5; }
.pill.yellow { background: var(--yellow); color: #3b2f00; }
.pill.green { background: var(--green); color: #052e14; }
.pill.green-dark { background: var(--green-dark); color: #eafff1; }
.pill.red { background: var(--red); color: #fff; }
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus::after {
  content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 30;
  background: #050a16; border: 1px solid var(--border); color: var(--text); font-weight: 400;
  padding: 8px 10px; border-radius: 8px; width: max-content; max-width: 260px; font-size: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); white-space: normal;
}
/* маркер «здесь есть подсказка»: кружок с i в правом верхнем углу */
[data-tip]::before {
  content: "i"; position: absolute; top: -7px; right: -7px; width: 15px; height: 15px; border-radius: 50%;
  background: #4d8bff; color: #fff; font: 700 10px/15px Georgia, serif; text-align: center;
  box-shadow: 0 0 0 2px #0b1220; pointer-events: none;
}
[data-tip] { cursor: help; }
/* значок ⓘ живёт внутри подчёркнутого блока, в собственном отступе справа, и не заходит на текст/дату */
.hint { white-space: nowrap; border-bottom: 1px dotted var(--muted, #8b97ad); padding-right: 20px; margin-right: 4px; }
.hint[data-tip]::before { right: 2px; top: -5px; }
.tip-right:hover::after, .tip-right:focus::after { left: auto; right: 0; }
[data-tip]:hover::after, [data-tip]:focus::after { max-width: 320px; z-index: 40; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.tag.warn { background: #3a2d0a; color: #ffd866; border: 1px solid #6d5a1a; }
.tag.danger { background: #3a1620; color: #ff9aa9; border: 1px solid #6b2130; }

/* ---------- вкладки и сводка ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: #0f1a30; color: var(--text);
  font-weight: 600; font-size: 13px;
}
.tab:hover { text-decoration: none; background: #15223e; }
.tab.active { background: var(--primary); border-color: var(--primary); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat.warn .v { color: var(--yellow); }
.stat.bad .v { color: #ff8095; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar select { width: auto; }

/* ---------- таблица ---------- */
.tablewrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--panel-2);
}
td { padding: 11px 12px; border-bottom: 1px solid #16223c; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #121d35; }
tr.overdue td { background: rgba(239,68,68,.07); }
tr.grouphead td { background: #0b1324; font-weight: 700; padding: 10px 12px; color: #b9c7e6; }
.evcell { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.thumb {
  width: 42px; height: 42px; border-radius: 9px; object-fit: cover; background: linear-gradient(135deg, #24407f, #6d3bd2);
  display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.evname { font-weight: 600; color: var(--text); display: block; }
.evsub { color: var(--muted); font-size: 12px; }
.pager { display: flex; gap: 6px; padding: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pager .pages { display: flex; gap: 6px; }
.pager a, .pager span.cur { padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border); background: #0f1a30; color: var(--text); }
.pager span.cur { background: var(--primary); border-color: var(--primary); }
.empty { padding: 42px; text-align: center; color: var(--muted); }

/* ---------- детали ---------- */
.detail { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.hero { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.hero .thumb { width: 72px; height: 72px; font-size: 22px; }
.hero h2 { font-size: 20px; margin: 0; }
.statusopts { display: grid; gap: 8px; margin-bottom: 12px; }
.statusopt {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; background: #0c1426; color: var(--text); font-size: 13px; margin: 0;
}
.statusopt:has(input:checked) { border-color: var(--primary); background: #10214a; }
.statusopt input { accent-color: var(--primary); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.gray { background: var(--gray); } .dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); } .dot.green-dark { background: var(--green-dark); }
.dot.red { background: var(--red); }
.salebox { border: 1px dashed var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: #0f1a30; cursor: pointer; font-size: 12px; color: var(--text); }
.chip:hover { background: #17264a; }
.preview { background: #0c1a12; border: 1px solid #1d5a37; border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary-2); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.linklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.linklist li { background: #0c1426; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; word-break: break-all; }
.shot { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }

/* ---------- форма квитка ---------- */
.evsearch { position: relative; }
.evresults { border: 1px solid var(--border); background: #0c1426; border-radius: 10px; margin-top: 8px; max-height: 340px; overflow-y: auto; }
.evresults button {
  display: flex; width: 100%; text-align: left; gap: 12px; align-items: center; background: none; color: var(--text);
  border: 0; border-bottom: 1px solid #16223c; padding: 10px 12px; cursor: pointer; font: inherit;
}
.evresults button:hover { background: #14213d; }
.evresults button:last-child { border-bottom: 0; }
.evresults .head { padding: 8px 12px; color: var(--muted); font-size: 12px; border-bottom: 1px solid #16223c; }
.selected-event { display: flex; gap: 12px; align-items: center; background: #0c1a12; border: 1px solid #1d5a37; padding: 12px; border-radius: 10px; }
.selected-event.hidden, .hidden { display: none !important; }
.quick { background: #0d1830; border: 1px dashed #2b4fb3; }

/* ---------- логин ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #142a5a 0%, var(--bg) 60%); }
.loginbox { width: 100%; max-width: 400px; }
.loginbox .logo { justify-content: center; padding-bottom: 8px; }
.loginbox .logo .mark { font-size: 54px; }
.loginbox .card { padding: 26px; }
.creds { background: #0c1a12; border: 1px solid #1d5a37; border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.creds code { background: #050a16; padding: 4px 8px; border-radius: 6px; font-size: 15px; user-select: all; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 22px; max-width: 460px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(3,7,18,.7); }
dialog .row { justify-content: flex-end; margin-top: 18px; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .side-widgets, .side-foot { display: none; }
  .detail, .grid-2 { grid-template-columns: 1fr; }
  .grid-form { grid-template-columns: 1fr 1fr; }
  .content { padding: 14px; }
}

/* ---------- переключатель языка RU/EN ---------- */
.langswitch { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.langswitch button {
  background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; padding: 7px 11px;
}
.langswitch button:hover { color: var(--text); }
.langswitch button.on { background: var(--primary); color: #fff; cursor: default; }
.auth-lang { display: flex; justify-content: flex-end; margin-bottom: 14px; }
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 10px 14px; }
  .userchip { flex: 1 1 auto; min-width: max-content; justify-content: flex-end; }
  .userchip .who { flex: none; }
  .userchip .who b { overflow: visible; }
  .topbar form:first-of-type:not(.langswitch) { flex: 1 1 100%; max-width: none; order: 5; }
}
