:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --text: #17202a;
  --muted: #697586;
  --line: #d9e1e8;
  --brand: #cf2634;
  --brand-2: #126b8f;
  --ok: #16835d;
  --warn: #b56a00;
  --shadow: 0 18px 40px rgba(24, 36, 54, 0.08);
  --radius: 8px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

body.dark {
  color-scheme: dark;
  --bg: #111820;
  --surface: #18222d;
  --surface-2: #202c38;
  --text: #eef4f8;
  --muted: #9bacba;
  --line: #324252;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(0, 1fr);
  background: linear-gradient(135deg, #f3f6fa, #e8eef5 45%, #f5f7fb);
}

.login-panel,
.login-side {
  padding: 32px;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.login-brand,
.login-copy {
  display: grid;
  gap: 10px;
}

.login-copy h1,
.hero-card h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
}

.login-copy p:last-child,
.hero-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.login-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--brand);
  font-size: 13px;
}

.login-side {
  display: grid;
  place-items: center;
}

.hero-card {
  width: min(720px, 100%);
  min-height: 420px;
  padding: 36px;
  display: grid;
  align-content: end;
  gap: 18px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(10, 24, 42, 0.12), rgba(10, 24, 42, 0.58)),
    linear-gradient(120deg, #0d4664, #4f1818 58%, #1a242f);
  color: #fff;
  box-shadow: var(--shadow);
}

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

.hero-stats div {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.hero-stats span {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.hero-stats strong {
  font-size: 18px;
}

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

button {
  cursor: pointer;
}

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

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

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

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #f06b3a);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.profile-strip strong {
  display: block;
  line-height: 1.2;
}

.brand span,
.profile-strip span,
.small-muted,
.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  color: var(--text);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand);
}

.nav-item b {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
}

