/* The bottom sheet (layouts/_sheet): actions for a tapped task, block or
   habit, and the More menu. It slides up from the bottom on phones and sits
   centred as a small card on larger screens. */

.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -12px 40px -12px rgba(10, 16, 32, 0.35);
  overscroll-behavior: contain;
}

.sheet[open] {
  animation: sheet-up 0.22s var(--ease-out);
}

.sheet::backdrop {
  background: rgba(10, 16, 32, 0.38);
}

html.has-open-sheet {
  overflow: hidden;
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 641px) {
  .sheet {
    margin: auto;
    border-radius: 20px;
  }
}

.sheet-panel {
  display: flex;
  flex-direction: column;
  padding: 8px 16px calc(12px + env(safe-area-inset-bottom));
}

.sheet-handle {
  width: 40px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: var(--line-strong);
}

.sheet-header {
  padding: 4px 4px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.sheet-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.sheet-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.85rem;
}

.sheet-note {
  margin-top: 6px;
  color: var(--body);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sheet-menu,
.sheet-actions {
  display: flex;
  flex-direction: column;
}

.sheet-actions form {
  margin: 0;
}

.sheet-action {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 10px 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sheet-action:active {
  background: var(--surface-sunken);
}

/* Touch screens would keep the hover look on whatever was tapped last. */
@media (hover: hover) {
  .sheet-action:hover {
    background: var(--surface-sunken);
  }
}

.sheet-action:disabled {
  color: var(--faint);
  cursor: default;
  background: none;
}

.sheet-action .tab-icon,
.sheet-action-icon {
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 1.15rem;
  line-height: 24px;
}

.sheet-action-primary {
  color: var(--teal-ink);
  font-weight: 600;
}

.sheet-action-primary .sheet-action-icon {
  color: var(--teal-ink);
}

.sheet-action-quiet {
  color: var(--body);
}

.sheet-action-danger {
  color: var(--danger-ink);
}

/* "At [time] [Set]" on one row. */
.sheet-time-form {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 8px;
}

.sheet-time-form label {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 500;
}

.sheet-time-form input[type="time"] {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
  font-size: 16px;
}

.sheet-time-form .btn-primary {
  flex: none;
  min-height: 44px;
}

.sheet-close {
  min-height: 48px;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-sunken);
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
