/* Reset & Base */
* { 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; }
a { color: #1677ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #001529; color: #fff; flex-shrink: 0; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; }
.sidebar-header { padding: 24px 20px 12px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-header h2 { font-size: 18px; font-weight: 600; }
.sidebar-header .subtitle { font-size: 12px; color: rgba(255,255,255,.45); }
.nav-list { list-style: none; padding: 8px 0; }
.nav-list li a { display: block; padding: 12px 24px; color: rgba(255,255,255,.65); transition: all .2s; font-size: 14px; }
.nav-list li a:hover, .nav-list li a.active { color: #fff; background: #1677ff; text-decoration: none; }
.content { margin-left: 220px; padding: 24px 32px; flex: 1; min-width: 0; }

/* Typography */
h1 { font-size: 22px; font-weight: 600; margin-bottom: 20px; }
h2 { font-size: 16px; font-weight: 600; margin: 20px 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.card-number { font-size: 28px; font-weight: 700; color: #1677ff; }
.card-label { font-size: 13px; color: #666; margin-top: 4px; }
.card-sub { font-size: 12px; color: #999; margin-top: 4px; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
thead { background: #fafafa; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
th { font-weight: 600; color: #666; }
tr:hover { background: #fafafa; }
.actions { white-space: nowrap; }
.actions a, .actions button { margin-right: 8px; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.badge-pending { background: #fff7e6; color: #d48806; }
.badge-running { background: #e6f4ff; color: #1677ff; }
.badge-completed { background: #f6ffed; color: #389e0d; }
.badge-failed { background: #fff2f0; color: #cf1322; }
.badge-cancelled { background: #f5f5f5; color: #666; }
.badge-info { background: #e6f4ff; color: #1677ff; }
.badge-warn { background: #fff7e6; color: #d48806; }

/* Buttons */
.btn { display: inline-block; padding: 6px 16px; border-radius: 6px; border: 1px solid #d9d9d9; background: #fff; cursor: pointer; font-size: 13px; color: #333; transition: all .2s; }
.btn:hover { border-color: #1677ff; color: #1677ff; text-decoration: none; }
.btn-primary { background: #1677ff; color: #fff; border-color: #1677ff; }
.btn-primary:hover { background: #4096ff; color: #fff; }
.btn-success { background: #52c41a; color: #fff; border-color: #52c41a; }
.btn-success:hover { background: #73d13d; color: #fff; }
.btn-danger { background: #ff4d4f; color: #fff; border-color: #ff4d4f; }
.btn-danger:hover { background: #ff7875; color: #fff; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-lg { padding: 10px 32px; font-size: 15px; }
.btn-link { background: none; border: none; cursor: pointer; font-size: 13px; padding: 0; }
.btn-link.btn-danger { color: #ff4d4f; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; color: #333; }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 13px; transition: border-color .2s; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22,119,255,.1); }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; }
.form-inline input { flex: 1; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.radio-group label { display: block; margin-bottom: 6px; font-size: 13px; cursor: pointer; font-weight: normal; }
.help-text { font-size: 12px; color: #999; }
.inline { display: inline; }
.code-editor { font-family: "Cascadia Code", "Fira Code", "Consolas", monospace; font-size: 13px; line-height: 1.6; resize: vertical; min-height: 400px; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { margin-bottom: 0; }

/* Card form */
.card-form { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.06); margin-bottom: 20px; }
.card-form h3 { margin-top: 0; }

/* Flash messages */
.flash-messages { margin-bottom: 16px; }
.flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 8px; font-size: 13px; }
.flash-success { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.flash-error { background: #fff2f0; color: #cf1322; border: 1px solid #ffa39e; }
.flash-info { background: #e6f4ff; color: #1677ff; border: 1px solid #91caff; }

/* Progress bar */
.progress-bar { height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; flex: 1; }
.progress-bar-lg { height: 20px; border-radius: 10px; margin-bottom: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #1677ff, #69b1ff); border-radius: inherit; transition: width .5s; min-width: 0; }
.progress-text { font-size: 12px; color: #666; margin-left: 8px; }
.progress-stats { display: flex; gap: 24px; font-size: 13px; color: #666; }
.progress-section { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.06); margin-bottom: 20px; }

/* Task info */
.task-info { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.06); margin-bottom: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.info-row { display: flex; gap: 12px; padding: 4px 0; }
.info-label { color: #666; min-width: 80px; }
.cancel-form { margin-bottom: 20px; }

/* Task form */
.task-form { background: #fff; border-radius: 8px; padding: 24px; box-shadow: 0 1px 2px rgba(0,0,0,.06); max-width: 640px; }

/* Log */
.log-viewer { background: #1e1e1e; color: #d4d4d4; padding: 20px; border-radius: 8px; font-family: "Cascadia Code", "Fira Code", "Consolas", monospace; font-size: 12px; line-height: 1.8; overflow: auto; max-height: 600px; white-space: pre-wrap; word-break: break-all; }
.log-box { background: #fafafa; border: 1px solid #f0f0f0; border-radius: 8px; padding: 16px; max-height: 400px; overflow-y: auto; }
.log-line { padding: 3px 0; font-size: 12px; font-family: "Cascadia Code", "Fira Code", "Consolas", monospace; border-bottom: 1px solid #f5f5f5; }
.log-time { color: #999; margin-right: 8px; }
.log-level { font-weight: 600; margin-right: 4px; }
.log-info .log-level { color: #1677ff; }
.log-warning .log-level { color: #d48806; }
.log-error .log-level { color: #cf1322; }

.empty { color: #999; font-size: 13px; padding: 24px 0; text-align: center; }
