:root {
  color-scheme: light;
  --bg: #eef3f1;
  --surface: #fbfcfc;
  --surface-soft: #f3f7f6;
  --text: #1e2a2d;
  --muted: #657274;
  --line: #dce6e4;
  --accent: #2f7f73;
  --accent-strong: #1e6258;
  --warning: #a26a1b;
  --danger: #b84c4c;
  --shadow: 0 18px 55px rgba(32, 56, 59, 0.12);
  --radius: 8px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151b1d;
  --surface: #20282b;
  --surface-soft: #182123;
  --text: #edf4f2;
  --muted: #a4b3b0;
  --line: #334144;
  --accent: #74b8a9;
  --accent-strong: #a5d7cd;
  --warning: #dfb15d;
  --danger: #e27a7a;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--text);
}

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

button,
a {
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
}

button:hover,
a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

button:active,
.app-card:active,
.site-link:active {
  transform: translateY(1px);
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 127, 115, 0.14);
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  color: var(--accent-strong);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel h4 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
}

.brand p,
.eyebrow,
.hint,
.feed-item span,
.sidebar-footer span,
.status-dot {
  color: var(--muted);
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav a {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 12px;
}

.side-nav a:hover {
  background: var(--surface-soft);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.sidebar-footer strong,
.sidebar-footer span {
  display: block;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.main {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.topbar,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 92px;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar h2 {
  font-size: 28px;
  letter-spacing: 0;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

.quick-search {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-search input {
  width: 340px;
  height: 40px;
  padding: 0 13px;
}

.grid {
  display: grid;
  gap: 22px;
}

.two-columns {
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
}

.utility-grid {
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.05fr) minmax(260px, 0.85fr);
}

.three-columns {
  grid-template-columns: minmax(360px, 1fr) minmax(340px, 0.85fr) minmax(320px, 0.8fr);
}

.span-2 {
  grid-column: 1 / -1;
}

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

.quick-entry-panel {
  padding: 16px 20px;
}

.quick-entry-panel .panel-header {
  margin-bottom: 12px;
}

.quick-entry-panel .common-shortcuts {
  margin-bottom: 0;
}

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

.panel-header h3 {
  font-size: 20px;
}

.panel-header.compact {
  align-items: center;
}

.panel-header.compact input {
  width: 150px;
  height: 34px;
  padding: 0 10px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar.bottom {
  margin-top: 10px;
}

.select-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.select-label select {
  height: 38px;
  padding: 0 10px;
}

.site-strip {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

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

.shortcut-card {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.shortcut-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex: 0 0 auto;
}

.shortcut-card strong,
.shortcut-card small {
  display: block;
}

.shortcut-card small {
  color: var(--muted);
  margin-top: 2px;
}

.site-link,
.tool-link,
.learning-link,
.mini-link,
.app-card,
.project-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.site-link {
  min-height: 56px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8px;
  font-weight: 700;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.feed-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 14px;
  min-height: 360px;
}

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

.feed-title h4 {
  font-size: 16px;
}

.status-dot {
  font-size: 12px;
}

.status-dot.ok {
  color: var(--accent-strong);
}

.status-dot.warn {
  color: var(--warning);
}

.feed-list {
  display: grid;
  gap: 8px;
}

.feed-list.loading::before {
  content: "";
  width: 24px;
  height: 24px;
  margin: 70px auto 0;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.feed-item {
  display: grid;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  padding: 9px 2px 10px;
}

.feed-item strong {
  font-size: 14px;
  line-height: 1.45;
}

.feed-item span {
  font-size: 12px;
}

.tool-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tool-group h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.tool-links,
.learning-links,
.mini-links,
.project-list {
  display: grid;
  gap: 8px;
}

.learning-section {
  align-items: start;
}

.learning-header {
  margin-bottom: 14px;
}

.learning-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.learning-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex: 0 0 auto;
}

.ai-mark {
  background: #327c8d;
}

.quant-mark {
  background: #8a6b25;
}

.learning-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.learning-group h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.learning-link {
  min-height: 44px;
  display: grid;
  grid-template-columns: 1fr 34px;
  align-items: center;
  overflow: hidden;
}

.learning-link:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.learning-link a {
  min-width: 0;
  min-height: 42px;
  padding: 0 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.learning-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-link small {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  flex: 0 0 auto;
  font-size: 12px;
}

.learning-link.is-pinned {
  border-color: rgba(47, 127, 115, 0.45);
}

.pin-button {
  width: 34px;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.pin-button:hover {
  color: var(--warning);
  border-left-color: var(--line);
}

.learning-link.is-pinned .pin-button {
  color: var(--warning);
}

.more-link {
  min-height: 40px;
  margin-top: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  font-size: 13px;
}

.tool-link,
.mini-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
}

.tool-link small,
.mini-link small {
  color: var(--muted);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.app-card {
  min-height: 92px;
  padding: 12px 8px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
}

.app-card .app-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.hint {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.6;
}

textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

.match-list {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.match-item {
  border-left: 3px solid var(--accent);
  padding: 6px 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

.todo-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.todo-form input {
  height: 38px;
  padding: 0 12px;
}

.todo-list {
  display: grid;
  gap: 8px;
}

.todo-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 42px;
  padding: 7px 8px;
  background: var(--surface-soft);
}

.todo-item.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.todo-item input {
  width: 18px;
  height: 18px;
}

.todo-item button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--danger);
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.calendar-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  align-items: stretch;
}

.date-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  padding: 18px;
}

.date-card span,
.date-card small {
  color: var(--muted);
}

.date-card strong {
  font-size: 52px;
  line-height: 1;
}

.countdown {
  display: grid;
  align-content: center;
  gap: 10px;
}

.countdown input {
  height: 40px;
  padding: 0 12px;
  width: 100%;
  max-width: 210px;
  min-width: 0;
}

#countdownResult {
  color: var(--accent-strong);
  font-weight: 700;
}

.calculator {
  display: grid;
  gap: 12px;
}

.calculator input {
  height: 48px;
  padding: 0 12px;
  font-size: 22px;
  text-align: right;
}

.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.calc-keys button {
  min-height: 44px;
  padding: 0;
}

.calc-keys .accent-key {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.projects {
  margin-bottom: 10px;
}

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

.project-card {
  padding: 14px;
  min-height: 112px;
  display: grid;
  align-content: space-between;
}

.project-card strong {
  display: block;
  margin-bottom: 6px;
}

.project-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.hidden-by-search {
  display: none !important;
}

.timestamp-tool {
  display: grid;
  gap: 14px;
}

.timestamp-tool hr {
  margin: 2px 0;
}

.ts-row label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

.ts-input-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.ts-input-group input {
  height: 38px;
  padding: 0 10px;
  font-size: 13px;
  font-family: "Consolas", "SF Mono", "Microsoft YaHei", monospace;
}

.ts-input-group input[readonly] {
  background: var(--surface-soft);
}

.ts-input-group button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 12px;
}

.ts-result {
  margin-top: 5px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: "Consolas", "SF Mono", "Microsoft YaHei", monospace;
  color: var(--accent-strong);
  min-height: 22px;
  line-height: 1.6;
}

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

@media (max-width: 1280px) {
  body {
    min-width: 0;
  }

  .site-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .news-grid,
  .three-columns {
    grid-template-columns: 1fr;
  }

  .two-columns,
  .utility-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    min-width: 0;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 14px;
  }

  .brand {
    align-items: flex-start;
  }

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

  .side-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .side-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 9px 11px;
    background: var(--surface-soft);
  }

  .sidebar-footer {
    margin-top: 0;
    padding-top: 12px;
  }

  .main {
    padding: 14px;
    gap: 14px;
  }

  .topbar {
    display: grid;
    min-height: 0;
    padding: 16px;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .quick-search {
    display: grid;
    grid-template-columns: 1fr auto;
    width: 100%;
  }

  .quick-search input {
    width: 100%;
    min-width: 0;
  }

  .panel {
    padding: 14px;
  }

  .panel-header {
    display: grid;
    align-items: stretch;
    gap: 12px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .common-shortcuts,
  .news-grid,
  .tool-groups,
  .learning-groups,
  .calendar-row,
  .project-list {
    grid-template-columns: 1fr;
  }

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

  .site-link {
    min-height: 46px;
  }

  .feed-card {
    min-height: 0;
  }

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

  .three-columns,
  .two-columns,
  .utility-grid {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 220px;
  }

  .todo-form {
    grid-template-columns: 1fr;
  }

  .countdown input {
    width: 100%;
  }
}
