:root {
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f8f7fb;
  --surface: #ffffff;
  --brand: #7a00f9;
  --brand-hover: #6200c9;
  --brand-soft: #f1e7ff;
  --ink: #111827;
  --muted: #4b5563;
  --subtle: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.045);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --success-bg: #dcfce7;
  --success-ink: #166534;
  --warn-bg: #ffedd5;
  --warn-ink: #9a3412;
  --late-bg: #fee2e2;
  --late-ink: #991b1b;
  --neutral-bg: #f3f4f6;
  --neutral-ink: #374151;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

header {
  flex-shrink: 0;
  width: 100%;
  height: 80px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5vw;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.6px;
}

.brand-icon {
  background: var(--brand);
  color: #fff;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 16px rgba(122, 0, 249, 0.28);
}

.tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  color: var(--subtle);
  background: var(--neutral-bg);
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: 999px;
  margin-left: 4px;
}

#account {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

#account[hidden] { display: none; }

#name {
  font-weight: 600;
  color: var(--ink);
}

main {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  padding: 48px 5vw 48px;
  margin: auto;
}

h1 {
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -1.2px;
  margin: 8px 0 8px;
  font-weight: 700;
  color: var(--ink);
}

h2 {
  font-size: 18px;
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
}

p {
  line-height: 1.6;
  color: var(--muted);
  margin-top: 0;
  font-weight: 400;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.8px;
  color: var(--brand);
}

.heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px 24px;
  margin-bottom: 28px;
}

.heading-actions {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.project-select {
  flex: 0 1 220px;
  min-width: 160px;
  margin: 0;
}

.heading-actions .primary,
.heading-actions .project,
.heading-actions .meeting,
.heading-actions .remind {
  flex: 0 1 auto;
}

.heading-actions .picker-face {
  min-height: 41px;
  border-radius: 999px;
  padding: 10px 42px 10px 16px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(229, 231, 235, 0.8);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

button, input, select, textarea { font: inherit; }

button {
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover { background: var(--neutral-bg); }
button:disabled { opacity: 0.55; cursor: wait; }

.primary {
  background: var(--brand);
  color: #fff;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(122, 0, 249, 0.22);
}

.primary:hover {
  background: var(--brand-hover);
  filter: brightness(1.08);
}

.remind {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 999px;
}

.remind:hover { background: var(--neutral-bg); }

.meeting {
  background: var(--brand-soft);
  color: var(--brand-hover);
  border: 0;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 999px;
}

.meeting:hover { background: #e9d8ff; color: var(--brand-hover); }

.project {
  background: var(--ink);
  color: #fff;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(17, 24, 39, 0.18);
}

.project:hover {
  background: #1f2937;
  color: #fff;
  filter: brightness(1.08);
}

.ghost, .quiet {
  background: transparent;
  border: 0;
  color: var(--ink);
  box-shadow: none;
}

.ghost:hover, .quiet:hover {
  background: var(--neutral-bg);
}

.ghost-accent {
  color: var(--brand);
}

.ghost-accent:hover {
  background: var(--brand-soft);
  color: var(--brand-hover);
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

input, select, textarea {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  color: var(--ink);
  background: var(--surface);
  min-width: 0;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  width: 100%;
  max-width: 100%;
  min-height: 120px;
  resize: vertical;
}

.details-field { gap: 8px; }

.details-composer {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.details-composer textarea {
  border: 0;
  border-radius: 0;
  min-height: 120px;
  box-shadow: none;
}

.details-composer textarea:focus {
  box-shadow: none;
}

.details-composer:focus-within {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--brand);
}

.details-toolbar {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: #fcfcfb;
}
.details-toolbar button {
  width: 36px;
  min-height: 34px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.details-toolbar button:hover,
.details-toolbar button:focus-visible {
  border-color: var(--brand);
  color: var(--brand-hover);
}
.details-images-bar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--border);
  background: #fcfcfb;
}
.details-hint {
  display: block;
  padding: 0 10px 8px;
  color: var(--subtle);
  font-size: 11px;
}
.detail-copy p { margin: 0 0 10px; }
.detail-copy p:last-child { margin-bottom: 0; }
.detail-copy ul,
.detail-copy ol { margin: 4px 0 12px; padding-left: 24px; }
.detail-copy li { padding-left: 2px; }


.details-add {
  width: 36px;
  height: 36px;
  padding: 0;
  flex: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--surface);
}

.details-add:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.details-add:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand);
}

.details-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.details-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--neutral-bg);
}

