:root {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --border: #d0d7de;
  --text: #1f2328;
  --dim: #656d76;
  --accent: #0969da;
  --accent-wash: rgba(9, 105, 218, 0.08);
  --accent-ring: rgba(9, 105, 218, 0.3);
  --danger: #cf222e;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---- Identity gate ---- */

.gate {
  position: fixed;
  inset: 0;
  background: rgba(31, 35, 40, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.gate-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(31, 35, 40, 0.12);
  padding: 28px 24px;
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

.gate-sub {
  margin: 0 0 4px;
  font-size: 12.5px;
  color: var(--dim);
  text-align: center;
  line-height: 1.4;
}

.gate-panel input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
}

.gate-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.gate-panel button {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
}

.gate-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin: 0;
}

/* ---- App shell ---- */

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 16px 40px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 28px;
}

.logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-transform: uppercase;
}

.link-btn {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 13px;
  padding: 4px;
  position: absolute;
  right: 0;
}

.link-btn:hover {
  color: var(--text);
}

/* ---- Quick add: the focal point ---- */

.add-row {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-bottom: 32px;
}

.add-row input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 18px 20px;
  font-size: 18px;
  outline: none;
  box-shadow: 0 1px 3px rgba(31, 35, 40, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.add-row input::placeholder {
  color: var(--dim);
}

.add-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.add-btn {
  flex-shrink: 0;
  width: 56px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(31, 35, 40, 0.06);
}

.add-btn:hover {
  background: #0860c4;
}

/* ---- Task list ---- */

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  touch-action: pan-y;
}

.task-item.dragging {
  z-index: 50;
  box-shadow: 0 8px 24px rgba(31, 35, 40, 0.16);
  border-color: var(--dim);
  cursor: grabbing;
}

.task-item.done {
  opacity: 0.55;
}

.task-item.done .task-text {
  text-decoration: line-through;
  color: var(--dim);
}

.drag-handle {
  color: var(--dim);
  font-size: 14px;
  line-height: 1;
  padding: 6px 4px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  flex-shrink: 0;
}

.checkbox {
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox.checked::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.task-text {
  flex: 1;
  min-width: 0;
  outline: none;
  word-break: break-word;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: text;
}

.task-text:focus {
  background: var(--accent-wash);
}

.task-date {
  flex-shrink: 0;
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
}

.empty-state {
  color: var(--dim);
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
}

.footer {
  margin-top: 20px;
  text-align: center;
}
