/* ============================================
   客商信息维护 — 全局样式
   复刻 Axure 原型视觉风格
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
  /* Axure 原型精确配色 */
  --primary: #2D78EE;
  --primary-hover: #4080ff;
  --bg-page: #F3F3F3;
  --bg-white: #FFFFFF;
  --bg-dark: #352F2F;
  --bg-sidebar: #352F2F;
  --bg-header: #352F2F;
  --bg-menu-active: #50555B;
  --bg-submenu: #C4C6C5;
  --bg-submenu-hover: #DDDDDD;
  --text-primary: #333333;
  --text-secondary: #50555B;
  --text-placeholder: #C2C4CB;
  --text-dark: #352F2F;
  --text-white: #FFFFFF;
  --text-menu: #FFFEFF;
  --text-submenu: #666666;
  --border-color: #DCE0E6;
  --border-reset: #DDE1E5;
  --shadow-header: 0px 1px 4px rgba(0, 21, 41, 0.12);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-family: "PingFangSC-Regular", "PingFang SC", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --sidebar-width: 192px;
  --header-height: 68px;
  --tab-height: 28px;
}

/* ---------- Reset ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  overflow: hidden;
}

ul, ol { list-style: none; }
a { text-decoration: none; color: var(--primary); }
img { vertical-align: middle; }
table { border-collapse: collapse; }

/* ---------- Layout ---------- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  background: var(--bg-header);
  padding: 0 20px;
  z-index: 100;
  flex-shrink: 0;
  box-shadow: var(--shadow-header);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  width: var(--sidebar-width);
  flex-shrink: 0;
}

.header-left .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.header-left .platform-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 24px;
}

.header-center .welcome {
  color: var(--text-white);
  font-size: 18px;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
}

.header-center .menu-search {
  display: flex;
  align-items: center;
  background: var(--bg-white);
  border-radius: 8px;
  padding: 4px 12px;
  margin-left: 16px;
  border: 1px solid var(--border-color);
}

.header-center .menu-search input {
  border: none;
  background: transparent;
  outline: none;
  width: 160px;
  font-size: 13px;
  color: var(--text-primary);
}

.header-center .menu-search input::placeholder {
  color: var(--text-placeholder);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.header-right .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.header-right .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e8f0fe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
}

.header-right .user-name {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.89);
}

.header-right .icon-btn {
  width: 20px;
  height: 20px;
  cursor: pointer;
  opacity: 0.6;
}

/* Body */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-white);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  user-select: none;
}

.sidebar-toggle {
  display: flex;
  justify-content: flex-start;
  padding: 12px 18px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  flex-shrink: 0;
  margin-top: auto;
}

.sidebar-toggle:hover { opacity: 1; }

/* Sidebar collapsed */
.app-sidebar.collapsed {
  width: 48px;
  overflow: hidden;
}
.app-sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding: 16px 8px;
}
.app-sidebar.collapsed .sidebar-toggle { justify-content: center; padding: 12px 0; }
.app-sidebar.collapsed .sidebar-logo-text { display: none; }
.app-sidebar.collapsed .menu-item {
  justify-content: center;
  padding: 0 8px;
  white-space: nowrap;
}
.app-sidebar.collapsed .menu-item .menu-arrow,
.app-sidebar.collapsed .sub-menu {
  display: none;
}

.sidebar-toggle .toggle-icon {
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(255,255,255,0.6);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

/* Sidebar Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 20px;
}

.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 12px;
  font-weight: 500;
  font-family: "PingFangSC-Medium", "PingFang SC Medium", "PingFang SC", sans-serif;
  color: #fff;
  white-space: nowrap;
}

/* Sidebar Menu */
.sidebar-menu { flex: 1; }

.menu-group { margin-top: 8px; }

.menu-item {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
  transition: all 0.2s;
  position: relative;
}

.menu-item:hover { background: rgba(255,255,255,0.08); color: #fff; }

.menu-item.active {
  background: var(--bg-menu-active);
  color: var(--text-menu);
  font-weight: 500;
}

.menu-item .menu-arrow {
  margin-right: 6px;
  width: 12px;
  text-align: center;
  font-size: 10px;
  transition: transform 0.2s;
}

.menu-item .menu-arrow.expanded { transform: rotate(90deg); }

.menu-item .menu-icon {
  margin-right: 8px;
  width: 16px;
  text-align: center;
}

.sub-menu {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

/* 二级菜单项 */
.sub-menu > .menu-item {
  padding-left: 42px;
  height: 40px;
  font-size: 14px;
  background: #C4C6C5;
  color: #352F2F;
}

/* 二级目录（可展开的父级） */
.sub-menu > .menu-item.has-sub {
  font-weight: 500;
}

/* 三级菜单项 */
.sub-menu .sub-menu > .menu-item {
  padding-left: 62px;
  background: #D8DAD9;
}

.sub-menu .sub-menu > .menu-item:hover {
  background: #DDDDDD;
}

.sub-menu .sub-menu > .menu-item.current {
  background: #D8DAD9;
}

.sub-menu .menu-item:hover {
  background: #DDDDDD;
}

.sub-menu .menu-item .indicator {
  width: 4px;
  height: 40px;
  background: transparent;
  border-radius: 0 2px 2px 0;
  margin-right: 8px;
  transition: background 0.2s;
  position: absolute;
  left: 0;
  top: 0;
}

.sub-menu .menu-item.current .indicator {
  background: #352F2F;
}

.sub-menu .menu-item.current {
  color: #352F2F;
  font-weight: 500;
  background: #C4C6C5;
}

/* Main Content */
.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-page);
}

/* Breadcrumb */
.breadcrumb {
  padding: 12px 24px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-white);
  border-bottom: none;
  flex-shrink: 0;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }
