:root {
  --bg: #eef5ff;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --line: #dce7f5;
  --line-soft: #edf2f8;
  --text: #071d3a;
  --muted: #6b7d96;
  --soft: #9cadc4;
  --blue: #2f7df6;
  --blue-2: #0f68ff;
  --green: #14b88a;
  --orange: #f59e0b;
  --red: #ef4444;
  --purple: #7c3aed;
  --cyan: #16b7c9;
  --shadow: 0 24px 70px rgba(31, 74, 131, 0.12);
  --shadow-soft: 0 10px 30px rgba(31, 74, 131, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: radial-gradient(circle at 10% -10%, #fff 0, #eef6ff 35%, #eaf3ff 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: 18px;
}

body.is-locked .app-shell {
  filter: blur(4px);
  pointer-events: none;
}

.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(238, 245, 255, 0.86);
}

.lock-overlay.open {
  display: grid;
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 15px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(211, 225, 244, 0.95);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 2px 0 4px;
  font-size: 26px;
  letter-spacing: 0;
}

.login-card label,
.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-card input,
.field input,
.field select,
.field textarea,
.filter,
.search-box,
.month-picker {
  width: 100%;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
}

.login-card input,
.field input,
.field select,
.filter {
  min-height: 42px;
  padding: 8px 12px;
}

.field textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

.login-error {
  display: none;
  padding: 10px 12px;
  color: var(--red);
  background: #fff3f3;
  border: 1px solid #ffd4d7;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
}

.login-error.show {
  display: block;
}

.brand-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--blue-2));
  border-radius: 13px;
  box-shadow: 0 12px 30px rgba(47, 125, 246, 0.32);
  font-weight: 900;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.sidebar {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.76));
  border: 1px solid rgba(211, 225, 244, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 24px 22px 18px;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand small,
.sidebar-footer small,
.muted {
  color: var(--muted);
}

.module-nav {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.module-nav button {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 15px;
  color: #153457;
  background: transparent;
  border: 0;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 800;
  text-align: left;
  transition: 0.18s ease;
}

.module-nav button:hover {
  background: #f3f8ff;
}

.module-nav button.active {
  color: var(--blue);
  background: linear-gradient(90deg, #e8f2ff, #f7fbff);
  box-shadow: inset 0 0 0 1px #cfe2ff;
}

.module-nav em {
  margin-left: auto;
  min-width: 24px;
  padding: 2px 8px;
  color: var(--red);
  background: #fff1f1;
  border: 1px solid #ffd1d1;
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  text-align: center;
}

.nav-icon {
  width: 22px;
  text-align: center;
}

.nav-separator {
  height: 1px;
  margin: 8px 6px;
  background: var(--line);
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px;
}

.deer-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #fff, #f4f9ff);
  border: 1px solid var(--line);
  border-radius: 22px;
}

.mascot {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #7a4b17;
  background: #fff1dc;
  border: 1px solid #ffd8a3;
  border-radius: 50%;
  font-weight: 900;
}

.main-shell {
  min-width: 0;
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(211, 225, 244, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

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

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  width: 310px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
}

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

.month-picker {
  width: 160px;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
}

.month-picker input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.primary-action,
.ghost-button,
.danger-button,
.icon-button,
.avatar-button,
.link-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-weight: 850;
  transition: 0.18s ease;
}

.primary-action {
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(47, 125, 246, 0.26);
}

.primary-action:hover,
.ghost-button:hover,
.icon-button:hover,
.avatar-button:hover,
.link-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(31, 74, 131, 0.1);
}

.ghost-button,
.icon-button,
.link-button {
  padding: 0 13px;
  color: #153457;
  background: #fff;
}

.danger-button {
  padding: 0 14px;
  color: var(--red);
  background: #fff6f6;
  border-color: #ffd4d7;
}

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

.avatar-button {
  padding: 6px 12px 6px 6px;
  color: var(--text);
  background: #fff;
}

.avatar-button > span:first-child {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), #95c2ff);
  border-radius: 50%;
  font-weight: 900;
}

.avatar-button strong,
.avatar-button small {
  display: block;
  text-align: left;
}

.avatar-button small {
  color: var(--muted);
  font-size: 12px;
}

.view-host {
  min-height: 0;
  overflow: visible;
  padding-right: 0;
}

.view-host::-webkit-scrollbar,
.drawer-body::-webkit-scrollbar {
  width: 8px;
}

.view-host::-webkit-scrollbar-thumb,
.drawer-body::-webkit-scrollbar-thumb {
  background: #d2e0f3;
  border-radius: 999px;
}

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

.stats-grid {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(211, 225, 244, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
}

.stat-card {
  min-height: 128px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(47, 125, 246, 0.12), rgba(255, 255, 255, 0));
}

.stat-card .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-card .num {
  margin: 14px 0 6px;
  font-size: 34px;
  font-weight: 950;
  letter-spacing: 0;
}

.stat-card .delta {
  color: var(--muted);
  font-size: 12px;
}

.stat-card.red {
  background: linear-gradient(180deg, #fff, #fff7f7);
  border-color: #ffd7d7;
}

.stat-card.orange {
  background: linear-gradient(180deg, #fff, #fff9ed);
  border-color: #ffe0b3;
}

.stat-card.green {
  background: linear-gradient(180deg, #fff, #f4fffb);
  border-color: #bdeede;
}

.work-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr);
  margin-top: 16px;
}

.panel {
  padding: 22px;
}

.panel-head,
.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-head {
  margin-bottom: 16px;
}

.panel h2,
.panel h3,
.toolbar h2,
.toolbar h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0;
}

.sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.tabs,
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-toolbar {
  align-items: center;
  gap: 12px;
}

