:root {
  color-scheme: light;
  --ink: #0b1020;
  --muted: #8991a0;
  --quiet: #f4f6fa;
  --line: #e8ebf1;
  --paper: #ffffff;
  --blue: #1877f2;
  --navy: #071126;
  --green: #0f8a63;
  --amber: #a56700;
  --red: #c93d3d;
  --folder: #ffc940;
  --shadow: 0 18px 44px rgba(21, 31, 52, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #eef2f7;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.app-shell {
  width: min(100vw, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
  overflow-x: hidden;
  box-shadow: var(--shadow);
}

.brother-shell {
  width: min(100vw, 1240px);
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  border-radius: 16px;
}

.app-header {
  min-height: 88px;
  padding: 22px 20px 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.96);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brother-shell .app-header {
  min-height: 72px;
  padding: 18px 24px 12px;
  border-bottom: 1px solid var(--line);
}

.title-switch {
  padding: 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.15;
  font-weight: 850;
  text-align: left;
}

.title-switch::after {
  content: "⌄";
  margin-left: 6px;
  font-size: 17px;
  color: var(--ink);
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.more-btn {
  min-width: 48px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  color: #5d6675;
  background: var(--quiet);
  font-size: 14px;
  font-weight: 750;
}

main {
  padding: 0 18px 112px;
}

.brother-shell main {
  padding: 0;
}

.site-filing {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 18px;
  padding: 18px 0 96px;
  border-top: 1px solid var(--line);
  color: #7f8796;
  font-size: 12px;
  line-height: 20px;
}

.filing-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
  text-decoration: none;
}

.filing-link:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.police-filing img {
  display: block;
  flex: 0 0 20px;
}

.filing-divider {
  width: 1px;
  height: 12px;
  background: #d9dde5;
}

.brother-shell .site-filing {
  margin: 0 24px;
  padding: 16px 0 20px;
}

.hidden {
  display: none !important;
}

.login-screen {
  padding: 36px 4px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
}

.login-screen h1 {
  max-width: 330px;
  margin: 0 0 28px;
  font-size: 30px;
  line-height: 1.24;
}

.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.role-card {
  min-height: 92px;
  padding: 16px;
  text-align: left;
  border-radius: 14px;
  background: var(--quiet);
  color: #596170;
  border: 1px solid transparent;
}

.role-card.active {
  background: var(--navy);
  color: #fff;
}

.role-card span {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 850;
}

.role-card small {
  color: currentColor;
  opacity: 0.72;
  font-size: 12px;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.field span {
  color: #687083;
  font-size: 13px;
  font-weight: 760;
}

.field input,
.field textarea,
.field select,
.admin-toolbar input,
.admin-toolbar select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
  padding: 11px 13px;
  outline: none;
  color: var(--ink);
}

.field textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.55;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 46px;
  width: 100%;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 820;
}

.primary-btn {
  color: #fff;
  background: var(--blue);
}

.secondary-btn {
  color: var(--ink);
  background: var(--quiet);
}

.danger-btn {
  color: var(--red);
  background: #fff0f0;
}

.inline-btn {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
}

.text-btn {
  color: var(--blue);
  font-size: 13px;
  font-weight: 780;
}

.search-bar {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 15px;
  border-radius: 16px;
  background: #f2f4f8;
  color: #9aa1ad;
  margin: 4px 0 16px;
}

.search-symbol {
  width: 18px;
  height: 18px;
  border: 2px solid #a1a8b4;
  border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
}

.search-symbol::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: #a1a8b4;
  transform: rotate(45deg);
}

.search-bar input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

