/* 订单交付系统 - 全局样式与组件 */
:root {
  --color-bg: #f5f6f8;
  --color-surface: #fff;
  --color-border: #e2e4e8;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-success: #16a34a;
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

/* 布局 */
.app-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* 顶栏导航 */
.app-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 24px;
  margin-bottom: 24px;
}
.app-nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
}
.app-nav a {
  color: var(--color-text);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: background .15s;
}
.app-nav a:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}
.app-nav a.active,
.app-nav a[href]:not(.logout):first-of-type { margin-right: 4px; }
.app-nav .nav-user {
  margin-left: 12px;
  margin-right: 12px;
  color: var(--color-text-muted);
  font-size: 14px;
}
.app-nav .logout { color: var(--color-text-muted); }

/* 顶部搜索框 */
.nav-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-search-input {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 14px;
  min-width: 220px;
}
.nav-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}

.nav-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
}
.nav-search-btn svg {
  width: 14px;
  height: 14px;
  fill: #111827;
}

/* 顶部数据工具下拉 */
.nav-tools {
  position: relative;
}
.nav-tools details {
  position: relative;
}
.nav-tools summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.nav-tools summary::-webkit-details-marker {
  display: none;
}
.nav-tools details[open] summary {
  background: var(--color-bg);
}
.nav-tools-menu {
  position: absolute;
  top: 110%;
  left: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 4px 0;
  z-index: 20;
}
.nav-tools-item {
  width: 100%;
  padding: 6px 12px;
  text-align: left;
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
}
.nav-tools-item:hover {
  background: var(--color-bg);
}

/* 卡片 */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

/* 提示消息 */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 500;
}
.flash.success, .flash.message { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash.error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* 按钮 */
.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: var(--color-primary-hover); color: #fff; }
.btn-primary:focus { color: #fff; }
.btn-secondary {
  background: #e5e7eb;
  color: #111827;
  font-weight: 500;
}
.btn-secondary:hover { background: #d1d5db; color: #111827; }
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover { background: var(--color-danger-hover); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled, .btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* 表格 */
.table-wrap { overflow-x: auto; margin-bottom: 16px; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data-table th,
table.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
table.data-table th {
  background: var(--color-bg);
  font-weight: 600;
  color: var(--color-text-muted);
}
table.data-table tbody tr:nth-child(odd) td { background: var(--color-surface); }
table.data-table tbody tr:nth-child(even) td { background: #f9fafb; }
table.data-table tr:hover td { background: #f0f4ff !important; }
table.data-table a { color: var(--color-primary); text-decoration: none; }
table.data-table a:hover { text-decoration: underline; }
table.data-table a.btn-primary { color: #fff; }
table.data-table a.btn-primary:hover { color: #fff; text-decoration: none; }
table.data-table a.btn-secondary { color: #111827; }
table.data-table a.btn-secondary:hover { color: #111827; text-decoration: none; }
table.data-table a.btn-danger { color: #fff; }
table.data-table a.btn-danger:hover { color: #fff; text-decoration: none; }
table.data-table img { border-radius: 4px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--color-text);
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
input[type="file"].form-control { padding: 8px; }

/* 操作分组块（如已下单 / 搁置） */
.action-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px 18px 14px;
  margin: 16px 0 20px;
  background: #f9fafb;
}
.action-group h2 {
  font-size: 1rem;
  margin: 0 0 10px 0;
}

/* 图片弹窗预览 */
.image-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1000;
}
.image-modal.is-open {
  display: flex;
}
.image-modal-content {
  max-width: 90%;
  max-height: 90%;
  box-shadow: var(--shadow-md);
}
.image-modal-content img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  background: #fff;
}

/* 分页 */
.pagination {
  margin-top: 16px;
  font-size: 14px;
  color: var(--color-text-muted);
}
.pagination a {
  color: var(--color-primary);
  text-decoration: none;
  margin: 0 8px;
}
.pagination a:hover { text-decoration: underline; }

/* 标签 / Tab */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}
.tabs a {
  padding: 10px 18px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tabs a:hover { color: var(--color-primary); }
.tabs a.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  padding: 32px;
}
.login-card h1 {
  margin: 0 0 24px 0;
  font-size: 1.35rem;
  font-weight: 600;
}
.login-card .form-group { margin-bottom: 20px; }
.login-card .btn { width: 100%; padding: 12px; margin-top: 8px; }
.login-card .link-other { margin-top: 20px; text-align: center; font-size: 14px; color: var(--color-text-muted); }
.login-card .link-other a { color: var(--color-primary); text-decoration: none; }

/* 空状态 */
.empty-hint { color: var(--color-text-muted); padding: 24px; text-align: center; }

/* 详情页分区 */
.detail-section { margin-bottom: 24px; }
.detail-section .detail-heading {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--color-text);
}
.detail-section p { margin: 0 0 8px 0; }
.meta { margin: 0 0 20px 0; color: var(--color-text-muted); font-size: 14px; }
.action-forms { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.action-form-inline { display: inline-flex; gap: 8px; align-items: center; }
.action-form-inline .form-control { width: 140px; }
.radio-inline { margin-right: 12px; white-space: nowrap; }
.radio-inline input { margin-right: 4px; vertical-align: middle; }
.form-hint { font-size: 12px; color: var(--color-text-muted); margin-left: 4px; }
