:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #17211b;
  background: #f2f6f1;
}
* { box-sizing: border-box; }
body { margin: 0; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; padding: 0; }
.sidebar { border-right: 1px solid #e5ebe6; background: rgba(255,255,255,.72); padding: 22px 14px; }
.brand { font-size: 20px; font-weight: 850; margin: 0 8px 22px; }
.sidebar nav { display: grid; gap: 8px; }
.nav-item { width: 100%; text-align: left; border-radius: 10px; background: transparent; color: #334239; font-weight: 750; }
.nav-item.active { background: #e6efff; color: #175cd3; }
.nav-item:disabled { cursor: default; opacity: .65; }
.nav-item:hover { background: #eef4ef; color: #17211b; }
.nav-item.active:hover { background: #e6efff; color: #175cd3; }
.workspace { min-width: 0; padding: 34px 28px 70px; }
header, .section-title, .task, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
h1 { margin: 0; font-size: 28px; letter-spacing: -0.04em; }
h2 { margin: 0 0 20px; font-size: 20px; }
p { color: #5e6b63; }
.eyebrow { margin: 0 0 8px; color: #2d7a4e; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; }
.toolbar { margin: 26px 0 16px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.card { background: #fff; border: 1px solid #dfe8df; border-radius: 16px; box-shadow: 0 12px 40px rgba(34, 64, 44, .06); }
label { display: grid; gap: 7px; margin: 14px 0; color: #3d4b42; font-size: 14px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid #cedacf; border-radius: 11px; padding: 12px 13px; font: inherit; background: #fbfdfb; }
textarea { resize: vertical; }
button { border: 0; border-radius: 11px; padding: 11px 16px; background: #237a4b; color: white; font: inherit; font-weight: 700; cursor: pointer; }
button:hover { background: #19643c; }
button:disabled { cursor: default; opacity: .55; }
button.secondary { background: #e7eee8; color: #334239; }
button.danger { background: #fee4e2; color: #b42318; }
button.danger:hover { background: #fecdca; }
button.compact { padding: 6px 9px; border-radius: 8px; font-size: 12px; }
button.link-button { padding: 0; border-radius: 0; background: transparent; color: #175cd3; font-weight: 800; }
button.link-button:hover { background: transparent; color: #0f4393; text-decoration: underline; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-row { display: grid; grid-template-columns: 160px 1fr; gap: 10px; align-items: end; }
.filter-row label { margin: 0 0 12px; }
.hint { margin: 8px 0 14px; font-size: 13px; line-height: 1.45; }
.hint.success { color: #237a4b; }
.hint.error { color: #b42318; }
.hint.warning, .warning { color: #9a5b13; }
.suggestions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: -6px 0 10px; color: #5e6b63; font-size: 13px; }
button.suggestion { padding: 6px 10px; border-radius: 999px; background: #eef4ef; color: #237a4b; font-size: 13px; }
button.suggestion:hover { background: #dcebdd; }
.tasks { min-height: 260px; padding: 0; overflow: hidden; }
.task-summary { margin: 0; padding: 12px 16px; border-bottom: 1px solid #edf1ed; color: #5e6b63; font-size: 13px; background: #fbfdfb; }
.section-title h2 { margin: 0; }
#status { color: #77847b; font-size: 14px; }
.task-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.task-table th, .task-table td { padding: 13px 16px; border-bottom: 1px solid #edf1ed; text-align: left; vertical-align: middle; }
.task-table th { color: #3d4b42; background: #fbfdfb; font-size: 13px; font-weight: 800; }
.task-table td { color: #27332d; font-size: 14px; }
.task-table tr { cursor: pointer; }
.task-table tbody tr:hover { background: #f5f8f5; }
.task-table tr.selected { background: #eaf2ff; }
.task-table .select-col { width: 48px; text-align: center; }
.task-name { display: grid; gap: 3px; min-width: 0; }
.task-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-name span { color: #77847b; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-cell, .device-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.progress-inline { color: #496052; font-size: 12px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-bar { flex-basis: 100%; max-width: 260px; height: 6px; border-radius: 999px; overflow: hidden; background: #e7efe8; }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2c7f4f, #4fb477); transition: width .2s ease; }
.mini-detail { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-error { color: #b42318; font-size: 12px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: #77847b !important; }
.empty-row { height: 180px; text-align: center !important; color: #77847b !important; cursor: default; }
.task { padding: 16px 0; border-top: 1px solid #edf1ed; }
.task:first-child { border-top: 0; }
.task-running { box-shadow: inset 3px 0 #237a4b; }
.task-failed { box-shadow: inset 3px 0 #b42318; }
.task-stopped { box-shadow: inset 3px 0 #77847b; }
.task h3 { margin: 0 0 5px; }
.task p { margin: 0; font-size: 14px; }
.task .state-detail { margin-top: 5px; color: #334239; font-weight: 650; }
.task .warning { margin-top: 5px; font-size: 13px; line-height: 1.45; }
.task .progress { margin-top: 5px; color: #2d7a4e; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 9px; background: #eef4ef; color: #496052; font-size: 12px; }
.badge.connecting, .badge.syncing, .badge.idle { background: #dcf4e4; color: #116236; }
.badge.failed { background: #fee4e2; color: #b42318; }
.badge.stopped { background: #eef1ef; color: #5e6b63; }
.source-link { margin-top: 12px; padding: 12px; border: 1px solid #dfe8df; border-radius: 14px; background: #fbfdfb; }
.source-link p { margin-bottom: 10px; color: #334239; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.logs-list { max-height: 360px; overflow: auto; border: 1px solid #dfe8df; border-radius: 12px; padding: 10px 12px; background: #fbfdfb; }
.logs-list.compact-list { max-height: 180px; margin-top: 8px; }
.log-entry { margin: 0; padding: 8px 0; border-bottom: 1px solid #edf1ed; color: #334239; font-size: 13px; }
.log-entry:last-child { border-bottom: 0; }
.log-entry.error { color: #b42318; }
.log-entry.warning { color: #9a5b13; }
.devices-body { display: grid; gap: 14px; }
.settings-card { border: 1px solid #dfe8df; border-radius: 14px; padding: 14px; background: #fbfdfb; display: grid; gap: 10px; }
.settings-card h3 { margin: 0; font-size: 16px; }
.settings-card label { margin: 4px 0; }
.settings-card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-card-title .hint { margin: 0; text-align: right; }
.settings-list { display: grid; gap: 10px; }
.relay-node-card { background: #fff; }
.manager-list { display: grid; gap: 10px; max-height: 520px; overflow: auto; }
.manager-card { border: 1px solid #dfe8df; border-radius: 14px; padding: 12px; background: #fbfdfb; display: grid; gap: 8px; }
.manager-card h3 { margin: 0; font-size: 15px; }
.manager-card p { margin: 0; font-size: 13px; }
.manager-card.disabled { opacity: .68; border-color: #fecdca; }
.manager-card.trusted { border-color: #92d6aa; }
.manager-section-title { margin: 8px 0 2px; color: #334239; font-size: 13px; font-weight: 850; }
.detail-table { width: 100%; border-collapse: collapse; border: 1px solid #dfe8df; border-radius: 12px; overflow: hidden; background: #fbfdfb; }
.detail-table td { padding: 11px 12px; border-bottom: 1px solid #edf1ed; font-size: 14px; }
.detail-table tr:last-child td { border-bottom: 0; }
.detail-table td:first-child { width: 130px; font-weight: 800; background: #f5f8f5; }
.device-actions { padding-top: 4px; }
.error { color: #b42318 !important; }
dialog { width: min(620px, calc(100% - 32px)); border: 0; border-radius: 20px; padding: 24px; box-shadow: 0 24px 90px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(20, 32, 24, .45); }
#generated-link { margin-top: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
#toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 12px 16px; border-radius: 12px; background: #17211b; color: #fff; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .workspace { padding: 24px 16px 60px; }
  header, .toolbar { align-items: flex-start; flex-direction: column; }
  .task { align-items: flex-start; flex-direction: column; }
  .actions { justify-content: flex-start; }
  .task-table { min-width: 920px; }
  .tasks { overflow-x: auto; }
  .filter-row { grid-template-columns: 1fr; }
}
