/* ============================================
 * 差旅志 · Simple 简约版
 * 替换 dossier.css(保留原文件以便回滚)
 * 原则: 系统字体、无纹理、无装饰、单主色
 * ============================================ */

:root {
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --text: #1D2129;
  --text-2: #4E5969;
  --text-3: #86909C;
  --line: #E5E6EB;
  --line-soft: #F0F1F3;
  --primary: #1D2129;
  --primary-hover: #383D45;
  --link: #2F6BE0;
  --danger: #D93026;
  --danger-bg: #FDF2F1;
  --success: #22863A;

  --radius: 10px;
  --radius-sm: 8px;

  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
          "MiSans", "Noto Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* ============ Reset & Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-feature-settings: "tnum", "kern";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  line-height: 1.55;
  min-height: 100vh;
}

input, textarea, button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
hr { border: 0; margin: 0; }

/* ============ App Shell ============ */
.app-shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface);
  position: relative;
}
@media (min-width: 560px) {
  .app-shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* ============ Top Nav ============ */
.top-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
  min-height: 60px;
}

.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 17px; color: var(--text);
  text-decoration: none;
}
.logo .dot {
  width: 28px; height: 28px; background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 600;
}

.nav-title {
  font-size: 16px; font-weight: 600; color: var(--text);
  position: absolute; left: 50%; transform: translateX(-50%);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 55%;
  text-align: center;
}

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; color: var(--text-2);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:active { background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { background: var(--surface-2); border-color: var(--text-3); }
}

/* user avatar in nav */
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
  border: 0;
}
.avatar-btn:active { opacity: 0.85; }
.avatar-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 170px;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.15);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  overflow: hidden;
}
.avatar-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.avatar-menu .menu-head {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px; color: var(--text-3);
}
.avatar-menu a {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}
@media (hover: hover) and (pointer: fine) {
  .avatar-menu a:hover { background: var(--surface-2); }
}
.avatar-menu a.danger { color: var(--danger); }

/* ============ Main content area ============ */
.main { padding-bottom: 40px; }

/* ============ Page Head ============ */
.page-head {
  padding: 24px 20px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.page-head .title {
  font-size: 22px; font-weight: 700; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-all;
}
.page-head .sub {
  font-size: 13px; color: var(--text-3); margin-top: 4px;
}

/* ============ Trip Card (list item) ============ */
.trip-list { padding: 4px 20px 16px; }
.trip-card-wrap { position: relative; margin-bottom: 12px; }
.trip-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 0;
  color: var(--text);
  text-decoration: none;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.trip-card:active { background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) {
  .trip-card:hover { border-color: var(--text-3); }
}
.trip-name {
  font-size: 17px; font-weight: 600; line-height: 1.4;
  margin: 0 32px 6px 0;
  word-break: break-all;
}
.trip-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-3);
}
.trip-meta .pip { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }

.card-delete {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px;
  background: transparent; border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 2;
}
.card-delete:active { color: var(--danger); background: var(--danger-bg); }
@media (hover: hover) and (pointer: fine) {
  .card-delete:hover { color: var(--danger); background: var(--danger-bg); }
}

