:root {
  --bg: #0b1020;
  --bg-soft: #10172b;
  --panel: #131c33;
  --panel-2: #1a2644;
  --text: #e7ecff;
  --muted: #9ba8cc;
  --accent: #4da3ff;
  --accent-2: #76c0ff;
  --danger: #ff5d6e;
  --success: #3cd483;
  --border: #2a3960;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  --col-new: #ff5d6e;
  --col-review: #f7d24d;
  --col-rework: #ff9f59;
  --col-done: #41d391;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "SF Pro Text", sans-serif;
  color: var(--text);
  background: #3f434c;
}

.container { max-width: 1220px; margin: 0 auto; padding: 22px; }
.container.wide { max-width: none; width: calc(100vw - 24px); padding-left: 12px; padding-right: 12px; }
.muted { color: var(--muted); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(10, 15, 30, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; letter-spacing: 0.5px; }
.nav { display: flex; gap: 10px; }
.nav a {
  text-decoration: none;
  color: #c4d3ff;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.nav a.active, .nav a:hover {
  color: #ffffff;
  border-color: #3a5286;
  background: #172446;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-pill {
  background: #172446;
  border: 1px solid #2f4373;
  color: #d7e3ff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
}

h1, h2, h3, h4 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.head-actions { display: flex; gap: 8px; }
.hidden { display: none; }
.search-panel {
  margin-bottom: 14px;
  border: 1px solid #2d4475;
  background: #0f1730;
  border-radius: 12px;
  padding: 10px;
}
.search-row { display: flex; gap: 8px; }
#bugSearchInput {
  width: 100%;
  border: 1px solid #355084;
  border-radius: 8px;
  padding: 10px;
  background: #121d39;
  color: #ffffff;
}
.search-results {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.search-hit {
  text-align: left;
  display: grid;
  gap: 2px;
  border: 1px solid #365084;
  border-radius: 8px;
  background: #18284b;
  color: #ffffff;
  padding: 8px 10px;
  cursor: pointer;
}
.search-hit-title { font-weight: 600; }
.search-hit-status { color: #d2ddfb; font-size: 13px; }
.columns-list { display: grid; gap: 8px; }
.column-row {
  display: grid;
  grid-template-columns: 1fr 100px auto;
  gap: 8px;
  align-items: center;
}
.column-row-actions { display: flex; gap: 6px; }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  padding: 9px 13px;
  font-size: 14px;
  color: #0a1124;
  background: #dfe8ff;
  transition: transform .15s ease, filter .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
.btn-primary {
  color: #00162e;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(77, 163, 255, 0.35);
}
.btn-ghost {
  color: #d5e1ff;
  background: #18284b;
  border-color: #2b4272;
}
.btn-danger {
  color: #ffe8eb;
  background: #7b2431;
  border-color: #b84258;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.kanban {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
}
.column {
  background: linear-gradient(180deg, #121a31, #11182d);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  min-height: 520px;
  flex: 1 1 240px;
  min-width: 220px;
}
.column[data-status="new"] {
  background: linear-gradient(180deg, #4f1f29, #3f1a22);
  border-color: #7a3945;
}
.column[data-status="review"] {
  background: linear-gradient(180deg, #4f4720, #3f391a);
  border-color: #7d7241;
}
.column[data-status="rework"] {
  background: linear-gradient(180deg, #503220, #41291a);
  border-color: #7f5a41;
}
.column[data-status="done"] {
  background: linear-gradient(180deg, #1f3f31, #1a3529);
  border-color: #3e6f59;
}
.column header {
  border-top: 5px solid;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.column .cards { padding: 4px; min-height: 440px; }

.card {
  position: relative;
  background: transparent;
  border: 1px solid #ffffff;
  border-radius: 12px;
  padding: 10px;
  margin: 0 0 8px 0;
  width: 100%;
  cursor: grab;
}
.card-readonly { cursor: default; }
.card-actions-top {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}
.card-move-btn {
  width: 22px;
  height: 22px;
  border: 1px solid #ffffff;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  line-height: 1;
  cursor: pointer;
}
.card-delete-btn {
  width: 22px;
  height: 22px;
  border: 1px solid #ffffff;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  line-height: 1;
  cursor: pointer;
}
.column[data-status="new"] .card {
  background: linear-gradient(180deg, #4f1f29, #3f1a22);
}
.column[data-status="review"] .card {
  background: linear-gradient(180deg, #4f4720, #3f391a);
}
.column[data-status="rework"] .card {
  background: linear-gradient(180deg, #503220, #41291a);
}
.column[data-status="done"] .card {
  background: linear-gradient(180deg, #1f3f31, #1a3529);
}
.card h4 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #edf2ff;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding-right: 78px;
}
.card p {
  margin: 0;
  color: #bdcaea;
  font-size: 16px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.card small { display: block; margin-top: 8px; color: #8fa1c9; }

.modal {
  width: min(760px, 95vw);
  border: 1px solid #334a7b;
  border-radius: 14px;
  padding: 0;
  background: #121b33;
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(7, 11, 22, 0.72); }
.lightbox-modal { width: min(1050px, 98vw); background: #060b18; }
.lightbox-content { color: #fff; padding: 12px; }
.lightbox-content img, .lightbox-content video { width: 100%; max-height: 75vh; object-fit: contain; border-radius: 10px; }
.lightbox-actions { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; }

.stack-form { display: grid; gap: 10px; padding: 18px; }
.stack-form h2, .stack-form h3 { color: #ffffff; }
.stack-form input, .stack-form textarea, .stack-form select {
  width: 100%;
  margin-top: 4px;
  border: 1px solid #355084;
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  background: #0f1730;
  color: var(--text);
}
.stack-form input::placeholder, .stack-form textarea::placeholder { color: #95a6cf; }
.stack-form label { color: #eef3ff; }
.stack-form input[type="checkbox"] { width: auto; margin-right: 8px; accent-color: #6fb8ff; }
.stack-form textarea { min-height: 100px; resize: vertical; }
.row-actions { display: flex; justify-content: flex-end; gap: 10px; }

.details-body { padding: 18px; }
#detailsModal .details-body,
#detailsModal .stack-form {
  background: #686d79;
  color: #ffffff;
}
#detailsModal .stack-form {
  max-height: 82vh;
  overflow-y: auto;
}
#detailsModal input,
#detailsModal textarea,
#detailsModal select {
  background: #565b66;
  border-color: #868c99;
  color: #ffffff;
}
#detailsModal .muted { color: #e4e9f5; }
#detailsModal .comment-list {
  background: #575c67;
  border-color: #818795;
}
#detailsModal .comment-item,
#detailsModal .media-caption {
  color: #ffffff;
}
#detailsModal #cardViewBlock {
  display: grid;
  gap: 8px;
  background: #5f646f;
  border: 1px solid #818795;
  border-radius: 10px;
  padding: 10px;
}
#detailsModal #cardViewBlock span {
  color: #ffffff;
  word-break: break-word;
}
#detailsModal .details-actions {
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  background: linear-gradient(180deg, rgba(104, 109, 121, 0), rgba(104, 109, 121, 1) 35%);
}
.attach-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.attach-grid img, .attach-grid video { width: 100%; border-radius: 8px; }
.media-item { position: relative; background: #0f1730; border: 1px solid #2f4678; border-radius: 10px; padding: 6px; }
.media-item img, .media-item video { cursor: zoom-in; }
.media-caption { margin-top: 6px; font-size: 12px; color: #9fb0d6; word-break: break-word; }
.media-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: rgba(210, 33, 33, 0.95);
  color: #fff;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  cursor: pointer;
}
.media-removed { opacity: 0.45; filter: grayscale(1); }

.comment-list {
  background: #0f1730;
  border: 1px solid #2b3f6d;
  border-radius: 10px;
  padding: 8px;
  overflow-y: auto;
}
.comment-list { max-height: 180px; }
.comment-item { border-bottom: 1px solid #2c406e; padding: 8px 0; font-size: 13px; }
.comment-item:last-child { border-bottom: 0; }

.trash-list { display: grid; gap: 8px; max-height: 360px; overflow-y: auto; }
.trash-item {
  border: 1px solid #2d4475;
  background: #0f1730;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: #ffffff;
}
.trash-item strong { color: #ffffff; }
.trash-item .muted { color: #d7e3ff; }
.trash-actions { display: flex; gap: 8px; }
#trashModal h2 { color: #ffffff; }

.news-list { display: grid; gap: 14px; }
.news-card {
  background: linear-gradient(180deg, #131d36, #111a31);
  border: 1px solid #2e4474;
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.news-card p { color: #cad6f5; }
.news-card img, .news-card video { max-width: 520px; width: 100%; border-radius: 10px; margin-top: 8px; border: 1px solid #304777; }
.news-card footer { color: var(--muted); margin-top: 10px; font-size: 13px; }
.news-actions { margin-top: 10px; display: flex; gap: 8px; }

.settings-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(240px, 1fr)); }
.panel {
  background: linear-gradient(180deg, #131d36, #111a31);
  border: 1px solid #2d4475;
  padding: 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { text-align: left; border-bottom: 1px solid #2d416f; padding: 8px; font-size: 14px; color: #edf2ff; }
.role-form { display: flex; gap: 8px; align-items: center; }
.users-table td form { display: inline-flex; margin-right: 6px; margin-top: 4px; }
.logs-table th, .logs-table td { vertical-align: top; word-break: break-word; }
.table-scroll { overflow-x: auto; }

.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  width: min(420px, 95vw);
  background: linear-gradient(180deg, #132041, #101937);
  border: 1px solid #385488;
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.alert {
  background: #4b1d2a;
  border: 1px solid #8b3042;
  color: #ffd9df;
  padding: 10px;
  border-radius: 8px;
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .column { min-width: 200px; }
  .settings-grid { grid-template-columns: 1fr; }
  .trash-item { flex-direction: column; align-items: flex-start; }
}
