/* Стиль EASY: оранжевый с иконки (#F98710), белый, крупные скругления и белая «волна» */
:root {
  --brand: #f98710;
  --brand-deep: #e86f00;
  --bg: #fff8f1;
  --panel: #ffffff;
  --panel-2: #fff1e2;
  --border: #f3e0cc;
  --text: #2a1a0d;
  --muted: #8f7764;
  --accent: var(--brand);
  --accent-2: var(--brand-deep);
  --green: #1f9d55;
  --red: #e0362c;
  --yellow: #d98200;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(120, 60, 0, .05), 0 6px 20px rgba(232, 111, 0, .07);
  --hover: #fffaf4;
}
/* тёмная тема: включается кнопкой в меню, выбор запоминается в браузере */
:root[data-theme="dark"] {
  --bg: #15110d;
  --panel: #1f1914;
  --panel-2: #2b221a;
  --border: #3a2e23;
  --text: #f3e9df;
  --muted: #a8968a;
  --hover: #261e17;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  min-height: 100vh;
}
a { color: var(--brand-deep); }
h2 { margin: 0 0 16px; font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
h3 { margin: 0; font-size: 16px; font-weight: 700; }
[hidden] { display: none !important; }
::selection { background: var(--brand); color: #fff; }

/* ---------- боковое меню ---------- */
.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: linear-gradient(170deg, #fc9a2a 0%, var(--brand) 45%, var(--brand-deep) 100%);
  color: #fff;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
/* белая волна внизу — как на иконке */
.sidebar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 120px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 236 120' preserveAspectRatio='none'%3E%3Cpath d='M0 120 C40 70 110 62 170 60 C205 59 228 40 236 18 L236 34 C226 62 200 80 160 84 C100 90 50 96 18 120Z' fill='%23fff' opacity='.95'/%3E%3Cpath d='M30 120 C70 98 120 98 170 94 C205 91 228 76 236 52 L236 60 C228 86 204 100 172 104 C130 108 90 108 52 120Z' fill='%23fff' opacity='.55'/%3E%3C/svg%3E") no-repeat bottom / 100% 100%;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.logo img { width: 42px; height: 42px; border-radius: 12px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.logo b { display: block; font-size: 18px; font-weight: 800; letter-spacing: .04em; line-height: 1.1; }
.logo span { font-size: 12px; opacity: .85; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; min-height: 0; overflow-y: auto; position: relative; z-index: 1; }
.sidebar nav a {
  color: #fff;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  transition: background .15s;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .16); }
.nav-group { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .8; padding: 14px 12px 4px; }
.nav-group:first-child { padding-top: 0; }
.wm-drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center; cursor: pointer; background: var(--bg); }
.wm-drop:hover { border-color: var(--brand); }
.wm-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; margin-top: 16px; }
.wm-results img { width: 100%; border-radius: 12px; border: 1px solid var(--border); background: #fff; }
.sidebar nav a.active { background: #fff; color: var(--brand-deep); box-shadow: 0 4px 14px rgba(120, 50, 0, .18); }
.sidebar > :not(nav):not(.logo) { position: relative; z-index: 1; }

main { flex: 1; min-width: 0; padding: 28px; }

/* ---------- карточки ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card-title { color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.big { font-size: 24px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.gauge-card { display: flex; align-items: center; gap: 16px; }
.gauge {
  --p: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: conic-gradient(var(--c, var(--accent)) calc(var(--p) * 1%), var(--panel-2) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.gauge span {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--panel);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { margin: 0; }

/* ---------- кнопки и поля ---------- */
.btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(249, 135, 16, .28);
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--accent-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: var(--panel-2); color: var(--brand-deep); box-shadow: none; }
.btn.ghost:hover { background: var(--border); }
.btn.danger { background: var(--red); box-shadow: 0 3px 10px rgba(224, 54, 44, .25); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.icon {
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 15px;
}
.icon:hover { background: var(--panel-2); }
.icon.danger:hover { background: rgba(224, 54, 44, .12); }

input, select, textarea {
  width: 100%;
  background: var(--panel);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249, 135, 16, .18); }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.form label > input, .form label > select, .form label > textarea, .form label > .input-btn { margin-top: 4px; }
textarea { resize: vertical; }
.form label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }
.form label.check > input { margin: 0; }
.form label.check input { width: auto; accent-color: var(--brand); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-btn { display: flex; gap: 6px; }
.input-btn input { flex: 1; }
.section-title { color: var(--text); font-weight: 700; margin-top: 4px; border-top: 1px solid var(--border); padding-top: 12px; }

/* переключатель */
.switch { position: relative; display: inline-block; width: 40px; height: 23px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 23px;
  cursor: pointer;
  transition: .2s;
}
.switch span::before {
  content: "";
  position: absolute;
  width: 17px;
  height: 17px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: .2s;
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(17px); }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 8px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table tbody tr:hover > td { background: var(--hover); }
.table tr.off td { opacity: .5; }
.table td.drag { cursor: grab; color: var(--muted); font-size: 18px; user-select: none; width: 1%; }
.table tr.dragging td { opacity: .35; }
.table tr.drop td { box-shadow: inset 0 2px 0 var(--brand); }
.table tr.sub > td { background: var(--bg); padding: 12px; }
.table.inner th, .table.inner td { padding: 8px; }
.actions { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 28px !important; }
.tag { background: var(--panel-2); color: var(--brand-deep); border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.tag.dim { color: var(--muted); }
.badge { border-radius: 8px; padding: 2px 10px; font-size: 13px; font-weight: 700; }
.badge.on { background: rgba(31, 157, 85, .12); color: var(--green); }
.badge.off { background: rgba(224, 54, 44, .1); color: var(--red); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; }
.bar { height: 5px; background: var(--panel-2); border-radius: 5px; margin-top: 4px; min-width: 90px; }
.bar div { height: 100%; background: var(--accent); border-radius: 5px; }
.bar.warn div { background: var(--yellow); }
.bar.full div { background: var(--red); }
.red { color: var(--red); }
.yellow { color: var(--yellow); }

pre.code {
  background: var(--hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  max-height: 480px;
  font: 12px/1.5 ui-monospace, Consolas, monospace;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- модальные окна ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(42, 26, 13, .45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 10;
}
.modal-box {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(120, 50, 0, .25);
  width: 100%;
  max-width: 560px;
  padding: 22px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.qr { display: flex; justify-content: center; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; width: fit-content; margin: 0 auto 12px; }
.copy-row { display: flex; gap: 6px; margin-bottom: 10px; }
.copy-row input { flex: 1; font-size: 12px; }

#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}
.toast { background: #2a1a0d; color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600;
  border-left: 4px solid var(--green); box-shadow: 0 8px 24px rgba(42, 26, 13, .25); }
.toast.bad { border-left-color: var(--red); }

/* ---------- вход и страница оплаты: оранжевый фон с волной ---------- */
.splash {
  background: linear-gradient(160deg, #fc9a2a 0%, var(--brand) 50%, var(--brand-deep) 100%) fixed;
  position: relative;
}
.splash::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32vh;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 300' preserveAspectRatio='none'%3E%3Cpath d='M0 300 C200 160 480 150 720 146 C860 144 960 100 1000 30 L1000 80 C950 170 860 210 720 220 C480 236 260 240 120 300Z' fill='%23fff' opacity='.9'/%3E%3Cpath d='M180 300 C340 248 520 246 720 238 C860 232 960 200 1000 130 L1000 150 C960 226 860 256 730 262 C560 270 400 272 260 300Z' fill='%23fff' opacity='.5'/%3E%3C/svg%3E") no-repeat bottom / 100% 100%;
}
.login, .result { margin: auto; width: 100%; max-width: 380px; padding: 16px; position: relative; z-index: 1; }
.login .card, .result .card { padding: 30px 28px; border: 0; box-shadow: 0 24px 60px rgba(120, 50, 0, .28); }
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand img { width: 72px; height: 72px; border-radius: 20px; box-shadow: 0 6px 18px rgba(249, 135, 16, .35); }
.login h2, .result h2 { text-align: center; margin: 0; }
.result { text-align: center; max-width: 420px; }
.result .mark {
  width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 38px; font-weight: 800; color: #fff;
}
.result .mark.good { background: var(--green); box-shadow: 0 8px 22px rgba(31, 157, 85, .35); }
.result .mark.bad { background: var(--red); box-shadow: 0 8px 22px rgba(224, 54, 44, .3); }
.result .mark.wait { background: var(--brand); box-shadow: 0 8px 22px rgba(249, 135, 16, .35); }
.result p { margin: 10px 0 0; }
.result .details { background: var(--bg); border-radius: 14px; padding: 12px 14px; margin-top: 16px; text-align: left; }
.result .details div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.result .btn { display: block; margin-top: 20px; padding: 13px; text-decoration: none; font-size: 15px; }

/* ---------- телефоны ---------- */
.menu-title, .menu-btn, .mobile-only { display: none; }

@media (max-width: 760px) {
  body:not(.splash) { flex-direction: column; }
  /* меню — полоса сверху: логотип, название вкладки, ☰; список вкладок раскрывается по кнопке */
  .sidebar {
    width: 100%;
    height: auto;
    max-height: 100vh;
    z-index: 5;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 16px;
    overflow-y: auto;
  }
  .sidebar::after { display: none; }
  .logo { padding: 0; }
  .logo b { display: none; }
  .logo img { width: 34px; height: 34px; border-radius: 10px; }
  .menu-title { display: block; flex: 1; font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu-btn { display: block; background: rgba(255, 255, 255, .2); color: #fff; border: 0; border-radius: 10px;
              font-size: 22px; line-height: 1; padding: 8px 12px; cursor: pointer; }
  .sidebar nav, .sidebar > .btn { display: none; }
  .menu-open .sidebar nav { display: flex; flex-basis: 100%; overflow: visible; padding-top: 8px; }
  .menu-open .sidebar > .btn { display: block; flex: 1; margin-top: 8px; }
  .sidebar nav a { padding: 12px; }
  main { padding: 16px; }
  .row { grid-template-columns: 1fr; }
  /* iPhone увеличивает страницу при фокусе на поле со шрифтом меньше 16px */
  input, select, textarea { font-size: 16px; }
  .modal { padding: 12px; }
  .modal-box { padding: 16px; }
  .mobile-only { display: inline-flex; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }  /* цифры — по две в ряд */
  .grid > .card { padding: 14px; }

  /* таблицы — карточками: подпись колонки слева (data-label ставит app.js), значение справа */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--border); padding: 10px 0; }
  .table th, .table td { border: 0; padding: 3px 0; white-space: normal; overflow-wrap: anywhere; }
  /* подпись прижата влево (float), значение — справа; в ячейке может быть несколько элементов */
  .table td[data-label]:not([data-label=""]) { text-align: right; }
  .table td[data-label]:not([data-label=""])::before { content: attr(data-label); float: left; margin-right: 12px;
    color: var(--muted); font-size: 12px; line-height: 21px; }
  .table td.actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; padding-top: 8px; }
  .table td.drag { display: none; }
  .table tr.sub > td { padding: 10px; border-radius: 12px; }
}

/* ---------- графики ---------- */
.chart { display: flex; align-items: flex-end; gap: 2px; height: 120px; margin-top: 8px; }
.chart-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.chart-col:hover .chart-bar { background: var(--brand-deep); }
.chart-bar { width: 100%; min-height: 2px; background: linear-gradient(180deg, #fcac52, var(--brand)); border-radius: 4px 4px 0 0; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 4px; }

.theme-btn { margin-bottom: 8px; }