.toolbar-row,
.reader-meta,
.panel-head,
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-row {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.chips {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 0 0 14px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  min-height: 34px;
  border-radius: 11px;
  padding: 7px 14px;
  color: #939aa6;
  background: #f4f5fa;
  font-size: 14px;
  font-weight: 800;
}

.chip.active {
  background: var(--navy);
  color: #fff;
}

.home-actions {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.ask-strip {
  width: 100%;
  min-height: 70px;
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 14px 16px;
  text-align: left;
  border-radius: 14px;
  color: #fff;
  background: var(--navy);
}

.ask-strip.full {
  margin: 4px 0 18px;
}

.ask-strip span {
  font-size: 18px;
  font-weight: 850;
}

.ask-strip small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini-stats span {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 12px;
  background: #f6f8fb;
  color: #687083;
  font-size: 13px;
}

.mini-stats b {
  color: var(--ink);
  font-size: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 10px;
}

.section-title h2,
.panel-head h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
}

.list,
.question-stack {
  display: grid;
  gap: 8px;
}

.compact-list {
  gap: 4px;
}

.folder-row,
.post-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  min-height: 80px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(232, 235, 241, 0.8);
  text-align: left;
}

.post-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.post-row.unread .row-title::before {
  content: "";
  width: 8px;
  height: 8px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--blue);
  vertical-align: 2px;
}

.folder-icon {
  width: 44px;
  height: 34px;
  border-radius: 7px 7px 9px 9px;
  position: relative;
  background: linear-gradient(#ffd85a, var(--folder));
  box-shadow: inset 0 -7px 10px rgba(160, 101, 0, 0.09);
}

.folder-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: -7px;
  width: 22px;
  height: 11px;
  border-radius: 5px 5px 0 0;
  background: #ffd85a;
}

.row-title {
  margin: 0 0 5px;
  font-size: 17px;
  line-height: 1.32;
  font-weight: 840;
  word-break: break-word;
}

.row-meta {
  color: #9aa2af;
  font-size: 13px;
  line-height: 1.35;
}

.row-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #dde1e8;
}

.reader-card,
.plain-panel,
.question-card,
.desk-panel {
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.reader-card,
.plain-panel {
  padding: 17px;
  margin-bottom: 14px;
}

.reader-card.in-modal {
  border: 0;
  padding: 0;
}

.reader-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  margin-bottom: 10px;
}

.reader-card h1 {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.28;
}

.plain-panel h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.plain-panel p,
.post-body {
  margin: 0;
  white-space: pre-wrap;
  color: #424b5a;
  font-size: 15px;
  line-height: 1.72;
}

.plain-panel .secondary-btn,
.plain-panel .danger-btn {
  margin-top: 12px;
}

.link-card {
  display: block;
  margin-top: 14px;
  padding: 12px 13px;
  border-radius: 10px;
  background: #edf5ff;
  color: #0b66ca;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-top: 14px;
}

.image-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: #eef1f7;
}

.question-card {
  padding: 14px;
  text-align: left;
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #8d95a2;
  font-size: 12px;
  margin-bottom: 8px;
}

.question-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.38;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  background: #fff4d9;
  color: var(--amber);
  white-space: nowrap;
}

.status.answered {
  background: #eaf8f1;
  color: var(--green);
}

.status.resolved {
  background: #eef2ff;
  color: #3754b4;
}

.status.archived,
.status.draft {
  background: #eef0f4;
  color: #6f7785;
}

.reply {
  margin-top: 10px;
  padding: 11px;
  border-radius: 10px;
  background: #eef5ff;
}

.reply b {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.reply p {
  margin: 0;
  color: #354052;
  font-size: 14px;
  line-height: 1.6;
}

.question-actions,
.row-actions,
.desk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.question-actions {
  margin-top: 12px;
}

.question-actions button,
.row-actions button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: #516070;
  background: #f1f3f7;
  font-size: 12px;
  font-weight: 780;
}

.empty {
  padding: 34px 16px;
  text-align: center;
  color: #9aa1ad;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100vw, 430px);
  height: 76px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 26px rgba(17, 24, 39, 0.06);
  z-index: 25;
}

.nav-item {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  color: #9ba3af;
  font-size: 12px;
  font-weight: 780;
}

.nav-mark {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 2px solid currentColor;
}

.nav-item.active {
  color: var(--ink);
}

.nav-item.active .nav-mark {
  background: var(--navy);
  border-color: var(--navy);
}

.nav-item b {
  font-weight: 800;
}

