:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.navbar { background: #1e1b4b; color: #fff; padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 24px; }
.navbar-brand { font-weight: 700; font-size: 18px; color: #fff; letter-spacing: -0.3px; }
.navbar-brand span { color: #818cf8; }
.navbar a { color: #c7d2fe; font-size: 13px; }
.navbar a:hover { color: #fff; text-decoration: none; }
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.page-sub { color: var(--muted); margin-bottom: 24px; font-size: 13px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-weight: 600; font-size: 15px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-created  { background: #e2e8f0; color: #475569; }
.badge-uploaded { background: #dbeafe; color: #1d4ed8; }
.badge-extracting,.badge-restoring { background: #fef3c7; color: #92400e; }
.badge-restored { background: #d1fae5; color: #065f46; }
.badge-scanning { background: #e0e7ff; color: #3730a3; }
.badge-mapping, .badge-mapped  { background: #ede9fe; color: #5b21b6; }
.badge-migrating { background: #fff7ed; color: #9a3412; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-failed,.badge-error { background: #fee2e2; color: #991b1b; }
.badge-aborting,.badge-aborted { background: #fce7f3; color: #9d174d; }
.badge-pending  { background: #f1f5f9; color: #64748b; }
.badge-running  { background: #dbeafe; color: #1d4ed8; }
.badge-done     { background: #d1fae5; color: #065f46; }
.badge-skipped  { background: #f1f5f9; color: #64748b; }

/* Confidence bar */
.conf-bar { height: 4px; border-radius: 2px; background: #e2e8f0; }
.conf-fill { height: 100%; border-radius: 2px; }
.conf-high  { background: var(--success); }
.conf-med   { background: var(--warning); }
.conf-low   { background: var(--danger); }

/* Progress */
.progress-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; padding: 10px 12px; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); border-bottom: 1px solid var(--border); background: #f8fafc; }
tbody td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:hover td { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* Forms */
.form-group { margin-bottom: 14px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: #fff; color: var(--text); transition: border .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
input[type=checkbox] { width: auto; }

/* Log panel */
.log-panel { background: #0f172a; color: #94a3b8; font-family: monospace; font-size: 12px; padding: 12px; border-radius: 8px; height: 260px; overflow-y: auto; line-height: 1.6; }
.log-panel .log-ok   { color: #34d399; }
.log-panel .log-err  { color: #f87171; }
.log-panel .log-info { color: #93c5fd; }
.log-panel .log-warn { color: #fbbf24; }

/* Three-panel layout */
.three-panel { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.panel-left { display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 180px); overflow-y: auto; }
.panel-right { display: flex; flex-direction: column; gap: 16px; }
.table-item { padding: 10px 12px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; transition: all .1s; }
.table-item:hover { background: #f1f5f9; }
.table-item.active { background: #ede9fe; border-color: #a5b4fc; }
.table-item-name { font-weight: 600; font-size: 13px; }
.table-item-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Stat cards */
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.stat-value { font-size: 32px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

/* Upload area */
.upload-zone { border: 2px dashed var(--border); border-radius: 12px; padding: 60px 24px; text-align: center; transition: all .2s; cursor: pointer; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: #eef2ff; }
.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.upload-sub { color: var(--muted); font-size: 13px; }

/* Misc */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-mono { font-family: monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spinner { width: 16px; height: 16px; border: 2px solid #c7d2fe; border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

@media (max-width: 768px) {
  .three-panel { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
