* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --badge-bg: #f8fafc;
  --ok: #10b981;
  --merged: #f59e0b;
  --error: #ef4444;
  --skip: #94a3b8;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}
body[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --badge-bg: #334155;
}
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
.app-header { padding: 1.5rem 2rem; border-bottom: 1px solid var(--border); background: var(--card); position: sticky; top: 0; z-index: 10; box-shadow: var(--shadow); }
.app-header h1 { margin: 0 0 .75rem; font-size: 1.75rem; font-weight: 700; }
.status-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.passphrase-row { display: flex; gap: .75rem; align-items: center; margin-top: .75rem; }
.note { color: var(--muted); font-size: .875rem; }

.main-container { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }
.hero-card { background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%); border-radius: 1rem; padding: 2rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-lg); }
.hero-content h2 { color: white; margin: 0 0 1.5rem; font-size: 1.5rem; font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.stat-card { background: rgba(255,255,255,.15); backdrop-filter: blur(10px); border-radius: .75rem; padding: 1.5rem; text-align: center; border: 1px solid rgba(255,255,255,.2); }
.stat-value { display: block; font-size: 2.5rem; font-weight: 700; color: white; line-height: 1; margin-bottom: .5rem; }
.stat-label { display: block; font-size: .875rem; color: rgba(255,255,255,.9); text-transform: uppercase; letter-spacing: .05em; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 1rem; padding: 1.5rem; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card h2 { margin-top: 0; margin-bottom: 1rem; font-size: 1.25rem; font-weight: 600; }
.card-desc { color: var(--muted); font-size: .875rem; margin: -.5rem 0 1rem; }
.timeline-card { grid-column: 1 / -1; }
.timeline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 1rem; }
.timeline-header h2 { margin: 0; }

.row { display: flex; gap: .75rem; align-items: center; margin: .75rem 0; flex-wrap: wrap; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

input, textarea, button { font: inherit; }
input, textarea { width: 100%; padding: .75rem; border: 2px solid var(--border); border-radius: .5rem; background: var(--bg); color: var(--text); transition: border-color .2s; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
button { padding: .75rem 1.25rem; border: none; background: var(--accent); color: white; border-radius: .5rem; cursor: pointer; font-weight: 500; transition: background .2s, transform .1s; }
button:hover { background: var(--accent-hover); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { background: #94a3b8; cursor: not-allowed; opacity: .6; }
.btn-secondary { background: var(--badge-bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.badge { display: inline-block; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--badge-bg); font-size: .875rem; color: var(--text); cursor: pointer; transition: background .2s; }
.badge:hover { background: var(--border); }
.chip { display: inline-block; background: var(--badge-bg); border: 1px solid var(--border); border-radius: 999px; padding: .35rem .75rem; font-size: .875rem; }
.list { list-style: none; padding: 0; margin: .75rem 0 0; max-height: 400px; overflow-y: auto; }
.list li { padding: .75rem; border: 1px solid var(--border); border-radius: .5rem; margin-bottom: .75rem; background: var(--bg); transition: border-color .2s; }
.list li:hover { border-color: var(--accent); }
.timeline { list-style: none; padding-left: 0; max-height: 300px; overflow-y: auto; }
.timeline li { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; border: 1px dashed var(--border); border-radius: .5rem; margin-bottom: .5rem; font-size: .875rem; }
.timeline .status { font-size: .75rem; font-weight: 600; padding: .2rem .5rem; border-radius: .35rem; color: white; }
.status-ok { background: var(--ok); }
.status-merged { background: var(--merged); }
.status-error { background: var(--error); }
.status-skip { background: var(--skip); }
.legend-row { display: flex; gap: .75rem; margin-top: 1rem; flex-wrap: wrap; }
.legend { font-size: .75rem; font-weight: 600; padding: .25rem .5rem; border-radius: .35rem; color: white; }
.legend-ok { background: var(--ok); }
.legend-merged { background: var(--merged); }
.legend-error { background: var(--error); }
.legend-skip { background: var(--skip); }

.app-footer { padding: 2rem; color: var(--muted); text-align: center; font-size: .875rem; }

.spinner { position: fixed; inset: 0; display: none; place-items: center; z-index: 60; }
.spinner:not([hidden]) { display: grid; }
.spinner-dot { display: none; }

.snackbar { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%); background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: .75rem; padding: .75rem 1.25rem; box-shadow: var(--shadow-lg); z-index: 70; font-weight: 500; animation: slideUp .3s ease; }
@keyframes slideUp { from { transform: translate(-50%, 100px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
