/* ─── LucidLink Lab Design Tokens — Sand Edition ──────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ll-lab-bg:              #F0EFE9;
  --ll-lab-surface:         #ffffff;
  --ll-lab-surface-subtle:  #F0EFE9;

  --ll-lab-border:          #D8D0C0;
  --ll-lab-border-strong:   #C4B9A1;

  --ll-lab-text:            #191610;
  --ll-lab-text-muted:      #64583F;
  --ll-lab-text-subtle:     #917E5A;

  --ll-lab-accent:          #5E53E0;
  --ll-lab-accent-hover:    #4A40C8;
  --ll-lab-accent-subtle:   #E3E0FF;
  --ll-lab-accent-text:     #ffffff;

  --ll-lab-success:         #16a34a;
  --ll-lab-success-subtle:  #dcfce7;
  --ll-lab-warning:         #b45309;
  --ll-lab-warning-subtle:  #fef3c7;
  --ll-lab-danger:          #dc2626;
  --ll-lab-danger-subtle:   #fee2e2;
  --ll-lab-neutral-subtle:  #F0EFE9;

  --ll-lab-font:            'Inter', system-ui, -apple-system, sans-serif;
  --ll-lab-font-mono:       ui-monospace, 'Cascadia Code', 'Fira Code', monospace;

  --ll-lab-text-xs:   11px;  --ll-lab-text-sm:   13px;  --ll-lab-text-base: 15px;
  --ll-lab-text-lg:   17px;  --ll-lab-text-xl:   20px;  --ll-lab-text-2xl:  24px;
  --ll-lab-text-3xl:  30px;

  --ll-lab-space-1: 4px;   --ll-lab-space-2: 8px;   --ll-lab-space-3: 12px;
  --ll-lab-space-4: 16px;  --ll-lab-space-5: 20px;  --ll-lab-space-6: 24px;
  --ll-lab-space-8: 32px;  --ll-lab-space-10: 40px; --ll-lab-space-12: 48px;

  --ll-lab-radius-sm:   6px;  --ll-lab-radius-md:   10px;
  --ll-lab-radius-lg:   14px; --ll-lab-radius-full: 9999px;

  --ll-lab-transition: 150ms ease;
}

/* data-theme="lab" (default) uses the tokens above as-is. The disclaimer
   banner's own colors are hardcoded per the Lab spec and never change with
   the theme toggle below. */

:root[data-theme="light"] {
  --ll-lab-bg:              #F7F7F8;
  --ll-lab-surface:         #ffffff;
  --ll-lab-surface-subtle:  #F1F2F4;

  --ll-lab-border:          #E2E4E8;
  --ll-lab-border-strong:   #CBD0D8;

  --ll-lab-text:            #16181D;
  --ll-lab-text-muted:      #5B6270;
  --ll-lab-text-subtle:     #8B92A0;

  --ll-lab-success-subtle:  #E7F8EE;
  --ll-lab-warning-subtle:  #FDF1DD;
  --ll-lab-danger-subtle:   #FBE7E7;
  --ll-lab-neutral-subtle:  #F1F2F4;
}

