:root {
  color-scheme: dark;
  --bg: #030814;
  --bg-2: #050a14;
  --panel: rgba(4, 14, 28, 0.82);
  --panel-2: rgba(7, 20, 38, 0.92);
  --panel-3: rgba(3, 12, 24, 0.76);
  --line: rgba(43, 224, 255, 0.34);
  --line-strong: rgba(25, 227, 255, 0.62);
  --line-soft: rgba(25, 227, 255, 0.16);
  --text: #d9fbff;
  --muted: #7da4b8;
  --dim: #5f7f92;
  --green: #3dff9d;
  --cyan: #19e3ff;
  --amber: #ffbd54;
  --red: #ff6a00;
  --violet: #a987ff;
  --ink: #03101c;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  --glow-cyan: 0 0 22px rgba(25, 227, 255, 0.18);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: "Exo 2", "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100svh;
  overflow: hidden;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(141, 246, 255, 0.86);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  top: auto;
  left: -999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100svh;
  height: 100dvh;
  isolation: isolate;
  overflow: hidden;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background:
    radial-gradient(circle at 50% 8%, rgba(25, 227, 255, 0.2), transparent 24rem),
    radial-gradient(circle at 82% 72%, rgba(169, 135, 255, 0.18), transparent 20rem),
    radial-gradient(circle at 12% 86%, rgba(61, 255, 157, 0.1), transparent 18rem),
    linear-gradient(135deg, rgba(10, 28, 48, 0.96), #02050d 58%, #050a14);
}

.app-shell::before,
.app-shell::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.app-shell::before {
  z-index: -1;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 50%, rgba(0, 0, 0, 0.12) 50%),
    linear-gradient(90deg, rgba(0, 229, 255, 0.035), transparent 16%, transparent 84%, rgba(0, 229, 255, 0.035));
  background-size: 100% 4px, 100% 100%;
  mix-blend-mode: screen;
  opacity: 0.55;
}

.app-shell::after {
  z-index: -1;
  background:
    linear-gradient(90deg, transparent, rgba(141, 246, 255, 0.12), transparent),
    radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.16), transparent 28%);
  opacity: 0.42;
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  margin: 8px 10px 0;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(11, 30, 54, 0.9), rgba(5, 13, 27, 0.82)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 4px);
  box-shadow:
    0 0 0 1px rgba(217, 251, 255, 0.08) inset,
    0 0 30px rgba(25, 227, 255, 0.14),
    0 12px 32px rgba(0, 0, 0, 0.22);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}

.topbar::before {
  position: absolute;
  top: 9px;
  right: -4px;
  width: 26px;
  height: 0;
  content: "";
  border-top: 1px solid rgba(141, 246, 255, 0.95);
  filter: drop-shadow(0 0 7px rgba(25, 227, 255, 0.72));
  transform: rotate(45deg);
}

.brand {
  min-width: 0;
}

.brand span,
.kicker,
.field span,
.stat span,
.meta,
.empty-state span,
.sync-state {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #f1fdff;
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1.12;
  text-overflow: ellipsis;
  text-shadow: 0 0 14px rgba(25, 227, 255, 0.52);
  white-space: nowrap;
}

.icon-button,
.nav-button,
.quick-button,
.chip-button,
.status-button,
.item-action,
.primary-button,
.ghost-button,
.danger-button {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(4, 18, 34, 0.78);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
}

.icon-button svg,
.nav-button svg,
.quick-button svg,
.item-action svg,
.primary-button svg,
.danger-button svg,
.ghost-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button:hover,
.quick-button:hover,
.item-action:hover,
.ghost-button:hover,
.nav-button:hover {
  border-color: rgba(25, 227, 255, 0.58);
  color: #f7fdff;
  background: rgba(20, 64, 88, 0.72);
  box-shadow: 0 0 14px rgba(25, 227, 255, 0.14);
}

.icon-button:active,
.nav-button:active,
.quick-button:active,
.item-card:active,
.project-card__main:active,
.primary-button:active,
.ghost-button:active,
.danger-button:active {
  transform: translateY(1px);
}

.main-view {
  min-height: 0;
  overflow: auto;
  padding: 14px 12px 18px;
  overscroll-behavior: contain;
  scrollbar-color: rgba(25, 227, 255, 0.36) transparent;
}

.main-inner {
  width: min(100%, 1060px);
  margin: 0 auto;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.search {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(6, 19, 34, 0.82), rgba(2, 9, 19, 0.78)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 4px);
  box-shadow: 0 0 0 1px rgba(217, 251, 255, 0.04) inset;
  padding: 0 11px;
}

