@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;520;700&display=swap');

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  padding-top: 68px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #e0e0e0;
}

/* ── Toolbar ── */
.demo-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  background: #1a1a2e;
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.demo-toolbar a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #5fa6a6;
  font-size: 1.25rem;
}
.demo-toolbar a:hover { opacity: 0.8; }
.demo-toolbar .logo { height: 40px; width: auto; }
.demo-toolbar .brand-wf { font-weight: 520; }
.demo-toolbar .brand-js { font-weight: 700; }
.demo-toolbar .demo-info {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  text-align: right;
}
.demo-toolbar .demo-info strong { color: #fff; }

/* ── Layout: panels on top, explainer below ── */
.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 30px;
}
.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}
@media (max-width: 1000px) {
  .panels { grid-template-columns: 1fr; }
}

/* ── User panels ── */
.panel {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
  padding-bottom: 12px;
}
.panel-header {
  background: rgba(0,0,0,0.3);
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.panel-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #1a1a2e;
}
.avatar-ana { background: #4ecdc4; }
.avatar-ben { background: #e8b04e; }
.chip {
  margin-left: auto;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.12);
  color: #cfd8d8;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
}
.chip b { color: #4ecdc4; }
.chip + .chip { margin-left: 8px; }
.chip-sync {
  background: rgba(232, 176, 78, 0.15);
  border-color: rgba(232, 176, 78, 0.4);
  color: #e8b04e;
}
.panel table.emp-table { margin: 0 !important; }

/* ── Stars ── */
.star-toggle {
  cursor: pointer;
  font-size: 18px;
  color: rgba(255,255,255,0.35);
  transition: color 0.15s, transform 0.1s;
  user-select: none;
}
.star-toggle:hover { transform: scale(1.2); color: #e8b04e; }
.star-toggle.active { color: #e8b04e; }

/* ── DataTables dark theme ── */
.dataTables_wrapper { color: #e0e0e0; }
table.dataTable { border-collapse: collapse !important; }
table.dataTable thead th {
  background: rgba(0,0,0,0.4) !important;
  color: #fff !important;
  border-bottom: 2px solid #4ecdc4 !important;
  padding: 10px 15px !important;
}
table.dataTable tbody tr { background: rgba(255,255,255,0.02) !important; }
table.dataTable tbody tr:hover { background: rgba(78, 205, 196, 0.1) !important; }
table.dataTable tbody td {
  border-bottom: 1px solid rgba(255,255,255,0.05) !important;
  padding: 10px 15px !important;
  color: #e0e0e0 !important;
}
.dataTables_paginate .paginate_button,
div.dt-container .dt-paging .dt-paging-button {
  color: #888 !important;
  background: transparent !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
}
.dataTables_paginate .paginate_button.current,
div.dt-container .dt-paging .dt-paging-button.current {
  background: #4ecdc4 !important;
  color: #1a1a2e !important;
  border-color: #4ecdc4 !important;
}
.dataTables_paginate .paginate_button:hover,
div.dt-container .dt-paging .dt-paging-button:hover {
  background: rgba(78, 205, 196, 0.2) !important;
  color: #4ecdc4 !important;
}

/* ── Explainer ── */
.explainer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 30px;
}
@media (max-width: 1000px) {
  .explainer { grid-template-columns: 1fr; }
}
.explain-block {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 20px 24px;
}
.explain-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #4ecdc4;
}
.explain-block p {
  font-size: 14px;
  line-height: 1.65;
  color: rgba(255,255,255,0.75);
  margin: 0 0 10px;
}
.explain-block p:last-child { margin-bottom: 0; }
.explain-block em { color: #e8b04e; font-style: normal; }
.explain-block pre {
  margin: 0 0 12px;
  background: rgba(0,0,0,0.4);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,0.05);
}
.explain-block code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: #e0e0e0;
}
.explain-block p code {
  background: rgba(0,0,0,0.35);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.explain-block a.open-window { color: #4ecdc4; }
.explain-block a.open-window:hover { color: #7fe0d9; }

/* ── Table + journal split inside each panel ── */
.panel-split {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 14px;
  padding: 0 12px;
}
@media (max-width: 1250px) and (min-width: 1001px) {
  .panel-split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .panel-split { grid-template-columns: 1fr; }
}

/* ── Undo / redo ── */
.jbtn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #cfd8d8;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.jbtn:hover { border-color: #4ecdc4; color: #4ecdc4; }
.panel-header .jbtn { margin-left: 4px; }
.panel-header .sync-slot { margin-left: auto; }
.panel-header .chip { margin-left: 8px; }

/* ── The journal (this user's path through the shared table) ── */
.journal h4 {
  margin: 6px 0 8px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}
.journal ol {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12.5px;
  min-height: 3em;
}
.j-entry {
  padding: 5px 8px 5px 22px;
  border-left: 2px solid transparent;
  color: rgba(255,255,255,0.75);
  position: relative;
  border-radius: 4px;
}
.j-entry.j-current {
  border-left-color: #4ecdc4;
  background: rgba(78, 205, 196, 0.08);
  color: #fff;
}
.j-entry.j-current::before {
  content: '▶';
  position: absolute;
  left: 7px;
  font-size: 9px;
  top: 8px;
  color: #4ecdc4;
}
.j-entry.j-undone {
  color: rgba(255,255,255,0.35);
  text-decoration: line-through;
}
.j-entry.j-superseded { color: rgba(255,255,255,0.35); }
.j-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 10.5px;
  color: #e8b04e;
  text-decoration: none;
}

/* ── Inline rename editor ── */
.name-cell .nm { cursor: pointer; border-bottom: 1px dashed rgba(255,255,255,0.25); }
.name-cell .nm:hover { color: #4ecdc4; border-bottom-color: #4ecdc4; }
.name-cell .editor { display: inline-flex; gap: 4px; align-items: center; }
.name-cell input {
  background: rgba(0,0,0,0.4);
  border: 1px solid #4ecdc4;
  color: #fff;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 13px;
  width: 11em;
}
.name-cell .editor button {
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  color: #cfd8d8;
  cursor: pointer;
  font-size: 12px;
}
.name-cell .editor button.ok:hover { border-color: #4ecdc4; color: #4ecdc4; }
.name-cell .editor button.no:hover { border-color: #ff6b6b; color: #ff6b6b; }
