/* ------------------------------------------------------------------
   Everforest dark — design tokens
------------------------------------------------------------------ */
:root {
  color-scheme: dark;

  --bg-dim: #232a2e;
  --bg0: #2d353b;
  --bg1: #343f44;
  --bg2: #3d484d;
  --bg3: #475258;
  --bg4: #4f585e;

  --border: #3d484d;
  --border-soft: #343f44;
  --border-strong: #475258;

  --fg: #d3c6aa;
  --fg-muted: #9da9a0;
  --fg-dim: #859289;
  --fg-faint: #7a8478;

  --green: #a7c080;
  --aqua: #83c092;
  --blue: #7fbbb3;
  --yellow: #dbbc7f;
  --orange: #e69875;
  --red: #e67e80;
  --purple: #d699b6;

  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Menlo, Consolas,
    "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Noto Sans SC",
    "Microsoft YaHei", sans-serif;

  --radius: 14px;
  --shadow: 0 18px 45px rgba(10, 14, 16, 0.45);
}

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

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(1100px 560px at 12% -12%, rgba(167, 192, 128, 0.07), transparent 62%),
    radial-gradient(900px 520px at 108% 6%, rgba(131, 192, 146, 0.055), transparent 58%),
    var(--bg-dim);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(167, 192, 128, 0.28);
  color: #f3ead3;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg4) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: var(--bg4);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ------------------------------------------------------------------
   Buttons & fields
------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--bg2);
  color: var(--fg);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
  user-select: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: #232a2e;
  font-weight: 650;
}
.btn-primary:hover:not(:disabled) {
  background: #b8d095;
  border-color: #b8d095;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--fg-muted);
  padding: 6px 13px;
  font-size: 13px;
}
.btn-ghost:hover {
  color: var(--fg);
  border-color: var(--fg-faint);
  background: var(--bg1);
}

.btn-block {
  width: 100%;
  padding: 10px 16px;
  font-size: 14.5px;
}

.btn-sm {
  padding: 5px 13px;
  font-size: 12.5px;
  border-radius: 8px;
}

.field {
  background: var(--bg1);
  border: 1px solid var(--border-soft);
  color: var(--fg);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 13px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.field:focus {
  border-color: var(--aqua);
  box-shadow: 0 0 0 3px rgba(131, 192, 146, 0.12);
}

/* ------------------------------------------------------------------
   Boot
------------------------------------------------------------------ */
.boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--fg-dim);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.boot-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(167, 192, 128, 0.1);
  border: 1px solid rgba(167, 192, 128, 0.25);
  color: var(--green);
  font-size: 22px;
  animation: pulse 1.6s ease-in-out infinite;
}

.boot-mark svg {
  width: 22px;
  height: 22px;
}

/* ------------------------------------------------------------------
   Login
------------------------------------------------------------------ */
.login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 28px 20px;
}

.login-card {
  position: relative;
  width: min(380px, 100%);
  padding: 36px 30px 28px;
  background: linear-gradient(180deg, #303940 0%, var(--bg0) 55%, #2a3237 100%);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(167, 192, 128, 0.45),
    rgba(131, 192, 146, 0.25),
    transparent
  );
}

.login-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(167, 192, 128, 0.1);
  border: 1px solid rgba(167, 192, 128, 0.3);
  color: var(--green);
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 0 32px rgba(167, 192, 128, 0.08);
}

.login-mark svg {
  width: 27px;
  height: 27px;
}

.login-card h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.login-sub {
  margin: 6px 0 22px;
  color: var(--fg-dim);
  font-size: 13px;
}

.login-input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  background: var(--bg-dim);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--fg);
  font-size: 15px;
  letter-spacing: 0.04em;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.login-input::placeholder {
  color: var(--fg-faint);
  letter-spacing: 0;
}

.login-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(167, 192, 128, 0.12);
}

.login-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--red);
  font-size: 12.5px;
}

