:root {
  --bg: #10141c;
  --panel: #171d28;
  --line: #2a3344;
  --text: #e8eef7;
  --muted: #8b97ab;
  --accent: #5aa2ff;
  --good: #3ecf8e;
  --bad: #ff6b7a;
  --warn: #f5c15d;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
[hidden] { display: none !important; }
body {
  font: 15px/1.45 "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card, aside, .file, header, #progress {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border-radius: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-card h1 { margin: 4px 0 6px; font-size: 28px; }
.login-card input, .login-card button { width: 100%; margin: 0; }

.mark {
  width: 52px; height: 52px; margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 16px;
  background: #24344f;
  font-size: 26px;
}
.mark.sm { width: 40px; height: 40px; margin: 0; font-size: 20px; }

input, button, .primary {
  border: 1px solid var(--line);
  background: #121826;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
}

button, .primary { cursor: pointer; }
button.primary, .primary {
  background: var(--accent);
  border-color: transparent;
  color: #071018;
  font-weight: 650;
}
button.ghost { background: transparent; }
button:hover, .primary:hover { filter: brightness(1.08); }

.error { color: var(--bad); }
.login-card .error { margin-top: 0; }

#app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100%;
}

aside {
  margin: 16px;
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand small { display: block; color: var(--muted); }
aside h2 { margin: 8px 0 0; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
#history-side { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#history { overflow: auto; flex: 1; }
#activity-log { width: 100%; margin-top: 10px; }
.event {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.event strong { display: block; word-break: break-word; }
.event small { color: var(--muted); }
#logout { margin-top: auto; }

.node {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.node .row { display: flex; justify-content: space-between; gap: 8px; }
.node small { color: var(--muted); }
.bar { height: 6px; background: #0e141f; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); display: inline-block; margin-right: 6px; }
.dot.on { background: var(--good); }

main { padding: 16px 20px 20px 0; display: flex; flex-direction: column; gap: 12px; }
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
#add-client { flex-shrink: 0; }
nav { display: flex; flex-wrap: wrap; gap: 6px; }
nav button { padding: 8px 10px; }
.actions { display: flex; gap: 8px; }
.files {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-content: start;
  padding: 8px;
  border-radius: 16px;
  min-height: 240px;
}
.files.over { outline: 2px dashed var(--accent); background: #152033; }
.file {
  position: relative;
  border-radius: 16px;
  padding: 14px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file .icon { font-size: 28px; }
.file .name { word-break: break-word; font-weight: 600; padding-right: 28px; }
.file .meta { color: var(--muted); font-size: 12px; }
.file .ops { display: flex; gap: 6px; margin-top: auto; }
.file .ops button { padding: 6px 8px; font-size: 12px; }
.file-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.file-del:hover { color: var(--bad); filter: none; }
#client-project {
  font-weight: 700;
  font-size: 16px;
  word-break: break-word;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.empty { grid-column: 1 / -1; color: var(--muted); padding: 40px 12px; text-align: center; }
#progress { padding: 10px 14px; border-radius: 12px; }

.user-form { display: grid; gap: 8px; }
.modal-card input { width: 100%; }
.person {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.person small { color: var(--muted); }
.person button { padding: 6px 8px; font-size: 12px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.tests { margin-top: 18px; }
.tests code {
  background: #121826;
  padding: 1px 6px;
  border-radius: 6px;
}
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 99px;
  background: #24344f;
  color: var(--muted);
  font-size: 11px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 16, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}
.modal-card {
  width: min(480px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  display: grid;
  gap: 12px;
}
.modal-card.wide { width: min(960px, 100%); max-height: 90vh; overflow: auto; }
.modal-card h3 { margin: 0; }
.share-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.preview-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.preview-head a { text-decoration: none; }
#preview-body { min-height: 120px; }
#preview-body img, #preview-body video, #preview-body iframe {
  width: 100%;
  max-height: 70vh;
  border: 0;
  border-radius: 12px;
  background: #0c1118;
}
#preview-body pre {
  white-space: pre-wrap;
  background: #0c1118;
  padding: 12px;
  border-radius: 12px;
  overflow: auto;
  max-height: 70vh;
}

@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; }
  aside { margin: 12px 12px 0; }
  main { padding: 12px; }
}