.fab {
  position: fixed;
  left: calc(50% + 142px);
  bottom: 88px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  background: var(--blue);
  box-shadow: 0 14px 30px rgba(24, 119, 242, 0.28);
  z-index: 30;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  align-items: end;
  background: rgba(8, 13, 27, 0.34);
  z-index: 60;
}

.modal-card {
  width: min(100vw, 520px);
  max-height: 86vh;
  overflow-y: auto;
  margin: 0 auto;
  padding: 18px;
  border-radius: 18px 18px 0 0;
  background: #fff;
}

.brother-page .modal-card {
  align-self: center;
  border-radius: 16px;
}

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

.modal-head h2 {
  margin: 0;
  font-size: 21px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--quiet);
  color: #737b89;
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.file-preview,
.context-note {
  color: #687083;
  font-size: 13px;
}

.context-note {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f5f7fb;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 94px;
  transform: translateX(-50%) translateY(20px);
  width: min(calc(100vw - 36px), 380px);
  min-height: 42px;
  border-radius: 12px;
  background: #101828;
  color: #fff;
  padding: 11px 15px;
  opacity: 0;
  pointer-events: none;
  transition: 0.18s ease;
  z-index: 80;
  font-size: 14px;
  text-align: center;
}

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

.brother-layout {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  min-height: calc(100vh - 100px);
}

.side-nav {
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  background: #fbfcff;
}

.side-title {
  margin: 0 10px 14px;
  color: #7c8594;
  font-size: 12px;
  font-weight: 850;
}

.side-nav button {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  text-align: left;
  color: #566171;
  font-weight: 780;
}

.side-nav button.active {
  background: var(--navy);
  color: #fff;
}

.workspace {
  padding: 22px;
}

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

.desk-head h1 {
  margin: 0 0 6px;
  font-size: 25px;
  line-height: 1.2;
}

.desk-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.stat-card span {
  color: #7f8796;
  font-size: 13px;
  font-weight: 760;
}

.stat-card b {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.desk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.desk-panel {
  padding: 16px;
  background: #fff;
}

.content-admin {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 14px;
}

.folder-admin {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.folder-chip {
  display: grid;
  gap: 4px;
  min-height: 52px;
  padding: 10px;
  border-radius: 10px;
  text-align: left;
  color: #4c5564;
  background: #f7f8fb;
}

.folder-chip.active {
  background: var(--navy);
  color: #fff;
}

.folder-chip span {
  font-weight: 840;
}

.folder-chip small {
  opacity: 0.72;
}

.admin-toolbar {
  margin-bottom: 12px;
}

.admin-toolbar input {
  max-width: 420px;
}

.admin-toolbar select {
  max-width: 160px;
}

.segmented {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  color: #687083;
  background: #f4f6fa;
  font-weight: 780;
}

.segmented button.active {
  color: #fff;
  background: var(--navy);
}

.post-table {
  display: grid;
  gap: 8px;
}

.post-table.slim .admin-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.post-table.slim .row-actions {
  display: none;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
}

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

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

.settings-grid div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 10px;
  background: #f7f8fb;
}

.settings-grid span {
  color: #7f8796;
  font-size: 13px;
}

.settings-grid b {
  font-size: 14px;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .brother-shell {
    width: min(100vw, 430px);
    min-height: 100vh;
    margin: 0 auto;
    border-radius: 0;
  }

  .brother-layout,
  .content-admin,
  .desk-grid {
    grid-template-columns: 1fr;
  }

  .side-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-title {
    display: none;
  }

  .side-nav button {
    width: auto;
    white-space: nowrap;
  }

  .workspace {
    padding: 16px;
  }

  .stat-grid,
  .question-stack.desktop,
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 430px) {
  .app-shell {
    box-shadow: none;
  }

  main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .site-filing {
    align-items: flex-start;
    flex-direction: column;
    margin: 0 16px;
    padding-bottom: 94px;
  }

  .filing-divider {
    display: none;
  }

  .fab {
    left: auto;
    right: 16px;
  }

  .form-grid,
  .mini-stats,
  .stat-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .title-switch {
    font-size: 26px;
  }
}
