* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #f5f7fb 0%, #eef2ff 100%);
  color: #1f2937;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#app { max-width: 1600px; margin: 0 auto; padding: 18px; }
.hidden { display: none !important; }
.card { background: rgba(255,255,255,0.9); backdrop-filter: blur(8px); border-radius: 18px; padding: 18px 22px; margin-bottom: 16px; box-shadow: 0 14px 36px rgba(15,23,42,0.08); border: 1px solid rgba(148,163,184,0.18); }
.top-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.top-bar h2 { margin: 0 0 4px; font-size: 1.4rem; font-weight: 800; letter-spacing: 0.02em; }
.top-bar .left, .top-bar .right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.top-bar .right { justify-content: flex-end; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 14px; color: #555; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid #d0d7e2; font-size: 14px; background:#fff; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row .form-group { flex: 1 1 180px; min-width: 0; }
button { border: none; border-radius: 10px; padding: 10px 14px; font-size: 14px; cursor: pointer; background: #e0e3ec; color: #333; min-height: 42px; }
button.primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; }
button.secondary { background: #4b5563; color: #fff; }
button.danger { background: #dc2626; color: #fff; }
button:disabled { opacity: 0.6; cursor: not-allowed; }
.loading-indicator { display: inline-flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 999px; background: rgba(15, 23, 42, 0.86); color: #fff; box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22); font-size: 14px; position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1200; backdrop-filter: blur(8px); }
.loading-indicator .spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spinner-rotate 0.8s linear infinite; }
@keyframes spinner-rotate { to { transform: rotate(360deg); } }
.page-error-banner { margin: 12px 0 0; padding: 10px 12px; border-radius: 6px; background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; font-size: 13px; }
.pager { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.pager-info { font-size: 12px; color: #6b7280; }
.pager-actions, .pager-jump { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pager-page.active { background: #2563eb; color: #fff; }
.pager-jump input { width: 100px; }
.empty-state { padding: 28px 16px; text-align: center; color: #64748b; background: linear-gradient(180deg, #f8fafc, #ffffff); border: 1px dashed #cbd5e1; border-radius: 16px; }
.empty-state h4 { margin: 0 0 8px; color: #334155; font-size: 16px; }
.empty-state p { margin: 0; font-size: 13px; }
.tabs { display: flex; margin-bottom: 12px; }
.tab { flex: 1; padding: 8px 0; border-radius: 4px 4px 0 0; background: #e5e7eb; border: 1px solid #d1d5db; border-bottom: none; }
.tab + .tab { margin-left: 4px; }
.tab.active { background: #fff; border-bottom: 1px solid #fff; }
.tab-pane { border: 1px solid #d1d5db; border-radius: 0 4px 4px 4px; padding: 12px; display: none; }
.tab-pane.active { display: block; }
.message { margin-top: 8px; min-height: 20px; font-size: 13px; color: #b91c1c; }
.hint { font-size: 12px; color: #6b7280; }
.table-wrapper { overflow-x: auto; border: 1px solid #e5e7eb; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; background:#fff; min-width: 1500px; }
th, td { padding: 8px 10px; border-bottom: 1px solid #e5e7eb; white-space: nowrap; vertical-align: middle; }
th { background: linear-gradient(180deg, #f8fafc, #eef2ff); position: sticky; top: 0; z-index: 1; font-weight: 700; color: #334155; }
tr:nth-child(even) { background: #f9fafb; }
.positive { color: #dc2626; }
.negative { color: #16a34a; }
.neutral { color: #475569; }
.section-head, .control-grid { display:flex; gap:12px; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; }
.section-head h3 { margin:0; }
.section-actions { display:flex; gap:8px; flex-wrap:wrap; }
.stock-table-wrap { margin-top: 12px; border-radius: 16px; overflow: auto; box-shadow: inset 0 0 0 1px #e2e8f0; }
.file-label { position: relative; overflow: hidden; display: inline-block; padding: 8px 14px; border-radius: 10px; background: #6b7280; color: #fff; font-size: 14px; cursor: pointer; }
.file-label input { position: absolute; top: 0; left: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: #fff; border-radius: 12px; width: 100%; max-width: 420px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); margin: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.modal-header, .modal-footer { padding: 10px 14px; border-bottom: 1px solid #e5e7eb; }
.modal-footer { border-top: 1px solid #e5e7eb; border-bottom: none; text-align: right; }
.modal-body { padding: 10px 14px 14px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.icon-button { background: transparent; font-size: 20px; line-height: 1; padding: 0 6px; }
@media (max-width: 768px) { #app { padding: 8px; } .card { padding: 14px 12px; border-radius: 16px; } .hero-panel { grid-template-columns: 1fr; } .stats-grid { grid-template-columns: 1fr; } .loading-indicator { top: 12px; width: calc(100vw - 24px); justify-content: center; text-align: center; padding: 12px 14px; } .top-bar { flex-direction: column; align-items: stretch; } .top-bar .right { justify-content: flex-start; } .top-bar .right button, .top-bar .right .loading-indicator { width: 100%; } .form-row, .control-grid, .section-head { flex-direction: column; align-items: stretch; } .form-row .form-group, .form-row > button, .form-row > .file-label { width: 100%; } button, .file-label { width: 100%; justify-content: center; text-align: center; } .tabs { gap: 6px; overflow-x: auto; padding-bottom: 2px; } .tab { padding: 10px 0; min-width: 96px; white-space: nowrap; } .pager-actions, .pager-jump { justify-content: flex-start; } .pager-jump input { width: 100%; max-width: 160px; } .table-wrapper { margin: 0 -12px; border-radius: 0; } .modal { align-items: flex-end; } .modal-content { max-width: none; width: 100%; margin: 0; border-radius: 18px 18px 0 0; max-height: 92vh; } }
