:root {
  --blue: #14274e;
  --blue-2: #1b3363;
  --blue-3: #0f1d3a;
  --orange: #ff5a1f;
  --white: #ffffff;
  --black: #0b0b0c;
  --muted: #8a97ad;
  --line: rgba(255, 255, 255, 0.1);
  --line-dark: rgba(20, 39, 78, 0.12);
  --surface: #172f5c;
  --danger: #ff5a5a;
  --ok: #2f9f86;
  --font: "Inter", system-ui, sans-serif;
  --display: "Space Grotesk", "Inter", sans-serif;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--blue);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }

#app { min-height: 100vh; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(255, 90, 31, 0.18), transparent 55%),
    radial-gradient(700px 400px at -10% 100%, rgba(255, 255, 255, 0.06), transparent 50%),
    var(--blue);
}
.login-card {
  width: min(420px, 100%);
  background: rgba(15, 29, 58, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-card .brand {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}
.login-card .brand img { height: 28px; width: auto; }
.login-card h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}
.login-card .sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
}
.field input:focus { border-color: rgba(255, 90, 31, 0.7); }
.code-input {
  letter-spacing: 0.35em;
  font-size: 1.35rem;
  font-weight: 600;
  text-align: center;
}
.btn-row { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 600;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--orange); color: var(--blue); }
.btn-primary:hover { background: #ff7340; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--white);
}
.btn-ghost:hover { border-color: rgba(255, 255, 255, 0.28); }
.btn-light { background: var(--white); color: var(--blue); }
.muted { color: var(--muted); font-size: 0.88rem; }
.error {
  background: rgba(255, 90, 90, 0.12);
  border: 1px solid rgba(255, 90, 90, 0.35);
  color: #ffc9c9;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.ok-banner {
  background: rgba(47, 159, 134, 0.15);
  border: 1px solid rgba(47, 159, 134, 0.4);
  color: #c9f3e7;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

/* Shell */
.shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar {
  background: var(--blue-3);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sidebar .logo img { height: 22px; width: auto; display: block; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a, .nav button.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #c9d4e5;
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
}
.nav a:hover, .nav button.nav-link:hover, .nav a.active, .nav button.nav-link.active {
  background: rgba(255, 255, 255, 0.07);
  color: var(--white);
}
.nav .ico {
  width: 18px;
  text-align: center;
  opacity: 0.8;
  font-size: 0.85rem;
}
.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 180px),
    var(--blue);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 29, 58, 0.55);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  flex: 1;
}
.search {
  width: min(360px, 42vw);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  border-radius: 10px;
  padding: 10px 12px;
}
.content { padding: 20px; flex: 1; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.card {
  background: rgba(15, 29, 58, 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 120ms ease, transform 120ms ease;
}
.card:hover { border-color: rgba(255, 90, 31, 0.45); transform: translateY(-1px); }
.card h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.05rem;
}
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.card .meta { margin-top: 12px; font-size: 0.8rem; color: var(--muted); }

.split {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  min-height: calc(100vh - 120px);
}
.panel {
  background: rgba(15, 29, 58, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-h {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-h strong { flex: 1; font-size: 0.92rem; }
.panel-b { padding: 10px; overflow: auto; flex: 1; }

.tree-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #d7e0ee;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
}
.tree-item:hover, .tree-item.active { background: rgba(255, 255, 255, 0.08); }
.tree-item.child { padding-left: 22px; color: #b7c4d8; }

.editor-wrap { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.editor-title {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--white);
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 8px 4px 12px;
  outline: none;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.toolbar button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
}
.toolbar button:hover { border-color: rgba(255, 90, 31, 0.5); }
.editor {
  min-height: 420px;
  padding: 8px 4px 24px;
  outline: none;
  line-height: 1.6;
}
.editor h1, .editor h2, .editor h3 { font-family: var(--display); letter-spacing: -0.02em; }
.editor p { margin: 0 0 0.85em; }
.editor ul, .editor ol { padding-left: 1.3em; }

/* Board */
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.column {
  background: rgba(15, 29, 58, 0.65);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 480px;
  display: flex;
  flex-direction: column;
}
.column-h {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 600;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.dot.todo { background: #8a97ad; }
.dot.inprogress { background: var(--orange); }
.dot.done { background: var(--ok); }
.column-b { padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.issue-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}
.issue-card:hover { border-color: rgba(255, 90, 31, 0.55); }
.issue-card .key {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.issue-card .summary {
  margin: 6px 0 8px;
  font-size: 0.92rem;
  line-height: 1.35;
}
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: #d7e0ee;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill.bug { background: rgba(255, 90, 90, 0.18); color: #ffc9c9; }
.pill.story { background: rgba(47, 159, 134, 0.18); color: #c9f3e7; }
.pill.epic { background: rgba(255, 90, 31, 0.18); color: #ffd2c0; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table tr:hover td { background: rgba(255, 255, 255, 0.03); }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 10, 20, 0.62);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: var(--blue-3);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.modal-h {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--blue-3);
}
.modal-h h3 { margin: 0; flex: 1; font-family: var(--display); }
.modal-b { padding: 16px; }
.form-grid { display: grid; gap: 12px; }
.form-grid textarea, .form-grid select, .form-grid input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  border-radius: 10px;
  padding: 10px 12px;
}
.form-grid textarea { min-height: 120px; resize: vertical; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .split { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 240px); }
}
