:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --border: #d8dee8;
  --text: #172033;
  --muted: #667085;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #15803d;
  --danger: #b42318;
  --shadow: 0 4px 14px rgba(15, 23, 42, .07);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 8px 14px;
  background: #111827;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.brand { font-weight: 800; font-size: 18px; }
.server-clock { margin-top: 2px; font-size: 11px; color: #cbd5e1; }
.top-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

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

.btn {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 10px;
  min-height: 32px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.secondary { border-color: #cbd5e1; background: #fff; }
.topbar .btn.secondary { background: #1f2937; color: #fff; border-color: #475569; }
.btn.success { background: var(--success); color: #fff; }
.btn.danger { background: #fff; border-color: #f0a8a1; color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { border: 0; background: transparent; font-size: 24px; color: var(--muted); }

.appointment-strip {
  margin-bottom: 8px;
  padding: 9px 12px;
  border: 1px solid #f59e0b;
  background: #fffbeb;
  border-radius: 9px;
  font-weight: 700;
}
.appointment-strip.urgent { background: #fef2f2; border-color: #ef4444; }

.quick-add {
  display: grid;
  grid-template-columns: 145px minmax(220px, 1fr) 180px 68px;
  gap: 7px;
  padding: 8px;
  margin-bottom: 8px;
}
.quick-add input, .quick-add select,
.task-dialog input, .task-dialog select, .task-dialog textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 7px 8px;
  background: #fff;
  color: var(--text);
}

.recommendation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin-bottom: 8px;
}
.eyebrow { font-size: 11px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.recommend-title { margin-top: 3px; font-size: 15px; font-weight: 800; }
.recommend-actions { display: flex; gap: 6px; }

.board-shell {
  overflow-x: auto;
  padding-bottom: 4px;
}
.board {
  min-width: 1500px;
  display: grid;
  grid-template-columns: repeat(7, minmax(205px, 1fr));
  gap: 7px;
  align-items: start;
}
.column {
  min-height: 410px;
  max-height: calc(100vh - 295px);
  display: flex;
  flex-direction: column;
  background: #eef1f5;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}
.column.drag-over { outline: 2px solid #60a5fa; outline-offset: -2px; }
.column-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 9px;
  background: #e5e9f0;
  border-bottom: 1px solid var(--border);
}
.column-title { font-weight: 900; font-size: 13px; }
.column-count { font-size: 11px; color: var(--muted); }
.add-card-btn {
  border: 0;
  background: #fff;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 17px;
  line-height: 20px;
}
.card-list {
  padding: 6px;
  overflow-y: auto;
  min-height: 350px;
  flex: 1;
}
.card-list.completed-zone {
  border-top: 1px dashed #cbd5e1;
  min-height: 70px;
  flex: 0 0 auto;
}
.completed-label {
  margin: 5px 7px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.task-card {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 20px;
  gap: 5px;
  align-items: start;
  margin-bottom: 5px;
  padding: 7px 6px;
  background: #fff;
  border: 1px solid #d5dbe5;
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.task-card[draggable="true"] { cursor: grab; }
.task-card.dragging { opacity: .42; }
.task-card.completed { opacity: .72; background: #f8fafc; }
.task-card.completed .task-title { text-decoration: line-through; color: #64748b; }
.task-card.urgent { border-left: 4px solid #dc2626; }
.task-card.high { border-left: 4px solid #f59e0b; }
.task-card.doing { box-shadow: 0 0 0 2px #60a5fa inset; }
.task-card.waiting { background: #faf5ff; }
.task-check { width: 17px; height: 17px; margin: 2px 0 0; }
.task-title { font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.task-meta { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 3px 6px; font-size: 10px; color: var(--muted); }
.task-actions { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.mini-btn {
  border: 1px solid #d4dae4;
  border-radius: 5px;
  background: #fff;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 700;
}
.drag-handle { color: #94a3b8; user-select: none; font-weight: 900; touch-action: none; cursor: grab; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 999px; background: #94a3b8; }
.status-dot.doing { background: #2563eb; }
.status-dot.waiting { background: #7c3aed; }
.status-dot.due { background: #dc2626; animation: pulse 1.3s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.today-summary { margin-top: 8px; padding: 10px 12px; }
.summary-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.today-metrics { margin-top: 3px; font-size: 15px; font-weight: 900; }
.completed-timeline { display: flex; gap: 6px; overflow-x: auto; padding-top: 8px; }
.timeline-item { min-width: 180px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 7px; background: #f8fafc; }
.timeline-time { font-size: 10px; color: var(--muted); }
.timeline-title { margin-top: 2px; font-weight: 700; }

.task-dialog {
  width: min(680px, calc(100vw - 24px));
  border: 0;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(15,23,42,.28);
  padding: 0;
}
.task-dialog::backdrop { background: rgba(15,23,42,.5); }
.task-dialog.narrow { width: min(430px, calc(100vw - 24px)); }
.task-dialog form { padding: 14px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.task-dialog label { display: block; color: #344054; font-weight: 700; margin-top: 9px; }
.task-dialog label input, .task-dialog label select, .task-dialog label textarea { margin-top: 4px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.reminder-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 5px; }
.reminder-row label { margin: 0; font-weight: 400; }
.reminder-row input { width: auto; }
.dialog-actions { display: flex; gap: 7px; margin-top: 14px; align-items: center; }
.spacer { flex: 1; }

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 28px));
  padding: 10px 13px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: 0 8px 25px rgba(0,0,0,.25);
}

@media (max-width: 760px) {
  body { font-size: 12px; }
  .topbar { align-items: flex-start; }
  .brand { font-size: 15px; }
  .top-actions .btn { padding: 5px 7px; min-height: 28px; font-size: 11px; }
  main { padding: 7px; }
  .quick-add { grid-template-columns: 112px minmax(150px, 1fr) 62px; }
  .quick-add #quickDue { grid-column: 1 / -1; order: 4; }
  .recommendation { align-items: flex-start; }
  .board { min-width: 1440px; grid-template-columns: repeat(7, 198px); }
  .column { max-height: 56vh; min-height: 380px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .today-summary { padding: 8px; }
}
