/* Кабинет, вход и админка: те же цвета, шрифты и карточки, что у лендинга (styles.css) */

.app { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.app__bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(255, 79, 158, .16), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, rgba(255, 155, 203, .08), transparent 60%),
    var(--bg);
}
.app .header { position: sticky; background: rgba(11, 8, 12, .72); backdrop-filter: blur(16px); border-bottom-color: var(--border); }
.app main { flex: 1; padding: 40px 0 80px; }

.user-chip {
  display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 14px 0 5px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: rgba(255,255,255,.04);
  font-size: 14px; font-weight: 600;
}
.user-chip .avatar { width: 28px; height: 28px; font-size: 13px; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }

/* ===== Поля ===== */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select {
  width: 100%; height: 46px; padding: 0 16px; border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid var(--border-strong);
  color: var(--text); font: inherit; font-size: 15px; outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.input::placeholder { color: #75687a; }
.input:focus, .select:focus { border-color: rgba(255,155,203,.6); background: rgba(255,255,255,.06); box-shadow: 0 0 0 4px rgba(255,79,158,.12); }
.input--mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .04em; }
.select { appearance: none; cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a597a4' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; }
.select option { background: #1a1119; }
.row { display: flex; gap: 10px; }
.row > .input { flex: 1; }

.btn:disabled { opacity: .5; pointer-events: none; }
.btn--danger { background: rgba(255, 77, 109, .12); border: 1px solid rgba(255, 77, 109, .35); color: #ff8fa3; }
.btn--danger:hover { background: rgba(255, 77, 109, .2); }
.btn--icon { width: 34px; height: 34px; padding: 0; border-radius: 10px; }
.btn--icon svg { width: 16px; height: 16px; }

/* ===== Вход ===== */
.auth { flex: 1; display: grid; place-items: center; padding: 40px 16px; position: relative; overflow: hidden; }
.auth__bg {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(11,8,12,.7), rgba(11,8,12,.92)), url("assets/after.webp") center / cover no-repeat, var(--bg);
  filter: saturate(1.1);
}
.auth__card { width: 100%; max-width: 420px; padding: 34px 30px 30px; background: rgba(20, 13, 21, .72); backdrop-filter: blur(20px); }
.auth__card:hover { background: rgba(20, 13, 21, .72); }
.auth__logo { display: flex; justify-content: center; margin-bottom: 22px; }
.auth__logo .logo__icon { width: 44px; height: 44px; }
.auth__title { font-family: var(--font-head); font-size: 26px; font-weight: 700; text-align: center; letter-spacing: -.01em; }
.auth__sub { color: var(--muted); text-align: center; margin-top: 6px; font-size: 15px; }
.tabs { display: flex; padding: 4px; margin: 26px 0 22px; border-radius: 999px; background: rgba(255,255,255,.04); border: 1px solid var(--border); }
.tabs__btn { flex: 1; height: 38px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .2s, color .2s; }
.tabs__btn.is-active { background: rgba(255,255,255,.1); color: var(--text); }
.form { display: flex; flex-direction: column; gap: 16px; }
.form .btn { margin-top: 6px; }
.form__error { min-height: 20px; font-size: 14px; color: #ff8fa3; text-align: center; }
.auth__foot { margin-top: 18px; text-align: center; font-size: 14px; color: var(--muted); }
.auth__foot a { color: var(--accent-1); }

/* ===== Кабинет ===== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-head); font-size: clamp(28px, 4vw, 38px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.page-head p { color: var(--muted); margin-top: 6px; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
.panel { padding: 26px; display: flex; flex-direction: column; gap: 18px; }
.panel:hover { background: var(--card); border-color: var(--border); }
.panel__head { display: flex; align-items: center; gap: 12px; }
.panel__head h2 { font-family: var(--font-head); font-size: 19px; font-weight: 600; }
.panel__head .feature__icon { width: 38px; height: 38px; border-radius: 12px; margin: 0; }
.panel__head .feature__icon svg { width: 19px; height: 19px; }
.panel__head .spacer { flex: 1; }
.muted { color: var(--muted); font-size: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  background: rgba(255,255,255,.06); border: 1px solid var(--border-strong); color: var(--muted);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--ok { color: #7ee2b0; background: rgba(46, 204, 140, .1); border-color: rgba(46, 204, 140, .3); }
.pill--accent { color: var(--accent-1); background: rgba(255,79,158,.1); border-color: rgba(255,155,203,.3); }
.pill--bad { color: #ff8fa3; background: rgba(255, 77, 109, .1); border-color: rgba(255, 77, 109, .3); }

.sub__big { font-family: var(--font-head); font-size: 44px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.sub__big small { font-size: 18px; color: var(--muted); font-weight: 600; margin-left: 6px; letter-spacing: 0; }
.bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); box-shadow: 0 0 12px rgba(255,79,158,.6); transition: width .6s ease; }

.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.list__item:first-child { border-top: 0; padding-top: 4px; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list__meta { color: var(--muted); font-size: 13px; }
.list__actions { display: flex; gap: 6px; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; letter-spacing: .03em; }
.code--chip { padding: 3px 9px; border-radius: 8px; background: rgba(255,79,158,.1); color: var(--accent-1); cursor: pointer; }
.empty { padding: 26px 0 8px; text-align: center; color: var(--muted); font-size: 14px; }

/* ===== Админка ===== */
.stats-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 18px; }
.tile { padding: 18px 20px; }
.tile:hover { background: var(--card); border-color: var(--border); }
.tile__num { font-family: var(--font-head); font-size: 30px; font-weight: 700; line-height: 1.1; }
.tile__label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tile--accent .tile__num { background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .input { max-width: 300px; height: 40px; }
.table-wrap { overflow-x: auto; margin: 0 -26px; padding: 0 26px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 0 12px 12px; white-space: nowrap; }
.table td { padding: 12px; border-top: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; text-align: right; }
.table tr:hover td { background: rgba(255,255,255,.02); }
.table .list__actions { justify-content: flex-end; }

.gen { display: grid; grid-template-columns: 110px 1fr 1.4fr auto; gap: 10px; align-items: end; }
.result { display: none; padding: 16px; border-radius: 14px; background: rgba(255,79,158,.06); border: 1px dashed rgba(255,155,203,.35); }
.result.is-shown { display: block; }
.result pre { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14px; line-height: 1.7; white-space: pre-wrap; margin-bottom: 12px; max-height: 220px; overflow: auto; }

/* ===== Окно и уведомления ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(5, 3, 6, .6); backdrop-filter: blur(6px); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.modal.is-open { opacity: 1; visibility: visible; }
.modal__card { width: 100%; max-width: 400px; padding: 26px; background: #170f18; transform: translateY(10px) scale(.98); transition: transform .2s; }
.modal.is-open .modal__card { transform: none; }
.modal__card:hover { background: #170f18; }
.modal__title { font-family: var(--font-head); font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.modal__text { color: var(--muted); font-size: 15px; margin-bottom: 18px; }
.modal__body { margin-bottom: 20px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; max-width: 340px;
  background: rgba(28, 18, 29, .95); border: 1px solid var(--border-strong); backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0,0,0,.4); animation: toastIn .25s ease;
}
.toast--ok { border-color: rgba(46, 204, 140, .4); }
.toast--bad { border-color: rgba(255, 77, 109, .45); color: #ffb3c0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.loading { display: grid; place-items: center; padding: 120px 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.1); border-top-color: var(--accent-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }

/* ===== Завершающие элементы кабинета ===== */
.textarea { min-height: 128px; height: auto; padding-top: 13px; padding-bottom: 13px; resize: vertical; line-height: 1.55; }
.form--compact { gap: 12px; }
.form--compact .btn { align-self: flex-start; margin-top: 0; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.device-row strong { display: block; margin-bottom: 4px; }
.notice { padding: 12px 14px; border-radius: 12px; color: var(--muted); font-size: 13px; line-height: 1.5; background: rgba(255,255,255,.035); border: 1px solid var(--border); }
.config-tools { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .8fr); gap: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.config-editor { display: grid; grid-template-columns: minmax(160px, .65fr) minmax(260px, 1.35fr) auto; gap: 12px; align-items: end; }
.config-editor .textarea { min-height: 90px; }
.config-editor .btn { min-height: 46px; }
.config-import { display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; }
.config-icon { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 12px; color: var(--accent-1); background: rgba(255,79,158,.1); border: 1px solid rgba(255,155,203,.2); font: 700 14px var(--font-head); }
.admin-mark { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin-left: 3px; border-radius: 7px; color: var(--accent-1); background: rgba(255,79,158,.1); border: 1px solid rgba(255,155,203,.22); font: 700 10px var(--font-main); text-transform: uppercase; letter-spacing: .08em; vertical-align: middle; }
.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 18px; text-align: center; }
.error-page__code { margin-top: 44px; font: 800 clamp(88px, 18vw, 190px)/.85 var(--font-head); letter-spacing: -.07em; color: transparent; background: var(--accent); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 36px rgba(255,79,158,.2)); }
.error-page h1 { margin-top: 26px; font: 700 clamp(28px, 5vw, 42px)/1.1 var(--font-head); }
.error-page p { max-width: 520px; margin: 12px 0 28px; color: var(--muted); line-height: 1.65; }

@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  .col-4, .col-5, .col-6, .col-7, .col-8 { grid-column: span 12; }
  .gen { grid-template-columns: 1fr 1fr; }
  .gen .btn { grid-column: span 2; }
  .config-tools { grid-template-columns: 1fr; }
  .config-editor { grid-template-columns: 1fr 1.5fr; }
  .config-editor .btn { grid-column: span 2; }
  .app .header__actions .btn--ghost { display: inline-flex; }
}
@media (max-width: 640px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 20px; }
  .table-wrap { margin: 0 -20px; padding: 0 20px; }
  .row { flex-direction: column; }
  .user-chip span:last-child { display: none; }
  .user-chip { padding-right: 5px; }
  .device-row { align-items: flex-start; flex-direction: column; }
  .config-editor { grid-template-columns: 1fr; }
  .config-editor .btn { grid-column: auto; }
  .auth__card { padding: 28px 20px 24px; }
}
