/* AllDoki - стили из одобренных макетов */
:root {
  --bg: #f3f5f7;
  --surface: #fff;
  --text: #1b2128;
  --text-2: #3e4852;
  --muted: #66707a;
  --line: #e5e8ed;
  --line-2: #d4dae1;
  --accent: #1f5f8a;
  --accent-2: #184b6e;
  --accent-soft: #e7f1f7;
  --ok: #157a4b;
  --ok-soft: #e5f6ed;
  --warn: #8a5a10;
  --warn-soft: #f7efd6;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --violet-soft: #eef0f8;
  --violet: #3d4a7a;
  --chip: #eef1f4;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 32px rgba(16, 24, 40, .14);
  --sidebar-w: 216px;
  --top-h: 56px;
  --radius: 10px;
  --font: "Inter", "Noto Sans", "Liberation Sans", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}

.brand-name {
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -.01em;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: -1px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover { background: var(--bg); text-decoration: none; }

.nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 600;
}

.nav svg { flex: none; opacity: .85; }

.nav-section {
  margin: 16px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--top-h);
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  flex: none;
}

.topbar-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
  margin-right: auto;
}

.company-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 550;
  font-size: 12.5px;
  max-width: 280px;
}

.company-switch .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}

.company-switch .chev { color: var(--muted); margin-left: 4px; }

.user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 13px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #d9e6f0;
  color: var(--accent-2);
  display: grid;
  place-items: center;
  font-weight: 670;
  font-size: 12px;
}

.content { padding: 20px 22px 28px; }

.row { display: flex; gap: 16px; }
.row > * { min-width: 0; }
.col { display: flex; flex-direction: column; gap: 16px; }
.grow { flex: 1; }
.w-380 { width: 380px; flex: none; }
.w-400 { width: 400px; flex: none; }
.w-420 { width: 420px; flex: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-h {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-h h2 {
  font-size: 13.5px;
  font-weight: 650;
  margin-right: auto;
}

.card-b { padding: 14px 16px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 13px;
}

.tile .lbl {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.tile .val {
  font-size: 20px;
  font-weight: 680;
  letter-spacing: -.03em;
  margin-top: 4px;
}

.tile .hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.tile.is-ok .val { color: var(--ok); }
.tile.is-warn .val { color: var(--warn); }
.tile.is-danger .val { color: var(--danger); }
.tile.is-accent .val { color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 550;
  font-size: 13px;
  cursor: default;
  white-space: nowrap;
}

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

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-2); }

.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }

