:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #dce4e2;
  --brand: #1f7a6a;
  --brand-strong: #156052;
  --amber: #b7791f;
  --red: #c2413d;
  --blue: #3266a8;
  --shadow: 0 18px 55px rgba(30, 47, 43, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(244, 247, 246, 0.78), rgba(244, 247, 246, 0.92)),
    url("./assets/app-background.svg") center top / cover fixed,
    var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body.locked {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(244, 247, 246, 0.62), rgba(244, 247, 246, 0.88)),
    url("./assets/app-background.svg") center top / cover fixed,
    var(--bg);
}

.lock-screen.hidden {
  display: none;
}

.lock-panel {
  width: min(430px, 100%);
  padding: 24px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(220, 228, 226, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lock-panel h1 {
  font-size: 30px;
}

.lock-copy {
  color: var(--muted);
  line-height: 1.65;
}

.lock-form {
  display: grid;
  gap: 13px;
  margin-top: 18px;
}

.lock-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.topbar-actions,
.toolbar,
.segmented,
.section-head,
.item-actions {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 10px;
  flex-shrink: 0;
}

.primary-button,
.secondary-button,
.icon-button,
.text-button,
.tab,
.filter {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  transition: transform 160ms ease, background 160ms ease, border 160ms ease;
}

.primary-button {
  background: var(--brand);
  color: white;
  padding: 0 18px;
  font-weight: 700;
}

.add-button {
  width: 46px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.list-add-button {
  width: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.secondary-button {
  background: white;
  border-color: var(--line);
  color: var(--brand);
  padding: 0 14px;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

.secondary-button:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.wide {
  width: 100%;
}

.icon-button {
  width: 42px;
  background: var(--panel);
  border-color: var(--line);
  color: var(--brand);
  font-size: 22px;
  line-height: 1;
}

.text-button {
  background: transparent;
  color: var(--brand);
  padding: 0 8px;
  min-height: 34px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.summary-card {
  min-height: 96px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(220, 228, 226, 0.8);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
}

.summary-label {
  color: var(--muted);
  font-size: 14px;
}

.urgent strong {
  color: var(--red);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.create-page {
  margin-bottom: 16px;
}

.side-panel,
.content-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(220, 228, 226, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.side-panel {
  padding: 16px;
  max-width: 560px;
  margin: 0 auto;
}

.content-panel {
  padding: 16px;
  min-width: 0;
}

.create-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.create-head h2 {
  flex: 1;
  text-align: center;
}

.create-head::after {
  content: "";
  width: 58px;
}

.tabs,
.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
  gap: 4px;
  background: #edf3f1;
  border-radius: 8px;
}

.tab,
.filter {
  min-height: 36px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
}

.tab.active,
.filter.active {
  background: white;
  color: var(--brand);
  border-color: var(--line);
  font-weight: 700;
}

.entry-form {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 122, 106, 0.12);
}

.hidden {
  display: none;
}

.toolbar {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.toolbar-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
  flex: 0 1 280px;
}

.toolbar-selects select {
  min-height: 42px;
  padding: 9px 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 12px;
}

.search-box input {
  border: 0;
  box-shadow: none;
  padding-left: 0;
}

.segmented {
  width: 248px;
  grid-template-columns: repeat(3, 1fr);
}

.section-head {
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
  color: var(--muted);
}

.section-head h2 {
  color: var(--text);
}

.list-section.hidden {
  display: none;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-list {
  display: grid;
  gap: 10px;
}

.reminder-group {
  display: grid;
  gap: 10px;
}

.reminder-group + .reminder-group {
  margin-top: 14px;
}

.group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.group-title span {
  color: var(--brand);
}

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.item.done {
  opacity: 0.62;
}

.item.done .item-title {
  text-decoration: line-through;
}

.item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.item-title {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef4f3;
  color: var(--brand);
  font-weight: 700;
}

.pill.high {
  background: #fff1f0;
  color: var(--red);
}

.pill.medium {
  background: #fff7e6;
  color: var(--amber);
}

.pill.low {
  background: #edf5ff;
  color: var(--blue);
}

.item-body {
  margin: 0;
  color: #3f4d5a;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.small-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--text);
  padding: 0 9px;
}

.small-button.danger {
  color: var(--red);
}

.empty-state {
  display: grid;
  gap: 5px;
  padding: 18px;
  border: 1px dashed #b8c7c4;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(248, 251, 250, 0.8);
}

.mobile-dock {
  display: none;
}

@media (max-width: 880px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    background: var(--bg);
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .app-shell {
    width: 100%;
    padding: 14px 12px 20px;
  }

  .topbar,
  .toolbar,
  .item-top {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 12px;
  }

  .eyebrow {
    font-size: 12px;
  }

  h1 {
    font-size: 26px;
    line-height: 1.18;
  }

  .lock-screen {
    align-items: start;
    padding: max(22px, env(safe-area-inset-top)) 14px 14px;
    overflow: auto;
  }

  .lock-panel {
    padding: 20px;
  }

  .lock-panel h1 {
    font-size: 26px;
  }

  .topbar-actions,
  .segmented {
    width: 100%;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 46px;
    gap: 8px;
  }

  .primary-button,
  .secondary-button,
  .icon-button,
  .tab,
  .filter,
  .small-button {
    min-height: 46px;
  }

  .icon-button {
    width: 46px;
  }

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

  .summary-card {
    min-height: 76px;
    padding: 12px 10px;
    box-shadow: none;
  }

  .summary-label {
    display: block;
    min-height: 34px;
    font-size: 12px;
    line-height: 1.35;
  }

  .summary-card strong {
    margin-top: 4px;
    font-size: 26px;
  }

  .workspace {
    gap: 12px;
  }

  .side-panel,
  .content-panel {
    border-radius: 8px;
    box-shadow: none;
    padding: 12px;
  }

  .tabs,
  .segmented {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .entry-form {
    gap: 12px;
  }

  label {
    font-size: 13px;
  }

  input,
  select,
  textarea {
    min-height: 46px;
    padding: 12px;
    font-size: 16px;
  }

  textarea {
    min-height: 132px;
  }

  .toolbar {
    gap: 10px;
    margin-bottom: 12px;
  }

  .toolbar-selects {
    width: 100%;
    grid-template-columns: 1fr 1fr;
    flex: none;
  }

  .search-box {
    width: 100%;
    min-height: 46px;
  }

  .section-head {
    margin: 16px 0 10px;
  }

  .list-add-button {
    width: 46px;
    min-height: 46px;
  }

  .item {
    padding: 12px;
  }

  .item-title {
    font-size: 16px;
  }

  .item-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .small-button {
    width: 100%;
  }

  .mobile-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -10px 30px rgba(30, 47, 43, 0.12);
  }

  .dock-button {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    min-height: 56px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .dock-icon {
    position: relative;
    display: block;
    width: 25px;
    height: 25px;
    color: currentColor;
  }

  .dock-button.active {
    background: #edf3f1;
    color: var(--brand);
  }

  .dock-button.active .dock-icon {
    filter: drop-shadow(0 5px 10px rgba(31, 122, 106, 0.16));
  }

  .icon-log {
    border: 2px solid currentColor;
    border-radius: 6px;
  }

  .icon-log::before,
  .icon-log::after {
    content: "";
    position: absolute;
    left: 6px;
    right: 5px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .icon-log::before {
    top: 7px;
    box-shadow: 0 6px 0 currentColor;
  }

  .icon-log::after {
    width: 5px;
    right: auto;
    bottom: 5px;
  }

  .icon-reminder {
    border: 2px solid currentColor;
    border-radius: 50%;
  }

  .icon-reminder::before,
  .icon-reminder::after {
    content: "";
    position: absolute;
    left: 50%;
    background: currentColor;
    transform: translateX(-50%);
  }

  .icon-reminder::before {
    top: 5px;
    width: 2px;
    height: 9px;
    border-radius: 999px;
  }

  .icon-reminder::after {
    bottom: 5px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
  }

  .icon-all {
    border-radius: 6px;
    background:
      linear-gradient(currentColor 0 0) left top / 10px 10px no-repeat,
      linear-gradient(currentColor 0 0) right top / 10px 10px no-repeat,
      linear-gradient(currentColor 0 0) left bottom / 10px 10px no-repeat,
      linear-gradient(currentColor 0 0) right bottom / 10px 10px no-repeat;
  }

  .icon-lock {
    margin-top: 5px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 5px;
  }

  .icon-lock::before {
    content: "";
    position: absolute;
    left: 5px;
    right: 5px;
    top: -10px;
    height: 12px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 999px 999px 0 0;
  }

  .icon-lock::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 6px;
    width: 4px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    transform: translateX(-50%);
  }
}
