/* Портал и панель Платформы. Визуальный язык — по мотивам Apple Human Interface Guidelines. */
:root {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --sidebar: rgba(236, 236, 241, 0.82);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --separator: rgba(60, 60, 67, 0.14);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-text: #ffffff;
  --link: #0066cc;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --nav: rgba(251, 251, 253, 0.8);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --hero-1: #3b5fcc;
  --hero-2: #2a4596;
  --hero-3: #1a2a63;
  --gold: #f2e04a;
  --radius: 18px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --sidebar: rgba(28, 28, 30, 0.82);
    --text: #f5f5f7;
    --text-2: #98989f;
    --text-3: #636366;
    --separator: rgba(84, 84, 88, 0.6);
    --fill: rgba(120, 120, 128, 0.24);
    --fill-2: rgba(120, 120, 128, 0.36);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --link: #2997ff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --nav: rgba(22, 22, 23, 0.8);
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.47 var(--font);
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.03em; }
code, .mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: 0.86em; letter-spacing: 0; }
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 22px; }

/* ===== Иконки и плитки ===== */
.icon { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.14em; flex: none; }
.tile { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: #fff; flex: none; }
.tile .icon { width: 22px; height: 22px; stroke-width: 2; }
.tile.sm { width: 28px; height: 28px; border-radius: 7px; }
.tile.sm .icon { width: 16px; height: 16px; }
.tile.lg { width: 56px; height: 56px; border-radius: 13px; }
.tile.lg .icon { width: 30px; height: 30px; }
.tile-blue { background: #0a84ff; } .tile-green { background: #30c759; } .tile-orange { background: #ff9500; }
.tile-red { background: #ff3b30; } .tile-purple { background: #af52de; } .tile-pink { background: #ff2d55; }
.tile-teal { background: #30b0c7; } .tile-indigo { background: #5856d6; } .tile-gray { background: #8e8e93; }

/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 0; border-radius: 980px; padding: 9px 20px; cursor: pointer;
  font: 500 15px/1.2 var(--font); letter-spacing: -0.01em;
  background: var(--fill); color: var(--text); text-decoration: none; white-space: nowrap;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--fill-2); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--red); }
.btn.large { padding: 13px 28px; font-size: 17px; }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.link { background: none; color: var(--link); padding: 6px 4px; }
.btn.link:hover { text-decoration: underline; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ===== Сгруппированные списки (как в «Настройках») ===== */
.group { background: var(--bg-elevated); border-radius: var(--radius-sm); box-shadow: var(--shadow); overflow: hidden; }
.group + .group { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 52px; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; border-top: 1px solid var(--separator); }
.row.plain + .row.plain::before { left: 16px; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; }
.row .sub { color: var(--text-2); font-size: 14px; }
.row .meta { color: var(--text-3); font-size: 13px; }
.section-title { font-size: 13px; font-weight: 500; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.02em; margin: 28px 16px 8px; }
.section-note { font-size: 13px; color: var(--text-2); margin: 8px 16px 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 980px; font-size: 12px; font-weight: 500; background: var(--fill); color: var(--text-2); white-space: nowrap; }
.badge.green { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.badge.orange { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); }
.badge.red { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.badge.blue { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* ===== Формы ===== */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--text-2); margin: 0 0 6px 4px; }
input[type=text], input[type=password], input[type=search], textarea, select {
  width: 100%; font: 16px/1.4 var(--font); color: var(--text);
  background: var(--bg-elevated); border: 1px solid var(--separator); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 84px; resize: vertical; }
input[type=file] { font: 14px var(--font); color: var(--text-2); }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 14px; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin: 16px 0; font-size: 15px; display: flex; gap: 10px; align-items: flex-start; }
.alert.error { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.alert.ok { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); }

/* ===== Портал ===== */
.nav { position: sticky; top: 0; z-index: 10; background: var(--nav); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--separator); }
.nav .wrap { display: flex; align-items: center; gap: 24px; height: 52px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand img { height: 30px; }
.nav .links { margin-left: auto; display: flex; gap: 22px; font-size: 13px; }
.nav .links a { color: var(--text); opacity: .8; }

.hero { text-align: center; padding: 72px 0 40px; }
.hero .coat { height: 150px; filter: drop-shadow(0 12px 24px rgba(42, 69, 150, 0.28)); }
.hero .eyebrow { color: var(--hero-2); font-weight: 600; font-size: 17px; margin-top: 22px; }
@media (prefers-color-scheme: dark) { .hero .eyebrow { color: var(--text-2); } }
.hero h1 { font-size: clamp(40px, 7vw, 72px); line-height: 1.05; margin-top: 8px; font-weight: 700; }
.hero .lead { font-size: clamp(19px, 2.4vw, 24px); color: var(--text-2); max-width: 680px; margin: 16px auto 0; line-height: 1.35; }
.hero .actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }
.hero .fine { color: var(--text-2); font-size: 13px; margin-top: 14px; }

.band { background: linear-gradient(135deg, var(--hero-1), var(--hero-2) 55%, var(--hero-3)); color: #fff; border-radius: 28px; padding: 44px 44px 96px; margin: 24px 0 8px; position: relative; overflow: hidden; }
.band h2 { font-size: 32px; }
.band p { color: rgba(255, 255, 255, .82); max-width: 560px; }
.band::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; opacity: .1; background: #fff;
  clip-path: polygon(0 100%, 0 55%, 12% 25%, 20% 42%, 32% 8%, 42% 30%, 50% 0, 60% 28%, 70% 12%, 80% 40%, 90% 22%, 100% 50%, 100% 100%); }