.search svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  color: var(--cyan);
  filter: drop-shadow(0 0 6px rgba(25, 227, 255, 0.5));
}

.search input {
  width: 100%;
  min-height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
}

.quick-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  color: #bff9ff;
  font-weight: 900;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  position: relative;
  display: flex;
  min-height: 76px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(11, 30, 54, 0.76), rgba(5, 13, 27, 0.72));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.035) inset,
    var(--glow-cyan);
  padding: 11px;
}

.stat::after {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 1px;
  content: "";
  background: rgba(255, 189, 84, 0.72);
  box-shadow: 0 0 8px rgba(255, 189, 84, 0.28);
}

.stat strong {
  color: var(--cyan);
  font-family: "Courier New", monospace;
  font-size: 1.46rem;
  line-height: 1;
  text-shadow: 0 0 12px rgba(25, 227, 255, 0.34);
}

.view-grid {
  display: grid;
  gap: 12px;
}

.section-title {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 8px;
  color: #bff9ff;
}

.section-title h2 {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.section-title span {
  color: var(--amber);
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
  font-weight: 900;
}

.list {
  display: grid;
  gap: 9px;
}

.item-card,
.project-card,
.sync-panel,
.empty-state {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(7, 24, 42, 0.72), rgba(2, 9, 19, 0.72));
  box-shadow:
    0 0 0 1px rgba(217, 251, 255, 0.04) inset,
    0 10px 28px rgba(0, 0, 0, 0.18);
}

.item-card::before,
.project-card::before,
.sync-panel::before,
.empty-state::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(25, 227, 255, 0.2), transparent 18%, transparent 82%, rgba(25, 227, 255, 0.14)) border-box;
  mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.item-card,
.project-card {
  width: 100%;
  min-width: 0;
  text-align: left;
}

.item-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 11px;
}

.check {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid rgba(61, 255, 157, 0.28);
  border-radius: 3px;
  background: rgba(0, 22, 18, 0.34);
  color: var(--green);
  cursor: pointer;
}

.item-card.is-done {
  opacity: 0.74;
}

.item-card.is-done .check {
  border-color: var(--green);
  background: var(--green);
  color: var(--ink);
  box-shadow: 0 0 16px rgba(61, 255, 157, 0.28);
}

.item-main {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.item-main strong,
.project-card strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #f1fdff;
  font-size: 0.98rem;
  font-weight: 850;
  line-height: 1.25;
}

.item-main p,
.project-card p,
.empty-state p,
.sync-panel p {
  margin: 6px 0 0;
  color: #a8cad8;
  line-height: 1.36;
  overflow-wrap: anywhere;
}

.item-tags,
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(3, 14, 28, 0.58);
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  padding: 2px 7px;
  text-transform: uppercase;
}

.tag.is-high,
.priority-high {
  border-color: rgba(255, 106, 0, 0.6);
  color: #ffb27a;
}

.tag.is-medium,
.priority-medium {
  border-color: rgba(255, 189, 84, 0.58);
  color: #ffe2a9;
}

.tag.is-low,
.priority-low {
  border-color: rgba(61, 255, 157, 0.52);
  color: #a8ffd0;
}

.tag.is-idea {
  border-color: rgba(169, 135, 255, 0.54);
  color: #dcd2ff;
}

.tag.is-today {
  border-color: rgba(255, 189, 84, 0.66);
  color: var(--amber);
  box-shadow: 0 0 12px rgba(255, 189, 84, 0.12);
}

.item-actions {
  display: flex;
  gap: 6px;
}

.item-action {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #bcefff;
}

.project-grid {
  display: grid;
  gap: 10px;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 11px;
}

.project-card__main {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 2px;
  text-align: left;
}

.project-card__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.project-count {
  display: grid;
  min-width: 38px;
  min-height: 32px;
  place-items: center;
  border: 1px solid rgba(255, 189, 84, 0.48);
  border-radius: 3px;
  color: var(--amber);
  font-family: "Courier New", monospace;
  font-weight: 900;
  text-shadow: 0 0 10px rgba(255, 189, 84, 0.25);
}

.project-card__actions {
  display: flex;
  gap: 6px;
}

.project-detail {
  display: grid;
  gap: 12px;
}

.detail-head {
  display: grid;
  gap: 10px;
  margin-bottom: 2px;
  padding: 13px;
  border: 1px solid rgba(169, 135, 255, 0.34);
  border-radius: 3px;
  background:
    radial-gradient(circle at 84% 10%, rgba(169, 135, 255, 0.2), transparent 34%),
    linear-gradient(180deg, rgba(11, 18, 42, 0.86), rgba(4, 10, 24, 0.82));
  box-shadow: 0 0 24px rgba(169, 135, 255, 0.1);
}