.breadcrumb .sep { margin: 0 6px; color: var(--text-placeholder); }

/* Content Wrapper */
.content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

/* ---------- Query Area ---------- */
.query-area {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: none;
  position: relative;
}

.query-area.collapsed {
  padding: 12px 24px;
}

.query-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.query-toggle .arrow {
  transition: transform 0.2s;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
}

.query-toggle .arrow.collapsed { transform: rotate(180deg); }

.query-form { display: none; }

.query-form.visible { display: block; }

.query-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 20px;
  margin-bottom: 12px;
}

.query-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.query-item .label {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  min-width: 72px;
  text-align: right;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
}

.query-item .control {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
  color: var(--text-primary);
  background: var(--bg-white);
  outline: none;
  transition: border-color 0.2s;
}

.query-item .control::placeholder { color: var(--text-placeholder); }
.query-item .control:focus { border-color: var(--primary); }

.query-item select.control {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386909c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

/* Date Range Picker - 原型风格 */
.date-range-picker {
  flex: 1;
  position: relative;
}

.date-range-display {
  display: flex;
  align-items: center;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  cursor: pointer;
  padding: 0 8px;
  transition: border-color 0.2s;
}

.date-range-display:hover { border-color: #999999; }

.date-range-display.active { border-color: var(--primary); }

.date-range-text {
  flex: 1;
  font-size: 12px;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
  color: var(--text-placeholder);
}

.date-range-text.has-value { color: var(--text-primary); }

.date-range-icon {
  display: flex;
  align-items: center;
  margin-left: 4px;
  flex-shrink: 0;
}

.date-range-dropdown {
  position: absolute;
  top: 38px;
  left: 0;
  width: 280px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-md);
  z-index: 20;
}

.date-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.date-input-native {
  flex: 1;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

.date-input-native:focus { border-color: var(--primary); }

.date-range-sep {
  color: var(--text-placeholder);
  font-size: 12px;
}

.date-range-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.query-row-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  gap: 4px;
}

.btn-primary {
  background: #222222;
  color: #fff;
  border-color: #222222;
  border-radius: 4px;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
}

.btn-primary:hover { background: #444444; border-color: #444444; }

.btn-default {
  background: var(--bg-white);
  color: #222222;
  border-color: var(--border-reset);
  border-radius: 4px;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
}

.btn-default:hover { border-color: #999999; color: #222222; }

.btn-link {
  background: transparent;
  color: var(--primary);
  border: none;
  padding: 0 8px;
  height: auto;
}

.btn-link:hover { opacity: 0.8; }
.btn-link.danger { color: #f53f3f; }

.btn-sm { height: 28px; padding: 0 12px; font-size: 12px; }

/* Toolbar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ---------- Table ---------- */
.table-container {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: none;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
}

/* Table action bar */
.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.table-actions .table-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

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

table.data-table {
  width: 100%;
  min-width: 1200px;
  border-collapse: collapse;
}

table.data-table thead th {
  background: #fafbfc;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
  color: var(--text-secondary);
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

/* 固定右侧操作列 */
table.data-table thead th:last-child,
table.data-table tbody td:last-child {
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -2px 0 4px rgba(0,0,0,0.04);
}

table.data-table thead th:last-child {
  background: #fafbfc;
  z-index: 3;
}

table.data-table tbody tr:hover td:last-child {
  background: #f7f8fa;
}

table.data-table tbody td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  text-align: center;
}

table.data-table tbody tr:hover td {
  background: #f7f8fa;
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

table.data-table .col-check { width: 40px; text-align: center; }
table.data-table .col-seq { width: 60px; text-align: center; }
table.data-table .col-actions { width: 80px; text-align: center; }

.action-links {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.action-links a {
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
}

.action-links a:hover { opacity: 0.8; }

/* 已作废行置灰 */
table.data-table tbody tr.row-inactive td {
  color: #bcbcbc;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--text-placeholder);
  font-size: 14px;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ---------- Pagination ---------- */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-white);
}

.pagination-container .page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: all 0.2s;
  user-select: none;
}

.pagination-container .page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-container .page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pagination-container .page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-container .page-size {
  margin-left: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination-container .page-size select {
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 13px;
  outline: none;
  margin: 0 4px;
}

.pagination-container .page-jump {
  margin-left: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination-container .page-jump input {
  width: 48px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 13px;
  outline: none;
}

.pagination-container .page-jump input:focus {
  border-color: var(--primary);
}

.page-ellipsis {
  width: 32px;
  text-align: center;
  color: var(--text-placeholder);
  user-select: none;
}

/* ---------- Tab Bar ---------- */
.tab-bar {
  display: flex;
  align-items: flex-end;
  height: var(--tab-height);
  background: var(--bg-white);
  border-top: 1px solid var(--border-color);
  padding: 0 8px;
  gap: 2px;
  flex-shrink: 0;
  overflow-x: auto;
}

.tab-item {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 12px;
  background: #e8e9eb;
  border-radius: 4px 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  gap: 6px;
  user-select: none;
}

.tab-item.active {
  background: var(--bg-page);
  color: var(--text-primary);
  font-weight: 500;
}

.tab-item .tab-close {
  font-size: 10px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.5;
}

.tab-item .tab-close:hover { opacity: 1; background: rgba(0,0,0,0.1); }
.tab-item:first-child .tab-close { display: none; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-white);
  border-radius: 8px;
  width: 680px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header .modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all 0.2s;
}

.modal-close:hover { background: var(--border-light); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid var(--border-color);
}

/* Detail grid in modal */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

.detail-item {
  display: flex;
  gap: 8px;
}

.detail-item .detail-label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 80px;
  text-align: right;
  flex-shrink: 0;
}

.detail-item .detail-value {
  font-size: 13px;
  color: var(--text-primary);
}

.detail-item.full {
  grid-column: 1 / -1;
}

/* ---------- Form (edit page) ---------- */
.form-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.form-header {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.form-header .back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}

.form-header .back-btn:hover { color: var(--primary); }

.form-header .page-title {
  font-size: 16px;
  font-weight: 600;
}

.form-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.form-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 900px;
  box-shadow: var(--shadow-sm);
}

.form-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 32px;
}

.form-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-item.full {
  grid-column: 1 / -1;
}

/* inline mode — 标签与控件同行 */
.form-grid.form-inline .form-item {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.form-grid.form-inline .form-item .form-label {
  white-space: nowrap;
  flex-shrink: 0;
  width: 68px;
  text-align: right;
}
.form-grid.form-inline .form-item .form-control {
  flex: 1;
  min-width: 0;
}

.form-item .form-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.form-item .form-label .required {
  color: #f53f3f;
  margin-right: 2px;
}

.form-item .form-control {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.form-item .form-control::placeholder { color: var(--text-placeholder); }

.form-item .form-control:focus {
  border-color: var(--primary);
}

.form-item .form-control.error {
  border-color: #f53f3f;
}

.form-item select.form-control {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386909c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.form-item .error-msg {
  font-size: 12px;
  color: #f53f3f;
  display: none;
}

.form-item .error-msg.visible { display: block; }

.form-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.form-actions .btn {
  min-width: 100px;
}

/* ---------- Log Page ---------- */
.log-query {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}

.log-query .label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.log-query input {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}

.log-query input[type="date"] { width: 150px; }

.log-query input:focus { border-color: var(--primary); }

.log-query .sep {
  color: var(--text-placeholder);
  margin: 0 4px;
}

.log-desc {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-type-add { color: #00b42a; }
.log-type-edit { color: var(--primary); }

/* ---------- Customer Picker ---------- */
.picker-search {
  display: flex;
  align-items: center;
  gap: 10px;
}

.picker-label {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
}

/* ---------- Auth Dual Panel ---------- */
.auth-dual-panel {
  display: flex;
  gap: 16px;
}

.auth-panel {
  flex: 1;
  min-width: 0;
}

.auth-panel-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.auth-select-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.auth-table-wrap {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.auth-table-wrap table { min-width: 100%; }

/* ---------- File Attach Box ---------- */
.file-attach-box {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: #fafbfc;
  cursor: pointer;
  gap: 8px;
  transition: border-color 0.2s;
  user-select: none;
}

.file-attach-box:hover { border-color: var(--primary); }

.file-attach-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.file-attach-text {
  flex: 1;
  font-size: 12px;
  font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
  color: var(--text-placeholder);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-attach-clear {
  font-size: 12px;
  color: var(--text-placeholder);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 50%;
  flex-shrink: 0;
}

.file-attach-clear:hover { color: #f53f3f; background: rgba(245,63,63,0.08); }

/* ---------- Skeleton / Loading ---------- */
.loading-shimmer {
  background: linear-gradient(90deg, #f2f3f5 25%, #e5e6eb 50%, #f2f3f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: 4px;
  font-size: 14px;
  color: #fff;
  z-index: 2000;
  animation: toastIn 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.success { background: #00b42a; }
.toast.error { background: #f53f3f; }
.toast.info { background: var(--primary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1400px) {
  .query-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
  }
}

@media (max-width: 1100px) {
  .query-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
