:root {
  --bg: #2f373d;
  --panel: #394247;
  --panel-2: #323a40;
  --panel-3: #2b3237;
  --text: #f2f6f8;
  --muted: #98abb5;
  --line: #4a545b;
  --accent: #28b878;
  --accent-2: #1f9e68;
  --danger: #e34c5b;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: linear-gradient(145deg, #2b3338, #303a40 55%, #273036);
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Rajdhani", sans-serif;
  letter-spacing: 0.02em;
}

.hidden {
  display: none !important;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0);
  background-size: 4px 4px;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.auth-card {
  width: min(480px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-title-row i {
  color: var(--accent);
}

.auth-chip {
  background: #273036;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}

.auth-sub {
  color: var(--muted);
  margin-top: 8px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
}

.tab {
  border: none;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.auth-form {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.btn-wide {
  margin-top: 8px;
  justify-content: center;
}

.auth-message {
  min-height: 20px;
  color: #fdc94b;
  margin-top: 12px;
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 18px;
  max-height: calc(100vh - 44px);
  overflow: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.search-row input,
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  font-size: 14px;
  background: #2a3136;
  color: var(--text);
}

.search-row {
  margin-bottom: 8px;
}

.sidebar h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.menu-list li {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 9px 10px;
  cursor: pointer;
  background: var(--panel-2);
  transition: all 0.2s ease;
}

.menu-list li:hover,
.menu-list li.active {
  border-color: var(--accent);
  background: rgba(40, 184, 120, 0.14);
  transform: translateX(2px);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-badge {
  background: #293238;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 0;
  padding: 8px 10px;
  font-size: 13px;
}

.status-bar {
  background: rgba(40, 184, 120, 0.14);
  border: 1px solid rgba(40, 184, 120, 0.45);
  border-radius: 0;
  padding: 9px 12px;
  font-size: 14px;
}

.status-bar.error {
  background: rgba(227, 76, 91, 0.14);
  border-color: rgba(227, 76, 91, 0.45);
}

.meta {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.eyebrow {
  color: #83e8bb;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 700;
  margin: 0;
}

.btn {
  border: none;
  border-radius: 0;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
  background: #2a3136;
  color: #dce8ed;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-2);
}

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

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.module {
  padding: 16px;
}

.module-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  align-items: center;
}

.docs-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.preview {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 12px;
  min-height: 290px;
  background: var(--panel-3);
  overflow: auto;
}

.preview h1,
.preview h2,
.preview h3 {
  margin-top: 14px;
}

.action-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.link-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.link-card {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 12px;
  background: var(--panel-2);
}

.link-card p {
  margin: 4px 0;
}

.task-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.task-item {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px;
  background: var(--panel-2);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.kanban-col {
  border: 1px dashed var(--line);
  border-radius: 0;
  background: var(--panel-3);
  min-height: 160px;
  padding: 10px;
}

.dropzone {
  min-height: 120px;
}

.kanban-task {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 9px;
  margin-bottom: 8px;
  background: var(--panel-2);
  cursor: grab;
}

.modal {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  width: min(520px, 95vw);
  background: var(--panel);
  color: var(--text);
}

.modal::backdrop {
  background: rgba(13, 24, 22, 0.5);
}

#modalForm {
  padding: 16px;
}

#modalFields {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

a {
  color: #8eeac1;
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-height: none;
  }

  .docs-layout,
  .kanban {
    grid-template-columns: 1fr;
  }
}