/* ============ Day Header ============ */
.day-ribbon {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 22px 20px 8px;
}
.day-cn { font-size: 16px; font-weight: 700; color: var(--text); }
.day-num { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ============ Entry Row (timeline) ============ */
.entry {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 12px;
  padding: 12px 20px;
  align-items: start;
  border-bottom: 1px solid var(--line-soft);
}
.entry:last-child { border-bottom: 0; }
.entry-time {
  font-size: 14px; font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}
.entry-time small {
  display: block; font-size: 11px; font-weight: 400;
  color: var(--text-3);
}
.entry-body { min-width: 0; }
.entry-act {
  font-size: 15px; color: var(--text); line-height: 1.5;
  word-break: break-word;
}
.entry-photo {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 88px; height: 88px;
  display: block;
  overflow: hidden;
  cursor: pointer;
}
.entry-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.entry-actions { display: flex; gap: 2px; }
.entry-actions button {
  width: 30px; height: 30px;
  background: transparent; border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.entry-actions button:active { background: var(--surface-2); color: var(--text); }
@media (hover: hover) and (pointer: fine) {
  .entry-actions button:hover { background: var(--surface-2); color: var(--text); }
  .entry-actions button.danger:hover { background: var(--danger-bg); color: var(--danger); }
}

/* ============ Extra (attachment-only) Entry ============ */
.extras-head {
  padding: 24px 20px 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text-3);
  border-top: 1px solid var(--line);
  margin-top: 12px;
}
.extra-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 20px;
  font-size: 13px; color: var(--text-2);
}
.extra-row .thumb {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
}
.extra-row .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.extra-row .actions { display: flex; gap: 2px; }
.extra-row .actions button {
  width: 30px; height: 30px;
  background: transparent; border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}
@media (hover: hover) and (pointer: fine) {
  .extra-row .actions button:hover { background: var(--surface-2); color: var(--text); }
  .extra-row .actions button.danger:hover { background: var(--danger-bg); color: var(--danger); }
}

/* ============ Buttons ============ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 14px 24px;
  font-size: 16px; font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s ease;
}
.btn-primary:active { background: var(--primary-hover); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--primary-hover); color: #fff; }
}
.btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primary.danger { background: var(--danger); }
.btn-primary.danger:active { background: #B8241C; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary.danger:hover { background: #B8241C; }
}

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 13px 24px;
  font-size: 15px; font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-ghost:active { background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover { background: var(--surface-2); border-color: var(--text-3); color: var(--text); }
}

.btn-blue {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 12px 20px;
  font-size: 14px; font-weight: 500;
  border-radius: var(--radius);
  transition: background 0.15s ease;
}
.btn-blue:active { background: var(--primary-hover); }
@media (hover: hover) and (pointer: fine) {
  .btn-blue:hover { background: var(--primary-hover); color: #fff; }
}
.btn-blue[disabled] { opacity: 0.5; cursor: not-allowed; }

.bottom-action {
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 8px));
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex; flex-direction: column; gap: 10px;
  position: sticky; bottom: 0; z-index: 20;
}

/* ============ Form Fields ============ */
.field { padding: 14px 20px 4px; }
.field-label {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
.field-label .cn {
  font-size: 14px; font-weight: 500; color: var(--text-2);
}
.field-label .en { font-size: 12px; color: var(--text-3); }
.field-input, .field-textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 11px 12px;
  font-size: 16px;
  color: var(--text);
  outline: none;
  border-radius: var(--radius-sm);
  -webkit-appearance: none;
  transition: border-color 0.15s ease;
}
.field-input:focus, .field-textarea:focus { border-color: var(--text); }
.field-input[readonly] { background: var(--surface-2); color: var(--text-3); }
.field-textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.6;
}
.field-input::placeholder, .field-textarea::placeholder { color: var(--text-3); }
input[type="file"].field-input { padding: 9px 12px; font-size: 14px; }
input[type="date"].field-input, input[type="time"].field-input { min-height: 46px; }
.field-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3); line-height: 1.6;
}
/* time input pair */
.field-pair { display: flex; align-items: center; gap: 10px; }
.field-pair .field-input { flex: 1; min-width: 0; }
.field-pair .sep { color: var(--text-3); font-size: 13px; flex-shrink: 0; }

/* ============ Empty State ============ */
.empty {
  text-align: center;
  padding: 80px 32px;
  color: var(--text-3);
}
.empty .icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--surface-2);
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: var(--text-3);
}
.empty h3 {
  font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 6px;
}
.empty p { font-size: 13px; margin: 0; }

