:root {
  --bg: #0f1115;
  --panel: #171a20;
  --panel-strong: #1d2128;
  --panel-muted: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f3f5f7;
  --muted: #98a1ad;
  --accent: #8ea0b2;
  --accent-strong: #b9c4cf;
  --accent-soft: rgba(142, 160, 178, 0.14);
  --success-soft: rgba(79, 163, 122, 0.18);
  --warning: #c58a45;
  --warning-soft: rgba(197, 138, 69, 0.18);
  --danger: #cf6679;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: #d8e1ea;
}

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

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding: 1.5rem;
}

.auth-screen,
.workspace {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.auth-screen {
  min-height: calc(100vh - 3rem);
  display: grid;
  place-items: center;
}

.auth-card,
.card,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(620px, 100%);
  padding: 2.25rem;
}

.workspace {
  display: grid;
  gap: 1rem;
}

.workspace-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 320px minmax(420px, 1fr) minmax(360px, 430px);
}

.card {
  min-height: 72vh;
  padding: 1rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.69rem;
  color: #acb4bf;
}

.auth-card h1,
.topbar-title,
.section-header h2,
.subpanel h3,
.detail-empty h2,
.detail-panel h2,
#active-list-name,
.modal-header h2 {
  margin: 0;
}

.auth-copy,
.status-line,
.section-caption,
.account-email,
.empty-state,
.detail-empty p,
.preview-title,
.attachment-meta,
.empty-row {
  color: var(--muted);
}

.auth-grid,
.detail-grid,
.workspace-grid,
.modal-form {
  display: grid;
  gap: 1rem;
}

.auth-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 1.5rem;
}

.field,
.auth-grid label {
  display: grid;
  gap: 0.45rem;
}

.field span,
.auth-grid span {
  font-size: 0.88rem;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: #11141a;
  color: var(--text);
  padding: 0.8rem 0.9rem;
  outline: none;
}

textarea {
  resize: vertical;
}

input[type="color"] {
  min-height: 3.15rem;
  padding: 0.3rem;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
.task-card:focus-visible,
.attachment-link:focus-visible {
  border-color: rgba(184, 197, 210, 0.75);
  box-shadow: 0 0 0 3px rgba(184, 197, 210, 0.14);
  outline: none;
}

button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.78rem 1rem;
  cursor: pointer;
  transition: border-color 120ms ease, opacity 120ms ease, background 120ms ease, color 120ms ease;
}

button:hover {
  opacity: 0.96;
}

.primary-button {
  background: #eef2f5;
  color: #11151a;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.08);
}

.secondary-button,
.ghost-button,
.tab-button {
  background: #1a1e25;
  color: var(--text);
  border-color: var(--border);
}

.compact-button {
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
}

.danger-button {
  color: var(--danger);
}

.overview-button,
.topbar,
.topbar-actions,
.section-header,
.quick-add,
.task-meta,
.task-row,
.task-actions,
.task-topline,
.task-flag-row,
.auth-actions,
.subpanel-header,
.postpone-actions,
.attachment-actions,
.modal-actions,
.tab-row,
.list-row,
.list-row-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.overview-button {
  width: 100%;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  background: #14181e;
  border: 1px solid var(--border);
}

.overview-button.active,
.list-button.active,
.tab-button.active,
.label-toggle.active {
  background: var(--accent-soft);
  border-color: rgba(184, 197, 210, 0.2);
}

.overview-dot,
.list-dot,
.label-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  display: inline-block;
}

.overview-dot {
  background: var(--accent);
}

.list-nav,
.task-list,
.attachment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list-nav,
.task-list {
  display: grid;
  gap: 0.7rem;
}

.list-row {
  align-items: stretch;
}

.list-button {
  flex: 1;
  justify-content: space-between;
  text-align: left;
  background: transparent;
  color: var(--text);
  padding: 0.85rem 0.95rem;
  border: 1px solid transparent;
}

.list-row-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.task-count {
  color: var(--muted);
  font-size: 0.92rem;
}

.label-cloud,
.label-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.label-chip,
.label-toggle,
.mini-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.42rem 0.72rem;
}

