:root {
  --bg:          #0d0d14;
  --surface:     #16161f;
  --surface2:    #1e1e2e;
  --border:      #2a2a3d;
  --text:        #cdd6f4;
  --text-dim:    #9399b2;
  --accent:      #89b4fa;
  --green:       #a6e3a1;
  --yellow:      #f9e2af;
  --red:         #f38ba8;
  --ice9-cyan:   #00cccc;
  --ice9-purple: #8b5cf6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  overflow-y: scroll;
  display: flex;
  flex-direction: column;
}

/* ── App body layout ── */
#app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  #app-body {
    display: grid;
    grid-template-columns: 240px 1fr;
    align-items: start;
}
  #nav-col {
    align-self: stretch;
    background: var(--surface);
    border-right: 1px solid var(--border);
  }
}

@media (max-width: 767px) {
  #nav-col { display: contents; }
}

/* ── Header ── */
header {
  padding: 1.5rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
header img.logo { height: 48px; width: auto; display: block; }

/* ── Hamburger ── */
#menu-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
#menu-btn:hover { color: var(--text); background: var(--surface2); }

/* ── Nav sidebar / drawer ── */
#nav-drawer {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease;
}

#nav-drawer-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#sidebar-logo img { height: 48px; width: auto; display: block; }

#nav-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
}
#nav-close:hover { color: var(--text); background: var(--surface2); }

/* ── Desktop: sticky left column ── */
@media (min-width: 768px) {
  header { display: none; }
  #nav-drawer {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: none;
    border-right: none;
  }
  #nav-close { display: none; }
  #menu-btn { display: none; }
  #nav-overlay { display: none !important; }
}

/* ── Mobile: slide-in drawer from right ── */
@media (max-width: 767px) {
  #nav-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    left: auto;
    z-index: 200;
    border-right: none;
    border-left: 1px solid var(--border);
    transform: translateX(100%);
  }
  #nav-drawer.open { transform: translateX(0); }
  #sidebar-logo { display: none; }
  #nav-close { display: flex; align-items: center; margin-left: auto; }
  #header-logo { display: block; }
  #menu-btn { display: flex; }
}

#nav-links {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.nav-link:hover {
  background: var(--surface2);
  border-left-color: var(--accent);
  color: var(--accent);
}
.nav-link svg { flex-shrink: 0; opacity: 0.7; }
.nav-link:hover svg { opacity: 1; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 16px; }

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

#nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
}
#nav-overlay.open { display: block; }

/* ── Footer ── */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  transition: color 0.12s;
}

.footer-links a:hover { color: var(--text); }

.footer-copy {
  color: var(--text-dim);
  font-size: 12px;
}