.detail-head h2 {
  margin: 0;
  overflow-wrap: anywhere;
  color: #f1fdff;
  text-shadow: 0 0 14px rgba(169, 135, 255, 0.26);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 0 12px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.chip-button.is-active {
  border-color: rgba(25, 227, 255, 0.72);
  background: linear-gradient(180deg, #83f4ff, #15bdda);
  color: var(--ink);
  box-shadow: 0 0 18px rgba(25, 227, 255, 0.36);
}

.sync-panel,
.empty-state {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.sync-row {
  display: grid;
  gap: 8px;
}

.sync-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.field {
  display: grid;
  gap: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(25, 227, 255, 0.28);
  border-radius: 3px;
  background: rgba(3, 14, 28, 0.82);
  outline: 0;
  padding: 9px 10px;
  box-shadow: 0 0 0 1px rgba(217, 251, 255, 0.04) inset;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(25, 227, 255, 0.72);
  box-shadow:
    0 0 0 1px rgba(25, 227, 255, 0.12) inset,
    0 0 16px rgba(25, 227, 255, 0.16);
}

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

.primary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  font-weight: 900;
}

.primary-button {
  border-color: rgba(61, 255, 157, 0.68);
  background:
    linear-gradient(180deg, rgba(61, 255, 157, 0.95), rgba(20, 196, 117, 0.95));
  color: var(--ink);
  box-shadow: 0 0 18px rgba(61, 255, 157, 0.24);
}

.ghost-button {
  color: #bcefff;
}

.danger-button {
  border-color: rgba(255, 106, 0, 0.62);
  background: rgba(74, 24, 0, 0.36);
  color: #ffb27a;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  min-height: 72px;
  margin: 0 10px 8px;
  padding: 8px 8px max(8px, var(--safe-bottom));
  border: 1px solid rgba(25, 227, 255, 0.26);
  background:
    linear-gradient(180deg, rgba(6, 19, 34, 0.9), rgba(2, 9, 19, 0.94)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 4px);
  box-shadow:
    0 0 0 1px rgba(217, 251, 255, 0.06) inset,
    0 -10px 28px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}

.nav-button {
  display: grid;
  min-width: 0;
  min-height: 52px;
  place-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.nav-button.is-active {
  border-color: rgba(25, 227, 255, 0.58);
  background: rgba(20, 64, 88, 0.72);
  color: #f7fdff;
  box-shadow: 0 0 16px rgba(25, 227, 255, 0.18);
}

.nav-button.is-active svg {
  color: var(--cyan);
  filter: drop-shadow(0 0 7px rgba(25, 227, 255, 0.48));
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.62);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  backdrop-filter: blur(5px);
}

.sheet-backdrop[hidden] {
  display: none;
}

.sheet {
  justify-self: center;
  width: min(100%, 680px);
  max-height: min(84svh, 780px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background:
    linear-gradient(180deg, rgba(8, 23, 42, 0.98), rgba(4, 12, 25, 0.96)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 4px);
  box-shadow: var(--shadow);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 23, 42, 0.98);
}

.sheet-head h2 {
  margin: 0;
  overflow-wrap: anywhere;
  color: #f1fdff;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.editor-form {
  display: grid;
  gap: 12px;
  padding: 13px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 2px;
}

.toast {
  position: fixed;
  right: calc(12px + var(--safe-right));
  bottom: calc(86px + var(--safe-bottom));
  left: calc(12px + var(--safe-left));
  z-index: 30;
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(11, 30, 54, 0.96), rgba(5, 13, 27, 0.94));
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: 900;
  padding: 9px 12px;
}

.toast[hidden] {
  display: none;
}

@media (min-width: 760px) {
  .topbar {
    margin-right: 16px;
    margin-left: 16px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .main-view {
    padding: 20px 24px 26px;
  }

  .view-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
    align-items: start;
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field.is-wide {
    grid-column: 1 / -1;
  }

  .tabbar {
    width: min(100%, 760px);
    justify-self: center;
    margin-right: 0;
    margin-left: 0;
  }
}

@media (max-width: 390px) {
  .topbar {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 8px;
    margin-right: 8px;
    margin-left: 8px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .main-view {
    padding-right: 10px;
    padding-left: 10px;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat {
    min-height: 66px;
    padding: 9px;
  }

  .stat strong {
    font-size: 1.22rem;
  }

  .item-card {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .nav-button {
    font-size: 0.62rem;
  }
}