.small-chip,
.mini-badge {
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
}

.warning-badge {
  background: var(--warning-soft);
  color: #ffdcb1;
}

.topbar {
  justify-content: space-between;
  padding: 0.5rem 0 0.2rem;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.8rem;
  padding: 0 0.9rem;
  border-radius: 999px;
  background: #1a1f26;
  color: #dbe2e8;
  border: 1px solid var(--border);
}

.board-header {
  align-items: flex-start;
  justify-content: space-between;
}

.board-header-copy,
.detail-panel,
.detail-empty,
.subpanel,
.attachment-panel {
  display: grid;
  gap: 1rem;
}

.list-description,
.compact-preview {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: #13171d;
  border: 1px solid var(--border);
}

.quick-add input {
  flex: 1;
}

.quick-meta-row {
  display: flex;
  gap: 0.8rem;
}

.compact-field {
  min-width: 160px;
}

.task-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: #15191f;
  padding: 1rem;
  color: inherit;
  cursor: pointer;
}

.task-card.selected {
  border-color: rgba(184, 197, 210, 0.4);
  background: #1b2027;
}

.task-card.postponed {
  box-shadow: inset 3px 0 0 var(--warning);
}

.task-card.postponed-strong {
  box-shadow: inset 4px 0 0 #b97735;
  background: rgba(197, 138, 69, 0.08);
}

.task-row {
  justify-content: space-between;
  align-items: flex-start;
}

.task-main {
  display: grid;
  gap: 0.5rem;
  flex: 1;
}

.task-topline {
  justify-content: space-between;
  align-items: flex-start;
}

.task-flag-row,
.task-meta,
.postpone-actions,
.attachment-actions,
.modal-actions {
  flex-wrap: wrap;
}

.task-title {
  font-weight: 650;
  font-size: 1rem;
}

.task-card time,
.task-snippet,
.task-count,
.section-caption,
.attachment-meta,
.empty-row {
  font-size: 0.92rem;
}

.task-snippet {
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--muted);
}

.detail-grid-wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-field input {
  width: 1.1rem;
  height: 1.1rem;
}

.subpanel,
.attachment-panel,
.preview-panel {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #13171d;
}

.compact-header {
  align-items: flex-start;
}

.compact-status {
  margin: 0;
  min-height: 0;
}

.preview-title {
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.markdown-preview {
  color: #dbe2e8;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
  margin-top: 0;
}

.markdown-preview p,
.markdown-preview ul {
  margin: 0 0 0.8rem;
}

.markdown-preview img {
  display: block;
  max-width: 100%;
  border-radius: 16px;
  margin-top: 0.75rem;
}

.markdown-preview code {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.12rem 0.35rem;
}

.attachment-list {
  display: grid;
  gap: 0.6rem;
}

.attachment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  background: #15191f;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.attachment-link {
  color: #edf2f6;
  text-decoration: none;
}

.attachment-link:hover {
  text-decoration: underline;
}

.attachment-meta {
  margin: 0.2rem 0 0;
}

.empty-state,
.empty-row {
  text-align: center;
  padding: 1rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.72);
  z-index: 20;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.modal-card {
  width: min(640px, 100%);
  max-height: calc(100vh - 3rem);
  overflow: auto;
  padding: 1rem;
}

.modal-large {
  width: min(860px, 100%);
}

.modal-header {
  margin-bottom: 1rem;
}

.tab-row {
  margin-bottom: 1rem;
}

.tab-button {
  padding: 0.65rem 0.95rem;
}

.tab-pane {
  display: grid;
  gap: 1rem;
}

@media (max-width: 1220px) {
  .workspace-grid {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .details {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .app-shell,
  .modal {
    padding: 1rem;
  }

  .workspace-grid,
  .detail-grid-wide,
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-header,
  .quick-add,
  .task-row,
  .task-topline,
  .list-row,
  .modal-actions,
  .attachment-item {
    flex-direction: column;
    align-items: stretch;
  }

  .list-row-actions,
  .task-actions,
  .topbar-actions {
    justify-content: flex-start;
  }

  .modal-card {
    max-height: calc(100vh - 2rem);
  }
}
