body.site-app {
  min-height: 100vh;
}

.app-shell {
  width: min(100%, 1220px);
  display: grid;
  grid-template-columns: 242px minmax(0, 1fr);
  gap: 18px;
  margin: 0 auto;
  padding: calc(var(--nav-height) + 30px) var(--page-pad) 42px;
}

.app-sidebar,
.app-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

.app-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 18px);
  align-self: start;
  padding: 14px;
}

.app-user-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 14px;
  border-bottom: 1px solid var(--line);
}

.app-user-summary strong,
.device-item strong,
.post-item strong,
.notice-item strong,
.achievement-item strong {
  color: var(--text-strong);
}

.app-user-summary span:not(.app-avatar),
.device-item span,
.post-item span,
.achievement-item span,
.setting-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.app-side-nav {
  display: grid;
  gap: 6px;
  padding-top: 12px;
}

.app-side-btn {
  min-height: 40px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 10px;
  font-weight: 800;
}

.app-side-btn:hover,
.app-side-btn.is-active {
  background: rgba(98, 217, 137, 0.13);
  color: var(--text-strong);
}

.app-content {
  min-width: 0;
}

.app-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.app-page-head h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  line-height: 1.06;
}

.app-session-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.app-grid {
  display: grid;
  gap: 16px;
}

.app-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-panel {
  padding: 18px;
}

.wide-panel {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 1.05rem;
}

.panel-head span {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
}

.notice-list,
.post-list,
.settings-list,
.device-list {
  display: grid;
  gap: 10px;
}

.notice-item,
.post-item,
.device-item,
.achievement-item,
.setting-row,
.theme-options span {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045);
  padding: 12px;
}

.notice-item p,
.post-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

.notice-item.is-important {
  border-color: rgba(241, 186, 99, 0.44);
  background: rgba(241, 186, 99, 0.09);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-actions button {
  width: 100%;
}

.compact-form {
  display: grid;
  gap: 10px;
}

.compact-form input,
.compact-form textarea,
.compact-form select {
  min-height: 43px;
  padding: 0 12px;
}

.compact-form textarea {
  padding-top: 11px;
}

.profile-editor {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-avatar.large {
  width: 78px;
  height: 78px;
  font-size: 1.5rem;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.setting-row input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.achievement-item {
  position: relative;
  min-height: 102px;
}

.achievement-item::before {
  content: "";
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted-2);
  margin-bottom: 10px;
}

.achievement-item.is-complete::before {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(98, 217, 137, 0.14);
}

.achievement-item span {
  display: block;
  margin-top: 6px;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.theme-options label {
  min-width: 0;
}

.theme-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-options span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  font-weight: 800;
  color: var(--muted);
}

.theme-options input:checked + span {
  border-color: var(--line-strong);
  background: rgba(98, 217, 137, 0.15);
  color: var(--text-strong);
}

.saved-flash {
  animation: savedFlash 0.7s ease;
}

@keyframes savedFlash {
  0% { box-shadow: 0 0 0 0 rgba(98, 217, 137, 0); }
  35% { box-shadow: 0 0 0 4px rgba(98, 217, 137, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(98, 217, 137, 0); }
}

html[data-theme="light"] .app-sidebar,
html[data-theme="light"] .app-panel {
  background: rgba(255, 255, 255, 0.82);
}

html[data-theme="light"] .notice-item,
html[data-theme="light"] .post-item,
html[data-theme="light"] .device-item,
html[data-theme="light"] .achievement-item,
html[data-theme="light"] .setting-row,
html[data-theme="light"] .theme-options span,
html[data-theme="light"] .app-session-chip {
  background: rgba(255, 255, 255, 0.62);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
  }

  .app-side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding-top: 156px;
  }

  .app-grid.two-columns,
  .achievement-grid,
  .theme-options,
  .quick-actions,
  .app-side-nav {
    grid-template-columns: 1fr;
  }

  .app-page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-editor,
  .setting-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
