:root {
  --bg: #F6F1F2;
  --ink: #2A1D22;
  --muted: #6B5A61;
  --accent: #8B4F65;
  --accent-dark: #6E3A50;
  --border: #E5D6DC;
  --input-border: #D9C8CF;
  --tint: #EFE2E7;
  --card: #ffffff;
  --danger: #A32D2D;
  --ok: #2F6B4F;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Onest', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.right { text-align: right; }

.logo { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; font-size: 30px; letter-spacing: 5px; color: var(--accent-dark); }
.logo-lg { color: #fff; font-size: 34px; letter-spacing: 6px; }
.h1 { margin: 0; font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; font-size: 40px; }
.h1-lg { font-size: 52px; }
.h2 { margin: 0; font-size: 20px; font-weight: 600; }

/* Каркас */
.page { max-width: 1280px; margin: 0 auto; padding: 0 56px 64px; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: baseline; gap: 14px; }
.brand-sub { font-size: 14px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar-right form { margin: 0; }
.who { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; }
.avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; }
.hero { padding: 44px 0 32px; display: flex; flex-direction: column; gap: 8px; }
.hero-row { flex-direction: row; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.hero p { margin: 0; font-size: 16px; }
.row-gap { display: flex; gap: 10px; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--input-border); background: #fff; color: var(--ink); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tile:focus-visible, .link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: #fff; }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-block { width: 100%; min-height: 54px; font-size: 16px; }
.link { color: var(--accent-dark); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* Плитки */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.tile { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(110, 58, 80, .12); }
.tile-preview { height: 148px; background: var(--tint); display: flex; align-items: center; justify-content: center; }
.tile-body { padding: 24px 26px 26px; display: flex; flex-direction: column; gap: 10px; }
.tile-head { display: flex; align-items: center; justify-content: space-between; color: var(--accent); }
.tile-title { font-size: 22px; font-weight: 600; color: var(--ink); }
.tile-desc { margin: 0; font-size: 15px; color: var(--muted); }
.tile-host { font-size: 13px; color: var(--muted); padding-top: 4px; }
.empty { border: 2px dashed var(--input-border); border-radius: 20px; padding: 48px 24px; text-align: center; }
.empty p { margin: 0 0 6px; font-size: 18px; }

/* Вход */
.login-wrap { min-height: 100vh; display: flex; }
.login-side { width: 46%; max-width: 600px; background: var(--accent-dark); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 60px; line-height: 1.05; font-weight: 500; }
.login-lead { margin: 20px 0 0; font-size: 17px; color: #F1DDE5; max-width: 400px; }
.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.login-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login-form .muted { margin: -8px 0 6px; }
.hint { margin: 0; font-size: 14px; color: var(--muted); }

/* Формы */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 28px; margin-bottom: 24px; }
.card-narrow { max-width: 440px; text-align: left; display: flex; flex-direction: column; gap: 14px; }
.card-narrow p, .card-narrow h1 { margin: 0; }
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.form-card { max-width: 720px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
label { font-size: 14px; font-weight: 500; }
input[type=text], input[type=password], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 16px; font: inherit; font-size: 16px;
  border: 1px solid var(--input-border); border-radius: 12px; background: #fff; color: var(--ink);
}
input:disabled { background: var(--bg); color: var(--muted); }
textarea { resize: vertical; }
.help { font-size: 13px; color: var(--muted); }
.checks { display: flex; gap: 24px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 400; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.matrix { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.matrix-row { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.matrix-row:last-child { border-bottom: 0; }
.matrix-name { flex: 1 1 220px; }
.matrix-input { flex: 1 1 220px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.danger-zone { margin: 8px 0 0; }
.secret { padding: 12px 16px; background: var(--bg); border: 1px dashed var(--input-border); border-radius: 12px; word-break: break-all; user-select: all; }

/* Таблицы */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; }
.pill-ok { background: #E3F1EA; color: var(--ok); }
.pill-off { background: #EFE9EB; color: var(--muted); }

/* Сообщения */
.flashes { padding-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.flash { padding: 12px 16px; border-radius: 12px; font-size: 15px; background: #E3F1EA; color: var(--ok); border: 1px solid #C7E2D4; }
.flash-error { background: #FBEAEA; color: var(--danger); border-color: #EFC9C9; }

@media (max-width: 860px) {
  .page { padding: 0 20px 48px; }
  .h1-lg { font-size: 40px; }
  .login-wrap { flex-direction: column; }
  .login-side { width: 100%; max-width: none; padding: 28px 24px; gap: 16px; }
  .login-hero { font-size: 40px; }
  .login-side-foot { display: none; }
}
