* {
  box-sizing: border-box;
}

:root {
  --bg: #070b14;
  --card: rgba(17, 24, 39, 0.86);
  --border: rgba(148, 163, 184, 0.16);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #22c55e;
  --danger: #ef4444;
  --input: rgba(2, 6, 23, 0.72);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 30%),
    linear-gradient(180deg, #070b14, #020617);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  background: rgba(2, 6, 23, 0.72);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.sidebar h2 {
  margin-top: 0;
}

.main {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 24px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 5vw, 46px);
  letter-spacing: -0.05em;
}

header p,
.meta,
small {
  color: var(--muted);
}

.card,
.note,
.modalContent {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 24px 70px rgba(0,0,0,.38);
  backdrop-filter: blur(18px);
}

.card {
  padding: 22px;
}

.login {
  max-width: 420px;
  margin: 10vh auto;
}

.editor {
  margin-bottom: 20px;
}

.editor.fullscreen {
  position: fixed;
  inset: 12px;
  z-index: 80;
  overflow: auto;
}

.editorTop,
.checklistHeader,
.noteTop,
.buttonRow,
.actions,
.mobileActions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

input,
textarea,
select {
  width: 100%;
  background: var(--input);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 16px;
  padding: 14px 15px;
  margin-top: 12px;
  font-size: 16px;
  outline: none;
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(34,197,94,.85);
  box-shadow: 0 0 0 4px rgba(34,197,94,.13);
}

button {
  background: var(--accent);
  color: #052e16;
  border: 0;
  border-radius: 15px;
  padding: 12px 15px;
  margin-top: 12px;
  font-weight: 800;
  cursor: pointer;
}

.secondary {
  background: rgba(51, 65, 85, .95);
  color: #e2e8f0;
}

.danger {
  background: var(--danger);
  color: white;
}

.small {
  padding: 8px 10px;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.grid2,
.optionGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 14px;
  background: rgba(15,23,42,.75);
  border: 1px solid rgba(148,163,184,.14);
  margin-top: 12px;
}

.checkbox input {
  width: auto;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.checkbox span {
  display: grid;
  gap: 3px;
}

.checklistBox {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(148,163,184,.14);
  border-radius: 18px;
  background: rgba(15,23,42,.45);
}

.checkRow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.checkRow input[type="checkbox"] {
  width: auto;
}

.notes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 16px;
}

.note {
  padding: 18px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  border-top: 4px solid var(--accent);
}

.note.blue { border-top-color: #38bdf8; }
.note.purple { border-top-color: #a78bfa; }
.note.orange { border-top-color: #fb923c; }
.note.red { border-top-color: #f87171; }

.note h3 {
  font-size: 21px;
  line-height: 1.15;
}

.noteBody {
  color: #cbd5e1;
  white-space: normal;
  line-height: 1.55;
  margin-top: 12px;
  flex: 1;
}

.noteBody a,
.comment a {
  color: #38bdf8;
  text-decoration: none;
  word-break: break-word;
}

.badge,
.tag {
  display: inline-flex;
  width: fit-content;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(34,197,94,.12);
  border: 1px solid rgba(34,197,94,.22);
  color: #bbf7d0;
}

.tagRow,
.reads {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.due,
.miniChecklist {
  margin-top: 10px;
  color: #fde68a;
  font-size: 14px;
}

.meta {
  display: grid;
  gap: 4px;
  border-top: 1px solid rgba(148,163,184,.12);
  padding-top: 12px;
  margin-top: 14px;
  font-size: 12.5px;
}

.empty,
.error {
  color: #f87171;
  padding: 15px;
}

.filterBlock {
  margin-top: 18px;
}

.filterBlock label {
  color: var(--muted);
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,.65);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modalContent {
  width: min(850px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  position: relative;
}

.smallModal {
  max-width: 420px;
}

.close {
  position: absolute;
  right: 16px;
  top: 10px;
  width: auto;
}

.uploadGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px,1fr));
  gap: 10px;
  margin: 12px 0;
}

.uploadGrid img {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.comment,
.historyItem,
.checkPreview {
  padding: 10px;
  background: rgba(15,23,42,.65);
  border: 1px solid rgba(148,163,184,.12);
  border-radius: 14px;
  margin-top: 8px;
}

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

  .sidebar {
    position: fixed;
    z-index: 90;
    inset: 0 auto 0 0;
    width: 280px;
  }

  .main {
    padding: 14px;
  }

  .grid2,
  .optionGrid {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .actions button,
  .mobileActions button {
    width: auto;
    flex: 1;
  }
}
