:root {
  --bg: #f4f3ee;
  --surface: #fffefa;
  --surface-strong: #ffffff;
  --ink: #20211f;
  --muted: #6c6b64;
  --line: #d8d5ca;
  --line-strong: #bdb8aa;
  --teal: #087f7a;
  --teal-soft: #d8efec;
  --amber: #c87719;
  --amber-soft: #f6e3c7;
  --rose: #b74343;
  --green: #2f7d4b;
  --blue: #3866a3;
  --shadow: 0 18px 42px rgba(32, 33, 31, 0.12);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

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

button {
  cursor: pointer;
}

.message h3,
.message h4 {
  margin: 10px 0 6px;
  line-height: 1.35;
}

.message h3 {
  font-size: 16px;
}

.message h4 {
  font-size: 14px;
  color: var(--teal);
}

.md-bullet {
  margin: 4px 0;
  line-height: 1.55;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.3fr);
  background:
    linear-gradient(135deg, rgba(8, 127, 122, 0.11), transparent 34%),
    linear-gradient(315deg, rgba(200, 119, 25, 0.14), transparent 30%),
    var(--bg);
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: 54px;
  border-right: 1px solid var(--line);
}

.brand-mark,
.mini-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-weight: 800;
}

.mini-mark {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.login-brand h1 {
  max-width: 520px;
  margin: 38px 0 18px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 54px;
  line-height: 1.02;
  font-weight: 800;
}

.login-brand p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

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

.metric-tile {
  min-height: 94px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.65);
}

.metric-tile strong {
  display: block;
  font-size: 24px;
}

.metric-tile span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel-wrap {
  display: grid;
  place-items: center;
  padding: 36px;
}

.login-panel {
  width: min(540px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-kicker,
.kicker {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.login-panel h2,
.view-title h2 {
  margin: 8px 0;
  font-size: 24px;
}

.login-panel p,
.view-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.demo-users {
  display: grid;
  gap: 10px;
  margin: 24px 0;
}

.user-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  text-align: left;
}

.user-button:not(:disabled):hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.user-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.user-button strong {
  display: block;
  margin-bottom: 4px;
}

.user-button span {
  color: var(--muted);
  font-size: 13px;
}

.role-pill,
.status-pill,
.priority-pill,
.type-pill {
  align-self: start;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.role-pill.admin,
.status-pill.new,
.priority-pill.high {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: #75420a;
}

.status-pill.current,
.type-pill {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: #075854;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 28px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #ece9df;
}

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

.side-brand strong {
  display: block;
}

.side-brand span,
.user-mini span {
  color: var(--muted);
  font-size: 12px;
}

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

.nav button {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.nav button:hover,
.nav button.active {
  border-color: var(--line-strong);
  background: var(--surface);
}

.nav-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  background: #ded9ca;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.nav-badge {
  min-width: 20px;
  padding: 2px 6px;
  background: var(--rose);
  color: white;
  font-size: 11px;
  text-align: center;
}

.sidebar-bottom {
  margin-top: auto;
}

.user-mini {
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.58);
}

.ghost-button,
.primary-button,
.text-button,
.danger-button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.ghost-button {
  padding: 8px 10px;
}

.primary-button {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.danger-button {
  border-color: var(--rose);
  color: var(--rose);
}

.text-button {
  border-color: transparent;
  background: transparent;
  color: var(--blue);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 243, 238, 0.92);
  backdrop-filter: blur(12px);
}

.search-box {
  display: flex;
  width: min(520px, 55vw);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 12px;
}

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

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

.content {
  padding: 28px;
}

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

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

.summary-tile,
.panel,
.chat-pane,
.project-row,
.announcement-row,
.feature-entry,
.admin-table-wrap {
  border: 1px solid var(--line);
  background: var(--surface);
}

.summary-tile {
  min-height: 108px;
  padding: 16px;
}

.summary-tile span {
  color: var(--muted);
  font-size: 13px;
}

.summary-tile strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

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

.quick-grid button,
.future-grid button {
  min-height: 54px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  text-align: left;
}

.quick-grid button:hover,
.future-grid button:hover {
  border-color: var(--teal);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chat-pane {
  display: grid;
  min-height: calc(100vh - 154px);
  grid-template-rows: auto 1fr auto;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.chat-feed {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 320px;
  max-height: calc(100vh - 312px);
  overflow: auto;
  padding: 16px;
}

.message {
  width: min(760px, 92%);
  padding: 13px 14px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  white-space: pre-line;
  line-height: 1.65;
}

.message.user {
  justify-self: end;
  border-color: #c0d7d3;
  background: var(--teal-soft);
}

.message.assistant {
  justify-self: start;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.composer textarea {
  min-height: 72px;
  resize: vertical;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 10px;
  outline-color: var(--teal);
}

.side-stack {
  display: grid;
  gap: 16px;
}

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

.project-row,
.announcement-row {
  padding: 14px;
}

.row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.project-row h4,
.announcement-row h4,
.feature-entry h4 {
  margin: 0;
  font-size: 16px;
}

.muted,
.meta-line {
  color: var(--muted);
}

.meta-line {
  margin-top: 6px;
  font-size: 13px;
}

.project-actions,
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

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

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

.field span,
.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 10px;
  outline-color: var(--teal);
}

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

.profile-form {
  display: grid;
  gap: 14px;
  max-width: 780px;
}

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

.feature-entry {
  min-height: 92px;
  padding: 14px;
}

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

.admin-table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #ece9df;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
}

.mobile-nav-toggle {
  display: none;
}

@media (max-width: 1080px) {
  .login-shell,
  .app-shell,
  .workbench-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .login-brand {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

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

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

  .chat-pane {
    min-height: 620px;
  }
}

@media (max-width: 700px) {
  .login-brand,
  .login-panel-wrap,
  .content,
  .topbar {
    padding: 18px;
  }

  .login-brand h1 {
    font-size: 38px;
  }

  .login-metrics,
  .summary-grid,
  .admin-grid,
  .quick-grid,
  .future-grid,
  .nav {
    grid-template-columns: 1fr;
  }

  .topbar,
  .view-head {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .composer {
    grid-template-columns: 1fr;
  }
}

.skill-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.skill-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}

.skill-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.skill-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.skill-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-wrap: wrap;
}

.skill-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.skill-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.skill-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.skill-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-wrap: wrap;
}

.skill-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.skill-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.skill-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
