:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #ffffff;
  --bg-soft: rgba(255, 255, 255, 0.82);
  --text: #1c1c1e;
  --muted: #8e8e93;
  --muted-strong: #636366;
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --danger: #ff3b30;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-border: rgba(28, 28, 30, 0.08);
  --shadow: 0 24px 60px rgba(28, 28, 30, 0.08);
  --shadow-soft: 0 10px 26px rgba(28, 28, 30, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --content-width: 480px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(0, 122, 255, 0.08), transparent 36%),
    linear-gradient(180deg, #fdfdff 0%, #ffffff 18%, #ffffff 100%);
  color: var(--text);
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
}

body {
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
}

textarea,
input {
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
}

.auth-shell,
.app-view {
  width: 100%;
  max-width: var(--content-width);
  min-height: 100%;
}

.auth-shell {
  display: grid;
  place-items: center;
  padding: 20px 18px;
}

.auth-panel {
  width: 100%;
  padding: 28px;
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.eyebrow,
.sheet-eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.auth-panel h1,
.hero h1 {
  margin: 0;
  font-size: clamp(40px, 9vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.auth-copy {
  margin: 14px 0 0;
  color: var(--muted-strong);
  line-height: 1.6;
}

.auth-form,
.sheet-form {
  margin-top: 28px;
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 10px;
  font-size: 14px;
  color: var(--muted-strong);
}

.field span {
  font-size: 13px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(120, 120, 128, 0.08);
  color: var(--text);
  resize: none;
  line-height: 1.45;
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(142, 142, 147, 0.85);
}

.primary-button,
.ghost-button,
.segment,
.fab {
  cursor: pointer;
}

.primary-button {
  min-height: 54px;
  border-radius: 18px;
  background: linear-gradient(180deg, #0a84ff 0%, #007aff 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 14px 28px rgba(0, 122, 255, 0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.primary-button:active,
.ghost-button:active,
.segment:active,
.fab:active {
  transform: scale(0.98);
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(0, 122, 255, 0.08);
}

.app-view {
  position: relative;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.chrome-blur {
  position: absolute;
  inset: 0 0 auto;
  height: 140px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: 1;
}

.app-header {
  position: relative;
  z-index: 2;
  padding: 0 20px;
}

.status-pad {
  height: max(18px, env(safe-area-inset-top));
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
}

.hero-date {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 15px;
}

.toolbar {
  position: sticky;
  top: 0;
  padding: 18px 0 10px;
  backdrop-filter: blur(14px);
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(80px, 1fr));
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.08);
}

.segment {
  min-height: 36px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--muted-strong);
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.segment.is-active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 16px rgba(28, 28, 30, 0.06);
}

.toolbar-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.scroll-region {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px calc(120px + env(safe-area-inset-bottom));
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.scroll-region::-webkit-scrollbar {
  display: none;
}

.list-section {
  padding-top: 6px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.08);
  color: var(--muted-strong);
  font-size: 13px;
}

.task-list {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.task-row {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.9);
  transition:
    height 0.26s ease,
    margin 0.26s ease,
    opacity 0.22s ease,
    transform 0.22s ease;
}

.task-row.is-collapsing {
  height: 0 !important;
  margin: 0;
  opacity: 0;
}

.task-row.is-swipe-ready .task-surface {
  transition: transform 0.16s ease-out;
}

.task-actions {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.task-action-left,
.task-action-right {
  display: inline-flex;
  align-items: center;
  min-width: 68px;
  min-height: 100%;
}

.task-action-left {
  justify-content: flex-start;
}

.task-action-right {
  justify-content: flex-end;
}

.task-row[data-swipe="right"] .task-actions {
  background: linear-gradient(90deg, #ff3b30, rgba(255, 59, 48, 0.72));
}

.task-row[data-swipe="left"] .task-actions {
  background: linear-gradient(270deg, #007aff, rgba(0, 122, 255, 0.7));
}

.task-row[data-swipe="idle"] .task-actions {
  background: rgba(120, 120, 128, 0.08);
}

.task-surface {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.92);
  touch-action: pan-y;
  will-change: transform;
}

.task-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.task-meta strong {
  font-weight: 600;
  color: var(--muted-strong);
}

.task-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.08);
  color: var(--accent);
}

.task-row[data-status="archived"] .task-status {
  background: rgba(142, 142, 147, 0.12);
  color: var(--muted-strong);
}

.empty-state {
  margin-top: 28px;
  padding: 30px 24px;
  border-radius: var(--radius-xl);
  background: rgba(120, 120, 128, 0.06);
  text-align: center;
}

.empty-title {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.empty-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.fab {
  position: absolute;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 3;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(180deg, #0a84ff 0%, #007aff 100%);
  color: #ffffff;
  font-size: 34px;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.sheet-backdrop.is-visible {
  opacity: 1;
}

.sheet {
  position: absolute;
  inset: auto 0 0;
  z-index: 5;
  margin: 0 auto;
  width: 100%;
  max-width: var(--content-width);
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -20px 50px rgba(28, 28, 30, 0.14);
  transform: translateY(104%);
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.32, 1);
}

.sheet.is-visible {
  transform: translateY(0);
}

.sheet-grabber {
  width: 42px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: rgba(60, 60, 67, 0.18);
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.sheet-field textarea {
  min-height: 66px;
  max-height: 160px;
}

.sheet-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sheet-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 6;
  transform: translate(-50%, 16px);
  min-width: 140px;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.88);
  color: #ffffff;
  text-align: center;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 481px) {
  .app-view {
    border-left: 1px solid rgba(28, 28, 30, 0.06);
    border-right: 1px solid rgba(28, 28, 30, 0.06);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
  }
}

@media (display-mode: standalone) {
  body {
    background: #ffffff;
  }

  .chrome-blur {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0));
  }
}