:root[data-theme="dark"] {
  --ll-lab-bg:              #16151b;
  --ll-lab-surface:         #1e1d25;
  --ll-lab-surface-subtle:  #26252e;

  --ll-lab-border:          #34333d;
  --ll-lab-border-strong:   #47454f;

  --ll-lab-text:            #ECEAF0;
  --ll-lab-text-muted:      #A9A6B4;
  --ll-lab-text-subtle:     #7C7986;

  --ll-lab-accent:          #7C72F2;
  --ll-lab-accent-hover:    #948BF5;
  --ll-lab-accent-subtle:   #2E2A52;
  --ll-lab-accent-text:     #ffffff;

  --ll-lab-success:         #4ADE80;
  --ll-lab-success-subtle:  #16301F;
  --ll-lab-warning:         #FBBF24;
  --ll-lab-warning-subtle:  #3A2A0A;
  --ll-lab-danger:          #F87171;
  --ll-lab-danger-subtle:   #3A1518;
  --ll-lab-neutral-subtle:  #26252e;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ll-lab-font);
  background: var(--ll-lab-bg);
  color: var(--ll-lab-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- disclaimer banner ---- */
.ll-lab-disclaimer {
  position: sticky; top: 0; z-index: 100; width: 100%; height: 24px;
  display: flex; align-items: center; justify-content: center;
  gap: 12px; flex-shrink: 0;
  background: #b0fb16;
  border-bottom: 1px solid #ffffff;
}
.ll-lab-disclaimer-tape { flex-shrink: 0; height: 8px; line-height: 0; }
.ll-lab-disclaimer-center { display: flex; align-items: center; gap: 6px; }
.ll-lab-disclaimer-text {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px; line-height: 1; color: #000000; white-space: nowrap; margin: 0;
}
.ll-lab-disclaimer-text strong { font-weight: 700; }
.ll-lab-disclaimer-text span   { font-weight: 500; }

/* ---- header ---- */
.ll-lab-header {
  display: flex; align-items: center; gap: var(--ll-lab-space-3);
  padding: 0 var(--ll-lab-space-6); height: 56px;
  background: var(--ll-lab-surface);
  border-bottom: 1px solid var(--ll-lab-border);
  flex-shrink: 0;
  position: sticky; top: 24px; z-index: 90;
}
.ll-lab-app-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ll-lab-header-name {
  font-family: var(--ll-lab-font);
  font-size: var(--ll-lab-text-base); font-weight: 600;
  color: var(--ll-lab-text); flex: 1;
}

/* Light/Dark are plain viewing themes, not the branded Lab skin - the
   disclaimer banner only shows for the "Lab" theme. The header then sticks
   to the very top instead of leaving room for the (now absent) banner. */
:root[data-theme="light"] .ll-lab-disclaimer,
:root[data-theme="dark"] .ll-lab-disclaimer {
  display: none;
}
:root[data-theme="light"] .ll-lab-header,
:root[data-theme="dark"] .ll-lab-header {
  top: 0;
}

main#app { flex: 1; display: flex; flex-direction: column; }
.ll-view { display: none; flex: 1; flex-direction: column; }
.ll-view.is-active { display: flex; }

/* ---- shared components ---- */
.ll-center-col {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--ll-lab-space-5);
  padding: var(--ll-lab-space-8) var(--ll-lab-space-6);
}
.ll-card {
  background: var(--ll-lab-surface);
  border: 1px solid var(--ll-lab-border);
  border-radius: var(--ll-lab-radius-lg);
  padding: var(--ll-lab-space-6);
}
.ll-card-wide { width: 100%; max-width: 480px; }

.ll-h1 { font-size: var(--ll-lab-text-2xl); font-weight: 700; margin: 0 0 var(--ll-lab-space-2); }
.ll-sub { font-size: var(--ll-lab-text-sm); color: var(--ll-lab-text-muted); margin: 0 0 var(--ll-lab-space-5); line-height: 1.5; }
.ll-inline-code {
  font-family: var(--ll-lab-font-mono); background: var(--ll-lab-surface-subtle);
  border: 1px solid var(--ll-lab-border); border-radius: 4px; padding: 1px 5px; font-size: 12px;
}

.ll-form { display: flex; flex-direction: column; gap: var(--ll-lab-space-2); }
.ll-label { font-size: var(--ll-lab-text-sm); font-weight: 600; color: var(--ll-lab-text); margin-top: var(--ll-lab-space-2); }
.ll-input {
  width: 100%; font-family: var(--ll-lab-font); font-size: var(--ll-lab-text-base);
  border: 1px solid var(--ll-lab-border); border-radius: 6px; padding: 7px 12px;
  background: var(--ll-lab-surface); color: var(--ll-lab-text);
  transition: border-color var(--ll-lab-transition), box-shadow var(--ll-lab-transition);
}
.ll-input::placeholder { color: var(--ll-lab-text-subtle); }
.ll-input:focus {
  outline: none; border-color: var(--ll-lab-accent);
  box-shadow: 0 0 0 3px rgba(94, 83, 224, 0.12);
}
.ll-input-sm { padding: 5px 10px; font-size: var(--ll-lab-text-sm); width: 220px; }
.ll-hint { font-size: var(--ll-lab-text-xs); color: var(--ll-lab-text-subtle); margin: 2px 0 0; }
.ll-error {
  font-size: var(--ll-lab-text-sm); color: var(--ll-lab-danger);
  background: var(--ll-lab-danger-subtle); border-radius: 6px; padding: 8px 12px; margin: var(--ll-lab-space-2) 0 0;
}
.ll-form-actions { display: flex; gap: var(--ll-lab-space-2); margin-top: var(--ll-lab-space-4); }

.ll-note {
  width: 100%; max-width: 480px; font-size: var(--ll-lab-text-xs); color: var(--ll-lab-text-muted);
  line-height: 1.5; padding: 0 var(--ll-lab-space-2);
}

.ll-btn {
  font-family: var(--ll-lab-font); font-size: var(--ll-lab-text-sm); font-weight: 600;
  border-radius: 6px; padding: 7px 16px; border: 1px solid transparent; cursor: pointer;
  transition: background var(--ll-lab-transition), border-color var(--ll-lab-transition), color var(--ll-lab-transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.ll-btn-primary { background: var(--ll-lab-accent); color: #fff; }
.ll-btn-primary:hover { background: var(--ll-lab-accent-hover); }
.ll-btn-secondary { background: var(--ll-lab-surface); border-color: var(--ll-lab-border-strong); color: var(--ll-lab-text); }
.ll-btn-secondary:hover { border-color: var(--ll-lab-accent); color: var(--ll-lab-accent); }
.ll-btn-ghost { background: transparent; color: var(--ll-lab-text-muted); }
.ll-btn-ghost:hover { background: var(--ll-lab-surface-subtle); }
.ll-btn-sm { padding: 5px 12px; font-size: var(--ll-lab-text-xs); }
.ll-btn-icon { padding: 6px; }
.ll-btn:disabled { opacity: 0.5; cursor: default; }

.ll-status {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--ll-lab-text-xs);
  font-weight: 600; padding: 4px 10px; border-radius: var(--ll-lab-radius-full);
  background: var(--ll-lab-neutral-subtle); color: var(--ll-lab-text-muted); margin-left: auto;
}
.ll-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ll-lab-text-subtle); }
.ll-status-success { background: var(--ll-lab-success-subtle); color: var(--ll-lab-success); }
.ll-status-success .ll-status-dot { background: var(--ll-lab-success); }
.ll-status-danger { background: var(--ll-lab-danger-subtle); color: var(--ll-lab-danger); }
.ll-status-danger .ll-status-dot { background: var(--ll-lab-danger); }

.ll-code {
  font-family: var(--ll-lab-font-mono); background: var(--ll-lab-surface-subtle);
  border: 1px solid var(--ll-lab-border); border-radius: 6px; padding: var(--ll-lab-space-3);
  font-size: 12px; line-height: 1.6; overflow: auto;
}

/* ---- filespace list ---- */
.ll-fs-list { display: flex; flex-direction: column; gap: var(--ll-lab-space-2); margin-bottom: var(--ll-lab-space-2); }
.ll-fs-item {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  border: 1px solid var(--ll-lab-border); border-radius: var(--ll-lab-radius-md);
  padding: 10px 14px; background: var(--ll-lab-surface); cursor: pointer; font-family: var(--ll-lab-font);
  font-size: var(--ll-lab-text-sm); color: var(--ll-lab-text); text-align: left;
}
.ll-fs-item:hover { border-color: var(--ll-lab-accent); background: var(--ll-lab-accent-subtle); }
.ll-fs-item-id { font-family: var(--ll-lab-font-mono); font-size: 11px; color: var(--ll-lab-text-subtle); }

/* ---- events toolbar ---- */
.ll-events-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--ll-lab-space-4);
  padding: var(--ll-lab-space-4) var(--ll-lab-space-6);
  border-bottom: 1px solid var(--ll-lab-border);
  background: var(--ll-lab-surface);
}
.ll-toolbar-left, .ll-toolbar-right { display: flex; align-items: center; gap: var(--ll-lab-space-3); }
.ll-fs-badge {
  font-family: var(--ll-lab-font-mono); font-size: 12px; font-weight: 600;
  background: var(--ll-lab-accent-subtle); color: var(--ll-lab-accent-hover);
  padding: 5px 10px; border-radius: var(--ll-lab-radius-full);
}