.details-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.details-thumb button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
}

.details-thumb button:hover { background: #991b1b; color: #fff; }

.details-drophint {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in srgb, var(--brand-soft) 92%, #fff);
  color: var(--brand-hover);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  z-index: 1;
}

.details-composer.is-drop {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand);
}

.details-composer.is-drop .details-drophint { display: flex; }

.task-photos {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  color: var(--subtle);
  font-size: 11px;
}

.task-photos i { color: var(--brand); }

.detail-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.detail-images a {
  display: block;
  width: 88px;
  height: 88px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.detail-images img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

select {
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--brand);
}

.picker { position: relative; width: 100%; }

.picker-native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
}

.picker-face {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 42px 10px 16px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  box-shadow: none;
  position: relative;
}

.picker-face::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / 16px no-repeat;
  transform: translateY(-50%);
  transition: transform 0.15s ease;
}

.picker-face:hover { background: var(--surface); border-color: #d1d5db; }

.picker-face.is-placeholder { color: var(--subtle); }

.picker-face.is-open,
.picker-face.is-open:hover,
.picker-face:focus-visible {
  background: var(--surface);
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--brand);
}

.picker-face.is-open::after { transform: translateY(-50%) rotate(180deg); }

.picker-menu {
  display: none;
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  width: auto;
  height: auto;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.12);
  max-height: min(280px, 50vh);
  overflow: auto;
}

.picker-menu.is-open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.picker-option {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
}

.picker-option:hover { background: var(--neutral-bg); }

.picker-option.is-selected,
.picker-option.is-selected:hover {
  background: var(--brand-soft);
  color: var(--brand-hover);
  font-weight: 600;
}

.picker-option.is-selected::after {
  content: "";
  width: 5px;
  height: 9px;
  margin-left: auto;
  margin-top: -2px;
  border: solid var(--brand);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  flex: none;
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stats .card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 118px;
}

.stats span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.stats i { color: var(--brand); }
.stats .metric-done i { color: #16a34a; }
.stats .metric-late i { color: #dc2626; }

.stats strong {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--ink);
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.section-title > span {
  min-width: 0;
  font-size: 12px;
  color: var(--subtle);
  font-weight: 400;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  padding: 20px 0 8px;
}

.filters label { flex: 1 1 160px; min-width: 0; }

.assignee-filter-label {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.assignee-filter {
  position: relative;
  margin: 0;
  color: var(--ink);
}
.assignee-filter summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 36px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  list-style: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.assignee-filter summary::-webkit-details-marker { display: none; }
.assignee-filter summary::after { content: '⌄'; position: absolute; right: 13px; }
.assignee-filter[open] summary::after { content: '⌃'; }
.assignee-filter-options {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.assignee-filter-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.assignee-filter-option:hover { background: var(--bg); }
.assignee-filter-option input,
.task-assignee-option input {
  appearance: auto;
  -webkit-appearance: auto;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
}

.task-assignee-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.task-assignee-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 4px 12px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.task-assignee-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  text-align: left;
}
.task-assignee-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-assignee-summary { margin: 3px 0 0; color: var(--subtle); }

.filters .check {
  flex: 0 1 auto;
  align-self: end;
  height: 42px;
  margin: 0;
  min-width: 0;
  white-space: normal;
}

#task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  min-height: 0;
  max-height: min(70dvh, 720px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

.task {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  position: relative;
}

.task::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--border);
}

.task[data-priority="alta"]::before { background: #dc2626; }
.task[data-priority="média"]::before { background: var(--brand); }
.task[data-priority="baixa"]::before { background: #9ca3af; }

.task:hover { border-color: #d1d5db; }

.task-main:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand);
}

.task-tools {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: none;
}

.task-icon {
  width: 22px;
  height: 18px;
  padding: 0;
  border-radius: 6px;
  color: var(--subtle);
}

.task-icon i { font-size: 11px; }

.task-icon:hover { color: var(--ink); }

.task-icon.danger:hover {
  background: var(--late-bg);
  color: var(--late-ink);
}

.task-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.task-meta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: center;
  gap: 4px;
  flex: none;
  min-width: 4.75rem;
}

.task-sub {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin: 2px 0 0;
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
}

.task-sub .area {
  flex: none;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink);
}

.task-sub .details {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.badge {
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--neutral-bg);
  color: var(--neutral-ink);
  font-size: 11px;
  font-weight: 600;
}

.badge.open {
  background: var(--brand-soft);
  color: #9a3412;
}

.badge.done {
  background: var(--success-bg);
  color: var(--success-ink);
}

.badge.archived {
  background: var(--neutral-bg);
  color: var(--subtle);
}

.badge.late {
  background: var(--late-bg);
  color: var(--late-ink);
}

.task-main {
  flex: 1;
  min-width: 0;
}

.task .badge,
.task .chip-prio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 100%;
  height: 22px;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}

