
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}


.app.view-bubble {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.app.view-bubble .main { height: 100%; min-height: 0; overflow: hidden; }

.app.view-bubble .sidebar { position: static; height: 100%; overflow-y: auto; }


.sidebar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 15px; }
.brand-text small { font-size: 11px; color: var(--muted); letter-spacing: .04em; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--r-sm);
  border: 0; background: transparent; text-align: left; cursor: pointer;
  color: var(--text);
}
.nav-item:hover { background: var(--surface-2); }
.nav-item[aria-current="true"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item .nav-ico { width: 18px; text-align: center; font-size: 15px; }
.sidebar-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.sidebar-foot .tiny { padding: 0 4px; }


.sidebar-toggle {
  margin-top: 8px; padding: 6px 0; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--muted);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.sidebar-toggle:hover { color: var(--text); border-color: var(--brand); }



@media (min-width: 800px) {
  .app { transition: grid-template-columns 180ms ease; grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
  .app:has(.sidebar:hover), .app:has(.sidebar:focus-within) { grid-template-columns: var(--sidebar-w-expanded) 1fr; }
  
  .app:has(.sidebar.is-open:not(.is-dropzone)) { grid-template-columns: var(--sidebar-w-expanded) 1fr; }
  
  .app:has(.sidebar.is-dropzone) { grid-template-columns: var(--sidebar-w-expanded) 1fr; }
  .sidebar { width: auto; }
  
  .sidebar .brand-text,
  .sidebar .nav-label,
  .sidebar .sidebar-foot .tiny {
    opacity: 0; width: 0; overflow: hidden;
    transition: opacity 120ms ease, width 180ms ease;
    white-space: nowrap;
  }
  .sidebar:hover .brand-text,
  .sidebar:hover .nav-label,
  .sidebar:hover .sidebar-foot .tiny,
  .sidebar:focus-within .brand-text,
  .sidebar:focus-within .nav-label,
  .sidebar:focus-within .sidebar-foot .tiny,
  .sidebar.is-open .brand-text,
  .sidebar.is-open .nav-label,
  .sidebar.is-open .sidebar-foot .tiny,
  .sidebar.is-dropzone .brand-text,
  .sidebar.is-dropzone .nav-label,
  .sidebar.is-dropzone .sidebar-foot .tiny {
    opacity: 1; width: auto; overflow: visible;
  }
  
  .sidebar.is-dropzone > * { visibility: hidden; }

  
  .sidebar:not(:hover):not(:focus-within):not(.is-dropzone) { padding-left: 0; padding-right: 0; }
  .sidebar:not(:hover):not(:focus-within):not(.is-dropzone) .brand { justify-content: center; padding: 4px 0 14px; }
  .sidebar:not(:hover):not(:focus-within):not(.is-dropzone) .nav-item {
    justify-content: center; padding-left: 0; padding-right: 0; min-height: 38px;
  }
  .sidebar:not(:hover):not(:focus-within):not(.is-dropzone) .sidebar-foot { align-items: center; }
  
  .nav-item .nav-ico { width: 20px; flex: none; line-height: 1; }
  .brand-mark { width: 32px; height: 32px; }
}


.bubble-dropzone {
  position: fixed; z-index: 30;
  left: 0; top: 0; height: 100dvh;
  width: var(--sidebar-w-expanded);
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
  padding: 18px 12px;
  border: 2px dashed color-mix(in srgb, var(--drop-color, var(--brand)) 60%, transparent);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--drop-color, var(--surface)) 34%, var(--surface)),
      color-mix(in srgb, var(--drop-color, var(--surface)) 16%, var(--surface)));
  backdrop-filter: blur(3px);
  pointer-events: none;              
  animation: dzIn 150ms ease-out both;
  text-align: center;
}
.bubble-dropzone[hidden] { display: none; }
@keyframes dzIn { from { opacity: 0; transform: translateX(-12px); } }
.bdz-head { font-size: 15px; font-weight: 700; color: var(--text); }
.bdz-desc { font-size: 12.5px; line-height: 1.5; color: var(--text); opacity: .85; }
.bdz-color {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  margin-top: 4px; font-size: 11.5px; color: var(--muted);
}
.bdz-color i {
  width: 26px; height: 26px; border-radius: 50%; display: block;
  border: 2px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow: 0 1px 6px -1px rgba(0, 0, 0, .25);
}


.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.title-block { min-width: 0; }
.topbar h1 { font-size: 18px; font-weight: 650; white-space: nowrap; }
.subtitle { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.period-nav { display: flex; align-items: center; gap: 2px; }
.period-nav .today-btn { font-size: 13px; }

.content { flex: 1; min-width: 0; padding: 16px 20px 32px; outline: none; }


.banner-host { display: flex; flex-direction: column; gap: 8px; padding: 0 20px; }
.banner-host:not(:empty) { padding-top: 12px; }


.app.view-bubble .topbar {
  padding: 0;
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
  min-height: 0;
}
.app.view-bubble .topbar .title-block { display: none; }
.app.view-bubble .topbar .new-event-btn { display: none; }
.app.view-bubble .period-nav { display: none; }
.app.view-bubble .banner-host:empty { display: none; }

.app.view-bubble .content {
  padding: 0;
  overflow: hidden;
  
  display: flex;
  flex-direction: column;
}

.app.view-bubble .topbar-left { min-height: 44px; align-items: center; }
.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  font-size: 13px;
}
.banner b { font-weight: 600; }
.banner .spacer { flex: 1; }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.banner.info { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); background: var(--brand-soft); }


.tabbar { display: none; }

@media (max-width: 799px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 10px 14px; }
  .content { padding: 12px 14px calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); }
  .banner-host { padding: 0 14px; }

  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tabbar .nav-item {
    flex-direction: column; gap: 2px; justify-content: center;
    border-radius: 0; font-size: 11px; padding: 6px 0;
  }
  .tabbar .nav-item .nav-ico { font-size: 17px; width: auto; }
  .tabbar .nav-item[aria-current="true"] { background: transparent; color: var(--brand); }
}
