* { box-sizing: border-box; }
:root { --paper: #fbf9f4; --ink: #222; --muted: #8a8378; --line: #e5ded0; --accent: #c2410c; --today: #fff8e6; }
html, body { margin: 0; padding: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.hidden { display: none !important; }
h1 { font-size: 22px; margin: 0; letter-spacing: .02em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 6px; }
button { font: inherit; cursor: pointer; background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; color: var(--ink); }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
button.linklike { border: none; color: var(--accent); padding: 0; text-decoration: underline; }
input[type="text"], input[type="password"] { font: inherit; width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.error { color: #b91c1c; min-height: 1.2em; font-size: 14px; }
.report { background: #eef6ee; border: 1px solid #bcd8bc; border-radius: 6px; padding: 10px 12px; font-size: 14px; white-space: pre-line; }
.hint { color: var(--muted); font-size: 13px; }

/* Auth */
.auth { max-width: 420px; margin: 18vh auto 0; padding: 0 20px; }
.auth h1 { margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 14px; }
.auth label { display: block; margin: 14px 0 4px; font-size: 14px; }
.auth button.primary { width: 100%; margin-top: 16px; padding: 11px; }

/* Planner header */
#planner-view { max-width: 1180px; margin: 0 auto; padding: 12px 16px 40px; }
header { display: flex; align-items: center; justify-content: space-between; position: relative; padding: 4px 0 10px; }
.header-actions { display: flex; gap: 8px; }
#menu { position: absolute; right: 0; top: 44px; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.12); padding: 6px; display: flex; flex-direction: column; min-width: 220px; }
#menu button { border: none; text-align: left; padding: 9px 10px; border-radius: 5px; }
#menu button:hover { background: var(--paper); }

/* Day strip (mobile day picker) */
#day-strip { display: none; gap: 4px; margin-bottom: 10px; }
#day-strip button { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 6px 0; font-size: 12px; background: #fff; }
#day-strip button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
#day-strip button .dow { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
#day-strip button[aria-selected="true"] .dow { color: #ddd; }

/* Week grid */
#week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0 14px; }
.day { border-top: 2px solid var(--ink); padding: 8px 0 4px; min-width: 0; }
.day.today { border-top-color: var(--accent); background: var(--today); border-radius: 0 0 8px 8px; padding-left: 6px; padding-right: 6px; margin: 0 -6px; }
.day h2 { display: flex; justify-content: space-between; }
.day h2 .date-num { color: var(--ink); }
.task-list { list-style: none; margin: 0; padding: 0; min-height: 24px; }
.task-list li { display: flex; align-items: flex-start; gap: 8px; padding: 5px 2px; border-bottom: 1px solid var(--line); }
.task-list li.done .task-text { text-decoration: line-through; color: var(--muted); }
.task-list li.dragging { opacity: .4; }
.task-list li.drop-target { background: #eef6ee; }
.task-check { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.task-text { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: text; }
.task-text-input { flex: 1; padding: 2px 6px; }
.task-badge { flex: 0 0 auto; font-size: 11px; color: var(--accent); border: 1px solid var(--accent); border-radius: 10px; padding: 0 6px; margin-top: 3px; white-space: nowrap; }
.task-menu-btn { flex: 0 0 auto; border: none; padding: 2px 6px; color: var(--muted); font-size: 16px; line-height: 1; }
.task-move { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 2px; }
.task-move button { font-size: 12px; padding: 3px 8px; }
.add-form { display: flex; gap: 6px; margin-top: 8px; }
.add-form input { flex: 1; border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 6px 2px; }
.add-form input:focus { outline: none; border-bottom-color: var(--ink); }
.add-form button { border: none; font-size: 20px; padding: 0 8px; color: var(--muted); }
.recur-picker { display: flex; gap: 4px; align-items: center; }
.recur-picker button { border: none; font-size: 16px; padding: 2px 6px; color: var(--muted); }
.recur-picker button[aria-pressed="true"] { color: var(--accent); }
.recur-choice { font-size: 12px; color: var(--accent); }

/* Someday + recurring */
#someday-section, #recurring-section { margin-top: 28px; border-top: 2px solid var(--ink); padding-top: 10px; }
.template-list { list-style: none; margin: 0; padding: 0; }
.template-list li { display: flex; gap: 8px; align-items: center; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.template-list .task-text { cursor: default; }
.template-list button { font-size: 12px; }
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 20px; max-width: 420px; width: calc(100% - 40px); }
dialog label { display: block; margin: 12px 0 4px; font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Mobile: one day at a time, controls in the first viewport */
@media (max-width: 760px) {
  #planner-view { padding: 10px 14px 32px; }
  #day-strip { display: flex; }
  #week { display: block; }
  .day { display: none; border-top-width: 2px; }
  .day.mobile-active { display: block; }
  .day.today { margin: 0; padding-left: 0; padding-right: 0; background: transparent; }
  .day.today.mobile-active { background: var(--today); padding-left: 8px; padding-right: 8px; margin: 0 -8px; }
}
