body {
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  background: transparent;
  color: var(--dx-text);
  font-family: var(--dx-font);
}

[hidden] {
  display: none !important;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 20;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--dx-card);
  color: var(--dx-text);
  border-radius: var(--dx-radius-sm);
}

.dx-header .dx-actions {
  min-width: 0;
  max-width: 46%;
}

#sync-label {
  min-width: 0;
  text-align: right;
  font-size: 0.75rem;
  color: var(--dx-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dx-header [data-dong-theme-toggle] {
  position: static;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  margin: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.dx-header [data-dong-theme-toggle] .dong-theme-toggle__track {
  width: 2.75rem;
  height: 1.75rem;
  border-radius: 999px;
  border: 1px solid var(--dx-border);
  background: var(--dx-card);
  box-shadow: none;
}

main {
  padding: 4px 16px 16px;
}

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 16px;
  padding: 10px 12px;
  border-radius: var(--dx-radius);
  background: var(--dx-card);
  color: var(--dx-text);
  border: 1px solid var(--dx-border);
  box-shadow: var(--dx-shadow);
  backdrop-filter: blur(var(--dx-blur));
  -webkit-backdrop-filter: blur(var(--dx-blur));
  font-weight: 600;
}

.banner-warn {
  border-color: #9f1239;
}

.banner .btn {
  width: auto;
}

h2, h3, p {
  overflow-wrap: anywhere;
}

.hero,
.card {
  background: var(--dx-card);
  color: var(--dx-text);
  border: 1px solid var(--dx-border);
  border-radius: var(--dx-radius);
  box-shadow: var(--dx-shadow);
  backdrop-filter: blur(var(--dx-blur));
  -webkit-backdrop-filter: blur(var(--dx-blur));
  padding: 14px;
  margin: 0 0 12px;
  min-width: 0;
}

.hero {
  padding: 16px;
}

.hero h2,
.card h2,
.card h3 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.card h3 {
  font-size: 1rem;
}

.card-title {
  font-size: 1rem !important;
  margin-bottom: 8px;
}

.muted,
.stat-label,
.hint,
.field-label,
.when {
  color: var(--dx-muted);
}

.muted,
.when,
.stat-label {
  margin: 6px 0 0;
  font-size: 0.85rem;
}

.countdown {
  margin: 14px 0 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.stat-num {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.bar-cap {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 12px 0 6px;
  font-size: 0.82rem;
}

.bar-cap b,
.badge,
.count-line b {
  font-variant-numeric: tabular-nums;
}

.bar {
  display: block;
  height: 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--dx-muted) 28%, transparent);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--dx-accent);
}

.section-title {
  margin: 16px 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dx-on-bg);
  text-shadow: 0 1px 2px hsl(0 0% 0% / 0.85), 0 0 12px hsl(0 0% 0% / 0.6);
}

.stack {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-main,
.block-link {
  display: block;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.meta,
.split,
.ref-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ref-line {
  justify-content: space-between;
}

.chip,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dx-text) 8%, var(--dx-card-solid));
  color: var(--dx-text);
  font-size: 0.75rem;
  font-weight: 700;
}

.chip-done,
.chip-approved,
.chip-drafting,
.chip-with_supervisor {
  background: var(--dx-accent-soft);
  color: var(--dx-accent);
}

.badge {
  flex-shrink: 0;
}

.badge.soon {
  background: #9f1239;
  color: #fff;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.readonly {
  margin: 0;
  overflow-wrap: anywhere;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}

.field-label,
.picker legend {
  font-size: 0.8rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--dx-border);
  border-radius: var(--dx-radius-sm);
  background: var(--dx-card-solid);
  color: var(--dx-text);
  font: inherit;
  font-size: 16px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.btn,
.icon-btn,
.tabs a,
.check,
summary {
  min-height: 44px;
}

.btn,
.icon-btn {
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--dx-radius-sm);
  background: var(--dx-accent);
  color: var(--dx-accent-fg);
  font-weight: 600;
}

.btn-ghost {
  width: auto;
  margin-top: 0;
  background: var(--dx-card-solid);
  color: var(--dx-text);
  border: 1px solid var(--dx-border);
}

.add-inline {
  width: 100%;
  margin-top: 8px;
}

.btn-danger {
  background: #9f1239;
  color: #fff;
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--dx-border);
  border-radius: var(--dx-radius-sm);
  background: var(--dx-card-solid);
  color: var(--dx-text);
}

.icon-btn:disabled {
  opacity: 0.35;
}

.row > .check,
.action .check:not(:has(span)) {
  width: 44px;
  min-width: 44px;
  flex: 0 0 44px;
  justify-content: center;
}

.row-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.check input {
  width: 22px;
  height: 22px;
  min-height: 22px;
  flex: 0 0 auto;
}

.check span {
  overflow-wrap: anywhere;
}

.action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.action .check {
  flex: 0 0 auto;
}

.action input[type="text"] {
  flex: 1 1 140px;
}

.action input[type="date"] {
  flex: 1 1 150px;
}

.picker {
  margin: 12px 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.back,
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--dx-accent);
  font-weight: 600;
  text-decoration: none;
}

.count-line,
.pad {
  margin: 4px 0 12px;
}

.done-box summary {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
}

.tabs {
  position: fixed;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  width: min(640px, 100%);
  margin: 0 auto;
  display: flex;
  gap: 4px;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  background: var(--dx-header);
  border: 0;
  border-top: 1px solid var(--dx-border);
  border-radius: 0;
  overflow: hidden;
  backdrop-filter: blur(var(--dx-blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--dx-blur)) saturate(1.4);
}

.tabs a {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 2px;
  border-radius: 999px;
  text-align: center;
  text-decoration: none;
  color: var(--dx-muted);
  background: transparent;
  font-family: var(--dx-font);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
}

.tabs a.is-active,
.tabs a[aria-current="page"] {
  background: var(--dx-accent-soft);
  color: var(--dx-accent);
  box-shadow: none;
}

:focus-visible {
  outline: 2px solid var(--dx-accent);
  outline-offset: 2px;
}

button,
a,
.check {
  touch-action: manipulation;
}

.notion-comments {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notion-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.notion-meter .bar {
  flex: 1;
  min-width: 0;
}

.notion-meter-label {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.notion-section {
  min-width: 0;
  margin-top: 10px;
}

.notion-ticks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.notion-card input:disabled {
  opacity: 1;
}

.notion-card .field > .chip {
  align-self: flex-start;
  max-width: 100%;
}

.chip-priority-high {
  background: #9f1239;
  color: #fff7f7;
}

.chip-priority-medium {
  background: #92400e;
  color: #fffbeb;
}

.chip-priority-low {
  background: #166534;
  color: #f0fdf4;
}

.badge-reviewed {
  background: #166534;
  color: #f0fdf4;
}
