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

html { font-size: 15px; }

body {
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: none;
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 27, 31, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 27, 31, 0.025) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 88%);
}

a { text-decoration: none; color: inherit; }
input, select, button, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(112, 137, 167, 0.28); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(112, 137, 167, 0.45); }

.app {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  background-color: #fbfcfe;
  color: var(--sidebar-foreground);
  border-right: 1px solid var(--sidebar-bdr);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  position: relative;
}

.sidebar::before {
  content: none;
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 28%),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.02) 100%);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 18px;
  border-bottom: 1px solid var(--sidebar-bdr);
  position: relative;
  z-index: 1;
}

.sidebar-logo svg,
.login-logo svg {
  transition: transform .28s ease, filter .28s ease;
}

.sidebar-logo:hover svg,
.login-logo:hover svg {
  transform: translateY(-1px);
  filter: drop-shadow(0 8px 14px rgba(31, 94, 168, 0.12));
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.logo-name {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.01em;
}

.logo-sub {
  font-size: .63rem;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: .16em;
  margin-top: 4px;
}

.nav {
  flex: 1;
  padding: 16px 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--sidebar-txt);
  font-size: .88rem;
  font-weight: 700;
  transition: .18s ease;
  user-select: none;
}

.nav-item svg {
  opacity: .72;
  flex-shrink: 0;
}

.nav-item:hover {
  color: var(--sidebar-foreground);
  background: var(--sidebar-hover);
}

.nav-item.active {
  color: var(--sidebar-txt-a);
  background: var(--sidebar-act);
  box-shadow: inset 3px 0 0 var(--sidebar-primary), inset 0 0 0 1px rgba(31, 94, 168, 0.10);
}

.nav-item.active svg { opacity: 1; }

.nav-item-external {
  margin-top: 6px;
  color: var(--blue);
  background: var(--blue-dim);
  border: 1px solid var(--blue-bdr);
}

.nav-item-external:hover {
  color: var(--blue);
  background: #ffffff;
  border-color: var(--blue-bdr);
}

.sidebar-entry {
  padding: 10px 4px 12px;
  position: relative;
  z-index: 1;
}

.btn-new-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius);
  font-size: .86rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  transition: background .18s ease, box-shadow .18s ease;
}

.btn-new-entry:hover {
  background: var(--accent-h);
  box-shadow: var(--shadow-md);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px 8px;
  border-top: 1px solid var(--sidebar-bdr);
  font-size: .72rem;
  color: var(--sidebar-muted);
  line-height: 1.8;
  position: relative;
  z-index: 1;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--topbar-bdr);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.topbar-right,
.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-yomu-link {
  white-space: nowrap;
}

.topbar-yomu-link svg {
  flex-shrink: 0;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #f5f9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .05em;
  box-shadow: var(--shadow-sm);
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-size: .9rem;
  font-weight: 800;
}

.user-role {
  font-size: .72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .09em;
}

.main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 38px;
}

.main > .page {
  max-width: 1440px;
  margin: 0 auto;
}

.page { display: none; }
.page.active { display: block; animation: fadeUp .24s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-header h1 {
  font-size: 1.52rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.page-header p {
  margin-top: 6px;
  font-size: .87rem;
  color: var(--text-3);
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--bg-hover);
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--foreground);
  border-radius: 999px;
  transition: all .2s ease;
}

.hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 22, 30, 0.32);
  backdrop-filter: blur(4px);
  z-index: 199;
}

.sidebar-overlay.visible { display: block; }
.bottom-nav { display: none; }