.filter-toolbar .filters {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 10px;
  min-width: 0;
}

.filter-toolbar .filter {
  min-height: 38px;
  width: 100%;
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
}

.filter-toolbar .ghost-button {
  flex: 0 0 auto;
  min-height: 38px;
}

.tabs {
  padding: 5px;
  background: #f3f7fd;
  border: 1px solid var(--line-soft);
  border-radius: 15px;
}

.tabs button {
  height: 32px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 11px;
  font-weight: 800;
}

.tabs button.active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 5px 16px rgba(31, 74, 131, 0.08);
}

.task-list {
  display: grid;
}

.task-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.task-item:last-child {
  border-bottom: 0;
}

.task-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: #eef5ff;
  border-radius: 13px;
  font-weight: 900;
}

.task-title {
  font-weight: 900;
}

.task-desc {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status.blue {
  color: #1b73ff;
  background: #e9f2ff;
  border-color: #cfe2ff;
}

.status.green {
  color: #0d9f78;
  background: #e9fbf5;
  border-color: #bdeede;
}

.status.orange {
  color: #d97706;
  background: #fff7e8;
  border-color: #ffe0b3;
}

.status.red {
  color: var(--red);
  background: #fff1f1;
  border-color: #ffd1d1;
}

.status.gray {
  color: #64748b;
  background: #f3f6fa;
  border-color: #e2e8f0;
}

.status.purple {
  color: var(--purple);
  background: #f3efff;
  border-color: #ddd1ff;
}

.table-card {
  overflow: hidden;
}

.toolbar {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th {
  height: 48px;
  padding: 0 18px;
  color: var(--muted);
  background: #f6f9fd;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.data-table td {
  min-height: 66px;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
  vertical-align: middle;
}

.data-table strong {
  display: block;
}

.data-table small {
  color: var(--muted);
}

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

.empty-state {
  padding: 34px 20px;
  color: var(--muted);
  text-align: center;
}

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

.chart-card {
  min-height: 320px;
  padding: 22px;
}

.bars {
  display: grid;
  gap: 15px;
  margin-top: 20px;
}

.bar-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 82px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  background: #edf2f8;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  border-radius: 999px;
}

.donut-wrap {
  display: grid;
  place-items: center;
  padding: 10px 0;
}

.donut {
  width: 210px;
  height: 210px;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 46%, var(--cyan) 46% 73%, var(--orange) 73% 88%, #e9eef6 88%);
}

.donut::before {
  content: "";
  position: absolute;
  width: 138px;
  height: 138px;
  background: #fff;
  border-radius: 50%;
}

.donut-center {
  position: relative;
  text-align: center;
}

.donut-center b {
  display: block;
  font-size: 32px;
}

.trend {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 210px;
  padding-top: 18px;
}

.trend-bar {
  flex: 1;
  min-width: 0;
  display: grid;
  align-content: end;
  gap: 8px;
  height: 100%;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.trend-bar span {
  display: block;
  background: linear-gradient(180deg, var(--blue), var(--cyan));
  border-radius: 12px 12px 4px 4px;
}

.form-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #fbfdff;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
}

.form-section h3 {
  margin: 0;
}

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

.field.full {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  color: var(--text);
  font-size: 14px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

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

.detail-box {
  padding: 14px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.detail-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-box strong {
  display: block;
  margin-top: 4px;
  word-break: break-word;
}

.timeline {
  margin-left: 9px;
  padding-left: 18px;
  border-left: 2px solid #d7e4f5;
}

.timeline-item {
  position: relative;
  margin: 0 0 14px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 2px;
  width: 12px;
  height: 12px;
  background: var(--blue);
  border: 3px solid #e8f2ff;
  border-radius: 50%;
}

.timeline-item b {
  display: block;
}

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

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  justify-content: flex-end;
  background: rgba(7, 29, 58, 0.28);
  backdrop-filter: blur(8px);
}

.drawer-overlay.open {
  display: flex;
}

.drawer {
  width: min(980px, 100%);
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #fff;
  box-shadow: -26px 0 80px rgba(7, 29, 58, 0.22);
}

.drawer-header,
.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line-soft);
}

.drawer-actions {
  border-top: 1px solid var(--line-soft);
  border-bottom: 0;
}

.drawer-actions > div {
  display: flex;
  gap: 10px;
}

.drawer-header h2 {
  margin: 0;
  font-size: 26px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drawer-body {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  overflow: auto;
  padding: 22px 24px;
  background: #f8fbff;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 18px;
  color: #fff;
  background: var(--text);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(7, 29, 58, 0.3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(8px);
}

.confirm-overlay.open {
  display: grid;
}

.confirm-dialog {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.confirm-dialog h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 1320px) {
  .app-shell {
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

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

  .work-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 10px;
    gap: 10px;
  }

  .sidebar {
    border-radius: 18px;
  }

  .brand {
    padding: 16px;
  }

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

  .topbar {
    align-items: stretch;
    flex-direction: column;
    border-radius: 18px;
  }

  .top-actions,
  .search-box,
  .month-picker,
  .primary-action,
  .avatar-button {
    width: 100%;
  }

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

  .panel,
  .chart-card {
    padding: 16px;
  }

  .toolbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table th,
  .data-table td {
    display: block;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    padding: 12px 16px;
    border-top: 1px solid var(--line-soft);
  }

  .data-table td {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    min-height: 0;
    padding: 8px 0;
    border-top: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
  }

  .task-item {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .task-item > div:last-child {
    grid-column: 2;
    text-align: left;
  }

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

  .field.full {
    grid-column: auto;
  }

  .drawer {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .filter-toolbar .filters {
    grid-template-columns: 1fr;
  }
}
