/* エクスプローラー型 UI（data-ui-style="explorer"） */

html[data-ui-style="explorer"] {
  --exp-header-bg: #1e3a5f;
  --exp-rail-bg: #234672;
  --exp-rail-active-bg: #d6e6f7;
  --exp-rail-active-fg: #1e3a5f;
  --exp-subnav-bg: #f3f4f6;
  --exp-subnav-active: #d6e6f7;
  --exp-border: #d0d7de;
  --exp-text: #1f2937;
  --exp-muted: #6b7280;
  --exp-main-bg: #ffffff;
  --theme-primary: #234672;
  --theme-primary-2: #1e3a5f;
  --theme-primary-rgb: 35, 70, 114;
  --theme-bg-1: #e8eef5;
  --theme-bg-2: #e8eef5;
  --theme-bg-3: #dce6f0;
  --theme-border: #d0d7de;
  --theme-border-2: #d0d7de;
  --theme-border-3: #d0d7de;
  --theme-border-4: #d0d7de;
  --theme-border-5: #d0d7de;
  --ui-text: #1f2937;
  --ui-text-muted: #6b7280;
  --ui-btn-text: #1e3a5f;
}

/* デフォルト（digital/smarthr）ではシェル非表示 */
.exp-app {
  display: none;
}

html[data-ui-style="explorer"] {
  height: 100%;
}

html[data-ui-style="explorer"] body {
  margin: 0;
  padding: 0 !important;
  min-height: 100%;
  height: 100%;
  background: #e8eef5 !important;
  overflow: hidden;
}

html[data-ui-style="explorer"] body.exp-ready {
  display: block;
}

html[data-ui-style="explorer"] .exp-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

html[data-ui-style="explorer"] .exp-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 48px;
  padding: 0 16px;
  background: var(--exp-header-bg);
  color: #fff;
  z-index: 20;
}

html[data-ui-style="explorer"] .exp-brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

html[data-ui-style="explorer"] .exp-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

html[data-ui-style="explorer"] .exp-header-link {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.95;
}

html[data-ui-style="explorer"] .exp-header-link:hover {
  text-decoration: underline;
}

html[data-ui-style="explorer"] .exp-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #3b6ea5;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

html[data-ui-style="explorer"] .exp-workspace {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  min-width: 0;
}

html[data-ui-style="explorer"] .exp-rail {
  flex: 0 0 72px;
  background: var(--exp-rail-bg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 8px 0;
  gap: 4px;
  overflow-y: auto;
}

html[data-ui-style="explorer"] .exp-rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 6px;
  padding: 10px 4px;
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

html[data-ui-style="explorer"] .exp-rail-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

html[data-ui-style="explorer"] .exp-rail-item.is-active {
  background: var(--exp-rail-active-bg);
  color: var(--exp-rail-active-fg);
}

html[data-ui-style="explorer"] .exp-rail-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

html[data-ui-style="explorer"] .exp-rail-item.is-active .exp-rail-icon {
  background: #fff;
}

html[data-ui-style="explorer"] .exp-subnav {
  flex: 0 0 220px;
  background: var(--exp-subnav-bg);
  border-right: 1px solid var(--exp-border);
  overflow-y: auto;
  padding: 12px 0;
}

html[data-ui-style="explorer"] .exp-subnav-title {
  padding: 4px 16px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--exp-muted);
}

html[data-ui-style="explorer"] .exp-subnav-list {
  display: flex;
  flex-direction: column;
}

html[data-ui-style="explorer"] .exp-subnav-item,
html[data-ui-style="explorer"] .exp-subnav-item-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--exp-text);
  text-decoration: none;
  cursor: pointer;
}

html[data-ui-style="explorer"] .exp-subnav-item:hover,
html[data-ui-style="explorer"] .exp-subnav-item-btn:hover {
  background: #e5e7eb;
}

html[data-ui-style="explorer"] .exp-subnav-item.is-active {
  background: var(--exp-subnav-active);
  color: var(--exp-rail-active-fg);
}

html[data-ui-style="explorer"] .exp-subnav-item.is-disabled {
  color: #9ca3af;
  cursor: default;
}

html[data-ui-style="explorer"] .exp-subnav-current {
  margin: 8px 16px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--exp-border);
  font-size: 12px;
  color: var(--exp-muted);
  word-break: break-all;
}

html[data-ui-style="explorer"] .exp-subnav-empty {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--exp-muted);
}

html[data-ui-style="explorer"] .exp-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--exp-main-bg);
  padding: 16px 18px 24px;
}

/* 既存 userbar はヘッダーへ寄せるためコンパクトに */
html[data-ui-style="explorer"] .exp-main > .userbar {
  width: auto;
  max-width: none;
  margin: 0 0 12px;
  justify-content: flex-end;
}

html[data-ui-style="explorer"] .exp-main .window,
html[data-ui-style="explorer"] .exp-main .page-admin.page-search-layout .window {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border: 1px solid var(--exp-border);
  border-radius: 8px;
  box-shadow: none;
}

html[data-ui-style="explorer"] .exp-main .titlebar,
html[data-ui-style="explorer"] .page-admin.page-search-layout .titlebar {
  background: #fff;
  color: var(--exp-text);
  border-bottom: 1px solid var(--exp-border);
  border-radius: 8px 8px 0 0;
}

html[data-ui-style="explorer"] .titlebar-split a {
  color: #234672;
}

/* MENU: タブ／ボタン一覧はサブナビへ移すため非表示 */
html[data-ui-style="explorer"] body.page-menu .tabbar,
html[data-ui-style="explorer"] body.page-menu .panel,
html[data-ui-style="explorer"] body.page-menu .titlebar {
  display: none !important;
}

html[data-ui-style="explorer"] body.page-menu .page-header {
  font-size: 22px;
  color: var(--exp-text);
}

html[data-ui-style="explorer"] body.page-menu .window {
  border: 0;
  box-shadow: none;
}

html[data-ui-style="explorer"] body.page-menu .content {
  padding: 0;
}

html[data-ui-style="explorer"] body.page-menu .exp-menu-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  color: var(--exp-muted);
  text-align: center;
  gap: 8px;
}

html[data-ui-style="explorer"] body.page-menu .exp-menu-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #e8eef5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #234672;
}

html[data-ui-style="digital"] .exp-menu-empty,
html[data-ui-style="smarthr"] .exp-menu-empty {
  display: none;
}

html[data-ui-style="explorer"] .theme-picker-item.is-style-locked .theme-picker-select {
  opacity: 0.55;
  pointer-events: none;
}

html[data-ui-style="explorer"] .theme-picker-hint-explorer {
  display: block;
  width: 100%;
  text-align: right;
  font-size: 11px;
  color: var(--exp-muted);
}

html[data-ui-style="digital"] .theme-picker-hint-explorer,
html[data-ui-style="smarthr"] .theme-picker-hint-explorer {
  display: none;
}

/* 狭い画面ではサブナビを畳む */
@media (max-width: 900px) {
  html[data-ui-style="explorer"] .exp-subnav {
    display: none;
  }
  html[data-ui-style="explorer"] body.page-menu .tabbar,
  html[data-ui-style="explorer"] body.page-menu .panel {
    display: block !important;
  }
  html[data-ui-style="explorer"] body.page-menu .exp-menu-empty {
    display: none;
  }
}
