:root {
  --bg: #f7f8f4;
  --bg-gradient: #f7f8f4;
  --surface: #fdfdfb;
  --surface-solid: #fdfdfb;
  --surface-muted: #f2f4ef;
  --border: #d8ddd6;
  --border-strong: #c7cec5;
  --text: #344038;
  --text-dim: #657068;
  --text-light: #69756d;
  --accent: #52785a;
  --accent-light: #7ca982;
  --accent-glow: rgba(124, 169, 130, 0.18);
  --positive: #4f7758;
  --negative: #a6534d;
  --warning: #a8763f;
  --shadow-light: transparent;
  --shadow-dark: transparent;
  --shadow-dark-subtle: transparent;
  --lcd: #f2f4ef;
  --lcd-text: #344038;
  --lcd-dim: #657068;
  --lcd-glow: transparent;
  --shell-radius: 14px;
  --radius-inner: 12px;
  --radius-control: 9px;
  --sidebar-width: 232px;
  --topbar-height: 72px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

* { scrollbar-color: #cbd3ca transparent; }

html { background: var(--bg); }

body {
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif !important;
  background: var(--bg) !important;
  color: var(--text);
  line-height: 1.55 !important;
  letter-spacing: 0 !important;
  padding: 0 0 56px var(--sidebar-width);
}

[hidden] { display: none !important; }

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

button {
  min-height: 36px;
  border: 0 !important;
  border-radius: 9px !important;
  background: var(--accent) !important;
  color: #fff !important;
  padding: 8px 13px;
  box-shadow: none !important;
  transition: background-color 180ms var(--ease-out), transform 180ms var(--ease-out), opacity 180ms ease;
}

button:hover { background: #45684d !important; transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tab:focus-visible {
  outline: 3px solid rgba(111, 153, 118, .24) !important;
  outline-offset: 2px;
}

input, select, textarea {
  color: var(--text) !important;
  background: #fff !important;
  border: 1px solid var(--border) !important;
  border-radius: 9px !important;
  box-shadow: none !important;
}

input::placeholder, textarea::placeholder { color: var(--text-dim); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--accent) !important; }
textarea { resize: vertical; }

.header {
  position: sticky !important;
  top: 0;
  z-index: 40;
  min-height: var(--topbar-height);
  padding: 14px 28px !important;
  gap: 18px !important;
  background: rgba(247, 248, 244, .94) !important;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border) !important;
  box-shadow: none !important;
  flex-wrap: nowrap !important;
}

.header-heading { min-width: 180px; }
.header-heading h1 {
  margin: 0;
  color: var(--text) !important;
  font-family: inherit !important;
  font-size: 17px !important;
  line-height: 1.25;
  font-weight: 650 !important;
  letter-spacing: -.01em !important;
}
.header-heading > span { display: block; margin-top: 3px; color: var(--text-dim); font-size: 11px; }
.mobile-brand { display: none; }