.ll-segmented { display: inline-flex; border: 1px solid var(--ll-lab-border); border-radius: var(--ll-lab-radius-full); padding: 2px; background: var(--ll-lab-surface-subtle); }
.ll-segmented-btn {
  font-family: var(--ll-lab-font); font-size: var(--ll-lab-text-xs); font-weight: 600;
  border: none; background: transparent; color: var(--ll-lab-text-muted);
  padding: 5px 14px; border-radius: var(--ll-lab-radius-full); cursor: pointer;
}
.ll-segmented-btn.is-active { background: var(--ll-lab-surface); color: var(--ll-lab-accent); box-shadow: 0 0 0 1px var(--ll-lab-border); }

.ll-filter-chips { display: flex; gap: var(--ll-lab-space-2); padding: var(--ll-lab-space-3) var(--ll-lab-space-6); flex-wrap: wrap; background: var(--ll-lab-surface); border-bottom: 1px solid var(--ll-lab-border); }
.ll-chip {
  font-family: var(--ll-lab-font); font-size: 12px; font-weight: 600; cursor: pointer;
  padding: 4px 12px; border-radius: var(--ll-lab-radius-full); border: 1px solid var(--ll-lab-border);
  background: var(--ll-lab-surface); color: var(--ll-lab-text-muted); display: inline-flex; align-items: center; gap: 5px;
  user-select: none;
}
.ll-chip .ll-chip-dot { width: 7px; height: 7px; border-radius: 50%; }
.ll-chip.is-active { border-color: transparent; color: #fff; }

/* ---- events table ---- */
.ll-events-wrap { flex: 1; overflow: auto; padding: var(--ll-lab-space-4) var(--ll-lab-space-6); }
.ll-table { width: 100%; border-collapse: collapse; background: var(--ll-lab-surface); border: 1px solid var(--ll-lab-border); border-radius: var(--ll-lab-radius-md); overflow: hidden; }
.ll-table thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--ll-lab-text-subtle); font-weight: 600; padding: 10px 14px;
  border-bottom: 1px solid var(--ll-lab-border); background: var(--ll-lab-surface-subtle);
}
.ll-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--ll-lab-border); font-size: var(--ll-lab-text-sm); vertical-align: top; }
.ll-table tbody tr:last-child td { border-bottom: none; }
.ll-table tbody tr:hover { background: var(--ll-lab-surface-subtle); }
.ll-table tbody tr.is-new { animation: ll-flash 1.4s ease; }
@keyframes ll-flash { from { background: var(--ll-lab-accent-subtle); } to { background: transparent; } }

