/* 财务工作管理平台 · 样式表（手机优先，零依赖） */
:root {
  --brand: #0f6f5c;
  --brand-dark: #0a5244;
  --brand-soft: #e6f3ef;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #fafbfb;
  --line: #e3e8e9;
  --text: #1c2b28;
  --text-2: #5b6b68;
  --text-3: #8a9997;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --warn: #b7791f;
  --warn-soft: #fdf6e3;
  --info: #2b6cb0;
  --info-soft: #e8f1fa;
  --ok: #2f855a;
  --ok-soft: #e8f5ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 42, 36, 0.06), 0 4px 16px rgba(16, 42, 36, 0.05);
  --nav-h: 58px;
  --header-h: 54px;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
}

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

/* ---------- 启动动画 ---------- */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  justify-items: center;
  background: var(--bg);
  z-index: 100;
}
.boot-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 1px;
}
.boot-text {
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- 布局 ---------- */
.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .sub {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 400;
  margin-left: 6px;
}

.page {
  flex: 1;
  padding: 14px 12px 24px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  animation: fade 0.18s ease;
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.bottomnav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-3);
  font-size: 11px;
  min-height: 44px;
}
.bottomnav a.active {
  color: var(--brand);
}
.bottomnav a .ico {
  font-size: 18px;
  line-height: 1;
  font-style: normal;
}
.bottomnav .dot {
  position: absolute;
  top: 7px;
  margin-left: 16px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}

/* ---------- 基础信息公司列表 ---------- */
[data-corow]:last-child {
  border-bottom: none;
}
[data-corow] .co-head:active {
  background: rgba(0, 0, 0, 0.03);
}
@media (hover: hover) {
  [data-corow] .co-head:hover {
    background: rgba(0, 0, 0, 0.025);
  }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.card-tight {
  padding: 12px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.card-head h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
  flex: 1;
}
.card-head .more {
  font-size: 13px;
  color: var(--brand);
}

.section-title {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
  margin: 18px 2px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title .count {
  color: var(--text-3);
  font-weight: 400;
}

/* ---------- 统计卡 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat b {
  display: block;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.2;
}
.stat span {
  font-size: 11px;
  color: var(--text-3);
}
.stat.hot b {
  color: var(--danger);
}
.stat.warn b {
  color: var(--warn);
}
.stat.ok b {
  color: var(--ok);
}

/* ---------- 任务行 ---------- */
.task-row {
  display: flex;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  align-items: flex-start;
  transition: border-color 0.15s;
}
.task-row:active {
  border-color: var(--brand);
}
.task-main {
  flex: 1;
  min-width: 0;
}
.task-title {
  font-weight: 550;
  font-size: 15px;
  margin-bottom: 3px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.task-title .txt {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.task-meta {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}
.task-row.done .task-title {
  color: var(--text-3);
  text-decoration: line-through;
}

/* ---------- 徽标 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 18px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tag.todo {
  background: #f1f3f4;
  color: #4a5755;
}
.tag.in_progress {
  background: var(--info-soft);
  color: var(--info);
  border-color: #cfe1f5;
}
.tag.blocked {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f7d3cf;
}
.tag.done {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: #cbe8d8;
}
.tag.cancelled {
  background: #f1f3f4;
  color: var(--text-3);
}
.tag.pri-urgent {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f7d3cf;
}
.tag.pri-high {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: #f2e2bd;
}
.tag.pri-low {
  background: #f1f3f4;
  color: var(--text-3);
}
.tag.overdue {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f7d3cf;
  font-weight: 600;
}
.tag.ghost {
  background: transparent;
}

/* ---------- 进度条 ---------- */
.progress {
  height: 5px;
  background: #eef1f2;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 7px;
}
.progress > i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.3s;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}
.btn:disabled {
  opacity: 0.55;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.primary:active {
  background: var(--brand-dark);
}
.btn.danger {
  color: var(--danger);
  border-color: #f3d5d1;
  background: var(--danger-soft);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand);
  min-height: 36px;
  padding: 0 8px;
}
.btn.sm {
  min-height: 34px;
  font-size: 13px;
  padding: 0 12px;
  border-radius: 8px;
}
.btn.block {
  width: 100%;
}
.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- 表单 ---------- */
.field {
  margin-bottom: 12px;
}
.field > label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 5px;
  font-weight: 500;
}
.field .hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.5;
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.6;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 111, 92, 0.1);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235b6b68' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-size: 14px;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

/* 多选列表勾选框（任务/周期任务的关联公司等） */
.check-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 240px;
  overflow: auto;
  background: var(--bg, #fff);
}
.check-list .check {
  padding: 8px 12px;
  margin: 0;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  min-height: 36px;
  font-weight: 400;
}
.check-list .check:last-child {
  border-bottom: none;
}
.check-list .check:hover {
  background: rgba(0, 0, 0, 0.03);
}
.check-list.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 720px) {
  .check-list.cols-2 {
    grid-template-columns: 1fr;
  }
}