/* ============ Modal (sheet) ============ */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.sheet-backdrop.open { opacity: 1; visibility: visible; }
.sheet {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.2s ease;
}
.sheet-backdrop.open .sheet { opacity: 1; transform: translateY(0); }
@media (min-width: 600px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 14px; max-width: 460px; max-height: 88vh; }
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: 10px auto 0;
}
.sheet-head {
  padding: 16px 20px 12px;
  display: flex; align-items: baseline; justify-content: space-between;
}
.sheet-title {
  font-size: 18px; font-weight: 700;
  color: var(--text);
  margin: 0;
}
.sheet-sub { font-size: 12px; color: var(--text-3); }
.sheet-body { padding: 0 0 8px; }
.sheet-foot {
  padding: 14px 20px calc(20px + env(safe-area-inset-bottom, 10px));
  display: flex; gap: 10px;
}
.sheet-foot button { flex: 1; }
.sheet-foot .btn-primary { flex: 2; }
.sheet-foot form { flex: 2; display: flex; }
.sheet-foot form .btn-primary { width: 100%; }

/* ============ Toast ============ */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--primary);
  color: #fff;
  padding: 11px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ============ Doc Preview (export page) ============ */
.doc-preview {
  margin: 16px 20px 0;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.doc-preview h4 {
  font-size: 16px; font-weight: 700; text-align: center; margin: 2px 0 14px;
  color: var(--text);
}
.doc-preview small {
  display: block; text-align: right;
  font-size: 12px;
  color: var(--text-2); margin-top: 12px;
  line-height: 1.6;
}

/* ============ Table Preview ============ */
.table-prev {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.table-prev th, .table-prev td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
  color: var(--text);
  vertical-align: top;
}
.table-prev th {
  font-weight: 500;
  font-size: 12px;
  color: var(--text-3);
}
.table-prev tr:last-child td { border-bottom: 0; }
.table-prev th:nth-child(1), .table-prev td:nth-child(1),
.table-prev th:nth-child(2), .table-prev td:nth-child(2) { white-space: nowrap; }

/* ============ Note Box ============ */
.note {
  margin: 14px 20px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-2); line-height: 1.6;
  border-radius: var(--radius-sm);
}
.note b { color: var(--text); }
.note.danger { background: var(--danger-bg); border-color: rgba(217, 48, 38, 0.25); }
.note.danger b { color: var(--danger); }

/* ============ Image Lightbox ============ */
.lightbox-bd {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 300;
  display: flex;
  align-items: center; justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.lightbox-bd.open { opacity: 1; visibility: visible; }
.lightbox-bd img { max-width: 92%; max-height: 92%; object-fit: contain; }
.lightbox-bd .close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.12);
  color: #fff; border: 0;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 22px;
}

/* ============ Login / Auth ============ */
.auth-shell {
  max-width: 520px; margin: 0 auto;
  min-height: 100vh;
  background: var(--surface);
  display: flex; flex-direction: column;
}
@media (min-width: 560px) {
  .auth-shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
.auth-hero {
  padding: 88px 32px 40px;
  text-align: center;
}
.auth-logo {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--primary);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 600;
  margin-bottom: 20px;
}
.auth-mark {
  font-size: 26px; font-weight: 700; color: var(--text);
  line-height: 1.2; margin: 0 0 6px;
}
.auth-sub { font-size: 14px; color: var(--text-3); margin: 0; }

.auth-fields { padding: 16px 24px 0; }
.auth-fields .field { padding-left: 0; padding-right: 0; }
.auth-action { padding: 24px 24px 0; }
.auth-foot { padding: 20px 24px 40px; text-align: center; }
.auth-link { color: var(--text-3); font-size: 14px; }
.auth-link a { color: var(--link); font-weight: 500; }

.remember-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0 0;
  font-size: 14px; color: var(--text-2);
}
.remember-row input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .sheet, .toast, .avatar-menu { transform: none !important; }
}

/* ============ Print friendly ============ */
@media print {
  body { background: white !important; }
  .top-nav, .bottom-action, .sheet-backdrop, .toast-container, .no-print { display: none !important; }
  .app-shell { border: 0; max-width: none; }
}

/* ============ Utility ============ */
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none !important; }
