:root {
  --bg: #eef2f9;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d7dde8;
  --primary: #2059ff;
  --accent: #0f766e;
  --danger: #b91c1c;
  --warn: #b45309;
  --radius: 16px;
  --shadow: 0 16px 40px rgba(31, 49, 87, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #f4f7fd 0%, #ebf3ff 50%, #f8fafc 100%);
  color: var(--ink);
}

.mesh-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(32, 89, 255, 0.08), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(15, 118, 110, 0.1), transparent 30%),
    radial-gradient(circle at 60% 90%, rgba(185, 28, 28, 0.06), transparent 34%);
  z-index: -1;
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

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

.hidden {
  display: none !important;
}

.login-panel {
  margin: 60px auto;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.brand-block {
  padding: 20px;
  border-radius: var(--radius);
  background: linear-gradient(150deg, #172554, #2059ff);
  color: #eef4ff;
}

.brand-block h1 {
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 2rem;
  line-height: 1.2;
}

.form-card {
  display: grid;
  gap: 12px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.form-card h2 {
  margin: 0 0 6px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: #1f2937;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c6d0df;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

button {
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  filter: brightness(0.96);
}

button.ghost-btn {
  background: #eef3ff;
  color: #1e3a8a;
  border: 1px solid #c9d8ff;
}

.error-text {
  margin: 0;
  color: #dc2626;
  min-height: 1.1rem;
}

.dashboard {
  display: grid;
  gap: 18px;
}

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

.topbar h2 {
  margin: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#today-label {
  font-size: 0.9rem;
  color: #334155;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
}

.kpi-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.kpi-card small {
  display: block;
  color: var(--muted);
}

.kpi-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.3rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 14px;
}

.stack-form {
  display: grid;
  gap: 10px;
}

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

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.hint {
  color: #64748b;
  font-size: 0.75rem;
}

.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-shell {
  border: 1px solid #c6d0df;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid #dbe3f0;
  background: linear-gradient(180deg, #f7faff, #eff5ff);
}

.editor-toolbar button {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
}

.rich-editor {
  min-height: 150px;
  padding: 10px;
  outline: none;
  background: #ffffff;
  line-height: 1.4;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

.rich-editor h1,
.rich-editor h2,
.rich-editor h3,
.rich-editor h4,
.rich-editor h5,
.rich-editor h6,
.rich-editor p,
.rich-editor ul,
.rich-editor ol,
.rich-editor blockquote,
.rich-editor pre {
  margin: 0 0 8px;
}

.rich-editor ul,
.rich-editor ol {
  padding-left: 20px;
}

.rich-editor blockquote {
  border-left: 3px solid #cbd5e1;
  padding-left: 10px;
  color: #334155;
}

.rich-editor pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  font-family: "IBM Plex Mono", monospace;
  overflow-x: auto;
}

.rich-editor a {
  color: #1d4ed8;
  text-decoration: underline;
}

.rich-editor img {
  max-width: min(100%, 280px);
  max-height: 180px;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 8px;
  margin: 6px 0;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
}

.image-thumb {
  border: 1px solid #d2dced;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fbff;
}

.image-thumb img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  display: block;
}

.image-thumb footer {
  padding: 6px;
  display: grid;
  gap: 4px;
}

.image-thumb small {
  font-size: 0.66rem;
  color: #334155;
  word-break: break-word;
}

.image-thumb button {
  padding: 4px 6px;
  font-size: 0.7rem;
  border-radius: 7px;
}

.project-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  max-height: 270px;
  overflow: auto;
}

.project-item {
  border: 1px solid #d9e1f0;
  background: #f9fbff;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px;
}

.project-item .name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.project-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.filter-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.section-head h3 {
  margin: 0;
}

.section-head small {
  color: var(--muted);
}

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

.kanban-col {
  border: 1px solid #dde5f1;
  border-radius: 14px;
  background: #f8fbff;
  min-height: 180px;
  padding: 8px;
}

.kanban-col h4 {
  margin: 4px 4px 10px;
  font-size: 0.92rem;
  color: #1f2937;
}

.kanban-list {
  display: grid;
  gap: 8px;
}

.task-card {
  border: 1px solid #d9e1f0;
  border-radius: 12px;
  background: #fff;
  padding: 9px;
  display: grid;
  gap: 8px;
}

.task-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.task-head h4 {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.3;
}

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.priority.low {
  color: #065f46;
  background: #d1fae5;
}

.priority.medium {
  color: #1e40af;
  background: #dbeafe;
}

.priority.high {
  color: #92400e;
  background: #fef3c7;
}

.priority.critical {
  color: #991b1b;
  background: #fee2e2;
}

.rich-content {
  font-size: 0.84rem;
  color: #334155;
  line-height: 1.4;
}

.rich-content h1,
.rich-content h2,
.rich-content h3,
.rich-content h4,
.rich-content h5,
.rich-content h6,
.rich-content p,
.rich-content ul,
.rich-content ol,
.rich-content blockquote,
.rich-content pre {
  margin: 0 0 8px;
}

.rich-content ul,
.rich-content ol {
  padding-left: 20px;
}

.rich-content blockquote {
  border-left: 3px solid #cbd5e1;
  padding-left: 10px;
}

.rich-content pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  font-family: "IBM Plex Mono", monospace;
  overflow-x: auto;
}

.rich-content img {
  max-width: min(100%, 240px);
  max-height: 150px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.desc.rich-content {
  max-height: 160px;
  overflow: auto;
  border: 1px dashed #d5deee;
  border-radius: 10px;
  padding: 8px;
  background: #fbfdff;
}

.card-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
}

.card-image-item img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border: 1px solid #d4dff2;
  border-radius: 8px;
  cursor: pointer;
}

.meta {
  font-size: 0.78rem;
  color: #475569;
}

.chip-wrap {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  border-radius: 999px;
  border: 1px solid #cdd9ed;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: #1e3a8a;
  background: #f3f7ff;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.task-actions button {
  padding: 6px 8px;
  font-size: 0.76rem;
  border-radius: 8px;
}

.task-actions .danger {
  background: #fee2e2;
  color: #991b1b;
}

.task-actions .soft {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #bbf7d0;
}

.deep-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.notes-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.note-item {
  border: 1px solid #dce4f2;
  border-radius: 12px;
  background: #fbfdff;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.note-item h5 {
  margin: 0;
  font-size: 0.9rem;
}

.note-meta {
  color: #64748b;
  font-size: 0.75rem;
}

.note-actions {
  display: flex;
  gap: 6px;
}

.note-actions button {
  padding: 6px 8px;
  font-size: 0.74rem;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-line input {
  width: auto;
}

.activity-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-height: 700px;
  overflow: auto;
}

.activity-list li {
  border: 1px solid #e1e8f4;
  border-radius: 10px;
  padding: 8px;
  font-size: 0.85rem;
  background: #f8fbff;
}

.activity-list span {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 0.75rem;
}

.empty {
  color: #64748b;
  font-size: 0.85rem;
  padding: 8px;
  border: 1px dashed #c8d4ea;
  border-radius: 10px;
  background: #fbfdff;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .workspace-grid,
  .deep-grid {
    grid-template-columns: 1fr;
  }

  .kanban-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .login-panel {
    grid-template-columns: 1fr;
    margin: 20px auto;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .row-2,
  .inline-form,
  .filter-actions {
    grid-template-columns: 1fr;
  }

  .kanban-board {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .editor-toolbar {
    gap: 4px;
  }

  .editor-toolbar button {
    padding: 5px 8px;
    font-size: 0.72rem;
  }
}
