:root {
  --chrome-bg: #f5f6f8;
  --shell-divider: rgba(15, 23, 42, 0.12);
  --sidebar: 292px;
  --sidebar-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-duration: 0.46s;
}

html,
body {
  background: var(--chrome-bg);
}

body {
  display: block;
  min-height: 100svh;
  padding: 0;
  overflow-x: hidden;
}

body::before {
  display: none !important;
}

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100svh;
  position: relative;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 0;
  width: var(--sidebar);
  background: var(--chrome-bg);
  pointer-events: none;
  transition: width var(--sidebar-duration) var(--sidebar-ease);
}

.app-shell::after {
  content: "";
  position: fixed;
  top: 18px;
  bottom: 0;
  left: calc(var(--sidebar) - 1px);
  z-index: 102;
  width: 1px;
  background: var(--shell-divider);
  /* Seam shadow lives on .sidebar::after in site-menu-title-common.css only;
     drawing it here too doubled the shadow on pages that load both files. */
  box-shadow: none;
  pointer-events: none;
  transition: left var(--sidebar-duration) var(--sidebar-ease);
}

html.is-sidebar-collapsed .app-shell,
.app-shell.is-sidebar-collapsed {
  --sidebar: 72px;
}

.sidebar {
  position: relative;
  align-self: stretch;
  flex: 0 0 var(--sidebar);
  width: var(--sidebar);
  min-height: 100svh;
  z-index: 100;
  overflow: visible;
  transition: flex-basis var(--sidebar-duration) var(--sidebar-ease), width var(--sidebar-duration) var(--sidebar-ease);
}

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 101;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 72px;
  height: 100svh;
  padding: 12px 8px;
  border-right: 0;
  background: var(--chrome-bg);
  opacity: 0;
  transform: translateX(-10px);
  pointer-events: none;
  transition: opacity var(--sidebar-duration) var(--sidebar-ease), transform var(--sidebar-duration) var(--sidebar-ease);
}

html.is-sidebar-collapsed .rail,
.app-shell.is-sidebar-collapsed .rail {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

html.is-sidebar-collapsed .side-panel,
.app-shell.is-sidebar-collapsed .side-panel {
  opacity: 0;
  transform: translateX(-14px);
  pointer-events: none;
}

.brand-mark,
.rail-button,
.menu-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.brand-mark {
  border: 1px solid rgba(39, 88, 216, 0.2);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-strong);
  text-decoration: none;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(27, 46, 86, 0.08);
}

.rail-brand-logo,
.side-brand-logo {
  object-fit: cover;
  display: block;
}

.rail-brand-logo {
  width: 100%;
  height: 100%;
}

.rail-button,
.menu-icon,
.side-collapse-btn {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #475467;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.menu-icon[hidden],
.menu-link[hidden] {
  display: none !important;
}

.menu-icon {
  position: relative;
}

.rail-button:hover,
.menu-icon:hover,
.menu-icon.is-active,
.side-collapse-btn:hover {
  background: #eef3ff;
  color: var(--accent-strong);
}

.rail-button i,
.menu-icon i {
  font-size: 19px;
}

.rail-spacer {
  flex: 1 1 auto;
}

.side-panel {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 101;
  width: 292px;
  height: 100svh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px 16px;
  background: var(--chrome-bg);
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  transition: opacity var(--sidebar-duration) var(--sidebar-ease), transform var(--sidebar-duration) var(--sidebar-ease);
}

.side-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 0;
  min-width: 0;
}

.side-brand-home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.side-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.side-brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.side-brand-copy strong,
.side-title strong {
  color: #101828;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
}

.side-brand-copy span,
.side-title span {
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
}

.side-collapse-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-left: auto;
}

.side-collapse-btn i {
  font-size: 18px;
}

.side-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: #f8fafc;
  color: #98a2b3;
  text-decoration: none;
  font-size: 13px;
}

.side-search-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  padding: 0;
}

.side-search-input::placeholder {
  color: #98a2b3;
}

.side-search i {
  font-size: 16px;
  flex: 0 0 auto;
}

.menu-stack {
  display: grid;
  gap: 22px;
}

.menu-group {
  display: grid;
  gap: 3.5px;
}

