:root {
  --void: #0A0D12;
  --panel: #10141C;
  --panel-2: #151B26;
  --panel-3: #1B2230;
  --line: rgba(255, 255, 255, 0.09);
  --text: #E9EEF6;
  --muted: #8993A6;
  --cyan: #56E8C6;
  --violet: #A78BFA;
  --amber: #F4B860;
  --danger: #F0708A;
  --radius: 14px;
  --font: "Segoe UI", system-ui, sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 800px 400px at 0% 0%, rgba(86, 232, 198, 0.07), transparent 55%),
    radial-gradient(ellipse 700px 400px at 100% 0%, rgba(167, 139, 250, 0.06), transparent 50%),
    var(--void);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}
.brand small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.04em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 4px;
  background: var(--void);
}

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 650;
}
.panel .hint {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 16px;
  line-height: 1.45;
}

.section-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 12px;
}

.btn {
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { border-color: rgba(86, 232, 198, 0.35); }
.btn.primary {
  background: linear-gradient(135deg, var(--cyan), #37C9A6);
  color: #052019;
  border-color: transparent;
}
.btn.ghost { background: transparent; }
.btn.danger {
  color: var(--danger);
  border-color: rgba(240, 112, 138, 0.35);
}
.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}
a.btn.disabled {
  opacity: 0.4;
  pointer-events: auto;
  cursor: not-allowed;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  padding: 11px 12px;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--cyan);
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.row .field { flex: 1; min-width: 160px; margin-bottom: 0; }

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.created { color: var(--muted); }
.badge.in_progress { color: var(--amber); border-color: rgba(244, 184, 96, 0.35); }
.badge.completed { color: var(--cyan); border-color: rgba(86, 232, 198, 0.35); }

.link-box {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}
.link-box input {
  flex: 1;
  min-width: 220px;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 11px 12px;
}

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 8px 0;
}

.interest-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--panel-3);
}
.interest-item h4 {
  margin: 0 0 6px;
  font-size: 15px;
}
.interest-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
}
.interest-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.catalog-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.catalog-box summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  user-select: none;
}
.catalog-box summary:hover { color: var(--cyan); }
.catalog-list {
  margin-top: 12px;
}
.catalog-item {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.catalog-item:last-child { border-bottom: none; }
.catalog-item .meta { flex: 1; min-width: 0; }
.catalog-item h5 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}
.catalog-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.folder-browser {
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
}
.library-details {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
}
.library-details > summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  user-select: none;
  list-style: none;
}
.library-details > summary::-webkit-details-marker { display: none; }
.library-details > summary::before {
  content: '▸ ';
  color: var(--cyan);
}
.library-details[open] > summary::before { content: '▾ '; }
.library-details > summary:hover { color: var(--cyan); }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 13px;
}
.crumb {
  background: none;
  border: none;
  color: var(--cyan);
  cursor: pointer;
  padding: 2px 4px;
  font: inherit;
}
.crumb:hover { text-decoration: underline; }
.crumb-sep { color: var(--muted); }

.folder-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.folder-entry:last-child { border-bottom: none; }
.folder-entry .main {
  flex: 1;
  min-width: 0;
}
.folder-entry .title {
  font-weight: 600;
  font-size: 14px;
}
.folder-entry .sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 3px;
  line-height: 1.4;
}
.folder-entry .icon {
  color: var(--amber);
  font-family: var(--mono);
  font-size: 12px;
  width: 18px;
  flex: none;
}
.folder-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 4px;
}

.danger-zone {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(240, 112, 138, 0.25);
}
.danger-zone .hint { color: var(--muted); }

.pre {
  background: #0c1018;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  max-height: 360px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-3);
  border: 1px solid var(--cyan);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
}
.error {
  color: var(--danger);
  font-size: 13.5px;
  margin: 0 0 12px;
}
.muted { color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

@media (max-width: 700px) {
  .table-wrap { overflow-x: auto; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
