:root {
  --page-bg: #ebebeb;
  --canvas: #ffffff;
  --canvas-soft: #fafafa;
  --line: #e2e2e2;
  --line-strong: #d5d5d5;
  --ink: #202020;
  --ink-muted: #727272;
  --accent: #ff5a00;
  --accent-strong: #ea4f00;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page-bg);
}

.app-shell {
  width: min(1000px, 100vw);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--canvas);
  border-left: 1px solid #e7e7e7;
  border-right: 1px solid #e7e7e7;
  padding: 0;
}

.app-header,
.sections-grid,
.toolbar-bottom {
  width: calc(100% - 1.9rem);
  margin-left: 0.95rem;
  margin-right: 0.95rem;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem;
  padding-top: 0.85rem;
  padding-bottom: 0.52rem;
  border-bottom: none;
}

.status-tools {
  display: inline-flex;
  align-items: flex-start;
}

.branding {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-shell {
  width: 44px;
  height: 44px;
  border-radius: 0;
  background: transparent;
  border: none;
  overflow: hidden;
  display: block;
}

.logo-shell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.logo-shell.fallback {
  font-family: "Inter Tight", "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #505050;
  font-size: 0.82rem;
}

h1 {
  margin: 0;
  font-family: "Inter Tight", "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: -0.05em;
  font-size: clamp(1.24rem, 2.3vw, 1.85rem);
  line-height: 1;
}

.title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  font-size: 0.69rem;
  color: var(--ink-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--canvas-soft);
  padding: 0.28rem 0.5rem;
  cursor: default;
}

.language-toggle {
  border: 1px solid #ffd7c2;
  border-radius: 999px;
  background: #fff7f2;
  color: #9e4400;
  font-size: 0.69rem;
  font-weight: 600;
  padding: 0.28rem 0.56rem;
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.language-toggle:hover {
  border-color: #ffc19f;
  background: #fff2ea;
}

.language-toggle.active {
  border-color: rgba(255, 90, 0, 0.45);
  color: #8f3e00;
  background: rgba(255, 90, 0, 0.12);
}

.language-toggle.loading {
  opacity: 0.7;
}

.language-icon {
  width: 0.74rem;
  height: 0.74rem;
  border: 1.4px solid currentColor;
  border-radius: 50%;
  position: relative;
  display: inline-block;
}

.language-icon::before,
.language-icon::after {
  content: "";
  position: absolute;
}

.language-icon::before {
  inset: -1px 2.8px;
  border-left: 1px solid currentColor;
  border-right: 1px solid currentColor;
  border-radius: 50%;
}

.language-icon::after {
  left: 1px;
  right: 1px;
  top: 50%;
  border-top: 1px solid currentColor;
}

.sync-dot {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: #9a9a9a;
  transition: background-color 140ms ease;
}

.sync-pill.connected .sync-dot {
  background: var(--accent);
}

.sections-grid {
  margin-top: 0.12rem;
}

.section-card {
  padding: 0.46rem 0.04rem 0.62rem;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 0.12rem;
  margin-bottom: 0.24rem;
}

.section-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  flex: 0 1 auto;
  min-width: 8ch;
  max-width: calc(100% - 4.2rem);
}

.section-head > .delete-btn {
  margin-left: auto;
}

.section-title-input {
  width: auto;
  flex: 0 1 auto;
  min-width: 8ch;
  max-width: 100%;
  font-family: "Inter Tight", "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 0.33rem 0.4rem;
}

.section-title-input:focus {
  outline: none;
  border-color: var(--line);
  background: var(--canvas-soft);
}

.drag-btn,
.delete-btn {
  width: 1.7rem;
  height: 1.7rem;
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #767676;
  font: inherit;
}

.drag-btn {
  cursor: grab;
}

.drag-btn:active {
  cursor: grabbing;
}

.drag-btn:hover,
.delete-btn:hover {
  color: #2f2f2f;
}

.delete-btn {
  opacity: 0.14;
  transition: opacity 130ms ease, color 130ms ease;
}

