/* Needs attention: the Mac's sheet over Home (NeedsAttentionListSheet and
   DeadlineAddSheet in mac-native). Same paper, stone cards, sections, rows
   and add sheet. */
:root {
  --na-paper: #fafbf6;
  --na-stone: #eff0e8;
  --na-chip: #e6e7de;
  --na-line: #e2e3da;
  --na-ink: #1d1d1f;
  --na-muted: rgba(60, 60, 67, 0.76);
  --na-yellow: #ffeeb5;
  --na-yellow-line: rgba(196, 143, 26, 0.12);
  --na-red: #fcc7c6;
  --na-red-line: rgba(194, 54, 54, 0.1);
  --na-lime: #617510;
}

.na-sheet-backdrop,
.na-sheet {
  display: none;
}

body.needs-attention-sheet-open .na-sheet-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.22);
  animation: na-fade 0.16s ease-out;
}

body.needs-attention-sheet-open .na-sheet {
  display: flex;
  flex-direction: column;
  position: fixed;
  z-index: 1201;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100vw - 32px));
  height: min(720px, calc(100dvh - 64px));
  transform: translate(-50%, -50%);
  overflow: hidden;
  border-radius: 14px;
  background: var(--na-paper);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22), 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  color: var(--na-ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  animation: na-rise 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes na-fade { from { opacity: 0; } }
@keyframes na-rise { from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); } }

.na-sheet button {
  min-width: 0;
  min-height: 0;
  font: inherit;
  cursor: pointer;
}

.na-sheet svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Close sits beside Add in the header, as on the Mac. */
.na-sheet-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--na-chip);
  color: var(--na-muted);
}

.na-sheet-close svg { width: 12px; height: 12px; stroke-width: 2.6; }
.na-sheet-close:hover { color: var(--na-ink); }

.na-sheet-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 28px;
  scrollbar-width: none;
}

.na-sheet-scroll::-webkit-scrollbar { display: none; }

.na-sheet-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 20px 0 16px;
}

.na-sheet-header h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--na-ink);
}

.na-sheet-add {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0.85px solid rgba(226, 227, 218, 0.66);
  border-radius: 50%;
  background: rgba(255, 238, 179, 0.92);
  color: var(--na-ink);
}

.na-sheet-add svg { width: 15px; height: 15px; stroke-width: 2.4; }
.na-sheet-add:hover { background: var(--na-yellow); }

.na-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.na-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.na-section h3 {
  margin: 0;
  padding: 0 4px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--na-muted);
}

.na-card {
  padding: 10px 0;
  border: 0.5px solid var(--na-line);
  border-radius: 20px;
  background: var(--na-stone);
}

.na-empty {
  margin: 0;
  padding: 18px;
  border: 0.5px solid var(--na-line);
  border-radius: 20px;
  background: var(--na-stone);
  font-size: 15.5px;
  color: var(--na-muted);
}

.na-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 51px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--na-ink);
  text-align: left;
}

.na-row { position: relative; }

/* The Mac divider starts after the icon tile (62 pt in). */
.na-row + .na-row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 62px;
  height: 1px;
  background: rgba(0, 0, 0, 0.07);
}

.na-row:hover .na-row-title { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(0, 0, 0, 0.25); }
.na-row:focus-visible { outline: 2px solid var(--na-lime); outline-offset: -2px; border-radius: 12px; }

.na-row-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 13px;
  border: 0.75px solid var(--na-yellow-line);
  background: var(--na-yellow);
  color: rgba(29, 29, 31, 0.76);
}

.na-row-icon.is-due {
  border-color: var(--na-red-line);
  background: var(--na-red);
}

.na-row-icon svg { width: 18px; height: 18px; stroke-width: 1.7; }

.na-row-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.na-row-title,
.na-row-due {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.na-row-title { font-size: 15.2px; font-weight: 600; line-height: 1.2; }
.na-row-due { font-size: 13.2px; font-weight: 400; line-height: 1.2; color: var(--na-muted); }

.na-row-chevron {
  flex: none;
  width: 16px;
  height: 16px;
  color: rgba(29, 29, 31, 0.64);
  stroke-width: 2.6;
}

/* Add sheet: a second sheet over the list, as on the Mac. */
.na-add-backdrop {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(0, 0, 0, 0.18);
}

.na-add-sheet {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 24px;
  transform: translate(-50%, -50%);
  border-radius: 14px;
  background: var(--na-paper);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(0, 0, 0, 0.12);
}

.na-add-sheet[hidden],
.na-add-backdrop[hidden],
.na-add-row[hidden] {
  display: none;
}

.na-add-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.na-add-head h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--na-ink);
}

.na-add-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--na-stone);
  color: var(--na-ink);
}

.na-add-close svg { width: 14px; height: 14px; stroke-width: 2.4; }

.na-add-label {
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--na-muted);
}

.na-add-field {
  box-sizing: border-box;
  width: 100%;
  border: 0.85px solid rgba(226, 227, 218, 0.78);
  border-radius: 16px;
  background: var(--na-stone);
  color: var(--na-ink);
}

.na-add-title {
  min-height: 74px;
  padding: 14px;
  resize: vertical;
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  outline: none;
}

.na-add-title:focus,
.na-add-row:focus-within {
  border-color: rgba(97, 117, 16, 0.55);
}

.na-add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 50px;
  padding: 0 14px;
  font-size: 15.5px;
  font-weight: 500;
}

.na-add-row input[type="date"],
.na-add-row input[type="time"] {
  min-width: 0;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: var(--na-chip);
  color: var(--na-ink);
  font: inherit;
  font-size: 15px;
  outline: none;
}

.na-add-toggle {
  height: 46px;
  font-size: 15px;
  cursor: pointer;
}

/* The Mac switch, tinted lime when on. */
.na-add-toggle input {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 11px;
  background: rgba(120, 120, 128, 0.24);
  appearance: none;
  cursor: pointer;
  transition: background 0.16s ease;
}

.na-add-toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.16s ease;
}

.na-add-toggle input:checked { background: var(--na-lime); }
.na-add-toggle input:checked::after { transform: translateX(16px); }

.na-add-submit {
  height: 48px;
  margin-top: 16px;
  border: 0;
  border-radius: 999px;
  background: var(--na-ink);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.na-add-submit:disabled {
  opacity: 0.42;
  cursor: default;
}

@media (max-width: 640px) {
  body.needs-attention-sheet-open .na-sheet {
    top: auto;
    bottom: 0;
    width: 100vw;
    height: calc(100dvh - 48px);
    transform: translateX(-50%);
    border-radius: 14px 14px 0 0;
    animation: none;
  }

  .na-sheet-scroll { padding: 0 16px 24px; }
  .na-sheet-header h2 { font-size: 26px; }
}

/* The app's global field sizes don't apply inside the sheet. */
.na-add-sheet input,
.na-add-sheet textarea {
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  box-shadow: none;
}

.na-add-sheet .na-add-toggle input {
  height: 22px;
  padding: 0;
  border: 0;
}

.na-add-sheet .na-add-row input[type="date"],
.na-add-sheet .na-add-row input[type="time"] {
  height: 32px;
  border: 0;
}
