/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #f0f2f5; color: #333; line-height: 1.6; }

/* ===== Login Page ===== */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.2); width: 380px; max-width: 90vw; }
.login-box h1 { text-align: center; margin-bottom: 28px; color: #333; font-size: 22px; }

/* ===== Layout ===== */
.layout-container { display: flex; min-height: 100vh; }
.layout-sidebar { width: 230px; min-width: 230px; background: #001529; color: #fff; display: flex; flex-direction: column; overflow-y: auto; }
.layout-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Sidebar */
.sidebar-logo { display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo-icon { font-size: 22px; margin-right: 10px; }
.sidebar-logo-text { font-size: 16px; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 8px 0; }

.menu-group { position: relative; }
.menu-item { display: flex; align-items: center; padding: 10px 20px; color: rgba(255,255,255,.65); text-decoration: none; font-size: 14px; cursor: pointer; transition: all .2s; white-space: nowrap; }
.menu-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.menu-item.active { color: #fff; background: #1890ff; }
.menu-icon { margin-right: 10px; font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.menu-text { flex: 1; }
.menu-arrow { font-size: 10px; transition: transform .2s; }
.menu-group.open > .menu-item .menu-arrow { transform: rotate(-180deg); }

.submenu { display: none; background: #000c17; }
.menu-group.open > .submenu { display: block; }
.submenu .menu-item { padding-left: 48px; }

/* App Header */
.app-header { background: #fff; padding: 0 24px; height: 48px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e8e8e8; box-shadow: 0 1px 4px rgba(0,0,0,.06); flex-shrink: 0; }
.header-left { display: flex; align-items: center; }
.breadcrumb { font-size: 14px; color: #999; }
.breadcrumb a { color: #667eea; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 6px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-info { color: #666; font-size: 14px; }

.app-main { flex: 1; padding: 24px; overflow-y: auto; }

/* ===== Toolbar ===== */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.search-form { display: flex; gap: 8px; align-items: center; }
.search-input { width: 260px; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; outline: none; transition: border-color .2s; }
.search-input:focus { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,.15); }

/* ===== Table ===== */
.table-wrapper { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.06); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { background: #fafafa; padding: 12px 14px; text-align: left; font-weight: 600; color: #555; border-bottom: 2px solid #e8e8e8; white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f0f0f0; }
.data-table tbody tr:hover { background: #fafbff; }
.empty-row { text-align: center; color: #999; padding: 40px !important; }
.code-tag { background: #f0f4ff; color: #4a6cf7; padding: 2px 8px; border-radius: 4px; font-size: 13px; }
.url-cell a { color: #4a6cf7; text-decoration: none; word-break: break-all; }
.url-cell a:hover { text-decoration: underline; }
.action-cell { white-space: nowrap; display: flex; gap: 6px; }
.info-bar { margin-top: 12px; color: #999; font-size: 13px; }

/* ===== Tree Table Indent ===== */
.tree-indent { display: inline-block; }
.tree-indent-l1 { padding-left: 0; }
.tree-indent-l2 { padding-left: 24px; }
.tree-indent-l3 { padding-left: 48px; }

/* ===== Toggle Button ===== */
.toggle-btn { border: none; padding: 4px 12px; border-radius: 12px; font-size: 12px; cursor: pointer; transition: all .2s; }
.toggle-btn.enabled { background: #e6f7e6; color: #52c41a; }
.toggle-btn.disabled { background: #fff1f0; color: #ff4d4f; }
.toggle-btn:hover { opacity: .85; }

/* ===== Form ===== */
.form-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.06); padding: 32px; max-width: 640px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: #444; }
.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group select { width: 100%; padding: 10px 14px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; outline: none; transition: border-color .2s; background: #fff; }
.form-group input:focus,
.form-group select:focus { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,.15); }
.form-group small { display: block; margin-top: 4px; color: #999; font-size: 12px; }
.required { color: #ff4d4f; }
.checkbox-label { display: flex !important; align-items: center; gap: 8px; cursor: pointer; font-weight: 400 !important; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: #667eea; }
.form-actions { display: flex; gap: 10px; margin-top: 28px; }

/* ===== Checkbox Group ===== */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 12px; }
.checkbox-group .checkbox-label { background: #fafafa; padding: 6px 12px; border-radius: 4px; border: 1px solid #e8e8e8; }
.checkbox-group .checkbox-label:hover { border-color: #667eea; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 9px 18px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; text-decoration: none; transition: all .2s; font-weight: 500; }
.btn-primary { background: #667eea; color: #fff; }
.btn-primary:hover { background: #5a6fd6; }
.btn-success { background: #52c41a; color: #fff; }
.btn-success:hover { background: #49b218; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #e04345; }
.btn-outline { background: #fff; color: #666; border: 1px solid #d9d9d9; }
.btn-outline:hover { border-color: #667eea; color: #667eea; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-warning { background: #faad14; color: #fff; }
.btn-warning:hover { background: #e8a212; }
.btn-block { width: 100%; padding: 12px; font-size: 16px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

/* ===== Alerts ===== */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #389e0d; }
.alert-error { background: #fff2f0; border: 1px solid #ffa39e; color: #cf1322; }
.alert-info { background: #e6f7ff; border: 1px solid #91d5ff; color: #096dd9; }

/* ===== Page Header ===== */
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 20px; color: #1a1a1a; margin-bottom: 4px; }
.page-header p { color: #999; font-size: 13px; }

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-muted { color: #999; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ===== Inline Form ===== */
.inline-form { display: inline; }

/* ===== Section Title ===== */
.section-title { font-size: 15px; font-weight: 600; color: #333; margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .layout-sidebar { width: 60px; min-width: 60px; }
  .sidebar-logo-text, .menu-text, .menu-arrow { display: none; }
  .sidebar-logo { justify-content: center; padding: 14px 0; }
  .sidebar-logo-icon { margin-right: 0; }
  .menu-item { justify-content: center; padding: 12px 0; }
  .menu-icon { margin-right: 0; }
  .submenu .menu-item { padding-left: 0; }
  .app-header { padding: 0 12px; }
  .app-main { padding: 16px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-form { flex-direction: column; }
  .search-input { width: 100%; }
  .form-card { padding: 20px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 6px; }
}
