/* Visual source: frontend b67ab11, public/kruzhok/index.html (.krj-af/.krj-gal).
   Local Onest/Tektur assets shared with the project's landing presentations. */
@import url("./fonts/fonts.css");

:root {
  font-family: "Onest", Arial, sans-serif;
  color: #1a1a1a;
  background: #fffdf5;
  font-size: 15px;
  line-height: 1.55;
  --ink: #1a1a1a;
  --blue: #0974f0;
  --lime: #caff00;
  --mauve: #dbbffe;
  --paper: #fffdf5;
  --muted: #595951;
  --border: #1a1a1a;
  --shadow: 4px 4px 0 var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  display: flex;
  min-height: 100vh;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 10px 17px;
  color: inherit;
  font-weight: 600;
  transition: box-shadow .15s ease, background .15s ease;
}
button:hover {
  border-color: var(--ink);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--ink);
  box-shadow: var(--shadow);
}
.primary:hover {
  background: #0866d3;
  box-shadow: 6px 6px 0 var(--ink);
  color: #fff;
}
.sidebar {
  width: 260px;
  flex-shrink: 0;
  border-right: 3px solid var(--border);
  background: var(--paper);
  padding: 34px 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.brand {
  font-size: 25px;
  font-family: "Tektur", Arial, sans-serif;
  letter-spacing: -1px;
  font-weight: 800;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}
.brand span {
  display: block;
  font-size: 12px;
  font-family: "Onest", Arial, sans-serif;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  margin-top: 5px;
}
nav {
  display: grid;
  gap: 7px;
  margin-top: 48px;
}
.nav {
  text-align: left;
  border: 2px solid transparent;
  background: transparent;
}
.nav.active {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 600;
}
.sidebar-note {
  margin-top: auto;
  padding-top: 20px;
  border-top: 2px solid var(--ink);
  font-size: 13px;
  color: var(--muted);
}
.connection {
  font-size: 12px;
  margin-top: 20px;
  color: var(--muted);
}
main {
  padding: 42px 4vw 30px;
  flex: 1;
  min-width: 0;
  max-width: 1700px;
}
header {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 26px;
  border-bottom: 3px solid var(--ink);
}
h1 {
  font-family: "Tektur", Arial, sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 34px;
  letter-spacing: -1px;
  margin: 0 0 9px;
  line-height: 1.2;
}
h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 17px;
}
p {
  margin: 0 0 12px;
}
header p {
  color: var(--muted);
  font-size: 14px;
}
.eyebrow {
  display: inline-block;
  padding: 4px 9px;
  border: 2px solid var(--ink);
  background: var(--lime);
  font-size: 10px !important;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--ink) !important;
}
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.filters input {
  flex: 1;
}
input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 0;
  color: var(--ink);
}
textarea {
  resize: vertical;
}
input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.filters select {
  width: auto;
  max-width: 230px;
}
.material-list {
  display: grid;
  gap: 18px;
}
.material-row {
  font-weight: 400;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 15px;
  text-align: left;
  background: #fff;
  padding: 22px;
  border: 2px solid var(--border);
  border-radius: 0;
}
.material-row h2 {
  margin: 0 0 6px;
}
.material-row p {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 10px;
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid var(--ink);
  background: var(--mauve);
  border-radius: 0;
  color: var(--ink);
}
.state {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  background: #fff0af;
  padding: 5px 10px;
  border: 1px solid var(--ink);
  border-radius: 0;
  align-self: start;
  justify-self: start;
}
.state.published {
  background: var(--lime);
  color: var(--ink);
}
.state.archived {
  background: #eeeae2;
  color: var(--muted);
}
.empty {
  padding: 60px 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 0;
  color: var(--muted);
  background: #fff;
}
.tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 25px;
}
.tag-card {
  box-shadow: var(--shadow);
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 20px;
}
.tag-card p {
  color: var(--muted);
  font-size: 13px;
}
.panel {
  padding: 26px;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 0;
}
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 22px;
}
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}
label input,
label textarea,
label select {
  display: block;
  margin-top: 6px;
  font-weight: 400;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 28px;
}
legend {
  font-size: 13px;
  font-weight: 600;
}
.check {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 10px;
}
.check input {
  width: 16px;
  margin: 0;
}
.tag-checks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.tag-checks .check {
  background: var(--paper);
  padding: 7px 10px;
  border-radius: 0;
  font-size: 12px;
}
.muted {
  font-size: 12px;
  color: var(--muted);
}
.banner {
  padding: 12px 16px;
  background: #e6f0ff;
  border: 2px solid var(--border);
  border-radius: 0;
  font-size: 13px;
  margin-bottom: 18px;
}
.banner.error {
  background: #ffe3da;
  border-color: var(--ink);
}
.file-info {
  margin-bottom: 15px;
  font-size: 13px;
}
.file-info a,
a {
  color: var(--blue);
}
.save-bar {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 24px;
  justify-content: space-between;
}
.save-bar p {
  max-width: 480px;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.text-button {
  border: 0;
  padding: 0;
  margin-bottom: 16px;
  color: var(--blue);
  background: transparent;
}
.messages {
  min-height: 300px;
  max-height: 60vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}
.bubble {
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 20px;
  background: #fff;
  max-width: 90%;
  white-space: pre-wrap;
}
.bubble.user {
  align-self: flex-end;
  background: var(--mauve);
  max-width: 80%;
}
.bubble .links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.bubble details {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
}
.bubble pre {
  overflow: auto;
  font-size: 11px;
  max-height: 230px;
}
.chat-input {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.chat-input textarea {
  flex: 1;
}
#notice {
  position: sticky;
  top: 10px;
  z-index: 4;
  padding: 14px 18px;
  background: #fff4e5;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
  border-radius: 0;
  margin-bottom: 20px;
}
dialog {
  border: 2px solid var(--border);
  border-radius: 0;
  width: min(850px, 90vw);
  padding: 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 7px 7px 0 var(--ink);
}
dialog::backdrop {
  background: #1a1a1a99;
}
dialog pre {
  white-space: pre-wrap;
  max-height: 65vh;
  overflow: auto;
  font: inherit;
  font-size: 14px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
[hidden] {
  display: none !important;
}
#retry-prepare {
  margin-bottom: 20px;
  font-size: 12px;
}
@media (max-width: 1000px) {
  .sidebar {
    width: 220px;
  }
  .editor-grid {
    grid-template-columns: 1fr;
  }
  .save-bar {
    align-items: flex-start;
    flex-direction: column;
  }
  header {
    align-items: flex-start;
  }
}
@media (max-width: 700px) {
  body {
    display: block;
  }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 20px;
    border-right: 0;
    border-bottom: 3px solid var(--ink);
  }
  .brand {
    font-size: 21px;
  }
  .sidebar-note,
  .connection {
    display: none;
  }
  nav {
    margin: 18px 0 0;
    display: flex;
    gap: 3px;
  }
  .nav {
    padding: 8px;
    font-size: 13px;
  }
  main {
    padding: 25px 18px;
  }
  header {
    flex-wrap: wrap;
  }
  h1 {
    font-size: 28px;
  }
  .filters {
    flex-wrap: wrap;
  }
  .filters input {
    flex-basis: 100%;
  }
  .filters select {
    max-width: 100%;
    flex: 1;
  }
  .panel {
    padding: 20px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .bubble {
    max-width: 100%;
  }
  .chat-input {
    flex-direction: column;
  }
  .material-row {
    grid-template-columns: 1fr;
  }
}

/* Keep controls usable with long material names and narrow viewports. */
header > div, .panel, .tag-card, .bubble, .filters input { min-width: 0; }
h1, h2, p, .file-info, .bubble, .chip { overflow-wrap: anywhere; }
header > button { flex-shrink: 0; }
.brand::before {
  content: "";
  display: block;
  width: 30px;
  height: 30px;
  border: 3px solid var(--ink);
  background: var(--lime);
  box-shadow: 5px 5px 0 var(--ink);
  margin-bottom: 22px;
}
.tag-card:nth-child(3n + 1) { border-top: 6px solid var(--blue); }
.tag-card:nth-child(3n + 2) { border-top: 6px solid var(--mauve); }
.tag-card:nth-child(3n) { border-top: 6px solid var(--lime); }
input[type="checkbox"] { accent-color: var(--blue); }
input[type="file"] { font-size: 12px; }
input::file-selector-button {
  font: inherit;
  color: var(--ink);
  background: var(--lime);
  border: 1px solid var(--ink);
  padding: 6px 9px;
  margin-right: 10px;
  cursor: pointer;
}
.text-button:hover { box-shadow: none; text-decoration: underline; }
#close-source { margin-bottom: 20px; }
@media (max-width: 700px) {
  .brand::before { display: inline-block; vertical-align: middle; margin: 0 14px 4px 0; width: 22px; height: 22px; }
  nav { flex-wrap: wrap; gap: 8px; }
  h1 { font-size: clamp(23px, 6.5vw, 28px); }
  .actions { width: 100%; }
  .actions button { max-width: 100%; }
  .tag-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}

.logout { margin-top: 18px; align-self: flex-start; font-size: 13px; }
.login-page { display: block; }
.login-layout {
  width: min(100%, 570px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-brand {
  font-family: "Tektur", Arial, sans-serif;
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 30px;
}
.login-brand::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 22px;
  vertical-align: middle;
  margin: 0 14px 5px 0;
  background: var(--lime);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.login-brand span {
  display: block;
  margin-top: 8px;
  font: 400 13px "Onest", Arial, sans-serif;
  text-transform: none;
  color: var(--muted);
}
.login-card {
  background: white;
  border: 3px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  padding: 36px;
}
.login-card h1 { font-size: 32px; }
.login-intro { margin: 15px 0 30px; color: var(--muted); }
.login-card input { padding: 12px; font-size: 16px; }
.login-card .primary { width: 100%; margin-top: 8px; }
.login-footer { margin-top: 26px; font-size: 13px; color: var(--muted); }
@media (max-width: 700px) {
  .logout { margin-top: 14px; }
  .login-layout { padding: 32px 20px; }
  .login-card { padding: 25px 20px; }
  .login-card h1 { font-size: clamp(24px, 6vw, 32px); }
  .login-brand { font-size: 16px; }
}
