/* Стилистика корпоративного сайта ООО «Энергопромсбыт»:
   палитра и шрифт взяты из resources/css/app.css проекта enersbyt (apanel). */

:root {
  --bg: #f5f7f9;
  --card: #ffffff;
  --text: #494f54;
  --muted: #757778;
  --border: #bcbec1;
  --accent: #0065a5;
  --accent-hover: #3a99d5;
  --on: #1a7f37;
  --off: #b42318;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 Tahoma, Arial, Helvetica, ui-sans-serif, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.screen { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.screen[hidden] { display: none; }

/* шапка с логотипом */
.brand { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 4px 0 2px; }
.brand img { width: 56px; height: 56px; object-fit: contain; }
.brand .brand-text { line-height: 1.25; }
.brand .brand-name { font-size: 15px; font-weight: 700; color: var(--accent); }
.brand .brand-sub { font-size: 12px; color: var(--muted); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.title { font-weight: 700; color: var(--accent); }
.topbar .who { flex: 1; text-align: right; margin-right: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

h1 { font-size: 19px; margin: 0; color: var(--accent); font-weight: 700; }
h2 { font-size: 13px; margin: 0 0 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.hint { text-align: center; font-size: 12px; }
.ok { color: var(--on); font-size: 13px; margin: 8px 0 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.login-card { display: flex; flex-direction: column; gap: 10px; margin-top: 8vh; }

input[type=password], input[type=text], input[type=tel], input[type=search] {
  width: 100%;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}
input[type=search] { margin-bottom: 10px; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  appearance: none;
  font-family: inherit;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.link { border: none; background: none; color: var(--muted); padding: 6px; font-weight: 500; }
.btn.link:hover { color: var(--accent); }

.btn.big {
  padding: 18px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  border: 1px solid var(--on);
  background: var(--on);
}
.btn.big:hover:not(:disabled) { color: #fff; filter: brightness(1.08); }
.btn.big.is-on { background: var(--off); border-color: var(--off); }
.btn.big.busy { opacity: .7; }

.status-card { display: flex; gap: 14px; align-items: center; border-left: 4px solid var(--border); }
.status-icon { font-size: 30px; line-height: 1; }
.status-title { font-size: 16px; font-weight: 700; }
.status-card.on { border-left-color: var(--off); }
.status-card.off { border-left-color: var(--on); }

.numbers { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.numbers li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.numbers li.selected { border-color: var(--accent); background: #eef5fa; }
.numbers .info { flex: 1; min-width: 0; }
.numbers .label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.numbers .phone { font-size: 13px; color: var(--muted); }
.numbers .active-badge { font-size: 12px; color: var(--on); font-weight: 700; }
.numbers .del { border: none; background: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 2px 6px; }
.numbers .del:hover:not(:disabled) { color: var(--off); }
.numbers input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }

.add-form { display: flex; flex-direction: column; gap: 8px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.error { color: var(--off); font-size: 13px; margin: 0; }
.empty { text-align: center; padding: 6px 0 12px; }

/* вкладки администратора */
.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; }
.tabs[hidden] { display: none; }
.tab {
  flex: 1; appearance: none; border: none; background: none; cursor: pointer;
  font-family: inherit; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 9px 8px; border-radius: 6px;
}
.tab:hover { color: var(--accent); }
.tab.is-active { background: var(--accent); color: #fff; }

#tab-my, #tab-admin { display: flex; flex-direction: column; gap: 14px; }
#tab-my[hidden], #tab-admin[hidden] { display: none; }

/* список добавочных */
/* overflow-x: hidden — иначе от кнопок вылезала горизонтальная полоса */
.ext-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh;
  overflow-y: auto; overflow-x: hidden; }
.ext-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
}
.ext-row.is-on { border-left: 4px solid var(--on); background: #f2f9f4; }
.ext-row .info { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.ext-row .label { font-weight: 600; }
.ext-row .phone { font-size: 12px; color: var(--muted); }
.ext-row .actions { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.btn.small { padding: 7px 10px; font-size: 12px; }
.btn.danger { color: var(--off); }
.btn.danger:hover:not(:disabled) { border-color: var(--off); color: var(--off); }

/* выданный доступ */
.issued { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 14px; }
.issued div { display: flex; gap: 10px; align-items: baseline; }
.issued .k { color: var(--muted); font-size: 12px; min-width: 86px; }
.issued .v { font-weight: 600; }
.issued .v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; letter-spacing: .04em; user-select: all; color: var(--accent); }

details > summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
details > summary:hover { color: var(--accent); }
details[open] > summary { margin-bottom: 10px; }

#audit { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; max-height: 320px; overflow: auto; }
#audit div { display: flex; gap: 8px; }
#audit .ts { white-space: nowrap; }

.btn.small.is-admin { border-color: var(--accent); color: var(--accent); }

/* поля с подписью, переключатель и форма задержки */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field select, .field input {
  width: 100%; padding: 10px 12px; font-family: inherit; font-size: 15px;
  color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: 6px;
}
.switch { display: flex; gap: 4px; border: 1px solid var(--border); border-radius: 6px; padding: 4px; margin-bottom: 10px; }
.seg {
  flex: 1; appearance: none; border: none; background: none; cursor: pointer;
  font-family: inherit; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 9px 8px; border-radius: 6px;
}
.seg:hover { color: var(--accent); }
.seg.is-active { background: var(--accent); color: #fff; }
.delay-form { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.delay-form .field { flex: 1; }
.delay-form[hidden] { display: none; }

/* запланированные отсутствия */
.absences { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.absences li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
}
.absences .info { flex: 1; min-width: 0; }
.absences .label { font-weight: 600; }
.absences .phone { font-size: 12px; color: var(--muted); }
.absences .del { border: none; background: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 2px 6px; }
.absences .del:hover { color: var(--off); }
