@import url("https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap");

:root {
  --background: #e3e7ea;
  --foreground: #171717;
  --primary: #244e70;
  --primary-hero: #244e85;
  --cold: #b4cac4;
  --room: #f5efdd;
  --reedly: #d9423a;
  --line: #d6c6a8;
  --line-strong: #c6b48d;
  --paper: rgba(245, 239, 221, 0.9);
  --paper-strong: rgba(255, 247, 230, 0.96);
  --shadow-soft: 0 10px 24px rgba(33, 52, 74, 0.12);
  --shadow-card: 0 4px 0 rgba(0, 0, 0, 0.2);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --status-open-bg: #e4ebf1;
  --status-open-fg: #32495f;
  --status-work-bg: #d5e4f4;
  --status-work-fg: #244c76;
  --status-wait-bg: #f3e2c8;
  --status-wait-fg: #7d561d;
  --status-done-bg: #d5e7dc;
  --status-done-fg: #2f6045;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Golos Text", "Segoe UI", sans-serif;
  color: var(--foreground);
  background:
    radial-gradient(circle at 10% -12%, rgba(255, 255, 255, 0.88), transparent 50%),
    radial-gradient(circle at 85% 0%, rgba(180, 202, 196, 0.35), transparent 36%),
    linear-gradient(180deg, #e8ecef 0%, var(--background) 62%);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Manrope", "Golos Text", sans-serif;
}

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

.title-input {
  min-height: 52px;
  line-height: 1.35;
  resize: none;
  overflow: hidden;
}

.glass {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.app-shell {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  min-height: 100vh;
  transition: grid-template-columns 240ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 16px;
  color: var(--room);
  background: linear-gradient(180deg, var(--primary-hero), var(--primary));
  border-color: rgba(245, 239, 221, 0.18);
  box-shadow: var(--shadow-soft);
  transition: opacity 200ms ease, transform 200ms ease;
}

.app-shell.sidebar-collapsed .sidebar {
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar h2,
.sidebar h3 {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar h2 {
  font-size: 16px;
}

.sidebar h3 {
  font-size: 13px;
  color: rgba(245, 239, 221, 0.92);
}

.settings-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(245, 239, 221, 0.24);
  background: rgba(255, 255, 255, 0.06);
}

.user-form {
  display: grid;
  gap: 8px;
}

.users-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.user-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 239, 221, 0.26);
  background: rgba(255, 255, 255, 0.1);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.user-actions .icon-btn {
  min-width: 0;
  white-space: nowrap;
}

.user-meta {
  margin: 0;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.user-name {
  font-weight: 700;
  color: #fff;
  overflow-wrap: anywhere;
}

.user-role {
  color: rgba(245, 239, 221, 0.8);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.role-chip {
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(245, 239, 221, 0.3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board-wrap {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.title-row {
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.title-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kicker {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}

h1 {
  font-size: 34px;
  letter-spacing: -0.03em;
  color: var(--primary);
}

.subtitle {
  margin: 4px 0 0;
  color: #455463;
  font-size: 14px;
}

.title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-box {
  display: grid;
  gap: 4px;
  min-width: 250px;
}

.session-box label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: #495a70;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.session-user {
  font-weight: 600;
  color: #223548;
}

.role-pill {
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(36, 78, 112, 0.1);
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.wave-divider {
  height: 16px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 12px 8px, rgba(245, 239, 221, 0.95) 8px, transparent 9px) 0 0 / 24px 16px,
    linear-gradient(90deg, rgba(36, 78, 112, 0.2), rgba(217, 66, 58, 0.25));
  opacity: 0.8;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(245px, 1fr));
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 4px;
}

.column {
  min-height: 430px;
  border-radius: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  display: grid;
  align-content: start;
  gap: 10px;
}

.column[data-status="Открыто"] {
  background: linear-gradient(180deg, #f7f5ef, #f0ede3);
}

.column[data-status="В работе"] {
  background: linear-gradient(180deg, #edf3f7, #e6edf4);
}

.column[data-status="Требуется информация"] {
  background: linear-gradient(180deg, #f7f1e8, #f2eadf);
}

.column[data-status="Завершено"] {
  background: linear-gradient(180deg, #ebf2ee, #e2ebe4);
}

.column.drag-over {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(36, 78, 112, 0.22);
}

.column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 1px dashed rgba(36, 78, 112, 0.25);
  padding-bottom: 8px;
}

.column-head h3 {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.column-count {
  min-width: 24px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(36, 78, 112, 0.12);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.column-cards {
  display: grid;
  gap: 10px;
}

.task-card {
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px;
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 7px;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease;
}

.task-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.task-card:focus-visible {
  outline: 2px solid rgba(36, 78, 112, 0.4);
  outline-offset: 2px;
}

.task-card.dragging {
  opacity: 0.65;
}

.task-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-key {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #455464;
}

.task-badge {
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.task-badge.status-open {
  background: var(--status-open-bg);
  color: var(--status-open-fg);
}

.task-badge.status-work {
  background: var(--status-work-bg);
  color: var(--status-work-fg);
}

.task-badge.status-wait {
  background: var(--status-wait-bg);
  color: var(--status-wait-fg);
}

.task-badge.status-done {
  background: var(--status-done-bg);
  color: var(--status-done-fg);
}

.task-title {
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.task-desc {
  margin: 0;
  font-size: 13px;
  color: #4b5867;
  line-height: 1.35;
  min-height: 34px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.task-meta {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #516274;
}

.empty {
  margin: 0;
  color: #596577;
  font-size: 13px;
}

button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 12px;
  transition: transform 140ms ease, filter 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.add-btn,
#save-ticket {
  background: var(--primary);
  color: var(--room);
}

.danger,
.delete-btn {
  background: var(--reedly);
  color: #fff;
}

.icon-btn {
  min-width: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: rgba(245, 239, 221, 0.9);
  color: var(--primary);
  border-radius: 10px;
  font-size: 14px;
  letter-spacing: 0;
}

.sidebar .icon-btn,
.remove-user {
  color: #fff;
  border-color: rgba(245, 239, 221, 0.3);
  background: rgba(255, 255, 255, 0.14);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(255, 250, 239, 0.94);
  color: var(--foreground);
}

.sidebar input,
.sidebar textarea,
.sidebar select {
  border-color: rgba(245, 239, 221, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar input::placeholder {
  color: rgba(245, 239, 221, 0.8);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(36, 78, 112, 0.22);
  border-color: var(--primary);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(23, 28, 36, 0.48);
  padding: 16px;
  z-index: 20;
}

.modal.hidden,
.hidden {
  display: none;
}

.modal-content {
  width: 100%;
  max-width: 1040px;
  max-height: 90vh;
  overflow: auto;
  border-radius: 18px;
  padding: 16px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  box-shadow: 0 22px 40px rgba(10, 19, 31, 0.28);
}

.auth-content {
  max-width: 460px;
}

.login-error {
  margin: 0;
  font-size: 13px;
  color: #a12d25;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(36, 78, 112, 0.25);
  margin-bottom: 12px;
}

.modal-head h2 {
  color: var(--primary);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 17px;
}

.task-form {
  display: grid;
  gap: 12px;
}

.issue-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 12px;
}

.issue-main,
.issue-side {
  display: grid;
  align-content: start;
  gap: 10px;
}

.create-author-badge {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: #2f4660;
  background: rgba(255, 252, 245, 0.9);
}

.issue-side {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(36, 78, 112, 0.06);
  padding: 12px;
  height: fit-content;
}

.issue-side h3 {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.file-label {
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 248, 235, 0.82);
  padding: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #2e4055;
}

.input-hint {
  margin: -2px 2px 2px;
  font-size: 11px;
  color: #5c6b7f;
}

.sidebar .input-hint {
  color: rgba(245, 239, 221, 0.78);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.meta-block {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 245, 0.9);
  padding: 9px;
  display: grid;
  gap: 4px;
}

.meta-line {
  margin: 0;
  font-size: 12px;
  color: #4f6074;
}

.attachment-current {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #516478;
}

.attachment-card {
  width: 218px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  text-decoration: none;
  color: #1f2b39;
  border: 1px solid var(--line);
  background: rgba(255, 252, 245, 0.94);
}

.attachment-preview {
  height: 90px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.attachment-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: #e5ebf5;
  color: var(--primary);
  font-weight: 800;
  display: grid;
  place-items: center;
}

.attachment-name {
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.attachment-date {
  margin: 0;
  font-size: 12px;
  color: #5c6b7f;
}

.history-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 252, 245, 0.88);
  padding: 12px;
}

.comments-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 252, 245, 0.88);
  padding: 12px;
}

.comments-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.comment-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf6;
  padding: 8px;
  display: grid;
  gap: 4px;
}

.comment-meta {
  margin: 0;
  color: #5a6b7f;
  font-size: 12px;
}

.comment-text {
  margin: 0;
  color: #24374d;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.history-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #506074;
  display: grid;
  gap: 7px;
}

.history-item {
  list-style: disc;
}

.history-details summary {
  cursor: pointer;
  color: #1f2f43;
  font-weight: 600;
}

.history-changes {
  margin: 8px 0 0;
  padding-left: 16px;
  display: grid;
  gap: 4px;
}

.history-change-item {
  margin-bottom: 8px;
}

.history-field {
  margin: 0 0 4px;
  font-weight: 700;
  color: #24374d;
}

.history-diff {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 6px;
}

.history-before,
.history-after {
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  white-space: pre-wrap;
  font-family: inherit;
}

.history-before {
  background: #f6e0dc;
  color: #7d3933;
  text-decoration: line-through;
}

.history-after {
  background: #dceee1;
  color: #2a5f42;
}

.history-arrow {
  color: #2f3f53;
  font-weight: 700;
  padding-top: 6px;
}

.history-change-item::marker {
  color: rgba(73, 96, 126, 0.6);
}

body.role-programmist .sidebar,
body.role-polyarnik .sidebar {
  display: none;
}

body.role-programmist .app-shell,
body.role-polyarnik .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .kanban-board {
    grid-template-columns: repeat(4, minmax(228px, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
    padding: 10px;
    gap: 10px;
  }

  .sidebar,
  .app-shell.sidebar-collapsed .sidebar {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    max-height: none;
  }

  .title-row {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }

  .title-actions {
    margin-left: auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }

  .session-box {
    min-width: 240px;
  }

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

  .kanban-board {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(76vw, 1fr);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
  }

  .column {
    scroll-snap-align: start;
    min-height: 360px;
  }

  .user-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .user-actions {
    justify-content: flex-start;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-actions .icon-btn {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .sidebar {
    padding: 10px;
    border-radius: 14px;
  }

  .settings-block {
    padding: 10px;
  }

  .title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .title-left {
    align-items: flex-start;
  }

  .title-actions {
    margin-left: 0;
    align-items: stretch;
  }

  .session-box {
    min-width: 100%;
  }

  .kanban-board {
    grid-auto-columns: minmax(88vw, 1fr);
  }

  h1 {
    font-size: 30px;
  }

  .kicker {
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  .session-row {
    flex-wrap: wrap;
  }

  .form-actions {
    flex-direction: column;
  }

  .modal {
    padding: 0;
  }

  .modal-content {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    padding: 12px;
  }

  .issue-side {
    padding: 10px;
  }

  .attachment-card {
    width: 100%;
  }
}