.menu-label {
  padding: 0 8px;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.menu-stack .menu-group[aria-label="업무 메뉴"]::before {
  content: "Workflows";
  padding: 0 8px;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.menu-stack .menu-group[aria-label="업무 메뉴"] > .menu-label {
  display: none;
}

.menu-link {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  color: #344054;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.2;
  transition: background 0.18s ease, color 0.18s ease;
}

.menu-link:hover,
.menu-link.is-active {
  background: #eef3ff;
  color: var(--accent-strong);
}

.menu-link i {
  width: 28px;
  text-align: center;
  color: inherit;
  font-size: 17px;
}

.menu-link > span:not(.admin-menu-badge) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-footer {
  margin-top: auto;
  padding: 18px 8px 4px;
  display: grid;
  gap: 12px;
}

.holiday-notice {
  color: #d92d20;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.guide-topbar,
.request-topbar,
.visit-topbar,
.order-topbar {
  position: fixed;
  top: 0;
  left: calc(var(--sidebar) - 1px);
  right: 0;
  z-index: 30;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-left: 1px solid var(--shell-divider);
  border-top: 1px solid var(--shell-divider);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  border-top-left-radius: 18px;
  background: #fff;
  pointer-events: none;
  transition: left var(--sidebar-duration) var(--sidebar-ease);
}

.guide-topbar::before,
.request-topbar::before,
.visit-topbar::before,
.order-topbar::before {
  content: "";
  position: fixed;
  top: 0;
  left: calc(var(--sidebar) - 1px);
  z-index: -1;
  width: 18px;
  height: 18px;
  background: var(--chrome-bg);
  pointer-events: none;
  transition: left var(--sidebar-duration) var(--sidebar-ease);
}

.guide-topbar-title,
.request-topbar-title,
.visit-topbar-title,
.order-topbar-title {
  margin: 0;
  color: #101828;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
}

.main-area,
.request-main-area,
.visit-main-area {
  position: relative;
  z-index: 25;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100svh;
  display: block;
  margin-left: -1px;
  padding: 0;
  background: var(--chrome-bg);
}

.main-area::before,
.request-main-area::before,
.visit-main-area::before {
  content: "";
  position: fixed;
  top: 44px;
  bottom: 0;
  left: calc(var(--sidebar) - 1px);
  z-index: 1;
  border-left: 1px solid rgba(15, 23, 42, 0.12);
  pointer-events: none;
  transition: left var(--sidebar-duration) var(--sidebar-ease);
}

.guide-page,
.order-page,
.visit-page,
.request-stage {
  position: relative;
  width: 100%;
  max-width: none;
  min-height: 100svh;
  margin: 0;
  padding: 56px 20px 20px;
  border-left: 0;
  border-top-left-radius: 18px;
  background: linear-gradient(var(--chrome-bg) 0 44px, #fff 44px);
}

.guide-page::before,
.order-page::before,
.visit-page::before,
.request-stage::before {
  display: none;
}

@media (max-width: 1200px) {
  :root {
    --sidebar: 72px;
  }

  .rail {
    width: 72px;
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }

  .side-panel {
    opacity: 0;
    transform: translateX(-14px);
    pointer-events: none;
  }
}

@media (max-width: 720px) {
  :root {
    --sidebar: 0px;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .app-shell {
    display: block;
  }

  .app-shell::before {
    display: none;
  }

  .app-shell::after {
    display: none;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    flex: 0 0 auto;
    width: 100%;
    height: 62px;
    min-height: 0;
    display: block;
    border-top: 1px solid rgba(15, 23, 42, 0.1);
    border-right: 0;
    overflow: visible;
    z-index: 80;
  }

  .rail {
    position: static;
    width: 100%;
    height: 62px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border-right: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    background: var(--chrome-bg);
    z-index: 80;
  }

  .rail::-webkit-scrollbar {
    display: none;
  }

  .side-panel,
  .brand-mark,
  .rail-button,
  .rail-spacer {
    display: none;
  }

  .menu-icon {
    scroll-snap-align: center;
  }

  .guide-topbar,
  .request-topbar,
  .visit-topbar,
  .order-topbar {
    left: 0;
    height: 44px;
    padding: 0 16px;
    border-top: 0;
    border-left: 0;
    border-top-left-radius: 0;
  }

  .guide-topbar::before,
  .request-topbar::before,
  .visit-topbar::before,
  .order-topbar::before {
    display: none;
  }

  .main-area,
  .request-main-area,
  .visit-main-area {
    min-height: calc(100svh - 62px);
    margin-left: 0;
    padding: 0 0 calc(62px + env(safe-area-inset-bottom, 0px));
    z-index: 1;
  }

  .main-area::before,
  .request-main-area::before,
  .visit-main-area::before {
    display: none;
  }

  .guide-page,
  .order-page,
  .visit-page,
  .request-stage {
    min-height: auto;
    padding: 56px clamp(12px, 3.5vw, 16px) calc(clamp(12px, 3.5vw, 16px) + 62px + env(safe-area-inset-bottom, 0px));
    border-left: 0;
    border-top-left-radius: 0;
    background: #fff;
  }
}