.ll-col-time { width: 150px; }
.ll-col-type { width: 150px; }
.ll-col-actor { width: 220px; }
.ll-col-size { width: 90px; text-align: right; }
.ll-col-expand { width: 36px; }

.ll-time-abs { color: var(--ll-lab-text-subtle); font-size: 11px; display: block; }
.ll-path-main { font-family: var(--ll-lab-font-mono); font-size: 12.5px; word-break: break-all; }
.ll-path-prev { font-family: var(--ll-lab-font-mono); font-size: 11px; color: var(--ll-lab-text-subtle); word-break: break-all; }
.ll-path-arrow { color: var(--ll-lab-text-subtle); margin: 0 4px; }
.ll-encrypted-note { font-size: 10px; color: var(--ll-lab-warning); background: var(--ll-lab-warning-subtle); border-radius: 4px; padding: 1px 5px; display: inline-block; margin-top: 3px; }

.ll-type-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: var(--ll-lab-radius-full);
}
.ll-type-created  { background: var(--ll-lab-success-subtle); color: var(--ll-lab-success); }
.ll-type-modified { background: var(--ll-lab-accent-subtle); color: var(--ll-lab-accent-hover); }
.ll-type-deleted  { background: var(--ll-lab-danger-subtle); color: var(--ll-lab-danger); }
.ll-type-moved    { background: var(--ll-lab-warning-subtle); color: var(--ll-lab-warning); }
.ll-type-linked, .ll-type-unlinked { background: var(--ll-lab-neutral-subtle); color: var(--ll-lab-text-muted); }