/* ---------- 筛选 chips ---------- */
.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar {
  display: none;
}
.chip {
  flex: 0 0 auto;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  color: var(--text-2);
  min-height: 34px;
}
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 500;
}

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-3);
  font-size: 14px;
}
.empty .ico {
  font-size: 30px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ---------- 时间轴 ---------- */
.timeline {
  position: relative;
  padding-left: 22px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}
.tl-item {
  position: relative;
  padding-bottom: 14px;
}
.tl-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cfd8d6;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.tl-item.hl::before {
  background: var(--brand);
}
.tl-head {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.tl-head b {
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
}
.tl-body {
  font-size: 14px;
  margin-top: 2px;
  white-space: pre-wrap;
  word-break: break-word;
}
.tl-body.quote {
  background: var(--surface-2);
  border-left: 3px solid var(--line);
  padding: 7px 10px;
  border-radius: 0 8px 8px 0;
  color: var(--text-2);
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  white-space: nowrap;
}
th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
th {
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
  position: sticky;
  top: 0;
}
tr:last-child td {
  border-bottom: none;
}

/* ---------- 弹层 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 42, 36, 0.38);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.16s;
}
.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 640px;
  max-height: 88dvh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  animation: up 0.2s ease;
}
@keyframes up {
  from {
    transform: translateY(16px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.sheet h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.sheet-actions .btn {
  flex: 1;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(28, 43, 40, 0.94);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 80;
  max-width: 88vw;
  text-align: center;
  animation: up 0.18s;
}
.toast.err {
  background: rgba(192, 57, 43, 0.96);
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(120% 80% at 50% 0%, #eaf5f1 0%, var(--bg) 45%);
}
.login-box {
  width: 100%;
  max-width: 380px;
}
.login-head {
  text-align: center;
  margin-bottom: 22px;
}
.login-head .logo {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: var(--brand);
  color: #fff;
  font-size: 28px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  box-shadow: 0 10px 24px rgba(15, 111, 92, 0.24);
}
.login-head h1 {
  font-size: 20px;
  margin: 0 0 4px;
}
.login-head p {
  margin: 0;
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- 其他 ---------- */
.kv {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 7px 10px;
  font-size: 13.5px;
}
.kv dt {
  color: var(--text-3);
}
.kv dd {
  margin: 0;
  word-break: break-all;
}
.hlist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 48px;
}
.hitem .grow {
  flex: 1;
  min-width: 0;
}
.hitem .t {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hitem .d {
  font-size: 12px;
  color: var(--text-3);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  flex: 0 0 auto;
}
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: none;
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(15, 111, 92, 0.34);
  z-index: 35;
  display: grid;
  place-items: center;
}
.sticky-actions {
  position: sticky;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 10px 0 4px;
  display: flex;
  gap: 8px;
  z-index: 20;
}
.sticky-actions .btn {
  flex: 1;
}
.warn-box {
  background: var(--warn-soft);
  border: 1px solid #f0e0b8;
  color: #7a5a12;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.6;
}
.danger-box {
  background: var(--danger-soft);
  border: 1px solid #f3d5d1;
  color: #9b2c20;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.6;
}
.muted {
  color: var(--text-3);
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.right {
  margin-left: auto;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wrap {
  flex-wrap: wrap;
}
.mt8 {
  margin-top: 8px;
}
.mt12 {
  margin-top: 12px;
}
.hide {
  display: none !important;
}
.file-drop {
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  padding: 18px 12px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  background: var(--surface-2);
}
.file-drop.over {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

/* ---------- 桌面适配 ---------- */
@media (min-width: 900px) {
  .shell {
    padding-bottom: 0;
    padding-left: 208px;
  }
  .bottomnav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    right: auto;
    width: 208px;
    height: 100dvh;
    grid-template-columns: 1fr;
    grid-auto-rows: 48px;
    align-content: start;
    padding-top: 14px;
    border-top: none;
    border-right: 1px solid var(--line);
    background: var(--surface);
  }
  .bottomnav a {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 18px;
    font-size: 14px;
    min-height: 48px;
  }
  .bottomnav a .ico {
    font-size: 17px;
    width: 20px;
    text-align: center;
  }
  .topbar {
    padding-left: 20px;
  }
  .page {
    padding: 20px 18px 40px;
  }
  .fab {
    right: 28px;
    bottom: 28px;
  }
  .toast {
    bottom: 32px;
  }
  .mask {
    align-items: center;
  }
  .sheet {
    border-radius: 16px;
    max-height: 82dvh;
  }
}
