/* ============================================================
   Slip Studios - Admin Tools · stylesheet
   Neutral tool aesthetic: gray panels, amber accent, mono
   chrome, sharp corners. No fluff.
   ============================================================ */
:root {
  --bg: #111214;
  --panel: #17181a;
  --panel-2: #1e2023;
  --border: #2a2c30;
  --border-soft: #232528;
  --text: #e8e7e3;
  --muted: #94969a;
  --accent: #e2a33e;
  --accent-hover: #f0b552;
  --danger: #e5604f;
  --ok: #58b47c;
  --radius: 4px;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono:
    "Cascadia Mono", "Consolas", "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
}

/* ---------- Top bar ---------- */
#topbar {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}
.brand-logo {
  width: 27px;
  height: 27px;
  background: #fff;
  border-radius: 4px;
  padding: 2px;
  display: block;
}
.brand-name {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-left: 1px solid var(--border);
  padding-left: 10px;
  margin-left: 1px;
}

#tabs {
  display: flex;
  gap: 2px;
  margin-right: auto;
  height: 100%;
}
.tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 0 12px;
  cursor: pointer;
  transition: 0.12s;
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

#conn-status {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ok);
  white-space: nowrap;
}
#conn-status.off {
  color: var(--accent);
}

/* ---------- Layout ---------- */
#app-view {
  height: 100%;
}
#main {
  height: calc(100% - 52px);
}

.tab-panel {
  display: none;
  height: 100%;
  overflow: hidden;
}
.tab-panel.active {
  display: flex;
}
#tab-projects.active {
  display: block;
  overflow-y: auto;
  padding: 26px 32px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar > .btn {
  margin: 12px;
}
.side-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2px 14px 8px;
  border-bottom: 1px solid var(--border-soft);
  margin: 0 12px 8px;
}
.rowlist,
#lists-tree {
  overflow-y: auto;
  padding: 0 8px 16px;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  padding: 7px 12px;
  cursor: pointer;
  transition: 0.12s;
}
.btn:hover {
  border-color: var(--muted);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #14161a;
  font-weight: 700;
}
.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn.ghost {
  background: transparent;
}
.btn.danger {
  color: var(--danger);
  border-color: rgba(229, 96, 79, 0.35);
}
.btn.danger:hover {
  border-color: var(--danger);
}
.btn.full {
  width: 100%;
}

/* ---------- Generic list rows (notes) ---------- */
.note-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
}
.note-row:hover {
  background: var(--panel-2);
}
.note-row.active {
  background: var(--panel-2);
  border-color: var(--border);
  box-shadow: inset 2px 0 0 var(--accent);
}
.note-row .row-main {
  min-width: 0;
  flex: 1;
}
.row-title {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-preview {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.row-sub {
  color: var(--muted);
  font-size: 10px;
  margin-top: 3px;
  font-family: var(--mono);
}
.row-del {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  font-family: var(--mono);
  border-radius: 3px;
  width: auto;
  min-width: 20px;
  padding: 0 4px;
  line-height: 18px;
  visibility: hidden;
  flex: none;
}
.note-row:hover .row-del,
.tree-row:hover .row-del,
.item-row:hover .row-del,
.project-card:hover .row-del {
  visibility: visible;
}
.row-del:hover {
  color: var(--danger);
  background: rgba(229, 93, 79, 0.12);
}

.row-del.armed {
  visibility: visible !important;
  width: auto;
  padding: 2px 8px;
  font-size: 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  color: #fff;
  background: var(--danger);
  border-radius: 3px;
}

/* ---------- Notes editor ---------- */
.note-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}
.editor-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 6px;
}
.editor-empty p {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.editor-real {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.tb {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 3px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12.5px;
  min-width: 30px;
  transition: 0.12s;
}
.tb:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tb-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 5px;
}

#note-title {
  font: inherit;
  font-size: 21px;
  font-weight: 700;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  padding: 16px 22px 10px;
}
#note-title::placeholder {
  color: var(--muted);
  opacity: 0.55;
}

.note-body-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 22px 40px;
}
#note-body {
  max-width: 850px;
  margin: 0 auto;
  min-height: 60vh;
  background: #fdfdfc;
  color: #21232a;
  border-radius: 4px;
  padding: 40px 48px;
  outline: none;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
  font-size: 16px;
  line-height: 1.65;
}
#note-body:empty::before {
  content: "Start typing…";
  color: #9aa0aa;
  pointer-events: none;
}
#note-body h1,
#note-body h2,
#note-body h3 {
  line-height: 1.25;
  margin: 0.8em 0 0.4em;
}
#note-body h1 {
  font-size: 1.9em;
}
#note-body h2 {
  font-size: 1.5em;
}
#note-body h3 {
  font-size: 1.2em;
}
#note-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 0.6em 0;
  padding: 0.2em 1em;
  color: #4a4d58;
  background: #f4f3ef;
  border-radius: 0 4px 4px 0;
}
#note-body ul.checklist {
  list-style: none;
  padding-left: 4px;
}
#note-body ul.checklist label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#note-body ul.checklist input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
#note-body ul,
#note-body ol {
  padding-left: 1.6em;
}

.save-status {
  position: absolute;
  right: 18px;
  bottom: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 3px;
  pointer-events: none;
  transition: 0.2s;
}
.save-status.ok {
  color: var(--ok);
  border-color: rgba(88, 180, 124, 0.35);
}
.save-status.pending {
  color: var(--accent);
  border-color: rgba(226, 163, 62, 0.35);
}

