:root {
    --bg: #f3f5f7;
    --panel: #ffffff;
    --ink: #172029;
    --muted: #66717d;
    --line: #e3e8ec;
    --accent: #167a63;
    --accent-dark: #0f5d4b;
    --nav: #111b21;
    --danger: #bc3d3d;
    --warning: #9b6818;
    --radius: 14px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 230px; padding: 28px 18px 20px;
    color: #dce6e3; background: var(--nav); display: flex; flex-direction: column; z-index: 10;
}
.brand { display: flex; gap: 12px; align-items: center; color: white; padding: 0 10px 28px; }
.brand:hover { text-decoration: none; }
.brand-mark, .auth-logo {
    width: 38px; height: 38px; display: grid; place-items: center; color: white;
    background: var(--accent); border-radius: 10px; font-weight: 800; font-size: 20px;
}
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: #81918d; font-size: 11px; letter-spacing: .08em; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { padding: 11px 13px; border-radius: 9px; color: #99aaa5; font-size: 14px; }
.sidebar nav a:hover, .sidebar nav a.active { color: white; background: #1c2a31; text-decoration: none; }
.sidebar nav a.active { box-shadow: inset 3px 0 var(--accent); }
.sidebar-footer { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid #27353b; display: flex; justify-content: space-between; font-size: 13px; }

.main { margin-left: 230px; padding: 34px 42px 60px; max-width: 1600px; }
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 75% 20%, #d7ebe5 0, transparent 34%), var(--bg); }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; }
.topbar h1 { margin: 3px 0 0; font-size: 28px; line-height: 1.2; }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.version { color: var(--muted); font: 12px ui-monospace, monospace; }

.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 36px; box-shadow: 0 24px 70px rgba(31, 52, 45, .1); }
.auth-card .auth-logo { margin-bottom: 28px; }
.auth-card h1 { margin: 7px 0 10px; font-size: 27px; }
.auth-card .muted { margin-bottom: 25px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.metric span, .metric small { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin: 12px 0 5px; font-size: 29px; }
.metric-accent { color: white; background: var(--accent); border-color: var(--accent); }
.metric-accent span, .metric-accent small { color: #d7eee8; }

.panel { margin: 0 0 20px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 14px rgba(18, 32, 40, .025); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.panel-head h2, .callout h2 { margin: 4px 0 0; font-size: 19px; }
.callout { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-left: 4px solid var(--accent); }
.muted, .form-note { color: var(--muted); font-size: 13px; line-height: 1.65; }
.is-hidden { display: none; }

.button {
    display: inline-flex; min-height: 38px; align-items: center; justify-content: center;
    border: 1px solid transparent; border-radius: 8px; padding: 8px 14px;
    font-weight: 650; font-size: 13px; cursor: pointer; text-decoration: none;
}
.button:hover { text-decoration: none; }
.button.primary { color: white; background: var(--accent); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { color: var(--ink); background: #f8fafb; border-color: #ccd5da; }
.button.ghost { color: var(--accent-dark); background: transparent; border-color: #cfe1dc; }
.button.tiny { min-height: 30px; padding: 5px 9px; font-size: 12px; }
.danger-button { color: var(--danger); background: #fff6f6; border-color: #e8bcbc; }
.link-button { border: 0; padding: 0; color: #88bcb0; background: none; cursor: pointer; font-size: 12px; }
.actions, .row-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }

.stack { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.span-2 { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: #39444d; font-size: 13px; font-weight: 650; }
input, select, textarea {
    width: 100%; border: 1px solid #cfd7dc; border-radius: 8px; padding: 10px 11px;
    color: var(--ink); background: white; outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22, 122, 99, .11); }
textarea { resize: vertical; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.hint { color: var(--muted); font-weight: 400; }
.check { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 42px; }
.check input { width: auto; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: #7b858e; font-size: 10px; text-align: left; letter-spacing: .08em; text-transform: uppercase; }
th, td { padding: 12px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfc; }
.cell-sub, .cell-error { display: block; max-width: 280px; margin-top: 4px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.cell-error { color: var(--danger); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ok { color: var(--accent-dark); }
.danger { color: var(--danger) !important; }

.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 750; white-space: nowrap; background: #edf1f3; color: #5e6a72; }
.badge-online, .badge-success, .badge-completed { color: #10634f; background: #e1f2ed; }
.badge-error, .badge-failed { color: #a62f2f; background: #f9e6e6; }
.badge-running { color: #176797; background: #e5f2fa; }
.badge-skipped, .badge-rolled_back { color: #77531a; background: #f7eedf; }

.empty { padding: 38px 20px; border: 1px dashed #cdd6da; border-radius: 10px; color: var(--muted); text-align: center; font-size: 13px; }
.alert { margin-bottom: 18px; padding: 12px 15px; border-radius: 9px; font-size: 13px; }
.alert-success { color: #125e4c; background: #e2f2ed; border: 1px solid #c3e2d8; }
.alert-error { color: #9d3030; background: #f9e7e7; border: 1px solid #eccaca; }

.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(330px, .6fr); gap: 20px; align-items: start; }
.sticky-panel { position: sticky; top: 20px; }
.snippet-list { display: grid; gap: 12px; }
.snippet { border: 1px solid var(--line); border-radius: 10px; padding: 15px; }
.snippet strong, .snippet small { display: block; }
.snippet small { margin-top: 4px; color: var(--muted); font: 10px ui-monospace, monospace; }
pre { max-width: 800px; margin: 10px 0 0; padding: 10px; overflow: auto; border-radius: 7px; color: #33424a; background: #f4f7f8; font: 10px/1.55 ui-monospace, monospace; white-space: pre-wrap; }

.select-head { display: flex; justify-content: space-between; }
.site-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.site-picker > label { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 9px; padding: 12px; }
.site-picker > label:has(input:checked) { border-color: var(--accent); background: #f1f8f6; }
.site-picker input { width: auto; }
.site-picker strong, .site-picker small { display: block; }
.site-picker small { margin-top: 3px; color: var(--muted); font-weight: 400; }
.site-picker .badge { min-height: 18px; padding: 2px 5px; }

.progress { width: 100%; height: 8px; margin: 12px 0 16px; overflow: hidden; border-radius: 999px; background: #e8edef; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s; }
.task-counts { display: flex; gap: 28px; color: var(--muted); font-size: 12px; }
.task-counts strong { margin-right: 3px; font-size: 17px; }
details summary { color: var(--accent-dark); cursor: pointer; font-size: 11px; margin-top: 6px; }
code { padding: 2px 5px; border-radius: 4px; background: #edf1f2; font-size: 11px; }

@media (max-width: 1050px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .site-picker { grid-template-columns: repeat(2, 1fr); }
    .split { grid-template-columns: 1fr; }
    .sticky-panel { position: static; }
}

@media (max-width: 760px) {
    .sidebar { position: static; width: auto; padding: 16px; }
    .sidebar nav { display: flex; overflow-x: auto; }
    .sidebar-footer { display: none; }
    .brand { padding-bottom: 14px; }
    .main { margin-left: 0; padding: 22px 15px 45px; }
    .metric-grid, .form-grid, .site-picker { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .callout { align-items: flex-start; flex-direction: column; }
    .panel { padding: 18px; }
}