.login-foot {
  margin: 0;
  color: var(--fg-faint);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

.login.shake .login-card {
  animation: shake 0.36s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ------------------------------------------------------------------
   App header
------------------------------------------------------------------ */
.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px 44px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -20px;
  background: rgba(35, 42, 46, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.app-header-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-mark {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(167, 192, 128, 0.11);
  border: 1px solid rgba(167, 192, 128, 0.28);
  color: var(--green);
  font-size: 17px;
  line-height: 1;
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.brand-text h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-path {
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(167, 192, 128, 0.12);
}

.sync-dot.is-offline {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(230, 126, 128, 0.12);
}

/* ------------------------------------------------------------------
   Add bar
------------------------------------------------------------------ */
.app-main {
  padding-top: 24px;
}

.add-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.add-bar:focus-within {
  border-color: rgba(167, 192, 128, 0.45);
  box-shadow:
    0 0 0 3px rgba(167, 192, 128, 0.08),
    0 10px 30px rgba(10, 14, 16, 0.18);
}

.add-text {
  flex: 1;
  min-width: 0;
  padding: 8px 6px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
}

.add-text::placeholder {
  color: var(--fg-faint);
  font-family: var(--sans);
  font-size: 13.5px;
}

.field-priority {
  width: 58px;
  flex: none;
  text-align: center;
  padding: 6px 4px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--yellow);
  cursor: pointer;
}

.field-date {
  width: 136px;
  flex: none;
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: 11.5px;
  cursor: pointer;
}

.add-bar .btn {
  flex: none;
  padding: 8px 18px;
}

/* ------------------------------------------------------------------
   Toolbar
------------------------------------------------------------------ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 14px;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg0);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-dim);
  font-size: 13px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.tab:hover {
  color: var(--fg);
}

.tab.is-active {
  background: var(--bg2);
  color: var(--fg);
}

.tab-count {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg1);
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 16px;
}

.tab.is-active .tab-count {
  background: rgba(167, 192, 128, 0.12);
  color: var(--green);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.field-search {
  width: 210px;
  background: var(--bg0);
  border-color: var(--border-soft);
  font-size: 12.5px;
}

.field-search::placeholder {
  color: var(--fg-faint);
}

.field-sort {
  background: var(--bg0);
  border-color: var(--border-soft);
  color: var(--fg-muted);
  font-size: 12.5px;
  cursor: pointer;
}

/* ------------------------------------------------------------------
   Todo list
------------------------------------------------------------------ */
.todo-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--bg0);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.todo-list:empty {
  display: none;
}

.todo-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 12px 14px;
  transition: background 0.12s ease;
}

.todo-item + .todo-item {
  border-top: 1px solid var(--border-soft);
}

.todo-item:hover {
  background: rgba(61, 72, 77, 0.32);
}

.todo-item.is-overdue {
  box-shadow: inset 2px 0 0 rgba(230, 126, 128, 0.55);
}

.check {
  position: relative;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  padding: 0;
  border: 1.5px solid var(--fg-faint);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.check:hover {
  border-color: var(--green);
  background: rgba(167, 192, 128, 0.1);
}

.check::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: 5px;
  height: 9px;
  border: solid #232a2e;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -58%) rotate(45deg) scale(0.6);
  opacity: 0;
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}

.check[aria-checked="true"] {
  background: var(--green);
  border-color: var(--green);
}

.check[aria-checked="true"]::after {
  opacity: 1;
  transform: translate(-50%, -58%) rotate(45deg) scale(1);
}

.todo-body {
  min-width: 0;
}

.todo-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.todo-text {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
  color: var(--fg);
  overflow-wrap: anywhere;
}

.prio {
  flex: none;
  align-self: center;
  padding: 1px 5px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.35;
}

.prio[data-priority="A"] {
  color: var(--red);
  background: rgba(230, 126, 128, 0.1);
}
.prio[data-priority="B"] {
  color: var(--orange);
  background: rgba(230, 152, 117, 0.1);
}
.prio[data-priority="C"] {
  color: var(--yellow);
  background: rgba(219, 188, 127, 0.1);
}
.prio[data-priority="D"] {
  color: var(--aqua);
  background: rgba(131, 192, 146, 0.1);
}
.prio[data-priority="E"] {
  color: var(--blue);
  background: rgba(127, 187, 179, 0.1);
}
.prio[data-priority="F"],
.prio[data-priority="G"],
.prio[data-priority="H"],
.prio[data-priority="I"],
.prio[data-priority="J"],
.prio[data-priority="K"],
.prio[data-priority="L"],
.prio[data-priority="M"],
.prio[data-priority="N"],
.prio[data-priority="O"],
.prio[data-priority="P"],
.prio[data-priority="Q"],
.prio[data-priority="R"],
.prio[data-priority="S"],
.prio[data-priority="T"],
.prio[data-priority="U"],
.prio[data-priority="V"],
.prio[data-priority="W"],
.prio[data-priority="X"],
.prio[data-priority="Y"],
.prio[data-priority="Z"] {
  color: var(--fg-dim);
  background: rgba(133, 146, 137, 0.1);
}

.tok-project {
  color: var(--green);
}

.tok-context {
  color: var(--purple);
}

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

.meta-item {
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.due-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}

.due-later {
  color: var(--fg-dim);
  background: var(--bg1);
  border-color: var(--border-soft);
}

.due-soon {
  color: var(--aqua);
  background: rgba(131, 192, 146, 0.1);
  border-color: rgba(131, 192, 146, 0.24);
}

.due-today {
  color: var(--yellow);
  background: rgba(219, 188, 127, 0.12);
  border-color: rgba(219, 188, 127, 0.3);
}

.due-overdue {
  color: var(--red);
  background: rgba(230, 126, 128, 0.12);
  border-color: rgba(230, 126, 128, 0.3);
}

.due-done {
  color: var(--green);
  background: rgba(167, 192, 128, 0.1);
  border-color: rgba(167, 192, 128, 0.22);
}

.is-done .todo-text {
  color: var(--fg-faint);
  text-decoration: line-through;
  text-decoration-color: rgba(122, 132, 120, 0.6);
}

.is-done .prio {
  opacity: 0.5;
}

.is-done .todo-meta {
  opacity: 0.75;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}

.todo-item:hover .item-actions,
.todo-item:focus-within .item-actions {
  opacity: 1;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-dim);
  cursor: pointer;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.icon-btn:hover {
  background: var(--bg2);
  color: var(--fg);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.icon-btn.danger:hover {
  background: rgba(230, 126, 128, 0.12);
  color: var(--red);
}

.icon-btn.is-confirm {
  width: auto;
  padding: 0 9px;
  background: rgba(230, 126, 128, 0.13);
  color: var(--red);
  font-size: 11.5px;
  font-family: var(--mono);
}

.icon-btn.is-confirm:hover {
  background: rgba(230, 126, 128, 0.2);
  color: var(--red);
}

/* ------------------------------------------------------------------
   Inline editor
------------------------------------------------------------------ */
.todo-item.is-editing {
  display: block;
  padding: 12px 14px;
  background: var(--bg1);
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editor-text {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg0);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.editor-text:focus {
  border-color: var(--aqua);
  box-shadow: 0 0 0 3px rgba(131, 192, 146, 0.12);
}

.editor-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-row .spacer {
  flex: 1;
}

.editor-row .field {
  background: var(--bg0);
  border-color: var(--border-strong);
}

/* ------------------------------------------------------------------
   Empty state
------------------------------------------------------------------ */
.empty {
  padding: 52px 24px;
  text-align: center;
  background: var(--bg0);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.empty-mark {
  margin-bottom: 10px;
  color: var(--green);
  font-size: 26px;
  opacity: 0.75;
}

.empty-title {
  margin: 0;
  color: var(--fg);
  font-size: 14.5px;
}

.empty-sub {
  margin: 4px 0 0;
  color: var(--fg-faint);
  font-size: 12.5px;
}

/* ------------------------------------------------------------------
   Footer
------------------------------------------------------------------ */
.app-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 22px;
  padding: 0 4px;
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 11px;
}

.footer-dot {
  opacity: 0.6;
}

.footer-spacer {
  flex: 1;
}

.app-footer a {
  color: var(--fg-faint);
  text-decoration: none;
  transition: color 0.15s ease;
}

.app-footer a:hover {
  color: var(--green);
}

/* ------------------------------------------------------------------
   Import / export dialog
------------------------------------------------------------------ */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  margin: auto;
  padding: 0;
  background: var(--bg0);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog::backdrop {
  background: rgba(18, 23, 26, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg0);
}

.dialog-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
}

.dialog-body {
  padding: 2px 20px 20px;
  overflow-y: auto;
}

.data-section {
  padding: 16px 0;
}

.data-section + .data-section {
  border-top: 1px solid var(--border-soft);
}

.data-section h3 {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
}

.data-desc {
  margin: 0 0 12px;
  color: var(--fg-dim);
  font-size: 12.5px;
  line-height: 1.65;
}

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 18px 14px;
  background: var(--bg-dim);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.file-drop:hover,
.file-drop:focus-within,
.file-drop.is-dragover {
  border-color: rgba(167, 192, 128, 0.6);
  background: rgba(167, 192, 128, 0.06);
}

.file-drop-icon {
  color: var(--green);
  font-size: 17px;
  line-height: 1.2;
}

#importFileName {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.file-meta {
  min-height: 15px;
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 11px;
}

.import-modes {
  display: flex;
  gap: 8px;
  margin: 12px 0 10px;
}

.mode-chip {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 11px;
  background: var(--bg1);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.mode-chip:has(input:checked) {
  border-color: rgba(167, 192, 128, 0.45);
  background: rgba(167, 192, 128, 0.07);
}

.mode-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.mode-top input {
  margin: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.mode-chip small {
  color: var(--fg-faint);
  font-size: 11px;
  line-height: 1.5;
  padding-left: 19px;
}

.muted {
  margin: 0 0 12px;
  color: var(--fg-faint);
  font-size: 12px;
  line-height: 1.6;
}

.btn-danger {
  background: rgba(230, 126, 128, 0.16);
  border-color: rgba(230, 126, 128, 0.5);
  color: var(--red);
  font-weight: 600;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(230, 126, 128, 0.26);
  border-color: rgba(230, 126, 128, 0.7);
  color: var(--red);
}

/* ------------------------------------------------------------------
   Toast
------------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  max-width: min(90vw, 420px);
  padding: 9px 16px;
  background: var(--bg2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(10, 14, 16, 0.45);
  color: var(--fg);
  font-size: 13px;
  text-align: center;
  transform: translate(-50%, 14px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

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

.toast.success {
  border-color: rgba(167, 192, 128, 0.4);
  color: #c7dcae;
}

.toast.error {
  border-color: rgba(230, 126, 128, 0.45);
  color: var(--red);
}

.noscript {
  padding: 40px;
  text-align: center;
  color: var(--fg-muted);
}

/* ------------------------------------------------------------------
   Motion & responsiveness
------------------------------------------------------------------ */
@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.97);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(4px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-6px);
  }
  40%,
  60% {
    transform: translateX(6px);
  }
}

