@import url('/fonts/fonts.css');

:root {
  --bg: #0f1116;
  --surface: #171a21;
  --surface-2: #1c2028;
  --surface-dim: #14171d;
  --line: #212630;
  --line-2: #262c37;
  --text: #e6e8ec;
  --text-2: #c3c9d4;
  --dim: #98a0ae;
  --dim-2: #5c6472;
  --dim-3: #4d5462;
  --faint: #3a4150;
  --accent: #5ee0c5;
  --accent-ink: #06241d;
  --warn: #e0a458;
  --sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1 { font-size: 27px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
p  { margin: 0; }

.mono { font-family: var(--mono); }
.dim-2 { color: var(--dim-2); }
.dim-3 { color: var(--dim-3); }
.grow { flex-grow: 1; }
.min0 { min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ views */

.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.scroll {
  flex-grow: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------------ login */

.login-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-t) + 88px) 24px 0;
}

.wordmark {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}

.login-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px;
}

.fp-halo {
  position: relative;
  width: 148px;
  height: 148px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(94, 224, 197, 0.14), rgba(94, 224, 197, 0) 68%);
}

.fp-halo::after {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px solid #22303a;
}

.fp { width: 76px; height: 76px; color: var(--accent); }

.login-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.login-copy h1 { font-size: 22px; }

.login-copy p {
  font-size: 14px;
  color: #7c8494;
  line-height: 1.5;
  max-width: 260px;
  text-wrap: pretty;
}

.login-foot {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 24px calc(var(--safe-b) + 28px);
}

#password-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.linkish {
  appearance: none;
  background: none;
  border: 0;
  color: #7c8494;
  font: inherit;
  font-size: 14px;
  min-height: 44px;
  cursor: pointer;
}

.linkish:active { color: var(--accent); }

/* ------------------------------------------------------- headers & footers */

