/* ==============================
   TraceNode Lite – Design System
   Part 1: Layout & Navigation
   ============================== */

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* ── Design Tokens ── */
:root {
  --sidebar-w: 200px;
  --topbar-h: 52px;

  --navy: #0D1B3E;
  --navy-hover: #192b54;
  --electric: #2563EB;
  --electric-hover: #1d4ed8;

  --bg-page: #F8FAFC;
  --bg-white: #ffffff;
  --clr-heading: #0D1B3E;
  --clr-body: #334155;
  --clr-muted: #64748b;
  --clr-slate: #94a3b8;
  --clr-border: #e2e8f0;

  --ff: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ff-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
}

/* ── Base ── */
html, body {
  font-family: var(--ff);
  background: var(--bg-page);
  color: var(--clr-body);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
img { max-width: 100%; }

/* ── Form element reset (replaces Pico defaults) ── */
select, input[type="text"], input[type="email"], input[type="number"], textarea {
  padding: 7px 10px;
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  background: var(--bg-white);
  color: var(--clr-body);
  line-height: 1.4;
}
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--electric);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
table { border-collapse: collapse; width: 100%; }

/* ── Loading spinner (replaces Pico aria-busy) ── */
[aria-busy="true"] { display: inline-flex; align-items: center; gap: 8px; }
[aria-busy="true"]::before {
  content: '';
  width: 16px; height: 16px;
  border: 2px solid var(--clr-border);
  border-top-color: var(--electric);
  border-radius: 50%;
  animation: tn-spin 0.6s linear infinite;
}
@keyframes tn-spin { to { transform: rotate(360deg); } }


/* ════════════════════════════════
   APP LAYOUT
   ════════════════════════════════ */
.app-layout { display: flex; min-height: 100vh; }


/* ── Sidebar ── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-mark {
  width: 28px; height: 28px;
  background: var(--electric);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 600; font-size: 14px;
  color: #fff; letter-spacing: -0.2px;
}

/* ── Sidebar Nav ── */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.s-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #8896ab;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}
.s-nav-item:hover {
  background: var(--navy-hover);
  color: #c8d1dc;
}
.s-nav-item.active {
  background: var(--electric);
  color: #fff;
}
.s-nav-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
}

.s-nav-badge {
  margin-left: auto;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  line-height: 1.5;
}

/* ── Sidebar Footer ── */
.sidebar-bottom {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.op-id-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: #8896ab;
  font-family: var(--ff-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.op-id-pill .dot {
  width: 6px; height: 6px;
  background: #10b981;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Switch Operator link ── */
.switch-op-link {
  display: block;
  text-align: center;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-decoration: none;
  margin-top: 6px;
  padding: 3px 0;
  transition: color 0.15s;
}
.switch-op-link:hover { color: rgba(255,255,255,0.65); }

/* ── Operator Entry Screen ── */
.op-entry-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--topbar-h, 56px));
  padding: 2rem;
}

.op-entry-card {
  background: #ffffff;
  border: 0.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 40px 44px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(13,27,62,0.07);
}

.op-entry-card .entry-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  font-size: 15px;
  font-weight: 700;
  color: #0D1B3E;
}

.op-entry-card .entry-logo .brand-mark {
  width: 28px; height: 28px;
  background: #0D1B3E;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}

.op-entry-card h2 {
  font-size: 17px;
  font-weight: 700;
  color: #0D1B3E;
  margin-bottom: 8px;
}

.op-entry-card .entry-sub {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 24px;
  line-height: 1.5;
}

.op-entry-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.op-entry-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #0D1B3E;
  font-family: var(--ff-mono);
  transition: border-color 0.12s, box-shadow 0.12s;
  background: #f8fafc;
}

.op-entry-row input:focus {
  outline: none;
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: #fff;
}

.op-entry-row button {
  padding: 10px 18px;
  background: #0D1B3E;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}

.op-entry-row button:hover { background: #1e3a7e; }

.op-entry-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.op-entry-hint a {
  color: #2563EB;
  text-decoration: none;
}

.op-entry-hint a:hover { text-decoration: underline; }

/* ── Main Area ── */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}


/* ── Top Bar ── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-white);
  border-bottom: 0.5px solid var(--clr-border);
  flex-shrink: 0;
}

.page-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--clr-heading);
  margin: 0; padding: 0;
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tb-timestamp {
  font-size: 11px;
  color: var(--clr-muted);
  font-family: var(--ff-mono);
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--clr-muted);
  background: var(--bg-white);
  transition: all 0.12s;
  cursor: pointer;
}
.tb-btn:hover {
  border-color: #cbd5e1;
  color: var(--clr-heading);
}

.tb-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 14px;
  background: var(--electric);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.tb-btn-primary:hover {
  background: var(--electric-hover);
}


/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 24px;
}


/* ── Mobile Responsive ── */
/* ── SHA-3 Verified Badge ── */
.sha3-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #16a34a;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.4;
}
.sha3-badge .sha3-check {
  font-size: 11px;
  line-height: 1;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-area {
    margin-left: 0;
  }
  .top-bar {
    padding: 0 16px;
  }
  .page-content {
    padding: 16px;
  }
  .tb-btn-primary span.tb-label { display: none; }
}