.task h3 {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.chip-prio {
  flex: none;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  background: var(--neutral-bg);
  color: var(--neutral-ink);
}

.chip-prio[data-priority="alta"] { background: var(--late-bg); color: var(--late-ink); }
.chip-prio[data-priority="média"] { background: var(--warn-bg); color: var(--warn-ink); }
.chip-prio[data-priority="baixa"] { background: var(--neutral-bg); color: var(--neutral-ink); }

.late { color: #dc2626; font-weight: 600; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.actions-main,
.actions-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.actions-more {
  margin-left: auto;
}

.actions button {
  justify-content: center;
  flex: 0 0 auto;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.actions button i {
  font-size: 11px;
  color: var(--subtle);
}

.actions button:hover {
  background: var(--neutral-bg);
  border-color: #d1d5db;
}

.actions button[data-action="restore"],
.actions .ghost-accent {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(122, 0, 249, 0.22);
}

.actions button[data-action="restore"] i,
.actions .ghost-accent i {
  color: #fff;
}

.actions button[data-action="restore"]:hover,
.actions .ghost-accent:hover {
  background: var(--brand-hover);
  color: #fff;
}

.actions button[data-action="archive"]:hover {
  background: var(--warn-bg);
  border-color: #fdba74;
  color: var(--warn-ink);
}

.actions button[data-action="archive"]:hover i {
  color: var(--warn-ink);
}

.actions button[data-action="delete"],
.actions button.btn-danger {
  height: 36px;
  min-height: 36px;
  border-radius: 999px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transform: none;
}

.actions button[data-action="delete"] i,
.actions button.btn-danger i {
  color: var(--subtle);
}

.actions button[data-action="delete"]:hover,
.actions button.btn-danger:hover {
  background: var(--late-bg);
  border-color: #fecaca;
  color: var(--late-ink);
  transform: none;
}

.actions button[data-action="delete"]:hover i,
.actions button.btn-danger:hover i {
  color: var(--late-ink);
}

.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--subtle);
  font-size: 14px;
  background: #fcfcfb;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

.empty i {
  display: block;
  font-size: 28px;
  margin-bottom: 12px;
  color: #d1d5db;
}

.muted { font-size: 12px; color: var(--muted); }

#ranking {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.rank {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.rank-line {
  display: flex;
  min-width: 0;
  gap: 9px;
  align-items: center;
  font-size: 13px;
}

.rank-line i { color: var(--brand); }
.rank-line strong { flex: 1; overflow-wrap: anywhere; font-weight: 600; }
.rank-line span { font-size: 11px; color: var(--subtle); font-weight: 500; }

.bar {
  height: 6px;
  border-radius: 999px;
  background: #f3f4f6;
  margin-top: 10px;
  overflow: hidden;
}

.bar span {
  height: 100%;
  display: block;
  background: var(--brand);
  border-radius: 999px;
}

dialog {
  margin: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: min(560px, 94vw);
  max-height: min(90vh, 90dvh);
  overflow: auto;
  color: inherit;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.16);
}

