.app-body {
  min-height: 100vh;
  padding-left: var(--rail-width);
  padding-top: var(--topbar-height);
}

.app-rail {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-rail);
  display: flex;
  flex-direction: column;
  width: var(--rail-width);
  height: 100vh;
  overflow: hidden;
  color: #d7deea;
  background: #121a2f;
  border-right: 1px solid #243047;
}

.app-rail a { color: inherit; }

.rail-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--topbar-height);
  padding: 0 10px 0 14px;
  color: #fff;
  font-weight: var(--fw-bold);
}

.rail-brand span { font-size: 19px; }

/* 브랜드 문구가 6자에서 8자로 늘어 레일 폭 안에서 줄바꿈되지 않도록 한 줄로 고정한다. */
.rail-brand-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-2);
  overflow: auto;
}

.rail-nav a {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: #c5cedd;
  font-size: var(--fs-md);
  white-space: nowrap;
}

.rail-nav a:hover { background: #ffffff14; color: #fff; }

.rail-nav a.active {
  color: #fff;
  background: #3451b233;
  font-weight: var(--fw-bold);
}

.rail-icon {
  display: grid;
  place-items: center;
  width: 22px;
  flex: 0 0 22px;
}

.rail-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  flex: 0 0 32px;
  border: 1px solid #ffffff30;
  border-radius: var(--r-sm);
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.app-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--rail-width);
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--topbar-height);
  padding: 0 var(--sp-4);
  color: #fff;
  background: var(--header-bg);
  box-shadow: var(--sh-1);
}

.app-topbar.is-other-event {
  box-shadow: inset 0 4px 0 0 #f79009, var(--sh-1);
}

.topbar-menu {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border: 1px solid #ffffff40;
  border-radius: var(--r-sm);
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.event-selector {
  min-width: 240px;
  max-width: 470px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid #ffffff80;
  border-radius: 8px;
  color: #fff;
  background: #ffffff14;
}

.event-selector:hover { background: #ffffff24; }
.event-selector-form { padding-right: 8px; }
.event-selector select {
  min-width: 0;
  flex: 1;
  color: #fff;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: var(--fw-bold);
}
.event-selector select option { color: #101828; }
.event-settings {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--r-sm);
  color: #fff;
  text-decoration: none;
}
.event-settings:hover { background: #ffffff24; }
.event-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-base); font-weight: var(--fw-bold); }
.event-date { white-space: nowrap; font-size: var(--fs-sm); color: #d0d7e6; }
.event-state { margin-left: auto; white-space: nowrap; padding-left: 8px; color: #f3d48a; font-size: var(--fs-xs); }
.header-spacer { flex: 1; }

.user-summary { display: flex; align-items: center; gap: var(--sp-2); min-width: 170px; }
.user-summary > span:last-child { display: grid; }
.user-summary b { font-size: var(--fs-md); }
.user-summary small { color: #d0d7e6; font-size: var(--fs-xs); }

.user-avatar,
.header-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff18;
  color: #fff;
}

.header-icon:hover { background: #ffffff2b; }

.logout { margin: 0; }

.logout button {
  background: #ffffff14;
  border: 1px solid #ffffff50;
  color: #fff;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.app-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: #10182866;
}

.container {
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-4) 42px;
}

.page-dashboard,
.page-reservation,
.page-master,
.page-admin,
.page-event,
.page-wide {
  max-width: none;
  width: 100%;
}

.app-body.rail-collapsed { --rail-width: 64px; }
.app-body.rail-collapsed .rail-label { display: none; }
.app-body.rail-collapsed .rail-brand-text { display: none; }
.app-body.rail-collapsed .rail-brand {
  justify-content: center;
  padding: 0;
}
.app-body.rail-collapsed .rail-toggle { display: none; }

@media (max-width: 1440px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1280px) {
  .grid.two {
    grid-template-columns: minmax(320px, 1fr) minmax(0, 1.2fr);
  }
}

@media (min-width: 1025px) {
  .app-body.rail-collapsed .topbar-menu { display: inline-flex; }
}

@media (max-width: 1024px) {
  .app-body,
  .app-body.rail-collapsed { --rail-width: 64px; }
  .rail-label,
  .rail-brand-text { display: none; }
  .rail-brand {
    justify-content: center;
    padding: 0;
  }
  .rail-toggle { display: none; }
  .grid.two { grid-template-columns: 1fr; }
  .app-rail a,
  .rail-brand a,
  .rail-toggle,
  .topbar-menu,
  .btn,
  .btn.small,
  .logout button,
  .header-icon,
  .event-settings,
  .kind-filter-button {
    min-height: 44px;
    min-width: 44px;
  }
  .event-selector { min-height: 44px; }
  .notice-banner a,
  .section-title-row a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]),
  select,
  textarea {
    min-height: 44px;
  }
  label:has(input[type=checkbox]),
  label:has(input[type=radio]),
  .form-grid > label.inline,
  .form-grid > .check-row {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .topbar-menu {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 768px) {
  .app-body,
  .app-body.rail-collapsed { --rail-width: 0px; }
  .app-rail {
    transform: translateX(-100%);
    width: 240px;
    transition: transform .2s ease;
  }
  .app-body.rail-open .app-rail { transform: none; }
  .app-body.rail-open .app-overlay { display: block; }
  .app-body.rail-open .rail-label,
  .app-body.rail-open .rail-brand-text { display: inline; }
  .app-body.rail-open .rail-brand {
    justify-content: flex-start;
    padding: 0 10px 0 14px;
  }
  .app-body.rail-open .rail-toggle { display: inline-flex; }
  .topbar-menu { display: inline-flex; }
  .event-selector { min-width: 0; flex: 1; }
  .event-date,
  .event-state,
  .user-summary,
  .header-icon { display: none; }
  .container { padding: 17px 12px 35px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .form-grid,
  .page-master .form-grid,
  .page-event .form-grid,
  .page-admin .form-grid { grid-template-columns: 1fr; }
  .btn.small { min-height: 44px; }
}

@media (max-width: 480px) {
  .app-topbar { gap: var(--sp-2); padding: 0 var(--sp-2); }
}

@media print {
  .app-rail,
  .app-topbar,
  .app-overlay,
  .no-print,
  .actions { display: none !important; }
  .app-body { padding: 0; }
  body { background: #fff; }
  .container { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; }
}