.head {
  padding: calc(var(--safe-t) + 52px) 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.head.bordered { border-bottom: 1px solid #1b2029; padding-left: 16px; padding-right: 16px; }

.head-row { display: flex; align-items: center; gap: 12px; }
.head-titles { display: flex; flex-direction: column; gap: 4px; }
.head-row h1 { font-size: 22px; }
#view-projects .head-row h1 { font-size: 27px; }

.file-name { font-size: 15px; font-weight: 500; }

.icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid #232833;
  background: none;
  color: var(--dim);
  cursor: pointer;
}

.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:active { background: var(--surface); }

.foot {
  flex-shrink: 0;
  padding: 14px 16px calc(var(--safe-b) + 22px);
  display: flex;
  gap: 10px;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  appearance: none;
  min-height: 56px;
  border-radius: 14px;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 18px;
  width: 100%;
}

.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:active { background: #4cc9b0; }
.btn-primary:disabled { background: #232833; color: var(--dim-2); cursor: default; }

.btn-ghost {
  background: none;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  font-weight: 500;
}

.btn-ghost:active { background: var(--surface); }

/* ----------------------------------------------------------------- inputs */

.input {
  min-height: 56px;
  border-radius: 13px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  padding: 0 15px;
  width: 100%;
}

.input:focus { outline: none; border-color: var(--accent); }
.input.invalid { border-color: var(--warn); }

.input-prefixed { display: flex; align-items: center; gap: 1px; }

.bare {
  flex-grow: 1;
  min-width: 0;
  background: none;
  border: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  padding: 0;
}

.bare:focus { outline: none; }

.field { display: flex; flex-direction: column; gap: 9px; }

.field-error {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--warn);
  padding-left: 2px;
  text-wrap: pretty;
}

/* ------------------------------------------------------------------ lists */

.list-cards { padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 8px; }

.card {
  min-height: 76px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}

.card:active { background: var(--surface-2); }
.card.stopped { background: var(--surface-dim); border-color: #1d222b; }
.card.stopped .card-name { color: var(--dim); }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(94, 224, 197, 0.13);
}

.dot.off { background: var(--faint); box-shadow: none; }

.card-text { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.card-name { font-size: 16px; font-weight: 500; }
.card-meta { font-family: var(--mono); font-size: 11.5px; color: var(--dim-2); }
.card.stopped .card-meta { color: var(--dim-3); }
.chev { width: 18px; height: 18px; color: #454c59; flex-shrink: 0; }
.card.stopped .chev { color: var(--faint); }

.list-rows { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 2px; }

.row {
  min-height: 56px;
  border-radius: 11px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  background: none;
  border: 0;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
}

.row:active { background: var(--surface); }
.row svg { width: 20px; height: 20px; flex-shrink: 0; }
.row .name { flex-grow: 1; min-width: 0; font-size: 15.5px; }
.row.file .name { font-family: var(--mono); font-size: 14px; }
.row .size { font-family: var(--mono); font-size: 11.5px; color: var(--dim-3); flex-shrink: 0; }
.row.dir svg { color: var(--accent); }
.row.file svg { color: #7c8494; }

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--dim-2);
  font-size: 14px;
  line-height: 1.6;
  text-wrap: pretty;
}

/* ---------------------------------------------------------------- crumbs */

.crumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--dim-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.crumbs::-webkit-scrollbar { display: none; }

.crumbs button {
  background: none;
  border: 0;
  font: inherit;
  color: #7c8494;
  padding: 0;
  white-space: nowrap;
  cursor: pointer;
}

.crumbs .sep { color: #39404d; }
.crumbs button:last-of-type { color: var(--accent); }

/* ------------------------------------------------------------------- code */

.code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.9;
  color: #b8c0cc;
  padding: 14px 16px calc(var(--safe-b) + 24px);
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
}

/* ----------------------------------------------------------------- sheets */

.scrim {
  position: fixed;
  inset: 0;
  background: #0b0d11;
  opacity: 0.66;
  z-index: 10;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  background: var(--surface);
  border-top: 1px solid var(--line-2);
  border-radius: 22px 22px 0 0;
  padding: 12px 20px calc(var(--safe-b) + 24px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.grabber {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: #2d3441;
  align-self: center;
}

.sheet-copy { display: flex; flex-direction: column; gap: 6px; }

.sheet-copy p {
  font-size: 13.5px;
  color: #7c8494;
  line-height: 1.5;
  text-wrap: pretty;
}

.sheet form { display: flex; flex-direction: column; gap: 20px; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions.column { flex-direction: column; }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--safe-b) + 20px);
  z-index: 20;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-2);
  text-align: center;
}

.toast.bad { border-color: var(--warn); color: var(--warn); }

@media (min-width: 620px) {
  .view { max-width: 560px; margin: 0 auto; border-left: 1px solid #171a21; border-right: 1px solid #171a21; }
  .sheet { max-width: 560px; margin: 0 auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .card, .row, .icon-btn { transition: background-color 120ms ease; }
}

/* --------------------------------------------------- project detail screen */

.sections { padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; }

.section-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim-3);
  padding-left: 4px;
}

.section-label.spaced { padding-top: 14px; }

.list-cards.flush { padding: 0; }

.card .folder { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
.card .size { font-family: var(--mono); font-size: 11.5px; color: var(--dim-3); flex-shrink: 0; }
.session-name { font-size: 14.5px; }
.session-title { font-family: var(--mono); font-size: 19px; font-weight: 500; }

.empty.tight { padding: 26px 16px; }

/* Action rows inside the session sheet. */
.act {
  min-height: 56px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.act svg { width: 19px; height: 19px; flex-shrink: 0; color: var(--accent); }
.act:active { background: var(--surface-2); }
.act:disabled { opacity: 0.5; cursor: default; }
.act-text { display: flex; flex-direction: column; gap: 2px; }
.act-sub { font-size: 12px; font-weight: 400; color: var(--dim-2); }

.act-warn { color: var(--warn); border-color: #3a2f22; }
.act-warn svg { color: var(--warn); }
.act-warn .act-sub { color: #7a6444; }

.act-plain { justify-content: center; color: var(--text-2); }