#detail .section-title h2, #project-dialog .section-title h2 { margin: 0; }

#project-dialog { width: min(420px, 94vw); }
#project-dialog label { margin: 16px 0 8px; }
#project-dialog .primary { width: 100%; margin-top: 8px; }
#reminder-dialog,
#meeting-dialog { width: min(560px, 94vw); }
#reminder-dialog label,
#meeting-dialog label { margin: 14px 0 8px; }
#reminder-dialog .primary,
#meeting-dialog .primary { width: 100%; margin-top: 8px; }
#reminder-dialog .muted,
#meeting-dialog .muted { margin: 4px 0 8px; }
#reminder-dialog .recipient-option,
#meeting-dialog .recipient-option,
#reminder-dialog .check-field,
#meeting-dialog .check-field { margin: 0; }

.meeting-when { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.meeting-when label { margin: 0; }

.recipient-block { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.recipient-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.recipient-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.recipient-count { font-size: 12px; font-weight: 600; color: var(--subtle); }
.recipient-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.recipient-tools button { min-height: 40px; padding: 8px 12px; color: var(--muted); font-size: 13px; }
.recipient-search { gap: 6px; }
.recipient-search input { min-height: 40px; }
.recipient-list {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.recipient-option {
  display: grid;
  grid-template-columns: 18px 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.recipient-option:last-child { border-bottom: 0; }
.recipient-option:hover { background: var(--neutral-bg); }
.recipient-option.is-selected { background: var(--brand-soft); }
.recipient-option.is-disabled { opacity: 0.55; cursor: not-allowed; }
.recipient-option .avatar { width: 32px; height: 32px; font-size: 11px; }
.recipient-option input[type="checkbox"],
.recipient-tools input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
}
.recipient-empty { margin: 0; padding: 20px 12px; color: var(--muted); text-align: center; }

dialog::backdrop { background: rgba(17, 24, 39, 0.4); }

#drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(17, 24, 39, 0.35);
}

#drawer-backdrop[hidden] { display: none; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 41;
  width: min(400px, 100vw);
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
  overflow: auto;
  background: var(--surface);
  border: 0;
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 40px rgba(17, 24, 39, 0.12);
}

.drawer[hidden] { display: none; }

body.drawer-open { overflow: hidden; }

.drawer label { margin: 0; }

.drawer label { margin: 14px 0; }

.drawer .primary { width: 100%; border-radius: var(--radius-sm); margin-top: 8px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin: 16px 0;
}

.detail-grid div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.detail-grid span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}

.detail-grid strong {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.detail-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fcfcfb;
}

.detail-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.detail-times div, .detail-notes { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.detail-times span, .detail-notes > span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}

.detail-times strong {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.detail-copy {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}

#detail-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-history-title {
  margin: 22px 0 10px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--subtle);
}

#form-error, #project-error, #reminder-error, #meeting-error { color: #b91c1c; font-size: 13px; }
#project-error, #reminder-error, #meeting-error { min-height: 1.2em; margin: 0; }

#notice {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 1200;
  max-width: min(360px, calc(100vw - 40px));
  margin: 0;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#notice.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.login {
  max-width: 530px;
  margin: 28px auto;
  padding: 36px;
}

.login ol {
  padding-left: 20px;
  color: var(--muted);
  line-height: 2;
  font-size: 14px;
}

