:root {
  --bg: #f4f6f3;
  --panel: #ffffff;
  --ink: #18211f;
  --muted: #64706b;
  --line: #dfe6e1;
  --line-strong: #c9d3ce;
  --accent: #176b5c;
  --accent-dark: #0f4f43;
  --accent-soft: #e0f2ed;
  --warning-soft: #fff0cf;
  --blue-soft: #e7eefc;
  --pink-soft: #fce7ee;
  --shadow: 0 18px 55px rgba(25, 34, 31, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell > * {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  min-width: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--accent);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
}

.section-nav {
  display: grid;
  gap: 6px;
  margin-top: 34px;
}

.nav-item {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
}

.nav-item.is-active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 700;
}

.nav-item.is-disabled {
  opacity: 0.58;
  pointer-events: none;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.main-content {
  min-width: 0;
  width: min(1180px, 100%);
  padding: 34px clamp(18px, 4vw, 42px) 48px;
}

.page-view {
  min-width: 0;
}

[hidden] {
  display: none !important;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.06;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 23px;
  letter-spacing: 0;
}

.primary-action {
  display: inline-flex;
  min-height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--accent);
  font-weight: 750;
  box-shadow: 0 10px 24px rgba(23, 107, 92, 0.2);
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action {
  display: inline-flex;
  min-height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--accent-dark);
  background: #ffffff;
  font-weight: 750;
}

.secondary-action:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 28px 0 18px;
}

.metric {
  display: grid;
  align-content: space-between;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(25, 34, 31, 0.04);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
  line-height: 1;
}

.workspace-panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.workspace-panel + .workspace-panel {
  margin-top: 18px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.view-switch {
  display: inline-flex;
  flex: 0 0 auto;
  width: max-content;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f9f7;
}

.view-button {
  display: grid;
  width: 34px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 18px;
}

.view-button.is-active {
  color: var(--accent-dark);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(25, 34, 31, 0.08);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(190px, 220px) minmax(150px, 180px);
  align-items: end;
  gap: 10px;
  margin: 20px 0;
}

.search-field input,
.select-field select {
  width: 100%;
  height: 44px;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
}

.search-field input {
  padding: 0 14px;
}

.search-field input:focus,
.select-field select:focus {
  outline: 3px solid rgba(23, 107, 92, 0.16);
  border-color: var(--accent);
}

.select-field {
  display: grid;
  gap: 5px;
}

.select-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.select-field select {
  padding: 0 12px;
}

.employees-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.employees-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.employees-table th,
.employees-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.employees-table th {
  color: var(--muted);
  background: #f8faf8;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.employees-table tbody tr {
  transition:
    background 140ms ease,
    box-shadow 140ms ease;
}

.employees-table tbody tr:hover {
  background: #fbfdfb;
}

.employees-table td:nth-child(2),
.employees-table td:nth-child(3) {
  max-width: 220px;
}

.employees-table tr:last-child td {
  border-bottom: 0;
}

.person {
  display: flex;
  min-width: 220px;
  align-items: center;
  gap: 12px;
}

.avatar {
  display: inline-grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  color: #12342e;
  background: var(--accent-soft);
  border: 1px solid rgba(18, 52, 46, 0.08);
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.58);
}

.avatar[data-tone="blue"] {
  background: var(--blue-soft);
}

.avatar[data-tone="pink"] {
  background: var(--pink-soft);
}

.avatar[data-tone="yellow"] {
  background: var(--warning-soft);
}

.person-details,
.person-details strong,
.person-details span {
  display: block;
  min-width: 0;
}

.person-details span,
.subtle {
  color: var(--muted);
  font-size: 13px;
}

.person-details strong {
  overflow-wrap: anywhere;
}

.tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.tag.office {
  color: #5a4012;
  background: var(--warning-soft);
}

.tag.remote {
  color: #1b4782;
  background: var(--blue-soft);
}

.tag.hybrid {
  color: #7f2548;
  background: var(--pink-soft);
}

.contact-list {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.contact-list a {
  color: var(--accent-dark);
  text-decoration: none;
  overflow-wrap: anywhere;
}

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

.employees-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.employee-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.employee-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 12px 28px rgba(25, 34, 31, 0.07);
  transform: translateY(-1px);
}

.employee-card .person {
  min-width: 0;
}

.card-meta {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.meta-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  color: var(--muted);
  font-size: 14px;
}

.meta-row strong {
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  gap: 6px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.article-sidebar {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.article-list {
  display: grid;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
  padding-right: 2px;
}

.article-item {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.article-item:hover {
  border-color: var(--line-strong);
  background: #fbfdfb;
}

.article-item.is-active {
  border-color: rgba(23, 107, 92, 0.45);
  background: var(--accent-soft);
}

.article-item strong {
  overflow-wrap: anywhere;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #ffffff;
  font-size: 12px;
  font-weight: 750;
}

.status-pill.draft {
  color: #5a4012;
  background: var(--warning-soft);
}

.status-pill.review {
  color: #1b4782;
  background: var(--blue-soft);
}

.status-pill.published {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.editor-shell {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.editor-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.title-field input {
  width: 100%;
  height: 48px;
  min-width: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
  outline: 0;
}

.title-field input::placeholder,
.article-editor:empty::before {
  color: #9aa49f;
}

.compact-field select {
  height: 38px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.editor-toolbar select {
  height: 34px;
  min-width: 128px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
}

.tool-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.tool-button:hover,
.tool-button.is-active {
  border-color: rgba(23, 107, 92, 0.45);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
}

.article-editor {
  min-height: 420px;
  padding: 28px clamp(18px, 4vw, 46px) 40px;
  color: var(--ink);
  outline: 0;
}

.article-editor:empty::before {
  content: "Начните писать статью...";
}

.article-editor h2 {
  margin: 28px 0 10px;
  font-size: 26px;
}

.article-editor h3 {
  margin: 22px 0 8px;
  font-size: 20px;
}

.article-editor p,
.article-editor ul,
.article-editor ol,
.article-editor blockquote {
  margin: 0 0 14px;
}

.article-editor ul,
.article-editor ol {
  padding-left: 24px;
}

.article-editor blockquote {
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: #f7faf7;
}

.article-editor a {
  color: var(--accent-dark);
}

.article-editor img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.article-editor figure {
  margin: 20px 0;
}

.article-editor figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.save-status {
  color: var(--muted);
  font-size: 13px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .section-nav {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
  }

  .summary-grid,
  .employees-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .knowledge-layout {
    grid-template-columns: 1fr;
  }

  .article-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 24px 14px 36px;
  }

  .page-header,
  .panel-header {
    display: grid;
  }

  .panel-header {
    gap: 14px;
  }

  .primary-action {
    width: 100%;
  }

  .summary-grid,
  .toolbar,
  .employees-grid {
    grid-template-columns: 1fr;
  }

  .workspace-panel {
    padding: 16px;
  }

  .secondary-action {
    width: 100%;
  }

  .article-list,
  .editor-topbar {
    grid-template-columns: 1fr;
  }

  .title-field input {
    height: auto;
    min-height: 46px;
    font-size: 24px;
  }

  .editor-toolbar {
    gap: 5px;
  }

  .editor-toolbar select {
    width: 100%;
  }

  .toolbar-divider {
    display: none;
  }

  .article-editor {
    min-height: 360px;
    padding: 22px 16px 34px;
  }

  .editor-footer {
    display: grid;
  }

  .meta-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .meta-row strong {
    text-align: left;
  }
}