.section-card:hover .delete-btn,
.task-item:hover .delete-btn,
.task-item:focus-within .delete-btn {
  opacity: 0.34;
}

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

.task-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  align-items: center;
  gap: 0.22rem;
  min-height: 2rem;
  border-top: 1px solid var(--line);
}

.task-checkbox {
  width: 0.9rem;
  height: 0.9rem;
  margin: 0;
  accent-color: #666666;
}

.task-text-input {
  width: 100%;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.26;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.31rem 0.36rem;
}

.task-text-input:focus {
  outline: none;
  border-color: var(--line);
  background: var(--canvas-soft);
}

.task-item.is-done .task-text-input {
  text-decoration: line-through;
  opacity: 0.45;
}

.task-item.is-done {
  opacity: 0.72;
}

.task-item.is-priority {
  background: rgba(255, 218, 89, 0.16);
}

.task-item.is-priority .task-text-input {
  color: #5a4a1a;
}

.priority-btn {
  width: 1.7rem;
  height: 1.7rem;
  border: none;
  background: transparent;
  border-radius: 7px;
  color: #c0c0c0;
  font-size: 0.92rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: color 120ms ease, transform 120ms ease;
}

.priority-btn:hover {
  color: #888888;
  transform: translateY(-1px);
}

.priority-btn.active {
  color: #f2b400;
}

.task-add-btn {
  width: 1.74rem;
  height: 1.74rem;
  min-width: 1.74rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: #4b4b4b;
  font-size: 1.14rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.task-add-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.task-add-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.section-task-add {
  margin-right: 0;
  flex: 0 0 auto;
}

.toolbar-bottom {
  margin-top: 1.25rem;
  padding-bottom: 1.15rem;
  padding-top: 0;
  border-top: none;
}

.section-cta {
  border: none;
  background: var(--accent);
  color: #ffffff;
  border-radius: 999px;
  min-height: 2.2rem;
  padding: 0.22rem 0.3rem 0.22rem 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background-color 120ms ease;
}

.section-cta:hover {
  background: var(--accent-strong);
}

.section-cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.section-cta-icon {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
  display: grid;
  place-items: center;
  font-size: 0.96rem;
  line-height: 1;
}

.empty-state {
  padding: 0.9rem 0.2rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.drag-ghost {
  opacity: 0.34;
}

.drag-chosen {
  opacity: 0.86;
}

.save-toast {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%) translateY(-8px);
  opacity: 0;
  pointer-events: none;
  background: #43b86f;
  color: #ffffff;
  border-radius: 999px;
  padding: 0.4rem 0.66rem;
  font-size: 0.75rem;
  transition: opacity 150ms ease, transform 150ms ease;
  z-index: 60;
}

.save-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.polish-mode .section-title-input[readonly],
.polish-mode .task-text-input[readonly] {
  cursor: default;
}

.translate-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(1px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
  z-index: 55;
}

.translate-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.translate-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #ebc8b1;
  border-radius: 999px;
  padding: 0.52rem 0.78rem;
  color: #7b3400;
  font-size: 0.79rem;
  font-weight: 600;
}

.translate-spinner {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid rgba(255, 90, 0, 0.22);
  border-top-color: #ff5a00;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 700px) {
  .app-header,
  .sections-grid,
  .toolbar-bottom {
    width: calc(100% - 1rem);
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }

  .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 0.5rem;
    row-gap: 0.2rem;
    padding-top: 0.72rem;
  }

  .branding {
    min-width: 0;
  }

  .status-tools {
    justify-self: end;
    align-self: start;
  }

  .title-row {
    flex-wrap: wrap;
    row-gap: 0.25rem;
  }

  .section-card {
    padding-inline: 0;
  }

  .task-item {
    min-height: 2.22rem;
  }

  .task-checkbox {
    width: 1.06rem;
    height: 1.06rem;
  }

  .drag-btn,
  .delete-btn,
  .priority-btn,
  .task-add-btn {
    width: 2.02rem;
    height: 2.02rem;
  }

  .section-cta {
    width: 100%;
    justify-content: space-between;
    min-height: 2.5rem;
  }
}
