/* 嵊州小笼包 EEP - 响应式样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: #f0f2f5; color: #333; font-size: 14px; }

/* 登录页 */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; padding: 40px 30px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); width: 360px; max-width: 90vw; }
.login-box h1 { text-align: center; color: #e74c3c; margin-bottom: 8px; font-size: 24px; }
.login-box .subtitle { text-align: center; color: #999; margin-bottom: 30px; font-size: 13px; }
.login-box .form-group { margin-bottom: 16px; }
.login-box label { display: block; margin-bottom: 6px; color: #555; font-weight: 500; }
.login-box input { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.login-box input:focus { outline: none; border-color: #667eea; }
.login-box button { width: 100%; padding: 11px; background: #e74c3c; color: #fff; border: none; border-radius: 6px; font-size: 15px; cursor: pointer; margin-top: 10px; }
.login-box button:hover { background: #c0392b; }
.login-tip { text-align: center; color: #999; font-size: 12px; margin-top: 14px; }

/* 主布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #2c3e50; color: #ecf0f1; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; transition: transform 0.3s; z-index: 100; }
.sidebar .logo { padding: 18px 16px; font-size: 16px; font-weight: bold; color: #e74c3c; border-bottom: 1px solid #34495e; text-align: center; }
.sidebar .menu-item { padding: 10px 16px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background 0.2s; }
.sidebar .menu-item:hover, .sidebar .menu-item.active { background: #34495e; color: #e74c3c; }
.sidebar .submenu { background: #1a252f; }
.sidebar .submenu .menu-item { padding-left: 36px; font-size: 13px; }

.main { flex: 1; margin-left: 220px; display: flex; flex-direction: column; min-height: 100vh; }
.header { height: 56px; background: #fff; border-bottom: 1px solid #e8e8e8; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 50; }
.header .menu-toggle { display: none; font-size: 20px; cursor: pointer; background: none; border: none; }
.header .user-info { display: flex; align-items: center; gap: 12px; }
.header .user-info .logout { color: #e74c3c; cursor: pointer; font-size: 13px; }

.content { padding: 20px; flex: 1; }
.page-title { font-size: 20px; margin-bottom: 16px; color: #2c3e50; }

/* 卡片和表格 */
.card { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.btn { padding: 7px 14px; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.btn-primary { background: #e74c3c; color: #fff; }
.btn-primary:hover { background: #c0392b; }
.btn-default { background: #fff; color: #555; border: 1px solid #ddd; }
.btn-default:hover { background: #f5f5f5; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-link { background: none; color: #1890ff; padding: 4px 6px; }
.btn-sm { padding: 4px 8px; font-size: 12px; }

.search-input { padding: 7px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; width: 200px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #f0f0f0; }
th { background: #fafafa; font-weight: 600; color: #555; white-space: nowrap; }
tr:hover { background: #f9f9f9; }
.table-wrap { overflow-x: auto; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.tag-green { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-red { background: #fff1f0; color: #f5222d; border: 1px solid #ffa39e; }
.tag-blue { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.tag-orange { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }

/* 模态框 */
.modal-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal { background: #fff; border-radius: 8px; width: 100%; max-width: 800px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #f0f0f0; text-align: right; }
.close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-item { display: flex; flex-direction: column; }
.form-item label { margin-bottom: 4px; color: #555; font-size: 13px; }
.form-item label .req { color: #f5222d; }
.form-item input, .form-item select, .form-item textarea { padding: 7px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; font-family: inherit; }
.form-item textarea { min-height: 60px; resize: vertical; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { outline: none; border-color: #e74c3c; }

/* 子表 */
.subtable { margin-top: 16px; }
.subtable h4 { margin-bottom: 8px; color: #555; }
.subtable table { font-size: 12px; }
.subtable input, .subtable select { padding: 4px 6px; font-size: 12px; width: 100%; border: 1px solid #eee; border-radius: 3px; }

/* 提示 */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 10px 20px; border-radius: 4px; color: #fff; z-index: 2000; font-size: 14px; }
.toast-success { background: #52c41a; }
.toast-error { background: #f5222d; }

.empty { text-align: center; padding: 40px; color: #999; }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .header .menu-toggle { display: block; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .content { padding: 12px; }
}

/* ========== PWA 适配 ========== */
html, body {
  height: 100%;
  overscroll-behavior: none;
}
body {
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}
/* 独立模式下隐藏顶部浏览器 UI 留白 */
@media (display-mode: standalone) {
  body { -webkit-tap-highlight-color: transparent; }
  .header { padding-top: env(safe-area-inset-top); }
}
/* 禁用长按选择 */
button, .menu-item, .btn { -webkit-touch-callout: none; user-select: none; }