.ll-expand-btn { background: none; border: none; cursor: pointer; color: var(--ll-lab-text-subtle); padding: 2px; }
.ll-expand-btn:hover { color: var(--ll-lab-accent); }

.ll-load-more-row { display: flex; justify-content: center; padding: var(--ll-lab-space-5) 0; }
.ll-live-indicator { font-size: var(--ll-lab-text-sm); color: var(--ll-lab-text-muted); display: inline-flex; align-items: center; gap: 7px; }
.ll-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ll-lab-success); animation: ll-pulse 1.6s infinite; }
@keyframes ll-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.ll-banner { border-radius: var(--ll-lab-radius-md); padding: var(--ll-lab-space-3) var(--ll-lab-space-4); font-size: var(--ll-lab-text-sm); margin-bottom: var(--ll-lab-space-3); }
.ll-banner-danger { background: var(--ll-lab-danger-subtle); color: var(--ll-lab-danger); }
.ll-empty { text-align: center; color: var(--ll-lab-text-subtle); padding: var(--ll-lab-space-10) 0; font-size: var(--ll-lab-text-sm); }

/* ---- about page ---- */
.ll-about-wrap { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; }
.ll-about-topbar { width: 100%; max-width: 720px; padding: var(--ll-lab-space-4) var(--ll-lab-space-6) 0; }
.ll-about-col { width: 100%; max-width: 720px; padding: var(--ll-lab-space-4) var(--ll-lab-space-6) var(--ll-lab-space-12); }
.ll-h2 { font-size: var(--ll-lab-text-lg); font-weight: 700; margin: var(--ll-lab-space-8) 0 var(--ll-lab-space-3); }
.ll-about-p { font-size: var(--ll-lab-text-base); line-height: 1.65; color: var(--ll-lab-text); margin: 0 0 var(--ll-lab-space-3); }
.ll-about-list { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: var(--ll-lab-space-2); font-size: var(--ll-lab-text-sm); line-height: 1.6; color: var(--ll-lab-text); }
.ll-about-footnote { font-size: var(--ll-lab-text-xs); color: var(--ll-lab-text-subtle); border-top: 1px solid var(--ll-lab-border); margin-top: var(--ll-lab-space-8); padding-top: var(--ll-lab-space-4); line-height: 1.5; }
.ll-about-code { margin: 0 0 var(--ll-lab-space-3); white-space: pre; }

.ll-usecase-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--ll-lab-space-3); }
.ll-usecase-card { background: var(--ll-lab-surface); border: 1px solid var(--ll-lab-border); border-radius: var(--ll-lab-radius-md); padding: var(--ll-lab-space-4); }
.ll-usecase-title { font-size: var(--ll-lab-text-sm); font-weight: 700; color: var(--ll-lab-accent-hover); margin-bottom: var(--ll-lab-space-1); }
.ll-usecase-card p { margin: 0; font-size: var(--ll-lab-text-sm); line-height: 1.55; color: var(--ll-lab-text-muted); }

@media (max-width: 640px) {
  .ll-usecase-grid { grid-template-columns: 1fr; }
}

/* ---- drawer ---- */
.ll-drawer { position: fixed; inset: 0; z-index: 200; display: flex; justify-content: flex-end; }
.ll-drawer-backdrop { position: absolute; inset: 0; background: rgba(25, 22, 16, 0.35); }
.ll-drawer-panel { position: relative; width: min(420px, 92vw); height: 100%; background: var(--ll-lab-surface); border-left: 1px solid var(--ll-lab-border); display: flex; flex-direction: column; }
.ll-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: var(--ll-lab-space-4) var(--ll-lab-space-5); border-bottom: 1px solid var(--ll-lab-border); font-weight: 600; }
.ll-drawer-code { margin: var(--ll-lab-space-4) var(--ll-lab-space-5); flex: 1; white-space: pre-wrap; }
