/* ===================================================================
   Slack Archiver — shell & utility styles (depends on theme.css)
   =================================================================== */

/* ---------- nav (sticky top bar) ---------- */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  background: #121826;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 8px 24px rgba(6,11,23,.18);
}
.top-nav-inner {
  position: relative; max-width: 1400px; margin: 0 auto; padding: 15px 24px;
  display: grid; grid-template-columns: minmax(150px,1fr) auto minmax(150px,1fr);
  align-items: center; gap: 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; width: fit-content;
  min-height: 32px; font-size: 16px; font-weight: 800; color: #fff;
  letter-spacing: -0.01em; cursor: pointer; text-decoration: none;
  margin: 0;
}
.brand-logo { display: block; width: 118px; height: 28px; object-fit: contain; object-position: left center; }
.brand-label { display: inline-flex; align-items: center; gap: 5px; color: inherit; font-size: 14px; font-weight: 750; letter-spacing: -0.01em; }
.brand-monitor-icon { font-size: 14px; line-height: 1; }
.brand-logo-light { display: none; }
.brand-logo-dark { display: block; }

/* hamburger */
.mobile-menu-toggle {
  display: none; border: 0; color: rgba(255,255,255,.9); border-radius: 9px;
  width: 36px; height: 36px; padding: 0; background: transparent; cursor: pointer;
  place-items: center;
}
.mobile-menu-toggle:hover { color: #fff; background: rgba(255,255,255,.1); }
.mobile-menu-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.mobile-menu-icon { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; width: 17px; }
.mobile-menu-icon span { display: block; width: 17px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .2s ease, opacity .2s ease; }
.mobile-menu-toggle.is-open .mobile-menu-icon span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mobile-menu-toggle.is-open .mobile-menu-icon span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.is-open .mobile-menu-icon span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.mobile-menu-backdrop { display: none; }

/* nav links */
.nav-links { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.nav-link {
  text-decoration: none; color: rgba(255,255,255,.75); border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 650; background: transparent;
  cursor: pointer; transition: color .18s ease, background .18s ease, box-shadow .18s ease;
  border: none !important;
  outline: none;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.12); }
.nav-link.active {
  color: #ffffff !important;
  background: #006cb7 !important;
  font-weight: 700 !important;
  border: none !important;
  box-shadow: none !important;
}
.nav-link.active:hover {
  background: #005a9c !important;
  color: #ffffff !important;
}

/* nav actions */
.nav-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }

/* logout button (icon) */
.logout-link {
  display: inline-grid; place-items: center; border: 0; border-radius: 10px;
  width: 40px; height: 40px; padding: 0; color: rgba(255,255,255,.82);
  background: transparent; cursor: pointer; transition: color .18s ease, background .18s ease;
  text-decoration: none;
}
.logout-link:hover { color: #fff; background: rgba(255,255,255,.1); }
.logout-link:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.logout-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* inline legacy logout (hidden by default, shown as fallback) */
.nav-user { margin-left: 2px; font-size: 12px; color: rgba(255,255,255,.65); }
.inline-logout-form { display: none; }
.nav-logout-btn { display: none; }

/* theme toggle */
.theme-toggle {
  border: 0; color: var(--text); border-radius: 10px; width: 40px; height: 40px;
  padding: 0; font: inherit; background: transparent; cursor: pointer;
  display: inline-grid; place-items: center;
}
.theme-toggle:hover { background: var(--surface-muted); }
.theme-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.theme-toggle-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; line-height: 1; transform-origin: center; }
.theme-icon-svg { width: 20px; height: 20px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 2.15; stroke-linecap: round; stroke-linejoin: round; }
html:not([data-theme="light"]) .theme-toggle .theme-icon-svg { color: #f2c94c; }
html[data-theme="light"] .theme-toggle .theme-icon-svg { color: #53606f; }
.theme-toggle.is-switching .theme-toggle-icon { animation: theme-icon-switch 450ms cubic-bezier(.22,.8,.32,1); }
@keyframes theme-icon-switch {
  0%   { opacity: .25; transform: rotate(-65deg) scale(.65); }
  55%  { opacity: 1;   transform: rotate(18deg) scale(1.18); }
  100% { opacity: 1;   transform: rotate(0deg) scale(1); }
}

/* ---------- admin dropdown button & menu ---------- */
.admin-dropdown-wrap { position: relative; display: inline-block; }
.admin-nav-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 12px;
  border-radius: 9px; font-size: 13px; font-weight: 700; font-family: inherit;
  color: rgba(255, 255, 255, 0.88); background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15); cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
  line-height: 1.2;
}
.admin-nav-btn:hover, .admin-nav-btn.active {
  color: #fff; background: var(--accent); border-color: var(--accent);
}
.admin-nav-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.admin-nav-btn .admin-chevron { font-size: 10px; opacity: 0.8; transition: transform .18s ease; }
.admin-nav-btn.is-open .admin-chevron { transform: rotate(180deg); }