/* ---------- Lists system ---------- */
.list-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 30px;
  min-width: 0;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 13.5px;
}
.tree-row:hover {
  background: var(--panel-2);
}
.tree-row.active {
  background: var(--panel-2);
  border-color: var(--border);
  box-shadow: inset 2px 0 0 var(--accent);
}
.tree-row .twist {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  width: 16px;
  height: 16px;
  line-height: 1;
  border-radius: 3px;
  flex: none;
  font-size: 9px;
}
.tree-row .twist:hover {
  color: var(--text);
}
.tree-row .name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-row .count {
  color: var(--muted);
  font-size: 10px;
  font-family: var(--mono);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  padding: 0 5px;
  flex: none;
}
.tree-row .row-actions {
  display: flex;
  gap: 2px;
  flex: none;
  visibility: hidden;
}
.tree-row:hover .row-actions {
  visibility: visible;
}
.tree-row .row-del {
  visibility: visible;
}
.depth-1 {
  padding-left: 26px;
}
.depth-2 {
  padding-left: 46px;
}

.tree-inline-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 4px 8px;
  outline: none;
}

.main-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.crumb {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.main-head h1 {
  margin: 0;
  font-size: 20px;
  font-family: var(--mono);
  letter-spacing: -0.01em;
}
.head-actions {
  display: flex;
  gap: 8px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: 0.12s;
}
.card:hover {
  border-color: var(--accent);
}
.card .card-title {
  font-weight: 600;
  margin-bottom: 3px;
  font-size: 13.5px;
}
.card .card-sub {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}

.progress {
  height: 4px;
  background: var(--panel-2);
  border-radius: 1px;
  overflow: hidden;
  margin: 4px 0 6px;
  max-width: 480px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: 0.3s;
}
.progress-label {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 16px;
  font-family: var(--mono);
  letter-spacing: 0.03em;
}

.item-add {
  margin: 0 0 12px;
  max-width: 640px;
}
#item-new,
.field input,
.field textarea,
.field select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
  outline: none;
}
#item-new:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
}

.items {
  max-width: 720px;
}
.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--panel);
  margin-bottom: 6px;
}
.item-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex: none;
}
.item-text {
  flex: 1;
  min-width: 0;
  outline: none;
  border-radius: 3px;
  padding: 2px 6px;
  word-break: break-word;
}
.item-text:focus {
  background: var(--panel-2);
  box-shadow: 0 0 0 1px var(--accent);
}
.item-row.done .item-text {
  color: var(--muted);
  text-decoration: line-through;
}
.empty-hint {
  color: var(--muted);
  padding: 16px 4px;
  font-size: 13px;
}

/* ---------- Projects ---------- */
.projects-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title {
  margin: 0;
  font-size: 22px;
  font-family: var(--mono);
  letter-spacing: -0.01em;
}
.page-sub {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding-bottom: 40px;
}
.project-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: 0.12s;
}
.project-card:hover {
  border-color: var(--accent);
}
.pc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.pc-name {
  font-weight: 700;
  font-size: 15px;
}
.pc-desc {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pc-due {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--mono);
  letter-spacing: 0.03em;
}
.pc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}
.pc-updated {
  color: var(--muted);
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.pc-actions {
  display: flex;
  gap: 4px;
}

.badge {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  flex: none;
  border: 1px solid;
  background: transparent;
}
.st-planning {
  color: #7aa7e8;
  border-color: rgba(122, 167, 232, 0.45);
}
.st-dev {
  color: var(--accent);
  border-color: rgba(226, 163, 62, 0.5);
}
.st-released {
  color: var(--ok);
  border-color: rgba(88, 180, 124, 0.5);
}
.st-hold {
  color: var(--muted);
  border-color: var(--border);
}
.st-cancelled {
  color: var(--danger);
  border-color: rgba(229, 96, 79, 0.5);
}
.st-archived {
  color: #8a8d93;
  border-color: var(--border);
}

/* ---------- Modal ---------- */
dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px;
  width: min(440px, 92vw);
}
dialog::backdrop {
  background: rgba(8, 9, 10, 0.7);
}
dialog h2 {
  margin: 0 0 18px;
  font-size: 15px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field {
  display: block;
  margin-bottom: 13px;
}
.field span {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.field em {
  font-style: normal;
  opacity: 0.6;
}
.field textarea {
  resize: vertical;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ---------- Auth: boot splash + login ---------- */
#boot-view,
#login-view {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.boot-text {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3em;
}
.login-card {
  width: min(340px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 26px 26px 22px;
}
.login-logo {
  display: block;
  margin: 0 auto;
  width: 52px;
  height: 52px;
  background: #fff;
  border-radius: 6px;
  padding: 3px;
}
.login-title {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  margin: 14px 0 2px;
}
.login-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 22px;
}
#login-form .field {
  margin-bottom: 12px;
}
.login-error {
  color: var(--danger);
  font-size: 12.5px;
  margin: 2px 0 10px;
}
#login-form .btn.full {
  width: 100%;
  margin-top: 4px;
}
.login-note {
  margin: 16px 0 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

#user-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
#user-email {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3a3d43;
}

/* ---------- Narrow screens ---------- */
@media (max-width: 760px) {
  .sidebar {
    width: 220px;
    min-width: 220px;
  }
  #note-body {
    padding: 24px;
  }
}