.section { padding: 56px 0 8px; }
.section > h2 { font-size: 40px; text-align: center; }
.section > .lead { text-align: center; color: var(--text-2); font-size: 19px; margin: 8px auto 32px; max-width: 640px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.card { background: var(--bg-elevated); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.card h3 { font-size: 21px; }
.card p { margin: 0; color: var(--text-2); font-size: 15px; }
.card .foot { margin-top: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.step { background: var(--bg-elevated); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.step::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 600; margin-bottom: 14px; }
.step h3 { font-size: 19px; margin-bottom: 6px; }
.step p { margin: 0; color: var(--text-2); font-size: 15px; }
.empty { text-align: center; color: var(--text-2); padding: 40px 20px; }
.footer { border-top: 1px solid var(--separator); margin-top: 72px; padding: 22px 0 40px; font-size: 12px; color: var(--text-2); }
.footer .wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }

/* ===== Панель администратора (раскладка macOS: боковая панель + содержимое) ===== */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 12px; background: var(--sidebar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-right: 1px solid var(--separator); display: flex; flex-direction: column; }
.sidebar .brand { padding: 4px 8px 18px; }
.sidebar .brand img { height: 36px; }
.sidebar .brand small { display: block; font-weight: 400; font-size: 11px; color: var(--text-2); line-height: 1.3; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.side-link:hover { background: var(--fill); text-decoration: none; }
.side-link.active { background: var(--accent); color: #fff; }
.side-head { font-size: 11px; font-weight: 600; color: var(--text-2); margin: 16px 8px 6px; }
.sidebar .bottom { margin-top: auto; }
.sidebar .who { font-size: 12px; color: var(--text-2); padding: 0 8px 8px; }
.content { padding: 34px 40px 60px; max-width: 980px; width: 100%; }
.content > header { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.content > header h1 { font-size: 34px; font-weight: 700; }
.content > header .actions { margin-left: auto; display: flex; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 20px; }
.stat { background: var(--bg-elevated); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 16px; }
.stat .num { font-size: 30px; font-weight: 700; font-family: var(--font-display); letter-spacing: -0.03em; margin-top: 10px; }
.stat .lbl { color: var(--text-2); font-size: 13px; }
.inline { display: inline; margin: 0; }
.actions-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.dropzone { border: 2px dashed var(--separator); border-radius: var(--radius-sm); padding: 22px; text-align: center; color: var(--text-2); background: var(--bg-elevated); margin-bottom: 14px; }
.dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg-elevated)); }

.logout { width: 100%; border: 0; background: none; font-family: inherit; letter-spacing: inherit; cursor: pointer; text-align: left; }
.row-link { color: inherit; }
.row-link:hover { text-decoration: none; background: var(--fill); }
.row-link > .icon { color: var(--text-3); }
.pad { padding: 18px; }
.mt { margin-top: 20px; }
.title.big { font-size: 19px; }
.meta.right { text-align: right; }

.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 600; font-size: 15px; flex: none; letter-spacing: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.value { color: var(--text-2); text-align: right; }
.filters { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.filters input { flex: 1 1 280px; width: auto; }
.filters select { flex: 0 1 260px; width: auto; }
.bar { height: 6px; border-radius: 3px; background: var(--fill); margin-top: 8px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--accent); transition: width .6s ease; }
.content > header .actions { flex-wrap: wrap; }
.bar-fill.green { background: var(--green); } .bar-fill.orange { background: var(--orange); } .bar-fill.red { background: var(--red); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .box { width: 100%; max-width: 380px; text-align: center; }
.login img { height: 96px; filter: drop-shadow(0 10px 20px rgba(42, 69, 150, 0.25)); }
.login h1 { font-size: 28px; margin: 18px 0 4px; }
.login form { text-align: left; margin-top: 26px; }
.login .btn { width: 100%; margin-top: 6px; }

@media (max-width: 760px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
  .sidebar .brand { padding: 0 8px 0 0; }
  .side-head, .sidebar .who { display: none; }
  .sidebar .bottom { margin: 0 0 0 auto; }
  .content { padding: 24px 16px 48px; }
  .nav .links { gap: 14px; }
  .band { padding: 28px; }
}

/* Команда установки на портале: выделяется целиком одним щелчком */
.cmd { margin: 24px 0 12px; padding: 18px 20px; background: var(--bg-elevated); border-radius: var(--radius); box-shadow: var(--shadow); font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; user-select: all; -webkit-user-select: all; color: var(--text); }

/* ===== Заявки ===== */
.side-count { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 980px; background: var(--red); color: #fff; font-size: 12px; font-weight: 600; text-align: center; }
.alert.attention { background: color-mix(in srgb, var(--red) 10%, transparent); color: var(--text); text-decoration: none; }
.alert.attention .icon { color: var(--red); }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; margin: 16px 0 4px; border-radius: 10px; background: var(--fill); }
.segmented a { padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none; }
.segmented a span { color: var(--text-2); font-weight: 400; margin-left: 2px; }
.segmented a.active { background: var(--bg-elevated); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.thread { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 10px 14px; border-radius: 18px; border-bottom-left-radius: 6px; background: var(--fill); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; }
.msg.mine .bubble { background: var(--accent); color: #fff; border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }
.msg-meta { font-size: 12px; color: var(--text-2); margin: 4px 6px 0; }
.shot { display: block; padding: 12px; }
.shot img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--separator); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.form-actions .grow { flex: 1; }
.filter { padding-bottom: 4px; }
.filter input { width: 100%; }
.section-aside { float: right; text-transform: none; letter-spacing: 0; font-weight: 400; }
.icon.inline { color: var(--text-2); }
@media (max-width: 640px) { .msg { max-width: 92%; } .section-aside { float: none; display: block; margin-top: 2px; } }
.row[hidden] { display: none; }