.header-meta { gap: 12px !important; color: var(--text-dim); }
.header .stats { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#heartbeat-dot { box-shadow: 0 0 0 4px rgba(124,169,130,.13); }

.search-bar { margin-left: auto !important; gap: 7px !important; }
.search-bar input { width: min(270px, 26vw) !important; padding: 9px 12px !important; }
.search-bar button, .header-actions button, .icon-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0 !important;
  display: inline-grid !important;
  place-items: center;
  background: var(--surface) !important;
  color: var(--text-dim) !important;
  border: 1px solid var(--border) !important;
}
.search-bar button:hover, .header-actions button:hover, .icon-button:hover { color: var(--accent) !important; background: #fff !important; }
.header-actions button { width: auto; padding: 0 11px !important; }

.tabs {
  position: fixed !important;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 16px 12px 24px !important;
  display: flex !important;
  flex-direction: column;
  align-items: stretch !important;
  gap: 3px !important;
  overflow-y: auto;
  background: var(--surface-muted) !important;
  border: 0 !important;
  border-right: 1px solid var(--border) !important;
  box-shadow: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 50px;
  padding: 2px 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.side-brand .ob-logo { width: 36px !important; height: 36px !important; border-radius: 10px; }
.side-brand strong { display: block; color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: -.015em; }
.side-brand span { display: block; margin-top: 2px; color: var(--text-dim); font-size: 10px; }
.side-brand .version-badge { display: inline; margin-left: 3px; }

.nav-section {
  padding: 10px 10px 5px;
  color: var(--text-light);
  font-size: 10px;
  font-weight: 600;
}
.nav-utility-label { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 15px; }
.tab-spacer { display: none !important; }

.tab {
  position: relative;
  min-height: 39px;
  padding: 8px 10px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: flex-start !important;
  gap: 10px !important;
  flex: 0 0 auto !important;
  color: var(--text-dim) !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  font-family: inherit !important;
  font-size: 12px !important;
  letter-spacing: 0 !important;
  cursor: pointer;
  max-width: none !important;
  text-align: left !important;
  transition: color 160ms ease, background-color 160ms ease;
}
.tab:hover { color: var(--text) !important; background: rgba(255,255,255,.6) !important; }
.tab.active { color: #36543d !important; background: #e3ece1 !important; font-weight: 600; }
.tab i, .tab svg { width: 17px !important; height: 17px !important; flex: none; }
.tab-en { display: none !important; }
.mail-unread-badge { margin-left: auto; min-width: 7px; height: 7px; border-radius: 50%; background: var(--negative); }
.mobile-more { display: none; }

.content {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto !important;
  padding: 28px 0 48px !important;
}

#embed-warn-banner { margin-left: 0 !important; border-radius: 0 !important; box-shadow: none !important; }

.bucket-item, .bucket-card, .plan-card, .letter-card, .anchor-card, .config-section,
.settings-section, .tool-section, .flow-step, .breath-info, .network-legend,
.import-card, .log-panel, .about-card, .self-entry {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}

.bucket-item:hover, .plan-card:hover, .letter-card:hover { border-color: var(--border-strong) !important; box-shadow: none !important; }
.filters { gap: 7px !important; }
.filter-btn, .secondary-button {
  background: var(--surface) !important;
  color: var(--text-dim) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}
.filter-btn.active { color: #36543d !important; border-color: #aebfac !important; background: #e8f0e4 !important; }

code, pre, #network-terminal, .log-line {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace !important;
}

/* Today */
.today-intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 26px; }
.today-intro p { margin: 0 0 7px; color: var(--accent); font-size: 12px; font-weight: 600; }
.today-intro h2 { margin: 0; color: var(--text); font-size: 25px; line-height: 1.3; letter-spacing: -.025em; text-wrap: balance; }
.today-intro > div > span { display: block; margin-top: 8px; color: var(--text-dim); font-size: 13px; }
.today-focus { margin-bottom: 16px; padding: 22px 24px; background: #e8f0e4; border-radius: 14px; }
.today-focus.is-empty { background: var(--surface); border: 1px dashed var(--border-strong); }
.section-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; }
.section-heading h3 { margin: 0; color: var(--text); font-size: 14px; font-weight: 650; }
.section-heading span { margin-left: auto; color: var(--text-dim); font-size: 11px; }
.section-heading svg { width: 17px; height: 17px; color: var(--accent); }
.today-message { max-width: 72ch; color: #34483a; font-size: 15px; line-height: 1.75; white-space: pre-wrap; }
.today-message-summary { margin-top: 14px; padding-top: 13px; border-top: 1px solid rgba(83,112,89,.18); color: var(--text-dim); font-size: 12px; }
.today-link { margin-top: 15px; padding: 0 !important; min-height: auto; background: transparent !important; color: #42634a !important; font-size: 12px; font-weight: 600; }
.today-link:hover { background: transparent !important; transform: none; color: var(--accent) !important; }
.today-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.today-section { min-height: 180px; padding: 20px 21px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.today-secondary .today-section { min-height: 150px; }
.today-list { display: flex; flex-direction: column; }
.today-row { width: 100%; padding: 11px 0; display: flex; align-items: flex-start; gap: 11px; border: 0; border-top: 1px solid #e9ece7; background: transparent !important; color: var(--text) !important; text-align: left; cursor: pointer; }
.today-row:hover { background: #f7f9f5 !important; transform: none; }
.today-row:first-child { padding-top: 2px; border-top: 0; }
.today-row:last-child { padding-bottom: 0; }
.today-row:hover strong { color: var(--accent); }
.today-row-dot { width: 8px; height: 8px; margin-top: 6px; flex: none; border-radius: 50%; background: #a9b9a8; }
.today-row-dot.overdue { background: var(--negative); }
.today-row strong { display: block; color: var(--text); font-size: 12px; font-weight: 600; }
.today-row p { margin: 3px 0 0; color: var(--text-dim); font-size: 11px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.today-row time { margin-left: auto; color: var(--text-light); font-size: 10px; white-space: nowrap; }
.ob-empty { display: grid; place-items: center; min-height: 110px; padding: 16px; color: var(--text-dim); text-align: center; font-size: 12px; }
.ob-empty svg { width: 22px; height: 22px; margin-bottom: 8px; color: #9eaaa0; }
.today-stats { display: flex; flex-wrap: wrap; gap: 18px; padding: 15px 2px 0; color: var(--text-dim); font-size: 11px; }
.today-stats strong { margin-right: 4px; color: var(--text); font-size: 13px; }

.activity-section { margin-top: 16px; padding: 20px 21px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.activity-section .section-heading { margin-bottom: 3px; }
.activity-help { margin: 0 0 13px; color: var(--text-dim); font-size: 11px; }
.activity-list { display: flex; flex-direction: column; }
.activity-row { min-height: 50px; display: flex; align-items: center; gap: 11px; border-top: 1px solid #e9ece7; }
.activity-row:first-child { border-top: 0; }
.activity-icon { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; color: #42634a; background: #e8f0e4; }
.activity-icon.is-error { color: var(--negative); background: #f8e8e5; }
.activity-icon svg { width: 15px; height: 15px; }
.activity-copy { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.activity-copy strong { color: var(--text); font-size: 12px; font-weight: 600; }
.activity-copy small { color: var(--text-dim); font-size: 10px; }
.activity-row time { margin-left: auto; color: var(--text-light); font-size: 10px; white-space: nowrap; }
.activity-status { min-width: 48px; color: #4d7255; font-size: 10px; text-align: right; }
.activity-status.is-error { color: var(--negative); }

.ob-skeleton-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ob-skeleton-stack span { height: 190px; border-radius: 12px; background: linear-gradient(90deg,#eef1ec 25%,#f8f9f6 50%,#eef1ec 75%); background-size: 200% 100%; animation: ob-shimmer 1.4s linear infinite; }
.ob-skeleton-stack span:first-child { grid-column: 1 / -1; height: 150px; }
@keyframes ob-shimmer { to { background-position: -200% 0; } }

/* Mailbox */
.mailbox-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.mailbox-toolbar h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.mailbox-toolbar p { margin: 6px 0 0; color: var(--text-dim); font-size: 12px; }
.mailbox-actions { display: flex; gap: 8px; }
.handoff-composer { margin-bottom: 16px; padding: 19px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.handoff-composer label { display: block; margin: 0 0 7px; color: var(--text); font-size: 12px; font-weight: 600; }
.handoff-composer label:not(:first-child) { margin-top: 14px; }
.handoff-composer label span { color: var(--text-light); font-weight: 400; }
.handoff-composer textarea { width: 100%; padding: 11px 12px; line-height: 1.65; }
.composer-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.composer-footer > span { margin-right: auto; color: var(--negative); font-size: 11px; }
.mailbox-layout { display: grid; grid-template-columns: minmax(280px, 36%) minmax(0, 1fr); min-height: 570px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.mailbox-list { overflow-y: auto; border-right: 1px solid var(--border); background: #fafbf8; }
.handoff-row { width: 100%; display: block; padding: 16px 17px; color: var(--text) !important; background: transparent !important; border: 0; border-bottom: 1px solid #e7ebe5; text-align: left; cursor: pointer; }
.handoff-row:hover { background: #f4f7f1 !important; transform: none; }
.handoff-row.active { background: #e8f0e4 !important; }
.handoff-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.handoff-row time { margin-left: auto; color: var(--text-light); font-size: 10px; }
.handoff-row strong { display: block; overflow: hidden; color: var(--text); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.handoff-row p { margin: 5px 0 0; color: var(--text-dim); font-size: 11px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mailbox-detail { min-width: 0; padding: 30px 32px; }
.mailbox-detail-head { display: flex; align-items: flex-start; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.mailbox-detail-head h3 { margin: 0; font-size: 17px; }
.mailbox-detail-head time { display: block; margin-top: 5px; color: var(--text-light); font-size: 11px; }
.mailbox-detail-actions { display: flex; gap: 6px; margin-left: auto; }
.mailbox-detail-actions button { background: transparent !important; color: var(--text-dim) !important; border: 1px solid var(--border) !important; }
.mailbox-letter { max-width: 68ch; padding: 26px 0 10px; color: var(--text); font-size: 14px; line-height: 1.85; white-space: pre-wrap; }
.mailbox-summary { max-width: 68ch; margin-top: 18px; padding: 16px; background: var(--surface-muted); border-radius: 10px; color: var(--text-dim); font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.mailbox-summary strong { display: block; margin-bottom: 6px; color: var(--text); }
.mailbox-empty, .ob-list-loading { min-height: 420px; display: grid; place-items: center; align-content: center; color: var(--text-dim); text-align: center; }
.mailbox-empty svg { width: 30px; height: 30px; margin-bottom: 12px; color: #99a69b; }
.mailbox-empty h3 { margin: 0; color: var(--text); font-size: 14px; }
.mailbox-empty p { margin: 7px 0 0; font-size: 11px; }

.self-fab {
  left: 18px !important;
  bottom: 18px !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 11px !important;
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: none !important;
}
.self-fab .fab-label { font-family: inherit !important; font-size: 14px !important; font-style: normal !important; font-weight: 650 !important; }
.self-fab .fab-dot { width: 6px !important; height: 6px !important; right: 5px !important; bottom: 5px !important; background: #f6c86f !important; }
#ob-chick { display: none !important; }

@media (max-width: 1050px) {
  .header .stats { display: none; }
  .header-actions button { width: 36px; padding: 0 !important; font-size: 0 !important; }
  .header-actions button svg { width: 16px; height: 16px; }
}

@media (max-width: 780px) {
  :root { --sidebar-width: 0px; }
  body { padding: 0 0 76px !important; }
  .header { min-height: 62px; padding: 10px 15px !important; }
  .mobile-brand { display: block; }
  .mobile-brand .ob-logo { width: 34px !important; height: 34px !important; border-radius: 9px; }
  .header-heading { min-width: 0; }
  .header-heading h1 { font-size: 15px !important; }
  .header-heading > span, .header-meta, .header-actions { display: none !important; }
  .search-bar { margin-left: auto !important; }
  .search-bar { width: auto !important; order: initial !important; }
  .search-bar input { width: min(44vw, 220px) !important; }

  .tabs { inset: auto 0 0 0 !important; width: 100% !important; height: 64px; padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)) !important; flex-direction: row; align-items: center !important; justify-content: space-around; overflow: visible; background: rgba(253,253,251,.97) !important; border-top: 1px solid var(--border) !important; border-right: 0 !important; }
  .side-brand, .nav-section, .tab:not(.primary-tab) { display: none !important; }
  .primary-tab, .mobile-more { min-width: 54px; height: 52px; padding: 5px 8px !important; display: flex !important; flex-direction: column !important; align-items: center; justify-content: center !important; gap: 3px !important; border-radius: 9px !important; font-size: 10px !important; text-align: center !important; }
  .primary-tab i, .primary-tab svg, .mobile-more svg { width: 19px !important; height: 19px !important; }
  .tab-en { display: none !important; }
  .mobile-more { background: transparent !important; color: var(--text-dim) !important; }
  body.mobile-more-open .tabs { height: auto; min-height: 285px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)) !important; display: grid !important; grid-template-columns: repeat(4, 1fr); align-content: end; box-shadow: 0 -8px 24px rgba(45,59,49,.08) !important; }
  body.mobile-more-open .tabs .tab { display: flex !important; flex-direction: column; justify-content: center; text-align: center; }
  body.mobile-more-open .tabs .side-brand, body.mobile-more-open .tabs .nav-section { display: none !important; }
  body.mobile-more-open .mobile-more { background: #e8f0e4 !important; color: #36543d !important; }

  .content { width: calc(100% - 28px); padding: 21px 0 30px !important; }
  .today-intro h2 { font-size: 21px; }
  .today-columns, .ob-skeleton-stack { grid-template-columns: 1fr; }
  .ob-skeleton-stack span:first-child { grid-column: auto; }
  .today-focus { padding: 18px; }
  .mailbox-toolbar { align-items: stretch; flex-direction: column; }
  .mailbox-actions { justify-content: flex-end; }
  .mailbox-layout { display: block; min-height: 0; }
  .mailbox-list { max-height: 360px; border-right: 0; border-bottom: 1px solid var(--border); }
  .mailbox-detail { min-height: 360px; padding: 22px 20px; }
  .self-fab { display: none !important; }
}

@media (max-width: 520px) {
  .search-bar input { display: none; }
  .mailbox-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .today-stats { gap: 10px 16px; }
  .mailbox-detail-head { flex-direction: column; }
  .mailbox-detail-actions { margin-left: 0; }
  .activity-row { flex-wrap: wrap; gap: 7px 10px; padding: 10px 0; }
  .activity-copy { flex: 1; }
  .activity-row time { width: calc(100% - 40px); margin-left: 40px; order: 3; }
  .activity-status { margin-left: auto; }
}

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