/* ===== 资产管理系统 - 样式表（响应式手机版） ===== */
:root {
  --primary: #1a56db;
  --primary-light: #3b82f6;
  --primary-dark: #1e40af;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --radius: 12px;
  --radius-sm: 8px;
  --navbar-height: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding-top: var(--navbar-height);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; font-family: inherit; border: none; }
a { text-decoration: none; color: var(--primary); }

/* ===== Navbar ===== */
.navbar {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  padding: 0 16px;
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}
.nav-brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; flex-shrink: 0; }
.brand-icon { font-size: 24px; }
.brand-text { white-space: nowrap; }

/* Hamburger toggle */
.nav-toggle {
  display: none;
  background: transparent;
  color: white;
  font-size: 26px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .2s;
  z-index: 1001;
}
.nav-toggle:hover { background: rgba(255,255,255,.12); }
.nav-toggle.open { background: rgba(255,255,255,.15); }

/* Nav links (desktop) */
.nav-links {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.8);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  transition: all .2s;
}
.nav-btn:hover { background: rgba(255,255,255,.12); color: white; }
.nav-btn.active { background: rgba(255,255,255,.2); color: white; font-weight: 600; }
.nav-btn:active { transform: scale(0.96); }

/* ===== Main Content ===== */
#main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
  transition: filter .2s;
}
#main-content.blur { filter: blur(2px); pointer-events: none; }

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.card-title { font-size: 16px; font-weight: 600; color: var(--text); }
.card-subtitle { font-size: 12px; color: var(--text-secondary); }

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:active { transform: scale(0.98); }
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue { background: #dbeafe; }
.stat-icon.green { background: #d1fae5; }
.stat-icon.yellow { background: #fef3c7; }
.stat-icon.red { background: #fce4ec; }
.stat-icon.purple { background: #ede9fe; }
.stat-icon.teal { background: #ccfbf1; }
.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 2px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.stat-trend { font-size: 11px; padding: 2px 6px; border-radius: 4px; margin-left: 6px; }
.stat-trend.up { background: #d1fae5; color: #065f46; }
.stat-trend.down { background: #fce4ec; color: #991b1b; }

/* ===== Charts ===== */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.chart-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.chart-card h3 { font-size: 14px; margin-bottom: 12px; color: var(--text); font-weight: 600; }
.chart-container { position: relative; height: 240px; max-height: 240px; }

/* ===== Tables ===== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 600px;
}
table.compact { min-width: auto; }

/* 手机端表格卡片化 */
@media (max-width: 640px) {
  table.card-table {
    min-width: auto;
  }
  table.card-table thead { display: none; }
  table.card-table tbody tr {
    display: block;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
  }
  table.card-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
  }
  table.card-table tbody td:last-child { border-bottom: none; }
  table.card-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    flex-shrink: 0;
    margin-right: 8px;
  }
}

thead th {
  background: #f8fafc;
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody tr:active { background: #f1f5f9; }
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.status-badge.rented { background: #d1fae5; color: #065f46; }
.status-badge.vacant { background: #fef3c7; color: #92400e; }
.status-badge.lawsuit { background: #fce4ec; color: #991b1b; }
.status-badge.other { background: #e2e8f0; color: #475569; }

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: white;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input { cursor: pointer; }

.filter-bar input, .filter-bar select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: white;
  min-width: 140px;
  flex: 1;
}
.filter-bar input:focus, .filter-bar select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-warning { background: #f59e0b; color: white; }
.btn-warning:hover { background: #d97706; }
.btn-success { background: #059669; color: white; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }

/* ===== Detail Panel (右侧滑出面板, 手机全屏) ===== */
.detail-panel {
  position: fixed;
  right: -480px;
  top: 0;
  width: 480px;
  height: 100%;
  background: white;
  box-shadow: -4px 0 20px rgba(0,0,0,.15);
  z-index: 200;
  transition: right .3s ease;
  overflow-y: auto;
}
.detail-panel.open { right: 0; }
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 199;
  display: none;
}
.panel-overlay.show { display: block; }
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 1;
}
.detail-header h2 { font-size: 16px; }
.close-btn {
  background: rgba(255,255,255,.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-btn:hover { background: rgba(255,255,255,.3); }
.detail-body { padding: 16px; }
.detail-field { display: flex; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.detail-label { width: 100px; color: var(--text-secondary); font-size: 13px; flex-shrink: 0; }
.detail-value { flex: 1; font-size: 14px; word-break: break-all; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  font-size: 13px;
  min-width: 36px;
}
.pagination button:hover { background: #f1f5f9; }
.pagination button:disabled { opacity: .5; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--text-secondary); }

/* ===== Deposit list ===== */
.deposit-list { list-style: none; }
.deposit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.deposit-item:last-child { border-bottom: none; }
.deposit-amount { font-size: 16px; font-weight: 700; color: var(--primary); }

/* Overdue */
.overdue-amount { color: var(--danger); font-weight: 700; }

/* ===== Vacant Grid ===== */
.vacant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.vacant-card {
  background: var(--card-bg);
  border: 2px dashed #d1d5db;
  border-radius: var(--radius);
  padding: 16px;
}
.vacant-card h4 { font-size: 14px; margin-bottom: 6px; }
.vacant-card p { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 15px;
}
.loading::after { content: '...'; animation: dots 1.5s steps(4, end) infinite; }
@keyframes dots { 0%, 20% { content: ''; } 40% { content: '.'; } 60% { content: '..'; } 80%, 100% { content: '...'; } }

/* ===== Edit Modal ===== */
.edit-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  max-width: 95vw;
  max-height: 88vh;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  z-index: 1002;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.edit-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.edit-modal-header h3 { font-size: 16px; }
.edit-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.edit-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { min-width: 0; }
.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
}
.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ===== Upload Area ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 30px 20px;
  text-align: center;
  transition: all 0.3s;
  background: var(--bg);
  margin-bottom: 14px;
}
.upload-area:hover { border-color: var(--primary-light); }
.upload-icon { font-size: 40px; margin-bottom: 10px; }

/* ===== Alerts ===== */
.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.8;
}
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 14px;
  border-radius: 8px;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}
.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.toast.success { background: #065f46; color: white; }
.toast.error { background: #991b1b; color: white; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== Utility Classes ===== */
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.font-mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ===== Responsive ===== */
/* 平板 */
@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
  .detail-panel { width: 100%; right: -100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 手机 */
@media (max-width: 640px) {
  body { padding-top: var(--navbar-height); }
  .navbar { padding: 0 12px; }
  .brand-text { font-size: 15px; }
  .brand-icon { font-size: 20px; }
  
  /* 汉堡菜单 */
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    background: var(--primary-dark);
    flex-direction: column;
    padding: 8px 12px 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,.25);
    z-index: 999;
    max-height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    gap: 2px;
  }
  .nav-links.open { display: flex; }
  .nav-btn {
    padding: 12px 14px;
    font-size: 15px;
    text-align: left;
    border-radius: 8px;
  }
  .nav-btn:active { background: rgba(255,255,255,.15); }

  /* 内容区 */
  #main-content { padding: 12px; }

  /* 卡片 */
  .card { padding: 14px; margin-bottom: 12px; }
  .card-title { font-size: 15px; }

  /* 统计卡片 */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px 10px; gap: 10px; }
  .stat-icon { width: 36px; height: 36px; font-size: 18px; border-radius: 10px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 11px; }

  /* 图表 */
  .chart-container { height: 200px; max-height: 200px; }
  .chart-card { padding: 12px; }
  .chart-card h3 { font-size: 13px; margin-bottom: 10px; }
  .charts-row { gap: 12px; margin-bottom: 16px; }

  /* 表格 */
  .table-wrapper { margin: 0 -2px; padding: 0 2px; }
  table { font-size: 11px; }
  thead th, tbody td { padding: 6px 8px; }

  /* 弹窗全屏 */
  .edit-modal {
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    top: 0;
    left: 0;
    transform: none;
    border-radius: 0;
    animation: none;
  }
  .edit-modal-header {
    padding: 14px 16px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
  }
  .edit-modal-body { padding: 14px 16px; }
  .edit-form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .edit-modal-footer { padding: 12px 16px; }

  /* 筛选栏 */
  .filter-bar { gap: 8px; }
  .filter-bar input, .filter-bar select {
    min-width: 100%;
    flex: none;
    font-size: 13px;
  }

  /* 按钮 */
  .btn { padding: 10px 16px; font-size: 14px; }
  .btn-sm { padding: 6px 12px; font-size: 12px; }

  /* 上传 */
  .upload-area { padding: 24px 16px; }

  /* 空置卡片 */
  .vacant-grid { grid-template-columns: 1fr; }

  /* Toast */
  .toast-container { top: 64px; width: 92%; }
  .toast { font-size: 13px; padding: 10px 16px; }
}

/* 超小屏 */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 16px; }
  .nav-btn { font-size: 14px; padding: 10px 12px; }
}