.profile-strip {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.avatar {
  width: 38px;
  height: 38px;
  background: var(--brand-2);
}

.main {
  min-width: 0;
  padding: 20px 26px 36px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 20px;
  background: linear-gradient(var(--bg) 72%, transparent);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, 100%);
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

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

.icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-btn,
.secondary-btn,
.icon-btn,
.text-btn {
  border: 0;
  border-radius: var(--radius);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-btn {
  padding: 0 14px;
  background: var(--brand);
  color: #fff;
}

.primary-btn.full {
  width: 100%;
}

.secondary-btn {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.secondary-btn.full {
  width: 100%;
}

.icon-btn {
  width: 40px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 10px 0 22px;
}

.section-head h1 {
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  color: var(--ok);
  font-weight: 700;
}

.status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.quick-grid,
.service-grid,
.file-grid,
.people-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.quick-tile,
.service-item,
.file-item,
.person-card,
.settings-panel,
.message-card,
.approval-card,
.event-card,
.task-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quick-tile {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 16px;
  color: var(--text);
  text-align: left;
}

.quick-tile .icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--brand);
}

.quick-tile em {
  font-style: normal;
  font-size: 28px;
  font-weight: 800;
  color: var(--brand);
}

.dev-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.dev-strip div {
  min-height: 70px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dev-strip span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.dev-strip strong {
  color: var(--text);
}

.dev-strip .good {
  color: var(--ok);
}

.dev-strip .warn {
  color: var(--warn);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

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

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

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

.approval-list,
.news-list,
.message-list,
.timeline,
#taskList,
.approval-page {
  display: grid;
  gap: 10px;
}

.approval-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
}

.approval-card h3,
.message-card h3,
.person-card h3,
.file-item h3,
.event-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.approval-card p,
.message-card p,
.person-card p,
.file-item p,
.event-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tag.hot {
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--brand);
}

.tag.ok {
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  color: var(--ok);
}

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

.mini-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.mini-btn.approve {
  border-color: var(--ok);
  color: var(--ok);
}

.mini-btn.reject {
  border-color: var(--brand);
  color: var(--brand);
}

.event-card,
.task-item,
.message-card,
.file-item,
.person-card,
.service-item {
  padding: 14px;
}

.timeline .event-card {
  border-left: 4px solid var(--brand-2);
}

.news-list .message-card {
  box-shadow: none;
}

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

.service-item {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 104px;
  color: var(--text);
}

.service-item .icon {
  color: var(--brand-2);
}

.segmented,
.tabs {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.segmented button,
.tabs button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

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

.contacts-layout,
.calendar-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
}

.message-card {
  text-align: left;
}

.message-card.active {
  outline: 2px solid var(--brand);
}

.org-tree,
.day-board,
.task-panel {
  min-height: 420px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 300px;
  gap: 16px;
}

.chat-list,
.chat-main,
.notice-rail {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-list {
  min-height: 520px;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.chat-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
}

.chat-item.active {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
}

.chat-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-item-title {
  font-weight: 700;
}

.chat-item-time {
  color: var(--muted);
  font-size: 12px;
}

.chat-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.chat-item-preview {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  font-size: 13px;
}

.dot-count {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
  background: var(--brand);
}

.chat-main {
  min-height: 520px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.chat-head h3 {
  margin: 0 0 4px;
}

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

.chat-history {
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 12px;
  max-height: 440px;
  overflow: auto;
}

.chat-row {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  gap: 5px;
}

.chat-row.self {
  justify-self: end;
  align-items: end;
}

.chat-row.other {
  justify-self: start;
  align-items: start;
}

.chat-sender {
  color: var(--muted);
  font-size: 12px;
}

.chat-bubble {
  border-radius: var(--radius);
  padding: 10px 12px;
  line-height: 1.5;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.chat-row.self .chat-bubble {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.chat-time {
  color: var(--muted);
  font-size: 12px;
}

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

.chat-composer input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 0 12px;
}

.notice-rail {
  min-height: 520px;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 10px;
}

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

.notice-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 12px;
}

.notice-item h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

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

.notice-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.org-node {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
}

.org-node.active {
  border-color: var(--brand);
  color: var(--brand);
}

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

.person-card {
  display: grid;
  gap: 12px;
}

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

.person-card .avatar {
  background: var(--brand);
}

.person-actions {
  display: flex;
  gap: 8px;
}

.day-board {
  display: grid;
  gap: 10px;
}

.event-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.event-time {
  color: var(--brand-2);
  font-weight: 800;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: none;
  margin-bottom: 10px;
}

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

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

.file-item {
  display: grid;
  min-height: 150px;
  align-content: space-between;
}

.file-meta,
.approval-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.settings-panel {
  padding: 18px;
}

.switch-row,
.radio-row,
.security-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}

.switch-row:last-child,
.radio-row:last-child,
.security-line:last-of-type {
  border-bottom: 0;
}

.switch-row input {
  appearance: none;
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--line);
}

.switch-row input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.switch-row input:checked {
  background: var(--brand);
}

.switch-row input:checked::after {
  transform: translateX(20px);
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(10, 18, 28, 0.46);
}

.dialog-card {
  width: min(520px, calc(100vw - 32px));
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

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

.dialog-card label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
}

.dialog-card input,
.dialog-card select,
.dialog-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--text);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #17202a;
  color: #fff;
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1100px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-side {
    display: none;
  }

  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .brand div:not(.brand-mark),
  .profile-strip div:not(.avatar),
  .nav-item span:last-child,
  .nav-item b {
    display: none;
  }

  .sidebar {
    align-items: center;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .dashboard-grid,
  .approval-page,
  .people-grid,
  .file-grid,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

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

@media (max-width: 760px) {
  .login-panel {
    padding: 20px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 30;
    height: 66px;
    display: block;
    padding: 8px;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .brand,
  .profile-strip {
    display: none;
  }

  .nav-list {
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
  }

  .nav-item {
    min-height: 50px;
  }

  .nav-item.active::before {
    display: none;
  }

  .main {
    padding: 12px 12px 86px;
  }

  .topbar,
  .section-head,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

  .quick-grid,
  .dev-strip,
  .dashboard-grid,
  .approval-page,
  .people-grid,
  .file-grid,
  .settings-grid,
  .chat-layout,
  .contacts-layout,
  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

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

  .event-card {
    grid-template-columns: 1fr;
  }

  .segmented,
  .tabs {
    width: 100%;
  }

  .segmented button,
  .tabs button {
    flex: 1;
  }
}