.login input:not([type="checkbox"]) {
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.login button { width: 100%; }

.remember,
.check {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.remember { margin: 14px 0 0; }

.remember input,
.check input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  box-shadow: none;
}

.remember .mark,
.check .mark {
  width: 20px;
  height: 20px;
  flex: none;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.remember:hover .mark,
.check:hover .mark { border-color: var(--brand); }

.remember input:focus-visible + .mark,
.check input:focus-visible + .mark {
  box-shadow: 0 0 0 3px rgba(122, 0, 249, 0.28);
}

.remember input:checked + .mark,
.check input:checked + .mark {
  background: var(--brand);
  border-color: var(--brand);
}

.remember input:checked + .mark::after,
.check input:checked + .mark::after {
  content: "";
  width: 5px;
  height: 9px;
  margin-top: -2px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

code {
  color: #9a3412;
  background: var(--brand-soft);
  padding: 3px 6px;
  border-radius: 6px;
  font-weight: 600;
}

.event {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
  font-size: 13px;
  background: #fcfcfb;
}

.event-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.event-top strong {
  flex: none;
  overflow-wrap: normal;
  font-weight: 700;
}

.event-meta {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px 8px;
  max-width: 100%;
  margin-left: auto;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.event-meta time { white-space: nowrap; font-variant-numeric: tabular-nums; }

.event p {
  margin: 6px 0 0;
  font-size: 12px;
  white-space: pre-wrap;
}

footer {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 18px 5vw;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  color: var(--ink);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  background: var(--surface);
  width: 100%;
}

footer strong {
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

footer > * { min-width: 0; }

footer span {
  font-size: 12px;
  font-weight: 400;
  color: var(--subtle);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

@media (min-width: 601px) and (max-width: 1040px) {
  .heading { align-items: flex-start; }
  .heading-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }
  .project-select { flex: 1 1 180px; max-width: 240px; }
  .heading-actions .primary,
  .heading-actions .project,
  .heading-actions .meeting,
  .heading-actions .remind {
    flex: 0 1 auto;
  }
}

@media (max-width: 900px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .columns > * { min-width: 0; }
  .columns aside { order: 2; }
  #task-list { max-height: none; overflow: visible; }
  .stats .card { padding: 20px; min-height: 0; }
  .stats strong { font-size: 1.75rem; }
}

@media (max-width: 600px) {
  header { height: 70px; padding: 0 18px; gap: 10px; }
  .brand { font-size: 20px; }
  .tag { display: none; }
  main { padding: 28px 18px 32px; }
  .heading { align-items: stretch; flex-direction: column; flex-wrap: nowrap; }
  .heading-actions { flex-direction: column; align-items: stretch; flex: none; }
  .project-select { flex: none; min-width: 0; }
  .project-select, .heading-actions .picker, .heading-actions .primary, .heading-actions .project, .heading-actions .meeting, .heading-actions .remind { width: 100%; flex: none; }
  .meeting-when { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; gap: 10px; }
  .stats .card { padding: 18px; flex-direction: row; justify-content: space-between; align-items: center; }
  .stats strong { font-size: 1.75rem; }
  .card { padding: 20px; }
  .filters { flex-wrap: wrap; }
  .filters label { min-width: 110px; }
  .filters .check { flex-basis: 100%; height: auto; justify-content: flex-start; }
  .detail-grid, .detail-times { grid-template-columns: 1fr; }
  .actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .actions-main,
  .actions-more {
    width: 100%;
    margin-left: 0;
    flex-wrap: nowrap;
  }
  .actions-main button,
  .actions-more button {
    flex: 1 1 0;
    height: 40px;
    min-height: 40px;
    padding: 0 10px;
  }
  .drawer { width: 100vw; }
  .section-title > span { max-width: 160px; text-align: right; }
  .login { padding: 24px; margin: 0; }
  #account {
    gap: 8px;
    font-size: 13px;
    min-width: 0;
    justify-content: flex-end;
  }
  #detail,
  #project-dialog,
  #reminder-dialog,
  #meeting-dialog,
  #person-editor {
    width: 100vw;
    max-width: none;
    max-height: 90dvh;
    margin: auto 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 20px 20px 0 0;
  }
  footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  }
  footer span { max-width: none; text-align: left; }
}
