:root {
  --primary: #4f46e5; --primary-hover: #4338ca; --primary-light: #e0e7ff;
  --bg: #f8fafc; --surface: #ffffff; --border: #e2e8f0;
  --text: #1e293b; --text-muted: #64748b;
  --success: #10b981; --danger: #ef4444; --warning: #f59e0b;
  --radius: 12px; --shadow: 0 1px 3px rgba(0,0,0,0.08); --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --transition: 0.2s ease;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
a { text-decoration: none; color: inherit; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column;
}

/* Navbar */
.navbar { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; height: 56px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.nav-left { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 22px; font-weight: 700; color: var(--primary); }
.logo-sub { font-size: 13px; color: var(--text-muted); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-user { font-size: 13px; color: var(--text-muted); padding: 0 8px; border-right: 1px solid var(--border); margin-right: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer; transition: var(--transition); white-space: nowrap; font-family: inherit; line-height: 1.4; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Main */
.main-container { flex: 1; padding: 24px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* Sections */
.tools-section { margin-bottom: 28px; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--text); padding-left: 4px; }

/* Tool Cards Grid */
.tools-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.tool-card {
  display: block; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow);
  padding: 16px 10px; text-align: center; cursor: pointer; transition: var(--transition);
  border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text);
}
.tool-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--primary); }
.tool-card .tc-icon { display: block; font-size: 22px; margin-bottom: 4px; }
.tool-card .tc-desc { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 400; }

/* Workspace Panel */
.workspace-panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--bg); }
.panel-header h3 { font-size: 16px; }
.panel-body { padding: 20px; }

/* File Drop Zone */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 40px; text-align: center; cursor: pointer; transition: var(--transition); background: var(--bg); }
.drop-zone.drag-over { border-color: var(--primary); background: var(--primary-light); }
.drop-zone h4 { margin-bottom: 8px; }
.drop-zone p { color: var(--text-muted); font-size: 13px; }

/* File List */
.file-list { margin-top: 12px; }
.file-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--bg); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.file-item .remove-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; padding: 2px 6px; }

/* Result Area */
.result-area { margin-top: 16px; text-align: center; }
.result-area .btn { margin: 4px; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.form-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; transition: var(--transition); }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Auth Page */
.auth-page { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #4f46e5 100%); min-height: 100vh; }
.auth-container { width: 380px; max-width: 90vw; }
.auth-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 40px 32px; text-align: center; }
.auth-logo { font-size: 32px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.auth-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.auth-form { text-align: left; }
.form-error { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 8px; }
.form-hint { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-hint code { background: var(--bg); padding: 1px 5px; border-radius: 3px; }

/* Config */
.config-page { display: flex; flex-direction: column; min-height: 100vh; }
.config-container { flex: 1; padding: 24px; max-width: 640px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 16px; }
.config-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.config-card h2 { font-size: 16px; margin-bottom: 4px; }
.config-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.config-desc a { color: var(--primary); }
.config-msg { text-align: center; font-size: 13px; min-height: 24px; }
.msg-success { color: var(--success); } .msg-error { color: var(--danger); } .msg-info { color: var(--primary); }
.user-table-wrap { overflow-x: auto; margin-top: 12px; }
.user-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.user-table th, .user-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.user-table th { font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; white-space: nowrap; }
.role-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.role-admin { background: var(--primary-light); color: var(--primary); }
.role-user { background: #f1f5f9; color: var(--text-muted); }
.form-group-flex { flex: 1; margin-bottom: 0; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 200; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 680px; max-width: 90vw; max-height: 80vh; display: flex; flex-direction: column; }
.modal-sm { width: 420px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; }
.modal-close { width: 32px; height: 32px; border: none; background: none; font-size: 22px; cursor: pointer; color: var(--text-muted); border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--bg); }
.modal-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); }
.modal-actions { display: flex; gap: 8px; padding: 16px; justify-content: flex-end; border-top: 1px solid var(--border); }

/* Toast */
.toast-container { position: fixed; top: 72px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease; max-width: 360px; color: #fff; font-weight: 500; }
.toast-success { background: var(--success); } .toast-error { background: var(--danger); } .toast-info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.empty { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }

/* Responsive */
@media (max-width: 1100px) { .tools-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 750px) { .tools-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px) { .tools-grid { grid-template-columns: repeat(2, 1fr); } }
