/*!
 * kvplan.ru
 * © 2026 Теребилов Анатолий. Все права защищены.
 */

:root {
  --ink: #1c1917;
  --muted: #6f675c;
  --paper: #efe8dc;
  --panel: #fffcf6;
  --line: #d9d0c2;
  --accent: #163a52;
  --accent-hot: #9a3412;
  --stage: #f7f3ea;
  --wall: #8d8d8d;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

html, body {
  margin: 0;
  min-height: 100%;
  height: auto;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.4 "Segoe UI", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  flex-direction: column;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

button, input, select {
  font: inherit;
  color: inherit;
}

input, textarea, select {
  user-select: text;
  -webkit-user-select: text;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: block;
  color: var(--accent);
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.copyright {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  user-select: text;
  -webkit-user-select: text;
  white-space: nowrap;
}

.contact-mail {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  text-decoration: none;
  user-select: text;
  -webkit-user-select: text;
  white-space: nowrap;
}

.contact-mail:hover {
  color: var(--accent);
  text-decoration: underline;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.btn {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 7px 12px;
  cursor: pointer;
}

.btn:hover { border-color: var(--ink); }

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  border-color: var(--line);
}

.btn:disabled:hover {
  border-color: var(--line);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-tiny { padding: 4px 8px; font-size: 12px; }

#btn-ext-all {
  width: 100%;
  margin: 8px 0 4px;
}

.btn-danger {
  background: transparent;
  border-color: #d4b4a6;
  color: var(--accent-hot);
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 168px 1fr 250px;
  min-height: 0;
}

.rail, .inspector {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px 12px;
  overflow: auto;
}

.inspector {
  border-right: 0;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.rail-label {
  margin: 14px 0 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.rail-label:first-child { margin-top: 0; }

.tool {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 7px 8px;
  margin-bottom: 4px;
  cursor: pointer;
}

.tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  flex-shrink: 0;
}

.tool:hover { border-color: var(--line); background: var(--stage); }

.tool.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--stage);
  min-width: 0;
}

#plan {
  flex: 1;
  width: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  background:
    linear-gradient(90deg, rgba(28,25,23,0.03) 1px, transparent 1px),
    linear-gradient(rgba(28,25,23,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

#plan text {
  -webkit-user-select: none;
  user-select: none;
}

.hint {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px 12px;
  max-width: min(420px, calc(100% - 24px));
  pointer-events: none;
  color: var(--muted);
}

.hint:empty { display: none; }

.stage-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.inspector label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
}

.inspector input,
.inspector select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.inspector .check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 4px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}

.inspector .check + .check {
  margin-top: 0;
  margin-bottom: 8px;
}

.inspector-report {
  margin: 0 0 12px;
}

.inspector-report a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.inspector-report a:hover {
  color: var(--accent);
}

.inspector .check input[type="checkbox"] {
  display: inline-block;
  width: auto;
  margin: 2px 0 0;
  padding: 0;
  flex-shrink: 0;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.help {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 16px;
}

.inspector .seo-lead {
  margin: 0 0 12px;
}

.inspector-contact {
  margin: auto 0 0;
  padding-top: 16px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--muted);
  user-select: text;
  -webkit-user-select: text;
}

.inspector-contact a {
  color: var(--accent);
  text-decoration: none;
  user-select: text;
  -webkit-user-select: text;
}

.inspector-contact a:hover {
  text-decoration: underline;
}

.sel-title {
  margin: 18px 0 8px;
  font-weight: 650;
}

#sel-fields .btn {
  display: block;
  width: 100%;
  margin-top: 8px;
}

.area-read {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  margin: 0 0 12px;
}

.inspector .area-edit {
  color: var(--ink);
}

.inspector .area-edit input {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink);
}

.site-about {
  flex-shrink: 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 32px 24px 40px;
  user-select: text;
  -webkit-user-select: text;
}

.site-about-inner {
  max-width: 40rem;
  margin: 0 auto;
}

.site-about h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-about h3 {
  margin: 22px 0 8px;
  font-size: 0.95rem;
  font-weight: 650;
}

.site-about p,
.site-about li {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.site-about ul {
  margin: 0 0 12px;
  padding-left: 1.2em;
}

.site-about li { margin-bottom: 6px; }

.site-about a {
  color: var(--accent);
  text-decoration: none;
}

.site-about a:hover { text-decoration: underline; }

@media print {
  .topbar, .rail, .inspector, .stage-footer, .hint, .site-about { display: none !important; }
  .app-shell, .workspace { display: block; min-height: 0; height: auto; }
  .stage { background: #fff; }
  #plan {
    width: 100%;
    height: 100vh;
    background: #fff;
  }
  body { background: #fff; }
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .rail {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .rail-label { width: 100%; margin-top: 8px; }
  .tool { width: auto; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); }
}
