:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e7eaf0;
  --text: #1f2937;
  --muted: #7b8494;
  --blue: #3370ff;
  --blue-soft: #eaf0ff;
  --green: #20b26b;
  --orange: #f59e0b;
  --shadow: 0 16px 40px rgba(24, 39, 75, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, #eef4ff 0, transparent 32%), var(--bg); }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 30px; }
.login-card h1 { margin: 28px 0 8px; font-size: 30px; letter-spacing: -.04em; }
.login-card p { color: var(--muted); line-height: 1.7; margin: 0 0 22px; }
.login-card button { width: 100%; margin-top: 8px; }
.login-error { display: block; min-height: 20px; color: #d92d20; margin-top: 12px; font-weight: 700; }
.compact-brand { margin-bottom: 0; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; background: #fff; border-right: 1px solid var(--line); padding: 22px 14px; overflow-y: auto; z-index: 10; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 10px 22px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #3370ff, #6ea8ff); color: white; display: grid; place-items: center; font-weight: 800; box-shadow: 0 10px 22px rgba(51,112,255,.28); flex: 0 0 auto; }
.brand-name { font-weight: 800; letter-spacing: .2px; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
nav { display: grid; gap: 4px; }
nav a { height: 38px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-radius: 10px; color: #475569; font-size: 14px; cursor: pointer; text-decoration: none; user-select: none; }
nav a.active, nav a:hover { background: var(--blue-soft); color: var(--blue); font-weight: 650; }
.main { margin-left: 236px; width: auto; min-width: 0; padding: 28px; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; letter-spacing: -.5px; }
.topbar p, .panel p { color: var(--muted); margin-top: 7px; font-size: 14px; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.language-select { width: auto; min-width: 132px; margin-bottom: 0; background: #fff; color: var(--text); font-weight: 700; }
button { border: 0; border-radius: 10px; padding: 10px 15px; font-weight: 700; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease; }
button:hover, .language-select:hover { border-color: #c8d5ea; }
button:active { transform: translateY(1px) scale(.99); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(51, 112, 255, .18); border-color: var(--blue); }
.primary { background: var(--blue); color: white; box-shadow: 0 10px 20px rgba(51,112,255,.22); }
.ghost { background: #fff; color: #334155; border: 1px solid var(--line); }
.danger { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.view-section { display: none; }
.view-section.active { display: block; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card, .panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); min-width: 0; }
.stat-card { padding: 20px; display: grid; gap: 8px; }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { font-size: 30px; letter-spacing: -.7px; }
.stat-card em { font-style: normal; color: var(--muted); font-size: 13px; }
.stat-card.accent { background: #f8fbff; border-color: #cfe0ff; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .9fr); gap: 16px; margin-bottom: 16px; }
.content-grid.bottom { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.content-grid .wide { grid-column: 1 / -1; }
.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.module-grid.single-module { grid-template-columns: minmax(0, 1fr); }
.panel { padding: 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head.compact { align-items: center; }
.panel-head h3 { font-size: 17px; }
.link-btn { background: #f5f7fb; color: #475569; border: 1px solid var(--line); }
.pill { background: #eef8f2; color: var(--green); padding: 5px 9px; border-radius: 999px; font-size: 12px; }
.table { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 90px 140px; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcff; font-size: 14px; }
.row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { color: var(--green); font-weight: 700; }
.empty { color: var(--muted); padding: 34px; text-align: center; border: 1px dashed #cfd6e4; border-radius: 14px; background: #fbfcff; line-height: 1.7; }
select, textarea, input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 10px; outline: none; background: #fbfcff; min-width: 0; }
textarea { min-height: 92px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.full { width: 100%; }
pre { min-height: 112px; background: #fbfcff; color: #334155; border: 1px solid var(--line); border-radius: 12px; padding: 14px; overflow: auto; font-size: 12px; white-space: pre-wrap; }
.app-list, .feature-list, .mini-list { display: grid; gap: 10px; }
.app, .feature, .mini-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcff; min-width: 0; }
.app small, .feature small, .mini-item small { display: block; color: var(--muted); margin-top: 3px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-empty { padding: 14px; }
.locked { color: #475569; background: #f1f5f9; padding: 5px 8px; border-radius: 999px; font-size: 12px; }
.service-actions { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(7, auto); gap: 8px; align-items: start; }
.takeover-actions { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.takeover-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.summary-pill { display: inline-flex; align-items: center; border-radius: 999px; background: #eef4ff; color: var(--blue); padding: 6px 10px; font-size: 12px; font-weight: 800; }
.summary-pill.muted { color: var(--muted); background: #f4f6f8; }
.takeover-list, .managed-list { display: grid; gap: 10px; max-height: 340px; overflow: auto; }
.module-panel { min-height: 360px; }
.module-panel .panel-head span { color: var(--muted); font-size: 12px; font-weight: 800; }
.module-desc { color: var(--muted); font-size: 13px; line-height: 1.65; margin: -6px 0 14px; }
.module-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 8px; margin-bottom: 10px; }
.module-toolbar input, .module-toolbar select { margin-bottom: 0; padding: 9px 10px; font-size: 12px; }
.module-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.module-summary span { border-radius: 8px; background: #f3f6fb; color: #526071; padding: 5px 7px; font-size: 11px; font-weight: 750; }
.module-assets { display: grid; gap: 10px; max-height: 430px; overflow: auto; }
.module-assets .managed-item { grid-template-columns: minmax(0, 1fr) 78px 62px; padding: 11px; }
.module-assets .managed-item b { font-size: 13px; }
.module-assets .managed-item small { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-subtitle { margin: 16px 0 10px; font-weight: 800; color: var(--text); }
.takeover-item, .managed-item { display: grid; grid-template-columns: minmax(0, 1fr) 90px 70px; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcff; }
.takeover-item small, .takeover-item p, .managed-item small { color: var(--muted); margin: 4px 0 0; }
.takeover-item p { grid-column: 1 / -1; }
.takeover-confirm { justify-self: end; grid-column: 1 / -1; }
.managed-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.managed-actions button { padding: 7px 10px; font-size: 12px; }
.managed-detail-box { grid-column: 1 / -1; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 0; color: var(--muted); white-space: pre-wrap; }
.risk { border-radius: 999px; padding: 5px 8px; text-align: center; font-size: 12px; font-weight: 800; background: #f1f5f9; color: #475569; }
.risk.high { background: #fff1f2; color: #be123c; }
.risk.medium { background: #fff7ed; color: #c2410c; }
.risk.low { background: #ecfdf5; color: #047857; }
.service-actions button { white-space: nowrap; }
.service-table { display: grid; gap: 8px; margin: 4px 0 12px; max-height: 420px; overflow: auto; }
.service-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 90px 100px minmax(0, 1.4fr); gap: 10px; align-items: center; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcff; color: var(--text); text-align: left; font-size: 13px; }
.service-head { background: #f3f6fb; color: var(--muted); font-weight: 700; position: sticky; top: 0; z-index: 1; }
.service-item:hover, .service-item.selected { border-color: #b8ccff; background: #f7faff; }
.service-row small, .service-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-row small { color: var(--muted); }
.user-form { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 140px minmax(0, 1fr) auto; gap: 8px; align-items: start; margin-bottom: 12px; }
.user-form input, .user-form select { margin-bottom: 0; }
.user-list { display: grid; gap: 8px; }
.user-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 120px 220px; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcff; }
.user-row small { color: var(--muted); display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-actions { display: flex; gap: 8px; justify-content: flex-end; }
.user-actions button, .user-actions select { margin-bottom: 0; padding: 8px 10px; font-size: 12px; }
.approval-list { display: grid; gap: 10px; }
.approval-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 120px 220px; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffaf2; }
.approval-row small { color: var(--muted); display: block; margin-top: 3px; }
.approval-actions { display: flex; justify-content: flex-end; gap: 8px; }
.approval-actions button { margin-bottom: 0; padding: 8px 10px; font-size: 12px; }
.docker-panel { background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); }
.docker-toolbar { display: grid; grid-template-columns: minmax(180px, 1fr) repeat(7, auto); gap: 8px; align-items: start; margin-bottom: 12px; }
.docker-toolbar select, .docker-toolbar button { margin-bottom: 0; }
.docker-table { display: grid; gap: 8px; max-height: 420px; overflow: auto; margin-bottom: 12px; }
.docker-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) 90px minmax(0, 1fr) 110px; gap: 10px; align-items: center; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcff; color: var(--text); text-align: left; font-size: 13px; }
.docker-head { background: #f3f6fb; color: var(--muted); font-weight: 800; position: sticky; top: 0; z-index: 1; }
.docker-item:hover, .docker-item.selected { border-color: #9fb8ff; background: #f5f8ff; }
.docker-row b, .docker-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docker-row small { color: var(--muted); }
.docker-result { min-height: 150px; max-height: 360px; }
.file-panel { background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%); }
.file-toolbar { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(0, 1.3fr) auto auto; gap: 10px; margin-bottom: 12px; }
.file-toolbar select, .file-toolbar input { margin-bottom: 0; }
.file-workspace { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(0, 1.4fr); gap: 12px; align-items: stretch; }
.file-list { display: grid; align-content: start; gap: 8px; max-height: 430px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #f8fbff; }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; width: 100%; padding: 10px 11px; border: 1px solid #dde6f3; border-radius: 12px; background: #fff; color: var(--text); text-align: left; font-size: 13px; }
.file-row:hover, .file-row.selected { border-color: #adc4ff; background: #f4f8ff; }
.file-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row small { color: var(--muted); font-variant-numeric: tabular-nums; }
.file-kind { border-radius: 999px; padding: 4px 7px; background: #eef4ff; color: var(--blue); font-size: 11px; font-weight: 850; }
.file-kind.file { background: #f1f5f9; color: #475569; }
.file-editor { display: grid; grid-template-rows: auto 1fr; gap: 10px; min-height: 430px; }
.file-editor-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; }
.file-editor-actions input, .file-editor-actions button { margin-bottom: 0; }
.file-content { min-height: 370px; margin-bottom: 0; background: #08111f; color: #e6edf7; border-color: #17243a; line-height: 1.55; }
.file-result { margin-top: 12px; min-height: 86px; }
.terminal-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; margin-bottom: 12px; }
.terminal-output { min-height: 360px; max-height: 520px; overflow: auto; background: #05070a; color: #d8ffe1; border-radius: 14px; padding: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; white-space: pre-wrap; }
.terminal-input { background: #0b0f14; color: #fff; border-color: #1d2733; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.status.active { color: var(--green); font-weight: 800; }
.status.failed { color: #be123c; font-weight: 800; }
.status.muted { color: var(--muted); }
.settings-grid { display: grid; gap: 12px; }
.setting-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcff; }
.setting-item span { color: var(--muted); text-align: right; }
.placeholder-panel .empty { text-align: left; }
@media (max-width: 1280px) {
  .stats-grid, .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-actions, .docker-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .service-actions input, .docker-toolbar select { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .sidebar { width: 210px; }
  .main { margin-left: 210px; width: auto; padding: 22px; }
  .content-grid, .content-grid.bottom, .module-grid, .service-actions, .service-row, .docker-toolbar, .docker-row, .user-form, .user-row, .approval-row, .file-toolbar, .file-workspace, .file-editor-actions, .terminal-toolbar { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .content-grid .wide { grid-column: auto; }
  .row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { margin-left: 0; width: 100%; padding: 18px; }
  .topbar { display: grid; }
  .top-actions { justify-content: flex-start; }
  .stats-grid { grid-template-columns: 1fr; }
}
