body {
  background: var(--color-bg);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--rail-width) 1fr;
  min-height: 100vh;
  position: relative;
}

/* —— Left icon rail (hover 시 가로 확장 + 메뉴명) —— */
.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--rail-width);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: var(--space-3) 0.6rem;
  background: var(--rail-bg);
  z-index: 120;
  overflow: hidden;
  transition:
    width 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s ease,
    padding 0.22s ease;
}

.app-sidebar:hover,
.app-sidebar:focus-within {
  width: var(--rail-expanded-width);
  padding-left: 0.7rem;
  padding-right: 0.7rem;
  box-shadow: 10px 0 28px rgba(8, 16, 28, 0.28);
}

.app-sidebar__logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7rem;
  width: 100%;
  height: 42px;
  margin-bottom: var(--space-5);
  padding: 0 0.35rem;
  border-radius: var(--radius-md);
  background: transparent;
  overflow: hidden;
  text-decoration: none;
  flex-shrink: 0;
  color: #fff;
}

.app-sidebar__logo:hover {
  background: var(--rail-active);
}

.app-sidebar__logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.app-sidebar__brand {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transform: translateX(-4px);
  transition:
    opacity 0.18s ease,
    max-width 0.22s ease,
    transform 0.22s ease;
}

.app-sidebar:hover .app-sidebar__brand,
.app-sidebar:focus-within .app-sidebar__brand {
  opacity: 1;
  max-width: 10rem;
  transform: none;
}

.app-sidebar__nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  flex: 1;
  width: 100%;
  min-height: 0;
}

.app-sidebar__footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  width: 100%;
  padding-bottom: var(--space-2);
  margin-top: auto;
}

.app-sidebar__link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  width: 100%;
  min-height: 42px;
  padding: 0 0.55rem;
  border-radius: var(--radius-md);
  color: var(--rail-icon-muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  overflow: hidden;
}

.app-sidebar__link:hover {
  color: var(--rail-icon);
  background: var(--rail-active);
}

.app-sidebar__link.is-active {
  color: #fff;
  background: var(--rail-active);
}

.app-sidebar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.app-sidebar__nav svg,
.app-sidebar__footer svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-sidebar__label {
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  opacity: 0;
  max-width: 0;
  margin-left: 0;
  overflow: hidden;
  transform: translateX(-6px);
  transition:
    opacity 0.16s ease 0.02s,
    max-width 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    margin-left 0.22s ease,
    transform 0.22s ease;
}

.app-sidebar:hover .app-sidebar__label,
.app-sidebar:focus-within .app-sidebar__label {
  opacity: 1;
  max-width: 11rem;
  margin-left: 0.7rem;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar,
  .app-sidebar__brand,
  .app-sidebar__label {
    transition: none;
  }
}

/* —— Workspace —— */
.app-workspace {
  min-width: 0;
  background:
    radial-gradient(ellipse 70% 40% at 0% 0%, rgba(15, 92, 76, 0.04), transparent 50%),
    var(--color-bg);
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--page-pad-y) var(--page-pad-x) 0;
  min-height: 3.25rem;
}

.app-main {
  padding: var(--space-3) var(--page-pad-x) var(--space-8);
  max-width: var(--content-max);
}

.page-header {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.page-header__tools {
  margin-top: 0.85rem;
}

.page-header h1 {
  font-size: clamp(1.55rem, 2.6vw, 1.95rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--color-text);
}

.project-title__code {
  margin-right: 0.5rem;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.project-title__name {
  font-weight: 700;
}

.page-header p {
  margin-top: 0.4rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 40rem;
}

.content-section {
  padding: var(--space-5) 0;
  border-top: 1px solid var(--color-border);
}

.content-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.content-section--flush {
  border-top: none;
  padding-top: 0;
  padding-bottom: var(--space-4);
}

.content-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.content-section__head h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.content-section__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.content-section__tools > a:not(.btn),
.content-section__tools > button:not(.btn) {
  color: var(--color-link);
  font-weight: 600;
}

.content-section__tools > a:not(.btn):hover,
.content-section__tools > button:not(.btn):hover {
  text-decoration: underline;
}

.content-section__tools .btn {
  text-decoration: none;
  font-size: 0.84rem;
  padding: 0.45rem 0.85rem;
}

.content-section__tools .btn--primary {
  color: #fff;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.content-section__tools .btn--primary:hover {
  color: #fff;
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  text-decoration: none;
}

.content-section__tools .btn--ghost {
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.content-section__tools .btn--ghost:hover {
  color: var(--color-text);
  background: var(--color-bg-elevated);
  border-color: var(--color-border-strong);
  text-decoration: none;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #fff;
}

.role-badge--client {
  background: var(--badge-client);
}

.role-badge--admin {
  background: var(--badge-admin);
}

.data-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

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

  .app-sidebar,
  .app-sidebar:hover,
  .app-sidebar:focus-within {
    position: sticky;
    top: 0;
    height: auto;
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.55rem;
    overflow-x: auto;
    box-shadow: none;
  }

  .app-sidebar__logo {
    margin-bottom: 0;
    width: auto;
    height: 40px;
    padding: 0 0.25rem;
  }

  .app-sidebar__brand,
  .app-sidebar:hover .app-sidebar__brand,
  .app-sidebar:focus-within .app-sidebar__brand,
  .app-sidebar__label,
  .app-sidebar:hover .app-sidebar__label,
  .app-sidebar:focus-within .app-sidebar__label {
    display: none;
  }

  .app-sidebar__nav {
    flex-direction: row;
    flex: 1;
    justify-content: center;
    gap: 0.15rem;
  }

  .app-sidebar__link {
    width: 40px;
    min-height: 40px;
    justify-content: center;
    padding: 0;
  }

  .app-sidebar__footer {
    flex-direction: row;
    width: auto;
    padding-bottom: 0;
    margin-top: 0;
  }

  .app-main {
    padding: var(--space-3) var(--space-4) var(--space-6);
  }

  .app-topbar {
    padding: var(--space-3) var(--space-4) 0;
  }

  .page-header {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
  }

  .content-section {
    padding: var(--space-4) 0;
  }
}