@media (max-width: 720px) {
  .app {
    padding: 0 14px 36px;
  }

  .dialog {
    width: calc(100vw - 20px);
    max-height: 90vh;
  }

  .dialog-head {
    padding: 13px 16px;
  }

  .dialog-body {
    padding: 2px 16px 16px;
  }

  .app-header {
    margin: 0 -14px;
  }

  .app-header-inner {
    padding: 11px 14px;
  }

  .file-path {
    max-width: 40vw;
  }

  .add-bar {
    flex-wrap: wrap;
  }

  .add-text {
    order: -1;
    flex: 1 1 100%;
    padding: 8px 6px 6px;
  }

  .field-priority {
    width: 54px;
  }

  .field-date {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .add-bar .btn {
    flex: none;
    padding: 8px 16px;
  }

  .toolbar {
    align-items: stretch;
    gap: 10px;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    justify-content: center;
    padding: 7px 6px;
  }

  .toolbar-right {
    width: 100%;
    margin-left: 0;
  }

  .field-search {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .field-sort {
    flex: none;
  }

  .todo-item {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 11px 12px;
  }

  .item-actions {
    opacity: 0.85;
  }

  .app-footer {
    flex-wrap: wrap;
  }
}

@media (hover: none) {
  .item-actions {
    opacity: 1;
  }
}

@media (max-width: 420px) {
  .app-header-inner {
    gap: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand-text h1 {
    font-size: 13px;
  }

  .header-actions {
    gap: 8px;
  }

  .sync-dot {
    display: none;
  }

  .file-path {
    max-width: 46vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
