/* Benjamin — modern minimal planner */

/* === Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Neutral grayscale palette */
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-hover: #fafafa;
  --surface-alt: #f2f2f2;
  --border: #e4e4e4;
  --border-light: #eeeeee;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --text-tertiary: #999999;

  /* Functional color — only where it aids scanning */
  --pri-a: #c33;
  --pri-b: #96780a;
  --pri-c: #999999;
  --status-done: #3a8a50;
  --sunday: #c33;

  /* Functional */
  --radius: 6px;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  font-feature-settings: 'cv01', 'cv02';
}

/* === Nav === */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}

nav .nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 48px;
}

nav .logo {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
  margin-right: 20px;
}

nav a {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 14px 10px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}

nav a:hover { color: var(--text); }
nav a.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

nav .spacer { flex: 1; }

nav .user-info {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* === Layout === */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* === Planner Page (Today) === */

/* Header: date+briefing left, calendar right */
.planner-header {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}

.planner-header-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.planner-date {
  margin-bottom: 16px;
}

.planner-date h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0;
}

.planner-date .date-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 400;
}


/* Briefing */
.planner-briefing {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
  white-space: pre-wrap;
  flex: 1;
}

/* Mini calendar */
.mini-cal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-width: 220px;
  flex-shrink: 0;
}

.mini-cal-month {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-cal-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 16px;
  color: var(--text-tertiary);
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.1s;
}

.mini-cal-nav:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.mini-cal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.mini-cal-footer {
  text-align: center;
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
}

.mini-cal-today-link {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: none;
}

.mini-cal-today-link:hover {
  color: var(--text);
}

.mini-cal-table th {
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 2px 0;
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.mini-cal-table td {
  text-align: center;
  padding: 2px 0;
  color: var(--text-secondary);
  font-weight: 400;
}

.mini-cal-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  text-decoration: none;
  color: inherit;
  border-radius: 50%;
  transition: background 0.1s;
}

.mini-cal-day:hover {
  background: var(--surface-alt);
}

/* Saturday and Sunday columns */
.mini-cal-table td:nth-child(6),
.mini-cal-table th:nth-child(6) {
  color: var(--text-tertiary);
}

.mini-cal-table td:nth-child(7),
.mini-cal-table th:nth-child(7) {
  color: var(--sunday);
}

.mini-cal-table td.empty {
  color: transparent !important;
}

.mini-cal-table td.is-today .mini-cal-day {
  font-weight: 700;
  color: var(--surface);
  background: var(--text);
}

.mini-cal-table td.is-today .mini-cal-day:hover {
  opacity: 0.8;
}

/* Two-column layout */
.planner-columns {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}

.planner-tasks {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.planner-schedule {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  align-self: start;
}

/* Section headers */
.section-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 14px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-light);
}

/* === Task rows === */
.task-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  min-height: 40px;
  transition: background 0.1s;
}

.task-row:last-child { border-bottom: none; }

.task-row:hover {
  background: var(--surface-hover);
}

/* Priority label */
.task-priority {
  width: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-tertiary);
  user-select: none;
  font-variant-numeric: tabular-nums;
}

.task-priority.pri-A { color: var(--pri-a); }
.task-priority.pri-B { color: var(--pri-b); }
.task-priority.pri-C { color: var(--pri-c); }

/* Status symbol */
.task-status-cell {
  width: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  transition: background 0.1s;
  border-radius: 4px;
  margin: 2px 0;
}

.task-status-cell:hover {
  background: var(--surface-alt);
}

.status-sym { font-weight: 500; }
.status-sym.pending { color: var(--text-tertiary); }
.status-sym.in_progress { color: var(--text-secondary); }
.status-sym.done { color: var(--status-done); }
.status-sym.deferred { color: var(--text-tertiary); }
.status-sym.cancelled { color: var(--text-tertiary); }

/* Task content */
.task-content {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 6px 10px 6px 4px;
  gap: 8px;
  min-width: 0;
}

.task-text {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

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

.task-text.is-deferred {
  color: var(--text-tertiary);
}

.task-text.is-cancelled {
  text-decoration: line-through;
  color: var(--text-tertiary);
  opacity: 0.5;
}

.task-detail {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.task-tag {
  font-size: 10px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-tertiary);
  letter-spacing: 0.1px;
}

/* Action buttons */
.task-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}

.task-row:hover .task-actions {
  opacity: 1;
}

.act-btn {
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-tertiary);
  transition: all 0.1s;
}

.act-btn:hover {
  border-color: var(--border);
  background: var(--surface-alt);
  color: var(--text);
}

/* === Schedule === */
.schedule-slot {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  min-height: 40px;
  padding: 0;
}

.schedule-slot:last-child { border-bottom: none; }

.slot-time {
  width: 52px;
  min-width: 52px;
  text-align: right;
  padding: 8px 10px 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  user-select: none;
  font-variant-numeric: tabular-nums;
}

.slot-content {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
}

.slot-event-title {
  font-weight: 500;
  color: var(--text);
}

.slot-event-duration {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: 6px;
}

/* === Notes section === */
.planner-notes {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 16px;
  overflow: hidden;
}

.planner-notes .notes-content {
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  min-height: 60px;
}

/* === Card === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
  color: var(--text-tertiary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* === Projects === */
.project-list { list-style: none; }

.project-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.project-item:last-child { border-bottom: none; }

.project-item a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

.project-item a:hover { color: var(--text-secondary); }

.project-status {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: 8px;
}

.project-tags {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.tag {
  font-size: 10px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-tertiary);
}

/* Milestones & Todos */
.milestone-item, .todo-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.milestone-item:last-child, .todo-item:last-child { border-bottom: none; }

.milestone-date, .todo-due {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Notes (markdown) */
.notes { font-size: 14px; line-height: 1.7; }
.notes h1 { font-size: 20px; margin: 16px 0 8px; font-weight: 700; letter-spacing: -0.3px; }
.notes h2 { font-size: 17px; margin: 14px 0 6px; font-weight: 600; }
.notes h3 { font-size: 15px; margin: 12px 0 4px; font-weight: 600; }
.notes p { margin-bottom: 8px; }
.notes ul, .notes ol { margin-left: 20px; margin-bottom: 8px; }

/* === Search === */
.search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-form input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--sans);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.search-form input:focus {
  outline: none;
  border-color: var(--text-tertiary);
}

.search-result {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.search-result:last-child { border-bottom: none; }

.search-result .path {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: monospace;
}

.search-result .line {
  font-size: 13px;
  margin-top: 2px;
}

.search-result .line-number {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: monospace;
}

/* === Login === */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}

.login-card {
  text-align: center;
  padding: 40px;
  max-width: 360px;
  width: 100%;
}

.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.login-card p {
  color: var(--text-tertiary);
  margin-bottom: 28px;
  font-size: 14px;
}

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sans);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.1s;
}

.btn:hover { background: var(--surface-alt); }

.btn-primary {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.btn-primary:hover { opacity: 0.85; }

/* === Empty state === */
.empty {
  text-align: center;
  padding: 32px;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* === Flash === */
.flash {
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.flash-error { background: #fef5f5; border-color: #e5c5c5; color: #7a3030; }
.flash-success { background: #f5fef5; border-color: #c5e5c5; color: #307a30; }

/* === htmx === */
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator { opacity: 1; }

/* === Responsive === */
@media (max-width: 700px) {
  .planner-header { flex-direction: column; }
  .mini-cal { min-width: unset; }
  .planner-columns { grid-template-columns: 1fr; }
  .container { padding: 16px; }
  nav .nav-inner { gap: 2px; }
  .task-actions { opacity: 1; }
}
