:root {
  --bg: #0e1112;
  --panel: #161a1c;
  --panel-2: #1f2527;
  --line: #2e3639;
  --text: #edf1f0;
  --muted: #95a19f;
  --accent: #3fc1a5;
  --accent-text: #06221c;
  --warn: #e9a83c;
  --error: #f0695f;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input { font: inherit; color: inherit; }

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  background: var(--panel-2);
  cursor: pointer;
}
button:hover { border-color: #4b5659; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--muted); border-color: transparent; }
button.ghost:hover { color: var(--text); }
button.small { padding: 3px 10px; font-size: 13px; }
button.danger:hover { color: var(--error); border-color: var(--error); }

input:not([type=checkbox]) {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
label input { margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { margin: 0; }

code, pre { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; }
code { overflow-wrap: anywhere; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }

.muted { color: var(--muted); }
.error { color: var(--error); margin: 0 0 12px; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline { display: flex; gap: 8px; }
.inline input { width: 220px; }

.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.panel { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel h1 { font-size: 22px; margin-bottom: 20px; }
.panel button { width: 100%; }

.top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; color: var(--accent); margin-right: 8px; }
#disk { font-size: 13px; }

.content { max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 18px; }
.card {
  display: block; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); min-width: 0;
}
.card:hover { border-color: var(--accent); }
.card strong { display: block; overflow-wrap: anywhere; }
.card .muted { font-size: 13px; }
.badge { display: inline-block; margin-top: 8px; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: #3a2c12; color: var(--warn); }
.badge.mine { background: #103229; color: var(--accent); }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 18px; font-weight: 600; margin-bottom: 14px; }
.crumbs a { color: var(--muted); font-weight: 400; }
.crumbs a:hover { color: var(--text); }

.lock { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.lock.other { border-color: var(--warn); }
.lock.mine { border-color: var(--accent); }

.drop { border: 1px dashed var(--line); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--muted); margin-bottom: 14px; }
.drop p { margin: 0; }
.drop.over { border-color: var(--accent); color: var(--text); }
.drop.off { opacity: .5; pointer-events: none; }
.pick { display: inline; margin: 0; font-size: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }

.queue:not(:empty) { margin-bottom: 14px; display: grid; gap: 8px; }
.job { padding: 10px 14px; background: var(--panel); border-radius: 8px; }
.job .row { justify-content: space-between; font-size: 14px; flex-wrap: nowrap; }
.job .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .state { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.job.failed .state { color: var(--error); white-space: normal; }
.bar { height: 5px; background: var(--panel-2); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }

.files { width: 100%; border-collapse: collapse; }
.files th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.files td { padding: 8px; border-bottom: 1px solid var(--panel-2); overflow-wrap: anywhere; }
.files .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.files .date { color: var(--muted); font-size: 13px; white-space: nowrap; }
.files .actions { text-align: right; white-space: nowrap; }
.files .actions button { margin-left: 4px; }
.files a.dir { color: var(--accent); }
#delete-project { margin-top: 16px; }

dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h3 { margin-bottom: 12px; overflow-wrap: anywhere; }
dialog > form[method=dialog] { margin-top: 16px; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; }

@media (max-width: 640px) {
  .files th:nth-child(3), .files td:nth-child(3) { display: none; }
  .inline, .inline input { width: 100%; }
  .files .actions { white-space: normal; }
}