.field label, .flabel {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.field .help {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

.ctrl, .input-like {
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
  width: 100%;
}

.ctrl:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.ctrl[disabled], .ctrl.is-disabled {
  background: var(--bg);
  color: var(--text-2);
}

.ctrl-row { display: flex; gap: 8px; align-items: center; }
.ctrl-row .ctrl { flex: 1; }

.seg {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.seg button {
  background: transparent;
  border: 0;
  padding: 7px 12px;
  font-weight: 550;
  font-size: 12.5px;
  color: var(--text-2);
}

.seg button + button { border-left: 1px solid var(--line-2); }

.seg button.is-on {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.note {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  background: var(--bg);
  color: var(--text-2);
}

.note.ok { background: var(--ok-soft); color: #0f5c38; }
.note.warn { background: var(--warn-soft); color: #6a470c; }
.note.info { background: var(--accent-soft); color: var(--accent-2); }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}
.table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table .num { font-variant-numeric: tabular-nums; font-weight: 550; }
.table .muted { color: var(--muted); }
.table .name { font-weight: 550; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  background: var(--chip);
  color: var(--text-2);
  white-space: nowrap;
}

.chip.is-on { background: var(--accent-soft); color: var(--accent-2); box-shadow: inset 0 0 0 1px #c5d9e8; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.idle { background: var(--violet-soft); color: var(--violet); }
.chip.draft { background: var(--chip); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  padding: 8px 12px;
  color: var(--text-2);
  font-weight: 550;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a .cnt {
  color: var(--muted);
  font-weight: 500;
  margin-left: 4px;
  font-size: 12px;
}

.tabs a.is-on {
  color: var(--accent-2);
  border-bottom-color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--muted);
  min-width: 200px;
}

.search input {
  border: 0;
  outline: none;
  width: 100%;
  background: transparent;
  color: var(--text);
}

.search input::placeholder { color: var(--muted); }

.linkish {
  color: var(--accent);
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 550; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.stat-grid .k { font-size: 12px; color: var(--muted); }
.stat-grid .v { font-size: 15px; font-weight: 650; letter-spacing: -.02em; margin-top: 1px; }

.doc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-2);
  font-weight: 550;
}

/* Login overlay */
.lock-wrap { position: relative; height: 100vh; overflow: hidden; }

.app.is-locked {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
  min-height: 100vh;
}

.login-overlay {
  position: absolute;
  inset: 0;
  background: rgba(243, 245, 247, .52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.login-card {
  width: 420px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 28px 28px 24px;
  text-align: center;
}

.login-card h1 {
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -.02em;
  margin: 14px 0 8px;
}

.login-card .lead {
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.google-btn {
  width: 100%;
  height: 44px;
  border: 1px solid #dadce0;
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #1f1f1f;
  box-shadow: 0 1px 2px rgba(60, 64, 67, .12);
}

.login-note {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  text-align: left;
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
}

/* Create dropdown */
.create-wrap { position: relative; }

.create-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 15;
  overflow: hidden;
  min-width: 480px;
}

.create-col {
  width: 230px;
  padding: 8px;
}

.create-col + .create-col {
  border-left: 1px solid var(--line);
  width: 260px;
  background: #fafbfc;
}

.menu-group {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 8px 10px 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  font-weight: 500;
  color: var(--text);
}

.menu-item:hover, .menu-item.is-on {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.menu-item .def {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ok);
  background: var(--ok-soft);
  border-radius: 999px;
  padding: 1px 6px;
}

/* Variables panel */
.var-panel { padding: 0; }
.var-search { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.var-groups { padding: 4px 6px 10px; }
.var-group { padding: 8px 8px 4px; }
.var-group h3 {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 6px;
}
.var-list { display: flex; flex-direction: column; gap: 2px; }
.var {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
}
.var:hover { background: var(--bg); }
.var code {
  font-family: "Geist Mono", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11.5px;
  background: var(--accent-soft);
  color: var(--accent-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 550;
}
.var .lab { flex: 1; font-size: 12px; color: var(--text-2); }
.var .copy {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  padding: 2px 6px;
  border-radius: 4px;
}
.var.is-copied { background: var(--ok-soft); }
.var.is-copied .copy { color: var(--ok); }

.star {
  color: #c48a12;
  font-size: 13px;
}

.file-cell { display: flex; flex-direction: column; gap: 3px; }
.file-cell .fn { font-weight: 550; }

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.page-head h1 {
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -.02em;
  margin-right: auto;
}

.page-head .sub {
  display: block;
  font-size: 12.5px;
  font-weight: 450;
  color: var(--muted);
  margin-top: 2px;
}

.crumb {
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 6px;
}

.crumb span { color: var(--text); font-weight: 550; }

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.list-row:last-child { border-bottom: 0; }
.list-row .when { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 12px;
}

.badge-file {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 650;
}

.badge-file.xml { background: #efe8f6; color: #5a3d7a; }

.tabs-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 0 8px;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 6;
}
.tabs-row .tabs { flex: 1; border-bottom: 0; margin-bottom: 0; }
.tabs-row .create-wrap { flex: none; }

.var-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 20px;
  padding: 8px 16px 16px;
}
.var-grid .var { min-width: 0; }
.var-grid .var code { max-width: 100%; overflow-wrap: anywhere; }

.var-grid .var-group { padding: 10px 0 6px; }
.var .lab { min-width: 0; }

.picker-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 550;
  padding: 0;
  cursor: default;
}
.file-cell { display: flex; flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }

.table th.col-def, .table td.col-def { width: 110px; white-space: nowrap; }
.table th.col-st, .table td.col-st { width: 140px; white-space: nowrap; }
.table td.col-st .chip { max-width: none; }