.admin-dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px;
  padding: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  z-index: 120; display: flex; flex-direction: column; gap: 3px;
  animation: admin-pop-in .15s ease-out;
}
.admin-dropdown-menu[hidden] { display: none !important; }
@keyframes admin-pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.admin-menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 650;
  color: var(--text); text-decoration: none; transition: background .15s ease, color .15s ease;
}
.admin-menu-item:hover { background: var(--surface-hover); color: var(--accent-text); }
.admin-menu-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 750; }
.admin-menu-item .item-icon { width: 14px; height: 14px; opacity: 0.8; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- admin sub tabs (page top horizontal bar) ---------- */
.admin-sub-tabs {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px;
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.admin-sub-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 7px; font-size: 13px; font-weight: 650; color: var(--muted);
  text-decoration: none; transition: all .18s ease;
}
.admin-sub-tab:hover { color: var(--text); background: var(--surface-hover); }
.admin-sub-tab.active { background: var(--accent); color: #fff; font-weight: 750; box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.admin-sub-tab.external { gap: 4px; }
.admin-sub-tab .tab-ext-icon { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

html[data-theme="light"] .admin-nav-btn {
  color: rgba(29, 41, 53, 0.85); background: rgba(0, 0, 0, 0.04);
  border-color: var(--line);
}
html[data-theme="light"] .admin-nav-btn:hover, html[data-theme="light"] .admin-nav-btn.active {
  color: #fff; background: var(--accent); border-color: var(--accent);
}

/* ---- light-mode nav overrides ---- */
html[data-theme="light"] .top-nav { background: #fff; border-bottom: 1px solid var(--nav-border); box-shadow: none !important; }
html[data-theme="light"] .top-nav .brand { color: var(--text); }
html[data-theme="light"] .top-nav .nav-link { color: rgba(29,41,53,.75); border: none !important; }
html[data-theme="light"] .top-nav .nav-link:hover { color: #1d2935; background: var(--surface-hover); }
html[data-theme="light"] .top-nav .nav-link.active {
  color: #ffffff !important;
  background: #006cb7 !important;
  font-weight: 700 !important;
  border: none !important;
  box-shadow: none !important;
}
html[data-theme="light"] .top-nav .nav-link.active:hover {
  background: #005a9c !important;
  color: #ffffff !important;
}
html[data-theme="light"] .top-nav .mobile-menu-toggle { color: var(--muted); }
html[data-theme="light"] .top-nav .mobile-menu-toggle:hover { color: var(--text); background: var(--surface-hover); }
html[data-theme="light"] .top-nav .logout-link { color: var(--muted); }
html[data-theme="light"] .top-nav .logout-link:hover { color: var(--text); background: var(--surface-hover); }
html[data-theme="light"] .top-nav .theme-toggle:hover { background: var(--surface-hover); }
html[data-theme="light"] .brand-logo-light { display: block; }
html[data-theme="light"] .brand-logo-dark { display: none; }

/* ---------- layout ---------- */
.wrap { flex: 1 0 auto; max-width: 1400px; margin: 0 auto; padding: 24px 20px 40px; width: 100%; }
.container { flex: 1 0 auto; max-width: 1300px; margin: 28px auto; padding: 0 24px; width: 100%; }

/* ---------- footer (sticky bottom) ---------- */
.site-footer { margin-top: auto; flex-shrink: 0; border-top: 1px solid var(--line); background: var(--panel); width: 100%; }
.site-footer-inner {
  position: relative; max-width: 1400px; margin: 0 auto; padding: 22px 24px;
  display: flex; align-items: center; justify-content: center; gap: 16px; text-align: center;
}
.site-footer-copy { color: var(--muted); font-size: 11px; line-height: 1.5; }
.site-footer-shortcuts { position: absolute; right: 24px; display: flex; align-items: center; gap: 10px; }
.site-footer-shortcut {
  display: inline-flex; align-items: center; min-height: 32px; padding: 7px 13px;
  border: 1px solid var(--accent); border-radius: 7px; color: #fff;
  background: var(--accent); font-size: 11px; font-weight: 750; line-height: 1.2;
  text-decoration: none; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.site-footer-shortcut-icon {
  width: 13px; height: 13px; margin-right: 6px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.site-footer-shortcut:hover {
  color: #fff; background: var(--accent-hover); border-color: var(--accent-hover);
  transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.22);
}
.site-footer-shortcut:focus-visible { outline: 2px solid var(--accent-border); outline-offset: 3px; }

/* ---------- global toast (premium glass panel) ---------- */
.global-toast-container {
  position: fixed;
  top: 54px;
  right: 24px;
  z-index: 2100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.global-toast {
  min-width: 250px;
  max-width: 400px;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  background: rgba(30, 35, 42, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 4px solid #006cb7;
  color: #eef1f4;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-16px) scale(0.96);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="light"] .global-toast {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #d7e0e7;
  border-left: 4px solid #006cb7;
  color: #1d2935;
  box-shadow: 0 14px 32px rgba(0, 108, 183, 0.14);
}

.global-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.global-toast.is-hiding {
  opacity: 0 !important;
  transform: translateY(-20px) scale(0.94) !important;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1), transform 0.45s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* 성공 토스트 */
.global-toast.toast-success {
  border-left-color: #006cb7;
}

/* 에러/경고 토스트 */
.global-toast.toast-error, .global-toast.toast-warning {
  border-left-color: #f85149;
}

html[data-theme="light"] .global-toast.toast-error,
html[data-theme="light"] .global-toast.toast-warning {
  border-left-color: #c83d3d;
}

/* 정보/안내 토스트 */
.global-toast.toast-info {
  border-left-color: #38bdf8;
}

@media (max-width: 768px) {
  .global-toast-container {
    top: 20px;
    right: 16px;
    left: 16px;
    width: auto;
  }
  .global-toast {
    max-width: none;
    width: 100%;
  }
}

/* ---------- buttons ---------- */
.btn {
  height: 34px; padding: 8px 14px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 0.85rem; text-decoration: none; display: inline-flex; align-items: center;
  font-family: inherit; font-weight: 600;
  transition: background .18s ease, color .18s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { background: var(--surface-muted); color: var(--disabled-text); cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c83d3d; }
.btn-danger:disabled { background: var(--surface-muted); color: var(--disabled-text); cursor: not-allowed; }
.btn-ghost { background: var(--surface-muted); color: var(--text); }
.btn-ghost:hover { background: var(--surface-hover); }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.76rem; font-weight: 600; }
.ok, .active, .badge-yes { background: #1d3527; color: #99d8ac; border: 1px solid #2f6f42; }
.warn, .draft { background: #3a2b10; color: #e8c36e; border: 1px solid #6d5219; }
.fail, .badge-no { background: #3a1a1a; color: #f85149; border: 1px solid #da3633; }
html[data-theme="light"] .ok, html[data-theme="light"] .active, html[data-theme="light"] .badge-yes { background: #d4efdf; color: #1e8449; border-color: #a3d9b1; }
html[data-theme="light"] .warn, html[data-theme="light"] .draft { background: #fdebd0; color: #935116; border-color: #f0c87a; }
html[data-theme="light"] .fail, html[data-theme="light"] .badge-no { background: #fadbd8; color: #922b21; border-color: #f1a9a0; }

/* ---------- links ---------- */
.link-primary { color: var(--accent-text); text-decoration: none; }
.link-primary:hover { text-decoration: underline; }
.link-primary-strong { color: var(--accent-text); text-decoration: none; font-weight: 500; }
.link-primary-strong:hover { text-decoration: underline; }
.link-body { color: var(--text); text-decoration: none; }
.link-body:hover { text-decoration: underline; }
.link-sm { font-size: 0.8rem; }
.right { text-align: right; }

/* ---------- misc ---------- */
.inline-code-badge { font-size: 0.75rem; background: var(--surface-muted); color: var(--text); padding: 2px 6px; border-radius: 3px; }
.empty-row-cell { text-align: center; padding: 20px; color: var(--muted); }
.status-dot { display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-right: 2px; }
.status-indicator { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; padding: 2px 8px; border-radius: 12px; background: var(--surface-muted); }
.push-right { margin-left: auto; }
.span-2 { grid-column: span 2; }
.badge-row { display: flex; gap: 8px; }
.danger-note { font-size: 0.82rem; color: var(--danger); margin-top: 6px; }
.help-text-muted { color: var(--muted); font-size: 0.82rem; }
.modal-help-text { font-size: 0.85rem; color: var(--muted); }
.modal-lead { font-size: 0.9rem; color: var(--muted); margin-bottom: 8px; }
[hidden] { display: none !important; }

/* ---------- modal ---------- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9998; display: flex; align-items: center; justify-content: center; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; min-width: 360px; max-width: 480px; box-shadow: 0 8px 32px rgba(0,0,0,0.6); }

/* ---------- responsive: mobile nav ---------- */
@media (max-width: 900px) {
  .top-nav-inner { grid-template-columns: auto 1fr auto; gap: 10px; padding: 10px 14px; }
  .mobile-menu-toggle { display: inline-grid; grid-column: 1; grid-row: 1; }
  .brand { grid-column: 2; grid-row: 1; justify-self: center; }
  .nav-actions { grid-column: 3; grid-row: 1; justify-self: end; }
  .nav-links {
    position: absolute; top: calc(100% + 8px); left: 14px; right: 14px;
    display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 3px;
    max-height: calc(100vh - 86px); overflow-y: auto; padding: 10px;
    border: 0; border-radius: 16px; background: #182238;
    box-shadow: 0 18px 42px rgba(6,11,23,.35);
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translateY(-10px) scale(.98); transform-origin: top center;
    transition: opacity .22s ease, transform .22s cubic-bezier(.2,.8,.2,1), visibility .22s ease;
  }
  html[data-theme="light"] .nav-links { background: #fff; box-shadow: 0 18px 42px rgba(35,52,115,.16); }
  .nav-links.is-open { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0) scale(1); }
  .nav-link {
    width: 100%; min-height: 54px; padding: 16px; text-align: left;
    font-size: 16px; font-weight: 750; letter-spacing: -0.01em; border-radius: 11px;
  }
  .nav-links.is-open .nav-link { animation: mobile-menu-item-in .28s both; }
  .nav-links.is-open .nav-link:nth-child(1) { animation-delay: .03s; }
  .nav-links.is-open .nav-link:nth-child(2) { animation-delay: .06s; }
  .nav-links.is-open .nav-link:nth-child(3) { animation-delay: .09s; }
  .nav-links.is-open .nav-link:nth-child(4) { animation-delay: .12s; }
  .nav-links.is-open .nav-link:nth-child(5) { animation-delay: .15s; }
  .nav-links.is-open .nav-link:nth-child(6) { animation-delay: .18s; }
  .nav-links.is-open .nav-link:nth-child(7) { animation-delay: .21s; }
  .nav-links.is-open .nav-link:nth-child(8) { animation-delay: .24s; }
  .nav-links.is-open .nav-link:nth-child(9) { animation-delay: .27s; }
  .nav-links.is-open .nav-link:nth-child(10) { animation-delay: .30s; }
  .nav-links .nav-actions { width: 100%; margin-top: 10px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); justify-content: space-between; }
  .nav-links .logout-link { flex: 0 0 46px; width: 46px; height: 46px; min-height: 46px; padding: 0; }
  .nav-links .theme-toggle { order: -1; width: 46px; height: 46px; }
  html[data-theme="light"] .nav-links .nav-actions { border-top-color: var(--line); }
  .mobile-menu-backdrop {
    display: block; position: fixed; inset: 0; z-index: 90;
    background: rgba(5,10,20,.58); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
  }
  .mobile-menu-backdrop.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }
  body.mobile-menu-open { overflow: hidden; }
  .site-footer-inner { padding: 20px 14px; flex-direction: column; align-items: center; gap: 10px; }
  .site-footer-shortcuts { position: static; }
  .container { padding: 0 14px; }
}

@keyframes mobile-menu-item-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle.is-switching .theme-toggle-icon { animation: none; }
  .mobile-menu-icon span, .nav-links, .mobile-menu-backdrop { transition: none; }
  .nav-links.is-open .nav-link { animation: none; }
}