/* 共通トークン・シェル・管理・検索・印刷 */
/* ==========================================
   WPG Design Tokens & Shared Components
   段階的見た目改善用の共通ルール（機能は変えない）
   ========================================== */
:root {
    --wpg-brand: #ff6b00;
    --wpg-brand-hover: #e05e00;
    --wpg-brand-soft: #fff7ed;
    --wpg-brand-border: rgba(255, 107, 0, 0.28);
    --wpg-ink: #1f2937;
    --wpg-muted: #6b7280;
    --wpg-subtle: #9ca3af;
    --wpg-line: #e5e7eb;
    --wpg-surface: #ffffff;
    --wpg-bg: #f3f4f6;
    --wpg-danger: #dc2626;
    --wpg-danger-soft: #fef2f2;
    --wpg-success: #16a34a;
    --wpg-success-soft: #f0fdf4;
    --wpg-info: #2563eb;
    --wpg-info-soft: #eff6ff;
    --wpg-warn: #d97706;
    --wpg-warn-soft: #fffbeb;
    --wpg-cal-holiday-bg: #fff8f7;
    --wpg-cal-today-bg: #f4f9ec;
    --wpg-cal-today: #689f38;
    --wpg-cal-sun: #e11d48;
    --wpg-cal-sat: #2563eb;

    --wpg-radius-sm: 8px;
    --wpg-radius-md: 12px;
    --wpg-radius-lg: 16px;
    --wpg-radius-event: 4px;

    --wpg-space-1: 4px;
    --wpg-space-2: 8px;
    --wpg-space-3: 12px;
    --wpg-space-4: 16px;
    --wpg-space-5: 24px;
    --wpg-space-6: 32px;

    --wpg-text-xs: 11px;
    --wpg-text-sm: 12px;
    --wpg-text-md: 13px;
    --wpg-text-lg: 14px;
    --wpg-text-xl: 16px;

    --wpg-shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
    --wpg-shadow-md: 0 8px 24px rgba(17, 24, 39, 0.08);
    --wpg-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    height: 100%;
}

/*
 * Tailwind h-screen は height:100vh。モバイルブラウザ（iOS Safari / Android Chrome など）では
 * アドレスバー・ナビ表示中の実表示より高くなり、body.overflow-hidden だと下端が見切れる。
 * svh = ブラウザ UI 表示中の最小ビューポート。border-box で safe-area の padding を高さ内に収める。
 */
body.h-screen {
    box-sizing: border-box;
    height: 100vh;
    height: 100svh;
    max-height: 100vh;
    max-height: 100svh;
}

.wpg-label {
    display: block;
    margin-bottom: var(--wpg-space-1);
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    color: var(--wpg-subtle);
}

.wpg-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: var(--wpg-radius-sm);
    padding: 10px 12px;
    font-size: var(--wpg-text-lg);
    color: var(--wpg-ink);
    background: var(--wpg-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wpg-input:focus {
    outline: none;
    border-color: var(--wpg-brand);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.12);
}

.wpg-input::placeholder {
    color: #c4c4c4;
}

.wpg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: var(--wpg-radius-sm);
    font-weight: 700;
    font-size: var(--wpg-text-lg);
    line-height: 1.2;
    padding: 10px 16px;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    cursor: pointer;
    user-select: none;
}

.wpg-btn:active {
    transform: translateY(1px);
}

.wpg-btn-primary {
    background: var(--wpg-brand);
    color: #fff;
    border: 1px solid var(--wpg-brand);
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-btn-primary:hover {
    background: var(--wpg-brand-hover);
    border-color: var(--wpg-brand-hover);
}

.wpg-btn-secondary {
    background: var(--wpg-surface);
    color: var(--wpg-ink);
    border: 1px solid #d1d5db;
}

.wpg-btn-secondary:hover {
    background: #f9fafb;
}

.wpg-btn-muted {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-btn-muted:hover {
    background: #e5e7eb;
}

.wpg-btn-ghost {
    background: transparent;
    color: var(--wpg-muted);
    border: 1px solid transparent;
    padding: 6px 8px;
    font-size: var(--wpg-text-sm);
}

.wpg-btn-ghost:hover {
    color: var(--wpg-brand);
}

.wpg-btn-block {
    width: 100%;
}


.wpg-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    padding: 12px 16px;
}

.wpg-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.wpg-toolbar-row > .wpg-btn,
.wpg-toolbar-filters .wpg-btn {
    min-height: 38px;
    align-self: center;
}

.wpg-toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.wpg-toolbar-filters > .wpg-input,
.wpg-toolbar-filters > select.wpg-input {
    width: auto;
    min-width: 10rem;
}

.wpg-empty-state {
    grid-column: 1 / -1;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 3rem 1.25rem;
    font-size: var(--wpg-text-sm);
    font-weight: 500;
    line-height: 1.5;
    color: var(--wpg-subtle);
}

.wpg-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    background: var(--wpg-bg);
}


.wpg-card {
    background: var(--wpg-surface);
    border: 1px solid #f3f4f6;
    border-radius: var(--wpg-radius-lg);
    box-shadow: var(--wpg-shadow-md);
}

.wpg-section-title {
    font-size: var(--wpg-text-xs);
    font-weight: 700;
    color: var(--wpg-subtle);
    letter-spacing: 0.02em;
    margin-bottom: var(--wpg-space-2);
}

.wpg-alert {
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    padding: var(--wpg-space-2) var(--wpg-space-3);
    border-radius: var(--wpg-radius-sm);
    border: 1px solid transparent;
}

.wpg-alert-error {
    color: var(--wpg-danger);
    background: var(--wpg-danger-soft);
    border-color: #fecaca;
}

.wpg-alert-success {
    color: var(--wpg-success);
    background: var(--wpg-success-soft);
    border-color: #bbf7d0;
}

.wpg-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 5px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.wpg-badge-pending {
    color: var(--wpg-info);
    background: var(--wpg-info-soft);
    border-color: #bfdbfe;
}

.wpg-badge-approved {
    color: var(--wpg-success);
    background: var(--wpg-success-soft);
    border-color: #bbf7d0;
}

.wpg-badge-rejected {
    color: var(--wpg-danger);
    background: var(--wpg-danger-soft);
    border-color: #fecaca;
}

.wpg-badge-remand {
    color: var(--wpg-warn);
    background: var(--wpg-warn-soft);
    border-color: #fde68a;
}

.wpg-badge-neutral {
    color: #4b5563;
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.wpg-brand-mark {
    display: inline-block;
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: 0.08em;
    color: #fff;
    background: #000;
    padding: 4px 12px;
    border: 2px solid #000;
}

.wpg-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--wpg-space-4);
    font-family: var(--wpg-font);
    background:
        radial-gradient(circle at top left, rgba(255, 107, 0, 0.08), transparent 34%),
        radial-gradient(circle at bottom right, rgba(17, 24, 39, 0.05), transparent 30%),
        var(--wpg-bg);
}

.wpg-login-card {
    width: 100%;
    max-width: 24rem;
    padding: var(--wpg-space-5);
    position: relative;
}

.wpg-login-title {
    margin-top: var(--wpg-space-2);
    font-size: var(--wpg-text-lg);
    font-weight: 700;
    color: var(--wpg-muted);
}

.wpg-login-stack {
    display: flex;
    flex-direction: column;
    gap: var(--wpg-space-4);
}

.wpg-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--wpg-text-sm);
    color: var(--wpg-muted);
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.wpg-check-row input[type="checkbox"] {
    accent-color: var(--wpg-brand);
}

.wpg-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--wpg-space-4);
    background: rgba(17, 24, 39, 0.45);
    backdrop-filter: blur(2px);
}

.wpg-modal-panel {
    width: 100%;
    max-width: 24rem;
    padding: var(--wpg-space-5);
}

.wpg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--wpg-space-3);
    margin-bottom: var(--wpg-space-4);
    border-bottom: 1px solid #f3f4f6;
}

.wpg-modal-title {
    font-size: var(--wpg-text-lg);
    font-weight: 700;
    color: var(--wpg-ink);
}

.wpg-help-text {
    font-size: var(--wpg-text-sm);
    color: var(--wpg-muted);
    line-height: 1.6;
}

.wpg-input-code {
    letter-spacing: 0.35em;
    text-align: center;
    font-weight: 700;
}

.wpg-input-sm {
    padding: 8px 10px;
    font-size: var(--wpg-text-md);
}

.wpg-btn-sm {
    padding: 7px 12px;
    font-size: var(--wpg-text-sm);
}

.wpg-btn-soft {
    background: var(--wpg-brand-soft);
    color: var(--wpg-brand);
    border: 1px solid var(--wpg-brand-border);
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-btn-soft:hover {
    background: #ffedd5;
}

.wpg-btn-dark {
    background: #2d3748;
    color: #fff;
    border: 1px solid #2d3748;
}

.wpg-btn-dark:hover {
    background: #1a202c;
    border-color: #1a202c;
}

.wpg-btn-danger-text {
    background: transparent;
    color: var(--wpg-danger);
    border: 1px solid transparent;
    padding: 7px 8px;
    font-size: var(--wpg-text-sm);
}

.wpg-btn-danger-text:hover {
    color: #b91c1c;
    background: var(--wpg-danger-soft);
}

.wpg-app-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--wpg-space-2) var(--wpg-space-3);
    flex-shrink: 0;
    z-index: 50;
    padding: var(--wpg-space-2) var(--wpg-space-4);
    background: var(--wpg-surface);
    border-bottom: 1px solid var(--wpg-line);
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-header-left,
.wpg-header-actions {
    display: flex;
    align-items: center;
    gap: var(--wpg-space-2);
    flex-shrink: 0;
}

.wpg-header-actions {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.wpg-header-more {
    display: flex;
    align-items: center;
}

.wpg-header-more-btn {
    display: none !important;
}

.wpg-header-more-panel {
    display: flex;
    align-items: center;
    gap: var(--wpg-space-2);
}

.wpg-header-title {
    font-size: var(--wpg-text-xl);
    font-weight: 700;
    color: var(--wpg-ink);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.wpg-mode-nav {
    display: none !important;
    align-items: center;
    gap: 2px;
    margin-left: var(--wpg-space-2);
    padding: 3px;
    background: #f3f4f6;
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    flex-shrink: 0;
}

.wpg-mode-nav-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--wpg-muted);
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.wpg-mode-nav-icon {
    display: none;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.wpg-mode-nav-label-short {
    display: none;
}

.wpg-mode-nav-btn:hover {
    color: var(--wpg-ink);
}

.wpg-mode-nav-btn.is-active {
    background: var(--wpg-surface);
    color: var(--wpg-ink);
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-mode-nav-btn .wpg-count-badge {
    position: static;
    margin-left: 2px;
}

.wpg-shell {
    flex: 1;
    display: flex;
    min-height: 0;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.wpg-shell-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wpg-shell-main > * {
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.wpg-app-nav {
    display: flex;
    flex-direction: column;
    width: 13.5rem;
    min-width: 13.5rem;
    height: 100%;
    padding: 12px 8px 16px;
    background: var(--wpg-surface);
    border-right: 1px solid var(--wpg-line);
    z-index: 45;
    box-sizing: border-box;
}

.wpg-app-nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: none;
}

.wpg-app-nav-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--wpg-line);
}

.wpg-app-nav-footer:not(:has(.wpg-app-nav-item:not(.hidden))) {
    display: none;
}

.wpg-app-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: var(--wpg-radius-sm);
    background: transparent;
    color: var(--wpg-muted);
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    text-decoration: none;
    box-sizing: border-box;
}

.wpg-app-nav-item:hover {
    background: #f9fafb;
    color: var(--wpg-ink);
}

.wpg-app-nav-item.is-active {
    background: var(--wpg-brand-soft);
    color: var(--wpg-brand);
    border-color: var(--wpg-brand-border);
}

.wpg-app-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.wpg-app-nav-item .wpg-count-badge {
    position: static;
    margin-left: auto;
}

.wpg-app-nav-backdrop {
    display: none;
}

.wpg-header-search {
    position: relative;
    flex: 1 1 180px;
    max-width: 420px;
    min-width: 140px;
    z-index: 60;
}

.wpg-search-overlay-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wpg-search-overlay-bar .wpg-search-wrap {
    flex: 1;
    min-width: 0;
}

.wpg-icon-btn.wpg-search-toggle,
.wpg-icon-btn.wpg-search-close {
    display: none;
}

.wpg-search-toggle svg {
    width: 20px;
    height: 20px;
}

.wpg-global-search-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    background: var(--wpg-surface);
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-md);
    box-shadow: var(--wpg-shadow-md);
    padding: 6px 0;
}

.wpg-global-search-panel.hidden {
    display: none !important;
}

.wpg-global-search-section + .wpg-global-search-section {
    border-top: 1px solid var(--wpg-line);
    margin-top: 4px;
    padding-top: 4px;
}

.wpg-global-search-heading {
    margin: 0;
    padding: 6px 12px 2px;
    font-size: 11px;
    font-weight: 800;
    color: var(--wpg-subtle);
    letter-spacing: 0.04em;
}

.wpg-global-search-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--wpg-ink);
}

.wpg-global-search-item:hover,
.wpg-global-search-item.is-active {
    background: var(--wpg-brand-soft);
}

.wpg-global-search-kind {
    flex-shrink: 0;
    margin-top: 1px;
    min-width: 36px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}

.wpg-global-search-kind.is-event {
    background: #dbeafe;
    color: #1e40af;
}

.wpg-global-search-kind.is-app {
    background: #fef3c7;
    color: #92400e;
}

.wpg-global-search-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.wpg-global-search-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.wpg-global-search-meta {
    font-size: 11px;
    color: var(--wpg-muted);
    line-height: 1.35;
}

.wpg-global-search-empty {
    padding: 16px 12px;
    font-size: 12px;
    color: var(--wpg-muted);
    text-align: center;
}

.wpg-header-user {
    display: none;
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    color: var(--wpg-muted);
    white-space: nowrap;
}

@media (min-width: 768px) {
    .wpg-header-user {
        display: inline;
    }
}

.wpg-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: var(--wpg-radius-sm);
    color: var(--wpg-muted);
    background: transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.wpg-icon-btn:hover {
    background: #f3f4f6;
    color: var(--wpg-ink);
}

/* PCでは機能一覧レールが常時表示のためハンバーガー不要 */
@media (min-width: 768px) {
    .wpg-app-nav-toggle,
    #appNavToggleBtn {
        display: none !important;
    }
}

.wpg-count-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--wpg-danger);
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    line-height: 16px;
    text-align: center;
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-sidebar {
    display: flex;
    flex-direction: column;
    width: 16rem;
    min-width: 16rem;
    height: 100%;
    padding: var(--wpg-space-4);
    background: var(--wpg-surface);
    border-right: 1px solid var(--wpg-line);
    overflow-y: auto;
    z-index: 40;
    transition: all 0.3s ease;
}

.wpg-sidebar-admin {
    width: 12.5rem;
    min-width: 12.5rem;
    padding: 12px 10px;
}

.wpg-sidebar-admin .wpg-nav {
    gap: 10px;
}

.wpg-sidebar-admin .wpg-nav-section {
    gap: 2px;
}

.wpg-sidebar-admin .wpg-nav-heading {
    padding: 4px 10px 2px;
    font-size: 10px;
}

.wpg-sidebar-admin .wpg-nav-item {
    gap: 0;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 600;
}

/* 管理ナビは絵文字を隠し、文字だけにする */
.wpg-sidebar-admin .wpg-nav-item > span:first-child:not(:only-child) {
    display: none;
}

@media (max-width: 767px) {
    .wpg-sidebar {
        position: absolute;
        box-shadow: var(--wpg-shadow-md);
    }
}

.wpg-sidebar-stack {
    display: flex;
    flex-direction: column;
    gap: var(--wpg-space-5);
    flex: 1;
}

.wpg-sidebar-section {
    display: flex;
    flex-direction: column;
}

.wpg-sidebar-divider {
    padding-top: var(--wpg-space-3);
    border-top: 1px solid var(--wpg-line);
}

.wpg-section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--wpg-space-2);
}

.wpg-section-title-row .wpg-section-title {
    margin-bottom: 0;
}

.wpg-search-wrap {
    position: relative;
}

.wpg-search-wrap .wpg-search-icon {
    position: absolute;
    inset: 0 auto 0 0;
    display: flex;
    align-items: center;
    padding-left: 10px;
    color: var(--wpg-subtle);
    pointer-events: none;
    font-size: var(--wpg-text-sm);
}

.wpg-search-wrap .wpg-input {
    padding-left: 2rem;
}

.wpg-filter-list {
    display: flex;
    flex-direction: column;
    gap: var(--wpg-space-1);
}

.wpg-filter-list-scroll {
    max-height: 12rem;
    overflow-y: auto;
    padding-right: 4px;
}

#my-group-filters .wpg-filter-row.is-active {
    background: color-mix(in srgb, var(--wpg-brand, #ff6b00) 12%, transparent);
    border-radius: 6px;
}

.wpg-filter-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border: 1px solid #f3f4f6;
    border-radius: var(--wpg-radius-sm);
    background: #f9fafb;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.wpg-filter-row:hover {
    background: #f3f4f6;
    border-color: var(--wpg-line);
}

.wpg-filter-label {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.wpg-filter-swatch {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex-shrink: 0;
}

.wpg-filter-name {
    font-size: var(--wpg-text-sm);
    font-weight: 500;
    color: var(--wpg-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wpg-overflow-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--wpg-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.wpg-overflow-btn:hover {
    background: #e5e7eb;
    color: var(--wpg-ink);
}

.wpg-overflow-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 2px);
    z-index: 50;
    width: 12rem;
    overflow: hidden;
    background: var(--wpg-surface);
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    box-shadow: var(--wpg-shadow-md);
}

.wpg-overflow-menu-head {
    display: flex;
    justify-content: flex-end;
    padding: 4px 6px 0;
}

.wpg-overflow-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--wpg-ink);
    font-size: var(--wpg-text-sm);
    cursor: pointer;
}

.wpg-overflow-item:hover {
    background: #f9fafb;
}

.wpg-nav {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.wpg-nav-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wpg-nav-heading {
    padding: 0 12px;
    color: var(--wpg-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.wpg-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--wpg-radius-sm);
    background: transparent;
    color: var(--wpg-muted);
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.wpg-nav-item:hover {
    background: #f9fafb;
    color: var(--wpg-ink);
}

.wpg-nav-item.menu-active {
    background: var(--wpg-brand-soft);
    color: var(--wpg-brand);
    border-color: var(--wpg-brand-border);
}

.wpg-nav-item-spaced {
    margin-top: var(--wpg-space-4);
}

.wpg-export-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
    font-size: var(--wpg-text-xs);
    color: var(--wpg-muted);
    background: #f9fafb;
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-export-btn:hover {
    background: #f3f4f6;
    color: var(--wpg-ink);
}


.wpg-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(17, 24, 39, 0.45);
    backdrop-filter: blur(4px);
}

@media (min-width: 768px) {
    .wpg-sheet-backdrop {
        align-items: center;
        padding: var(--wpg-space-4);
    }
}

@media (min-width: 768px) {
    .wpg-sheet-backdrop.is-centered {
        align-items: flex-start;
        justify-content: center;
        overflow: auto;
        padding: var(--wpg-space-4);
    }
}

.wpg-sheet-backdrop.z-approval { z-index: 120; }
.wpg-sheet-backdrop.z-app-form { z-index: 130; }
.wpg-sheet-backdrop.z-app-detail { z-index: 140; }

.wpg-sheet-close {
    border: none;
    background: transparent;
    color: var(--wpg-subtle);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.wpg-sheet-close:hover {
    color: var(--wpg-ink);
}

/* Tailwind の .hidden と display 指定クラスの衝突回避 */
.wpg-nav-item.hidden,
.wpg-app-nav-item.hidden,
.wpg-nav-section.hidden,
.wpg-btn.hidden,
.wpg-count-badge.hidden,
.wpg-sheet-backdrop.hidden {
    display: none !important;
}

.wpg-sidebar.hidden,
.wpg-cal-filters.hidden {
    display: none !important;
}

@media (min-width: 768px) {
    #admin-sidebar.wpg-sidebar.hidden {
        display: flex !important;
        flex-direction: column;
    }
}

html.wpg-admin-embed .wpg-app-header,
html.wpg-admin-embed #admin-sidebar.wpg-sidebar.hidden,
html.wpg-admin-embed #adminSidebarBackdrop {
    display: none !important;
}

html.wpg-admin-embed body,
html.wpg-admin-embed .wpg-admin-page {
    background: var(--wpg-bg);
}

.wpg-apps-settings-frame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 0;
    background: var(--wpg-bg);
}

.wpg-apps-subnav-btn.hidden {
    display: none !important;
}

/* backdrop / フィルタは board-panel 内。直下セレクタだと .hidden が効かず常時グレーになる */
#calendar-workspace .wpg-sidebar-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 35;
    background: rgba(17, 24, 39, 0.45);
    backdrop-filter: blur(2px);
}

#calendar-workspace .wpg-sidebar-backdrop.hidden {
    display: none !important;
}

.wpg-page.wpg-calendar-page {
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.wpg-calendar-board-panel {
    position: relative;
    min-height: 0;
}

.wpg-calendar-page .wpg-apps-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#calendar-workspace .wpg-cal-filters {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(85vw, 16rem);
    min-width: 0;
    z-index: 40;
    box-shadow: var(--wpg-shadow-md);
}


/* --- Admin (Phase 5) --- */
.wpg-admin-page {
    background: var(--wpg-bg);
    color: var(--wpg-ink);
    font-family: var(--wpg-font);
}

.wpg-admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: var(--wpg-space-4);
    background: var(--wpg-surface);
}

@media (min-width: 768px) {
    .wpg-admin-main {
        padding: 16px;
    }
}

.wpg-admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--wpg-space-3);
    flex-shrink: 0;
    padding-bottom: var(--wpg-space-3);
    margin-bottom: var(--wpg-space-3);
    border-bottom: 1px solid #f3f4f6;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--wpg-surface);
}

.wpg-admin-toolbar-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-width: 0;
}

.wpg-admin-toolbar-left > .wpg-subtabs,
.wpg-admin-toolbar-row {
    display: flex;
    align-items: center;
    gap: var(--wpg-space-3);
    flex-wrap: wrap;
}

.wpg-admin-toolbar-actions {
    display: flex;
    align-items: center;
    gap: var(--wpg-space-2);
    flex-shrink: 0;
}

.wpg-admin-view-title {
    margin: 0;
    font-size: var(--wpg-text-xl);
    font-weight: 700;
    color: var(--wpg-ink);
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.wpg-admin-view-hint {
    margin: 4px 0 0;
    font-size: var(--wpg-text-sm);
    font-weight: 400;
    color: var(--wpg-muted);
    line-height: 1.5;
}

.wpg-admin-view-hint:empty {
    display: none;
}


.wpg-subtabs {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: var(--wpg-space-2);
    padding: 3px;
    background: #f3f4f6;
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
}

.wpg-subtab {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--wpg-muted);
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.wpg-subtab:hover {
    color: var(--wpg-ink);
}

.wpg-subtab.is-active,
.wpg-subtab.subtab-active {
    background: var(--wpg-surface);
    color: var(--wpg-brand);
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-admin-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--wpg-space-2);
    flex-shrink: 0;
    margin-bottom: var(--wpg-space-4);
    padding: var(--wpg-space-3);
    background: #f9fafb;
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
}

.wpg-admin-filter-brand {
    background: var(--wpg-brand-soft);
    border-color: #ffedd5;
}

.wpg-admin-filter-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--wpg-muted);
    text-transform: uppercase;
}

.wpg-admin-filter-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--wpg-muted);
    white-space: nowrap;
}

.wpg-admin-filter-brand .wpg-admin-filter-label,
.wpg-admin-filter-brand > span {
    color: #9a3412;
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    text-transform: none;
}

.wpg-admin-filter-control {
    border: 1px solid #d1d5db;
    border-radius: var(--wpg-radius-sm);
    padding: 6px 10px;
    font-size: var(--wpg-text-sm);
    color: var(--wpg-ink);
    background: var(--wpg-surface);
}

.wpg-admin-filter-control:focus {
    outline: none;
    border-color: var(--wpg-brand);
}

.wpg-admin-dump {
    flex-shrink: 0;
    margin-bottom: var(--wpg-space-3);
}

.wpg-admin-dump-details {
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    background: #f9fafb;
    padding: 0 12px 10px;
}

.wpg-admin-dump-details > summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: var(--wpg-muted);
    padding: 10px 0;
    list-style: none;
}

.wpg-admin-dump-details > summary::-webkit-details-marker {
    display: none;
}

.wpg-admin-dump-details > summary::before {
    content: '▸ ';
}

.wpg-admin-dump-details[open] > summary::before {
    content: '▾ ';
}

.wpg-admin-dump-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--wpg-space-2);
}

.wpg-admin-dump .wpg-help-text {
    margin: 0;
    flex: 1 1 16rem;
}

.wpg-admin-dump #debug-dump-area {
    margin-top: 10px;
}

.wpg-admin-settings-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 2px 12px;
    max-width: 52rem;
}

.wpg-admin-settings-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wpg-admin-settings-title {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    color: var(--wpg-ink);
}

.wpg-admin-settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wpg-settings-panel-stack {
    display: block;
    padding: 8px 14px;
}

.mm-kind-row {
    align-items: flex-start;
    padding: 8px 0;
}

.mm-kind-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mm-kind-label {
    font-weight: 700;
    color: var(--wpg-ink);
    font-size: 13px;
}

.wpg-admin-log-detail {
    font-size: 12px;
    color: #374151;
    line-height: 1.45;
}

.wpg-admin-log-error {
    margin-top: 4px;
    padding: 6px 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #b91c1c;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10px;
    line-height: 1.4;
    word-break: break-all;
}

.wpg-admin-table-wrap {
    flex: 1;
    width: 100%;
    overflow: auto;
    background: var(--wpg-surface);
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-md);
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-admin-bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0 0 10px;
    padding: 8px 12px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--wpg-radius-md);
    font-size: var(--wpg-text-sm);
    position: sticky;
    top: 3.25rem;
    z-index: 4;
}

.wpg-admin-bulk-bar.hidden {
    display: none;
}

.wpg-admin-bulk-count {
    color: #9a3412;
    font-weight: 700;
}

.wpg-admin-bulk-user-fields,
.wpg-admin-bulk-extras {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 6px 8px;
}

.wpg-admin-bulk-user-fields.hidden {
    display: none;
}

.wpg-admin-bulk-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--wpg-muted);
}

.wpg-admin-bulk-field .wpg-input,
.wpg-admin-bulk-field .wpg-input-sm {
    min-width: 7.5rem;
}

.wpg-org-subordinates {
    display: none;
}

.wpg-admin-popover {
    position: absolute;
    z-index: 30;
    min-width: 12rem;
    max-width: 18rem;
    max-height: 14rem;
    overflow: auto;
    margin-top: 4px;
    padding: 8px 10px;
    background: var(--wpg-surface);
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    box-shadow: var(--wpg-shadow-md);
    font-size: 12px;
    color: #4b5563;
    line-height: 1.5;
}

.wpg-admin-popover.hidden {
    display: none;
}

.wpg-admin-reports-cell {
    position: relative;
}

.wpg-org-preview {
    margin: 6px 0 0;
    font-size: 13px;
    color: #1f2937;
}

.wpg-admin-special-host {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wpg-admin-special-host.hidden {
    display: none;
}

.wpg-access-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: auto;
    padding-bottom: 16px;
}

.wpg-access-privileges,
.wpg-access-toolbar,
.wpg-access-custom,
.wpg-access-detail {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    padding: 12px;
}

.wpg-access-privileges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
}

.wpg-access-privileges-note {
    color: #6b7280;
}

.wpg-access-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.wpg-access-group-title {
    margin: 12px 0 6px;
    font-size: 13px;
    font-weight: 600;
}

.wpg-access-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    text-align: left;
    gap: 2px;
    padding: 8px 10px;
    border: 0;
    border-left: 2px solid transparent;
    background: transparent;
    cursor: pointer;
}

.wpg-access-row.is-active {
    border-left-color: #ff6b00;
    background: rgba(15, 23, 42, 0.04);
}

.wpg-access-row-name {
    font-weight: 600;
    font-size: 14px;
}

.wpg-access-row-meta,
.wpg-access-legacy {
    color: #6b7280;
    font-size: 12px;
}

.wpg-access-assigns {
    list-style: none;
    margin: 8px 0;
    padding: 0;
}

.wpg-access-assign {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.wpg-access-form,
.wpg-access-custom-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: end;
}

.wpg-access-checks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
}

.wpg-access-check {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
}

.wpg-access-detail-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.wpg-access-detail-head h3,
.wpg-access-custom h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

@media (max-width: 800px) {
    .wpg-access-layout {
        grid-template-columns: 1fr;
    }
}

.wpg-view-perm-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
}

.wpg-view-perm-toolbar {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wpg-view-perm-presets {
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    background: #f9fafb;
    padding: 0 12px;
}

.wpg-view-perm-presets > summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--wpg-ink);
    padding: 10px 0;
    list-style: none;
}

.wpg-view-perm-presets > summary::-webkit-details-marker {
    display: none;
}

.wpg-view-perm-presets > summary::before {
    content: '▸ ';
    color: var(--wpg-muted);
}

.wpg-view-perm-presets[open] > summary::before {
    content: '▾ ';
}

.wpg-view-perm-presets-body {
    padding: 0 0 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wpg-view-perm-presets-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.wpg-view-perm-preview {
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    background: var(--wpg-surface);
    padding: 10px 12px;
}

.wpg-view-perm-preview .wpg-label {
    margin-bottom: 4px;
}

.wpg-view-perm-tools {
    margin: 12px 0;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.wpg-view-matrix-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--wpg-line);
    border-radius: 8px;
    background: var(--wpg-surface);
}

.wpg-view-matrix {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    min-width: 100%;
}

.wpg-view-matrix th,
.wpg-view-matrix td {
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    padding: 6px 8px;
    text-align: center;
    white-space: nowrap;
}

.wpg-view-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f9fafb;
    font-weight: 700;
    color: var(--wpg-muted);
}

.wpg-view-matrix-corner,
.wpg-view-matrix tbody th {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
    text-align: left;
    min-width: 10.5rem;
    max-width: 12rem;
}

.wpg-view-matrix thead .wpg-view-matrix-corner {
    z-index: 3;
    background: #f9fafb;
    vertical-align: bottom;
}

.wpg-view-matrix-filters {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 9.5rem;
}

.wpg-view-matrix-filters .wpg-input-sm {
    min-width: 0;
    width: 100%;
    font-size: 12px;
    padding: 4px 8px;
}

.wpg-view-matrix-colhead .wpg-view-matrix-col {
    display: inline-flex;
    align-items: center;
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wpg-view-matrix-depth {
    display: inline-block;
    width: calc(var(--depth, 0) * 0.55rem);
    flex-shrink: 0;
}

.wpg-view-matrix .is-filtered-out {
    display: none;
}

.wpg-view-matrix-row,
.wpg-view-matrix-col {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.wpg-view-matrix-rank {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: #9ca3af;
}

.wpg-view-matrix input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.wpg-admin-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    padding: 2px 6px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    font-weight: 700;
}

.wpg-admin-rank-pills {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.wpg-admin-pill {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.wpg-admin-table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    text-align: left;
}

.wpg-admin-th-row {
    background: #fafafa;
    border-bottom: 1px solid var(--wpg-line);
    text-align: left;
    font-size: var(--wpg-text-md);
    font-weight: 700;
    color: var(--wpg-muted);
    text-transform: none;
    letter-spacing: 0;
}

.wpg-admin-th,
.wpg-admin-td {
    padding: 8px 10px;
    vertical-align: middle;
}

.wpg-admin-th.is-actions,
.wpg-admin-td.is-actions {
    width: 3.25rem;
    text-align: center;
    position: sticky;
    right: 0;
    background: inherit;
    z-index: 1;
}

.wpg-admin-th-row .wpg-admin-th.is-actions {
    background: #f9fafb;
    z-index: 2;
}

.wpg-admin-tr {
    border-bottom: 1px solid #f3f4f6;
    font-size: var(--wpg-text-lg);
    color: #374151;
    transition: background-color 0.12s ease;
    background: var(--wpg-surface);
}

.wpg-admin-tr:hover {
    background: #f9fafb;
}

.wpg-admin-tr.is-compact {
    font-size: 12px;
}

.wpg-admin-name {
    font-weight: 700;
    color: var(--wpg-ink);
}

.wpg-admin-name.is-clickable {
    color: #2563eb;
    cursor: pointer;
}

.wpg-admin-name.is-clickable:hover {
    text-decoration: underline;
}

.wpg-admin-name.is-brand {
    color: var(--wpg-brand);
}

.wpg-admin-name.is-plain {
    color: var(--wpg-ink);
    cursor: default;
}

.wpg-admin-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--wpg-muted);
    font-size: 13px;
}

.wpg-admin-empty.is-error {
    color: #b91c1c;
}

.wpg-admin-action {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.wpg-admin-action.is-edit {
    color: #2563eb;
}

.wpg-admin-action.is-edit:hover {
    text-decoration: underline;
}

.wpg-admin-action.is-delete {
    color: #dc2626;
}

.wpg-admin-action.is-delete:hover {
    text-decoration: underline;
}

.wpg-admin-row-menu {
    position: relative;
    display: inline-flex;
    justify-content: center;
}

.wpg-admin-row-menu-btn {
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--wpg-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.wpg-admin-row-menu-btn:hover,
.wpg-admin-row-menu.is-open .wpg-admin-row-menu-btn {
    background: #f3f4f6;
    border-color: var(--wpg-line);
    color: var(--wpg-ink);
}

.wpg-admin-row-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 2px);
    z-index: 40;
    min-width: 10.5rem;
    padding: 4px;
    background: var(--wpg-surface);
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    box-shadow: var(--wpg-shadow-md);
}

.wpg-admin-row-menu-panel.hidden {
    display: none;
}

.wpg-admin-row-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--wpg-ink);
    cursor: pointer;
}

.wpg-admin-row-menu-item:hover {
    background: #f3f4f6;
}

.wpg-admin-row-menu-item.is-danger {
    color: #dc2626;
}

.wpg-admin-row-menu-item.is-danger:hover {
    background: #fef2f2;
}

.wpg-admin-tree-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding-left: calc(var(--depth, 0) * 1.1rem);
}

.wpg-admin-tree-toggle {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border: 1px solid var(--wpg-line);
    border-radius: 4px;
    background: #fff;
    color: var(--wpg-muted);
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.wpg-admin-tree-toggle:hover {
    border-color: #d1d5db;
    color: var(--wpg-ink);
}

.wpg-admin-tree-toggle.is-leaf {
    visibility: hidden;
    pointer-events: none;
}

.wpg-admin-tree-name {
    min-width: 0;
}

.wpg-admin-muted {
    color: #9ca3af;
}

.wpg-admin-dept-indent {
    color: var(--wpg-subtle);
    letter-spacing: -0.05em;
}

.wpg-admin-step {
    font-weight: 700;
    text-align: center;
    color: var(--wpg-brand);
    background: var(--wpg-brand-soft);
}

.wpg-settings-panel {
    width: 100%;
    background: var(--wpg-surface);
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    overflow: hidden;
}

.wpg-settings-row {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    align-items: center;
    gap: var(--wpg-space-2);
    padding: 14px;
    border-bottom: 1px solid var(--wpg-line);
    font-size: var(--wpg-text-sm);
    background: var(--wpg-surface);
}

.wpg-settings-row:last-child {
    border-bottom: none;
}

.wpg-settings-row.is-two {
    grid-template-columns: 150px 1fr;
}

.wpg-settings-key {
    font-weight: 700;
    color: #374151;
}

.wpg-settings-val {
    color: #4b5563;
    padding-left: var(--wpg-space-4);
}

.wpg-settings-val.is-muted {
    color: var(--wpg-subtle);
}

.wpg-settings-val.is-alert {
    color: var(--wpg-danger);
    font-weight: 700;
}

.mm-kind-block + .mm-kind-block {
    border-top: 1px solid var(--wpg-line);
}

.mm-digest-when {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 0 0 10px 28px;
}

.mm-digest-when-label {
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    color: #374151;
}

.wpg-settings-val > .mm-digest-when {
    padding-left: 0;
}

.wpg-hour-guide-input {
    width: 5.5rem;
    display: inline-block;
    text-align: right;
    margin-right: 4px;
}

.wpg-admin-panel {
    max-width: 42rem;
    padding: var(--wpg-space-5);
    background: var(--wpg-surface);
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-md);
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-admin-panel-block + .wpg-admin-panel-block {
    margin-top: var(--wpg-space-5);
    padding-top: var(--wpg-space-5);
    border-top: 1px solid #f3f4f6;
}

.wpg-admin-panel-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: var(--wpg-text-lg);
    font-weight: 700;
    color: var(--wpg-ink);
}

.wpg-btn-danger {
    background: var(--wpg-danger);
    color: #fff;
    border: 1px solid var(--wpg-danger);
}

.wpg-btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.wpg-input.is-readonly {
    background: #f3f4f6;
    color: var(--wpg-subtle);
    cursor: not-allowed;
}

.wpg-modal-sm {
    width: 100%;
    max-width: 24rem;
    padding: var(--wpg-space-5);
}

.wpg-modal-md {
    width: 100%;
    max-width: 42rem;
}

.wpg-modal-lg {
    width: min(720px, 94vw);
    max-height: 90vh;
}

/* 管理の追加・編集。中身が画面より高いときは本文だけスクロールし、見出しとボタンは残す。 */
#addModal .wpg-card {
    display: flex;
    flex-direction: column;
    width: min(40rem, calc(100vw - 2rem));
    max-width: min(40rem, calc(100vw - 2rem));
    max-height: calc(100svh - 2rem);
    margin: auto;
    overflow: hidden;
    box-sizing: border-box;
}

#addModal .wpg-modal-header,
#addModal .wpg-card > .flex {
    flex-shrink: 0;
}

#addModal #modal-fields {
    min-height: 0;
    overflow-y: auto;
}

.wpg-field-stack {
    display: flex;
    flex-direction: column;
    gap: var(--wpg-space-3);
}

.wpg-field-stack .wpg-input,
.wpg-field-stack .wpg-input-sm {
    margin-bottom: 0;
}

.wpg-subtabs.hidden,
.wpg-admin-filter.hidden,
#addModal.hidden,
#facility-sub-tabs.hidden,
#worksite-sub-tabs.hidden,
#audit-filter-container.hidden,
#audit-dump-container.hidden,
#workflow-filter-container.hidden,
#sort-btn.hidden,
#add-btn.hidden,
#debug-dump-area.hidden,
#wf-target-area.hidden,
#dualKeyError.hidden {
    display: none !important;
}


/* ==========================================
   📱 スマホ向け UI 改善
   ========================================== */
.wpg-sidebar-backdrop {
    display: none;
}

@media (max-width: 767px) {
    .wpg-sidebar-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 35;
        background: rgba(17, 24, 39, 0.45);
        backdrop-filter: blur(2px);
    }

    .wpg-sidebar-backdrop.hidden {
        display: none !important;
    }

    .wpg-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(85vw, 16rem);
        min-width: 0;
        z-index: 40;
        box-shadow: var(--wpg-shadow-md);
    }

    .wpg-sidebar-admin {
        width: min(85vw, 14rem);
        min-width: 0;
    }

    .wpg-app-nav-backdrop {
        display: block;
        position: fixed;
        top: var(--wpg-header-h, 3.75rem);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 70;
        background: rgba(17, 24, 39, 0.45);
        backdrop-filter: blur(2px);
    }

    .wpg-app-nav-backdrop.hidden {
        display: none !important;
    }

    .wpg-app-nav {
        display: none;
        position: fixed;
        top: var(--wpg-header-h, 3.75rem);
        left: 0;
        bottom: auto;
        height: auto;
        max-height: calc(100dvh - var(--wpg-header-h, 3.75rem));
        width: min(85vw, 16rem);
        min-width: 0;
        z-index: 71;
        overflow-y: auto;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        box-shadow: var(--wpg-shadow-md);
        border-bottom-right-radius: var(--wpg-radius-lg);
    }

    .wpg-app-nav.is-open {
        display: flex;
    }

    .wpg-app-header {
        z-index: 72;
    }

    body.app-nav-open .wpg-fab {
        visibility: hidden;
        pointer-events: none;
    }

    /* タップ領域 44px 以上 */
    .wpg-icon-btn {
        width: 44px;
        height: 44px;
    }

    .wpg-sheet-close {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* ヘッダーは1行。検索はオーバーレイ、機能切替はハンバーガー */
    body {
        --wpg-header-h: 3.75rem;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .wpg-app-header {
        padding: var(--wpg-space-2);
        gap: var(--wpg-space-2);
        flex-wrap: nowrap;
    }

    .wpg-header-left {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
    }

    .wpg-header-title {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .wpg-header-actions {
        flex: 0 0 auto;
        margin-left: auto;
        gap: 4px;
    }

    .wpg-header-more {
        position: relative;
    }

    .wpg-header-more-btn {
        display: inline-flex !important;
        width: 44px;
        height: 44px;
        font-size: 1.35rem;
        font-weight: 700;
        line-height: 1;
        color: var(--wpg-ink);
    }

    .wpg-header-more-panel {
        display: none;
        position: absolute;
        right: 0;
        top: calc(100% + 4px);
        z-index: 70;
        min-width: 11rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 6px 0;
        background: var(--wpg-surface);
        border: 1px solid var(--wpg-line);
        border-radius: var(--wpg-radius-md);
        box-shadow: var(--wpg-shadow-md);
    }

    .wpg-header-more.is-open .wpg-header-more-panel {
        display: flex;
    }

    .wpg-header-more-panel .wpg-header-more-item {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        min-height: 44px;
        padding: 10px 14px;
        border: none;
        border-radius: 0;
        box-shadow: none;
        text-decoration: none;
        box-sizing: border-box;
        font-size: 16px;
        background: transparent;
    }

    .wpg-header-more-panel .wpg-btn-dark {
        color: var(--wpg-ink);
        background: transparent;
    }

    .wpg-header-more-panel .wpg-btn-danger-text {
        color: var(--wpg-danger);
        justify-content: flex-start;
        padding: 10px 14px;
        font-size: 16px;
    }

    .wpg-icon-btn.wpg-search-toggle,
    .wpg-icon-btn.wpg-search-close {
        display: inline-flex;
        flex-shrink: 0;
    }

    .wpg-header-search {
        display: none;
        order: 0;
        flex: none;
        max-width: none;
        min-width: 0;
    }

    .wpg-header-search.is-open {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 80;
        background: var(--wpg-surface);
        padding: 10px 12px 16px;
        gap: 8px;
    }

    .wpg-header-search.is-open .wpg-global-search-panel {
        position: static;
        top: auto;
        max-height: none;
        flex: 1;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }

    .wpg-mode-switch {
        flex-shrink: 0;
        margin-left: 4px;
    }

    .wpg-mode-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-height: 36px;
    }

    /* 申請モーダル → ボトムシート（本文はスクロール） */
    .wpg-sheet-backdrop.is-centered {
        align-items: flex-end;
        padding: 0;
    }

    .wpg-sheet-detail,
    .wpg-sheet-form,
    .wpg-sheet-lg {
        width: 100%;
        max-width: 100%;
        height: min(92dvh, 100%);
        max-height: 92dvh;
        border-radius: var(--wpg-radius-lg) var(--wpg-radius-lg) 0 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .wpg-sheet-form .wpg-sheet-body,
    .wpg-sheet-detail .wpg-sheet-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: var(--wpg-space-3);
        gap: var(--wpg-space-3);
    }

    .wpg-detail-panel {
        padding: var(--wpg-space-4);
    }

    .wpg-detail-panel.is-paper {
        padding: var(--wpg-space-4);
    }

    .wpg-route-box {
        padding: var(--wpg-space-4);
    }

    .wpg-form-field {
        margin-bottom: 0;
        gap: 8px;
    }

    .wpg-form-fields {
        gap: var(--wpg-space-4);
    }

    .wpg-paper-title {
        font-size: var(--wpg-text-lg);
        padding-right: 0;
    }

    .wpg-input-line-title {
        font-size: 16px;
    }

    .wpg-sheet-footer {
        flex-wrap: nowrap;
        gap: var(--wpg-space-2);
        padding: var(--wpg-space-3);
        padding-bottom: calc(var(--wpg-space-3) + env(safe-area-inset-bottom, 0px));
    }

    .wpg-sheet-footer .wpg-btn {
        min-height: 44px;
        flex: 1;
        justify-content: center;
        gap: 6px;
    }

    #proxyApplicantSection .wpg-option {
        align-items: flex-start;
        gap: 10px;
    }

    #proxyApplicantSection .wpg-option strong {
        font-size: 16px;
        line-height: 1.45;
        font-weight: 700;
    }

    /* 入力ボックスの文字: スマホは 16px に揃える
       12–13px だとラベルとの差が大きく、iOS はフォーカス時にズームし、
       Chrome の端末エミュレータではネイティブの選択ピッカーが極小になる */
    .wpg-input,
    .wpg-input-sm,
    .wpg-input-compact,
    .wpg-input-line,
    .wpg-admin-filter-control {
        font-size: 16px;
        min-height: 44px;
        line-height: 1.25;
    }

    .wpg-input::placeholder,
    .wpg-input-compact::placeholder,
    .wpg-input-line::placeholder {
        color: #9ca3af;
        font-size: 16px;
    }

    .wpg-input-compact {
        padding: 10px;
    }

    select.wpg-input,
    select.wpg-input-compact,
    select.wpg-admin-filter-control {
        font-size: 16px;
    }

    select.wpg-input option,
    select.wpg-input-compact option {
        font-size: 16px;
    }

    .wpg-field-label {
        font-size: 16px;
    }

    .wpg-option,
    .wpg-option-row {
        font-size: 16px;
        line-height: 1.45;
    }

    .wpg-summary-text {
        font-size: 16px;
    }

    .wpg-filter-name {
        font-size: 16px;
    }

    .wpg-filter-row {
        min-height: 44px;
        padding: 8px 10px;
    }

    .wpg-btn-sm {
        font-size: 14px;
        min-height: 40px;
    }

    .wpg-group-select-row .wpg-btn {
        min-height: 44px;
        font-size: 14px;
    }

    .wpg-picker-box .selected-item,
    .wpg-picker-box .candidate-item {
        font-size: 16px;
        padding: 10px 12px;
    }

    .wpg-picker-caption {
        font-size: 12px;
    }

    /* 日時入力行: 日付は全幅、時:分は1行に横並び */
    .wpg-datetime-row {
        flex-direction: column;
        align-items: stretch;
    }

    .wpg-datetime-label {
        width: auto;
        font-size: 16px;
    }

    .wpg-time-sep {
        font-size: 16px;
    }

    .wpg-datetime-row > .wpg-input-compact[type="date"] {
        width: 100%;
        min-width: 0;
    }

    .wpg-time-pair {
        width: 100%;
    }

    .wpg-time-pair .wpg-input-compact {
        flex: 1 1 0;
        min-width: 0;
    }

    /* 参加者ピッカー */
    .wpg-picker-box.is-candidates {
        height: 120px;
    }

    .wpg-picker-box.is-selected {
        height: 8rem;
    }

    /* 申請カードのアクション */
    .wpg-app-card-actions {
        flex-direction: column;
    }

    .wpg-app-card-actions .wpg-btn {
        flex: none;
        width: 100%;
        min-height: 44px;
        font-size: var(--wpg-text-sm);
        padding: 10px 14px;
    }

    .wpg-app-card-title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* 月カレンダー「＋他 N 件」 */
    .wpg-cal-more {
        min-height: 36px;
        padding: 6px 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .wpg-cal-event-block,
    .wpg-cal-event-line {
        min-height: 28px;
        padding-top: 4px;
        padding-bottom: 4px;
    }

    /* 管理画面 */
    .wpg-admin-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--wpg-space-2);
    }

    .wpg-admin-toolbar-actions {
        flex-wrap: wrap;
        gap: var(--wpg-space-2);
    }

    .wpg-admin-toolbar-actions .wpg-btn {
        min-height: 40px;
    }

    .wpg-admin-table {
        min-width: 320px;
    }

    .wpg-admin-th,
    .wpg-admin-td {
        padding: 10px 8px;
        font-size: var(--wpg-text-sm);
    }

    .wpg-admin-filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .wpg-admin-filter-row .wpg-admin-filter-control,
    .wpg-admin-filter-row .min-w-\[200px\] {
        min-width: 0 !important;
        width: 100%;
    }

    /* ソートモーダル */
    .wpg-sort-modal {
        width: calc(100% - 2rem);
        max-height: min(85dvh, 520px);
        height: auto;
    }

    /* FAB は画面右下（セーフエリアの上） */
    .wpg-fab {
        right: calc(1rem + env(safe-area-inset-right, 0px));
        bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }

    /* カレンダーツールバー */
    .wpg-cal-main {
        padding: var(--wpg-space-2);
    }

    .wpg-cal-view-btn {
        min-height: 40px;
        font-size: 11px;
    }

    .wpg-subnav-btn,
    .wpg-apps-subnav-btn {
        min-height: 44px;
    }
}

/* --- 階層部署ピッカー --- */
.wpg-dept-picker,
.wpg-dept-multi {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wpg-dept-selected {
    font-size: var(--wpg-text-xs);
    color: var(--wpg-muted);
    line-height: 1.4;
}

.wpg-dept-selected strong {
    color: var(--wpg-ink);
    font-weight: 700;
}

.wpg-dept-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: var(--wpg-text-xs);
}

.wpg-dept-crumb {
    border: none;
    background: transparent;
    color: var(--wpg-info);
    font-weight: 700;
    cursor: pointer;
    padding: 2px 4px;
}

.wpg-dept-crumb:hover {
    text-decoration: underline;
}

.wpg-dept-crumb-sep {
    color: var(--wpg-subtle);
}

.wpg-dept-list,
.wpg-dept-multi-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    background: var(--wpg-surface);
}

.wpg-dept-picker-host .wpg-dept-list {
    max-height: 220px;
}

.wpg-dept-picker-host .wpg-dept-item {
    padding: 8px 10px;
}

.wpg-dept-picker-host .wpg-dept-item-name {
    font-size: var(--wpg-text-sm);
}

/* マイグループ / 共有グループ（部署フィルターと同じ select） */
.wpg-group-select-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wpg-group-select-row .wpg-input {
    flex: 1;
    min-width: 0;
}

.wpg-group-select-row .wpg-btn {
    flex-shrink: 0;
    padding: 6px 10px;
    white-space: nowrap;
}

.wpg-group-select-row .wpg-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.wpg-dept-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #f3f4f6;
}

.wpg-dept-row:last-child,
.wpg-dept-item:last-child {
    border-bottom: none;
}

.wpg-dept-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    flex: 1;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.wpg-dept-row .wpg-dept-item {
    border-bottom: none;
}

.wpg-dept-item:hover,
.wpg-dept-drill:hover {
    background: #f9fafb;
}

.wpg-dept-item.is-active {
    background: var(--wpg-brand-soft);
}

.wpg-dept-item-name {
    font-size: var(--wpg-text-md);
    font-weight: 700;
    color: var(--wpg-ink);
}

.wpg-dept-item-path,
.wpg-dept-item-hint {
    font-size: 10px;
    color: var(--wpg-muted);
}

.wpg-dept-drill {
    flex: 0 0 44px;
    border: none;
    border-left: 1px solid #f3f4f6;
    background: transparent;
    color: var(--wpg-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.wpg-dept-empty {
    padding: 16px 12px;
    font-size: var(--wpg-text-sm);
    color: var(--wpg-subtle);
    text-align: center;
}

.wpg-dept-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: var(--wpg-text-sm);
    color: var(--wpg-ink);
    cursor: pointer;
}

.wpg-dept-check:hover {
    background: #f9fafb;
}

.wpg-dept-tree-name {
    display: inline-block;
}

.wpg-org-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 16rem;
    overflow: auto;
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-sm);
    background: var(--wpg-surface);
    padding: 8px;
}

.wpg-org-menu.is-muted {
    opacity: 0.65;
}

.wpg-org-list {
    display: flex;
    flex-direction: column;
}

.wpg-org-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--wpg-ink);
    font-size: var(--wpg-text-sm);
}

.wpg-org-item:hover {
    background: #f9fafb;
}

.wpg-org-item.is-active {
    background: var(--wpg-brand-soft);
    font-weight: 700;
}

.wpg-org-check {
    width: 1.1rem;
    color: var(--wpg-brand);
    font-weight: 700;
}

.wpg-org-label {
    flex: 1;
    min-width: 0;
}

.wpg-org-divider {
    height: 1px;
    margin: 4px 8px;
    background: var(--wpg-line);
}



.wpg-subnav,
.wpg-apps-subnav {
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    gap: 0;
    overflow-x: auto;
    padding: 0 12px;
    background: var(--wpg-surface);
    border-bottom: 1px solid var(--wpg-line);
    scrollbar-width: none;
}

.wpg-subnav::-webkit-scrollbar,
.wpg-apps-subnav::-webkit-scrollbar {
    display: none;
}

.wpg-subnav-btn,
.wpg-apps-subnav-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--wpg-muted);
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.wpg-subnav-btn:hover,
.wpg-apps-subnav-btn:hover {
    color: var(--wpg-ink);
    background: #fafafa;
}

.wpg-subnav-btn.is-active,
.wpg-apps-subnav-btn.is-active {
    color: var(--wpg-brand);
    border-bottom-color: var(--wpg-brand);
}

/* ==========================================
   🖨️ 【可用性・UX強化】A4用紙印刷・PDF出力最適化スタイル
   ========================================== */
@media print {
    header,
    aside,
    button,
    #admin-nav-btn,
    .wpg-cal-toolbar,
    .wpg-cal-nav,
    .wpg-cal-views,
    .wpg-mode-switch,
    .wpg-mode-nav,
    .wpg-app-nav,
    .wpg-apps-workspace,
    .wpg-work-workspace,
    .wpg-projects-workspace,
    .wpg-page,
    .wpg-fab {
        display: none !important;
    }

    body,
    .flex,
    main,
    .wpg-shell,
    .wpg-shell-main,
    .wpg-cal-main,
    .wpg-cal-stage,
    #custom-month-view,
    #custom-week-view,
    #custom-day-view {
        height: auto !important;
        width: 100% !important;
        overflow: visible !important;
        position: static !important;
        background: transparent !important;
        color: #000 !important;
    }

    .overflow-y-auto,
    .overflow-auto,
    .scrollbar-hide {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    .grid {
        display: grid !important;
        page-break-inside: avoid;
    }

    div[style*="width:"] {
        width: 100% !important;
    }

    div, span, [style] {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/*
 * メニュー画面の共通見出し（カレンダー以外）。
 * 新規画面は .wpg-page-head / .wpg-page-title / .wpg-page-lead を使う。
 * 見出しは 16px、説明は 12px。操作ボタンは右。左右の内側余白は 16px。
 */
.wpg-page-head,
.wpg-apps-home-header {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--wpg-space-3);
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    padding: 16px 16px 12px;
}

.wpg-page-head-copy {
    flex: 1 1 16rem;
    min-width: min(100%, 12rem);
}

.wpg-page-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
}

.wpg-page-title,
.wpg-apps-home-title,
.wpg-projects-title,
.wpg-work-title,
.wpg-admin-view-title {
    margin: 0;
    font-size: var(--wpg-text-xl);
    font-weight: 700;
    color: var(--wpg-ink);
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.wpg-page-lead,
.wpg-apps-home-lead,
.wpg-projects-lead,
.wpg-admin-view-hint {
    margin: 4px 0 0;
    font-size: var(--wpg-text-sm);
    font-weight: 400;
    color: var(--wpg-muted);
    line-height: 1.5;
}

.wpg-reminders-workspace {
    overflow: hidden;
}

.wpg-reminders-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.wpg-reminders-panel.hidden {
    display: none !important;
}

.wpg-reminders-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0 16px 16px;
}

.wpg-reminders-table-wrap {
    overflow: auto;
    background: var(--wpg-surface);
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-md);
    box-shadow: var(--wpg-shadow-sm);
}

.wpg-reminders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--wpg-text-sm);
}

.wpg-reminders-table th,
.wpg-reminders-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.wpg-reminders-table th {
    font-size: var(--wpg-text-md);
    font-weight: 700;
    color: var(--wpg-muted);
    background: #fafafa;
}

.wpg-reminders-table td {
    font-size: var(--wpg-text-lg);
    color: var(--wpg-ink);
}

.wpg-reminders-table td.is-actions {
    text-align: right;
    white-space: nowrap;
}

.wpg-reminders-code {
    font-size: 0.75rem;
    background: #f3f4f6;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
}

.wpg-page.wpg-top {
    overflow: hidden;
    padding: 0;
}

.wpg-top-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wpg-top-band,
.wpg-top-panel {
    background: var(--wpg-surface);
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-md);
    min-width: 0;
}

.wpg-top-panel-head {
    padding: 10px 14px;
    font-size: var(--wpg-text-md);
    font-weight: 700;
    color: var(--wpg-ink);
    border-bottom: 1px solid var(--wpg-line);
}

.wpg-top-split {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 12px;
    align-items: start;
}

.wpg-top-notice-list {
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 0;
}

.wpg-top-notice-list > .wpg-empty-state,
.wpg-top-today > .wpg-empty-state {
    display: block;
    list-style: none;
    padding: 16px;
}

.wpg-top-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    color: var(--wpg-ink);
    font-size: var(--wpg-text-lg);
    line-height: 1.5;
    border-top: 1px solid var(--wpg-line);
}

.wpg-top-panel-head + .wpg-top-notice-list > .wpg-top-notice:first-child,
.wpg-top-band .wpg-top-notice-list > .wpg-top-notice:first-child {
    border-top: 0;
}

.wpg-top-notice.is-important {
    background: var(--wpg-brand-soft);
}

.wpg-top-notice-dot {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 99px;
    background: var(--wpg-brand);
    flex: none;
}

.wpg-top-notice-dot.is-empty {
    background: transparent;
}

.wpg-top-notice-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wpg-top-notice-title {
    font-weight: 700;
}

.wpg-top-notice-flag {
    color: var(--wpg-brand);
    margin-right: 6px;
}

.wpg-top-notice-body {
    color: var(--wpg-ink);
}

.wpg-top-notice-file {
    display: inline-block;
    margin-top: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--wpg-info);
    font-size: var(--wpg-text-sm);
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
}

.wpg-top-notice-time {
    flex: none;
    font-size: var(--wpg-text-sm);
    color: var(--wpg-muted);
    padding-top: 2px;
}

.wpg-top-today-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--wpg-line);
}

.wpg-top-panel-head + .wpg-top-today > .wpg-top-today-row:first-child {
    border-top: 0;
}

.wpg-top-today-copy {
    flex: 1;
    min-width: 0;
}

.wpg-top-today-label {
    margin: 0;
    font-size: var(--wpg-text-sm);
    color: var(--wpg-muted);
}

.wpg-top-today-value {
    margin: 2px 0 0;
    font-size: var(--wpg-text-lg);
    font-weight: 700;
    color: var(--wpg-ink);
}

.wpg-top-today-go {
    flex: none;
    font-size: var(--wpg-text-sm);
    color: var(--wpg-muted);
    text-decoration: none;
}

.wpg-top-today-go:hover {
    color: var(--wpg-brand);
}

@media (max-width: 900px) {
    .wpg-top-split {
        grid-template-columns: minmax(0, 1fr);
    }
}

.wpg-page.wpg-personnel {
    overflow: hidden;
    padding: 0;
}

.wpg-personnel .wpg-apps-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.wpg-staff-panel {
    overflow: hidden;
    width: 100%;
    min-width: 0;
    padding: 0;
    background: var(--wpg-bg);
    font-size: var(--wpg-text-lg);
    line-height: 1.5;
    color: var(--wpg-ink);
}

.wpg-staff-panel > .wpg-admin-table-wrap,
.wpg-staff-panel > .wpg-staff-body,
.wpg-staff-panel > .wpg-staff-form,
.wpg-staff-panel > #staff-person-editor {
    align-self: stretch;
    width: auto;
    max-width: none;
    min-width: 0;
    box-sizing: border-box;
}

.wpg-staff-panel .wpg-admin-table-wrap {
    margin: 0 16px 16px;
    flex: 1 1 auto;
    min-height: 8rem;
    min-width: 0;
}

.wpg-staff-panel .wpg-admin-table {
    width: 100%;
    min-width: 0;
    max-width: none;
    table-layout: fixed;
}

.wpg-staff-panel .wpg-admin-th-row {
    text-transform: none;
    letter-spacing: 0;
    font-size: var(--wpg-text-md);
    font-weight: 700;
    color: var(--wpg-ink);
}

.wpg-staff-panel .wpg-admin-th,
.wpg-staff-panel .wpg-admin-td {
    white-space: normal;
    overflow-wrap: break-word;
    max-width: none;
    font-size: var(--wpg-text-lg);
    color: var(--wpg-ink);
}

.wpg-staff-panel .wpg-admin-th {
    font-size: var(--wpg-text-md);
    font-weight: 700;
    color: var(--wpg-muted);
}

.wpg-staff-panel .wpg-admin-th.is-actions,
.wpg-staff-panel .wpg-admin-td.is-actions {
    position: static;
    width: auto;
}

.wpg-staff-panel .wpg-admin-tr {
    font-size: var(--wpg-text-lg);
}

.wpg-staff-panel .wpg-admin-empty {
    font-size: var(--wpg-text-lg);
    font-weight: 500;
    text-align: left;
    color: var(--wpg-muted);
    padding: 20px 12px;
}

.wpg-staff-body {
    width: 100%;
    padding: 0 16px 24px;
    overflow: auto;
    box-sizing: border-box;
}

.wpg-staff-grid {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
    gap: 16px;
    align-items: stretch;
}

.wpg-staff-card {
    background: var(--wpg-surface);
    border: 1px solid var(--wpg-line);
    border-radius: var(--wpg-radius-md);
    box-shadow: var(--wpg-shadow-sm);
    padding: 16px;
    min-width: 0;
}

.wpg-staff-card-title {
    margin: 16px 0 8px;
    font-size: var(--wpg-text-lg);
    font-weight: 700;
    color: var(--wpg-ink);
}

.wpg-staff-card-title:first-child,
.wpg-staff-form .wpg-staff-card-title {
    margin-top: 0;
}

.wpg-staff-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: var(--wpg-text-lg);
    line-height: 1.6;
    color: var(--wpg-ink);
}

.wpg-staff-note {
    margin: 0;
    font-size: var(--wpg-text-lg);
    line-height: 1.6;
    font-weight: 400;
    color: var(--wpg-muted);
}

.wpg-staff-stat {
    margin: 0 0 8px;
    font-size: var(--wpg-text-lg);
    line-height: 1.5;
    color: var(--wpg-ink);
}

.wpg-staff-stat strong {
    font-size: var(--wpg-text-xl);
    font-weight: 700;
    color: var(--wpg-ink);
}

.wpg-staff-panel .wpg-staff-card p,
.wpg-staff-panel .wpg-staff-check,
.wpg-staff-panel .wpg-input,
.wpg-staff-panel .wpg-input-sm,
.wpg-staff-panel .wpg-btn-sm {
    font-size: var(--wpg-text-lg);
}

.wpg-staff-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}

.wpg-staff-field {
    width: min(100%, 16rem);
    margin-bottom: 0;
}

.wpg-staff-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: flex-end;
    margin: 0 16px 12px;
}

.wpg-staff-card .wpg-staff-form,
#staff-person-editor .wpg-staff-form {
    margin: 12px 0 0;
}

#staff-person-editor:empty {
    display: none;
}

#staff-person-editor:not(:empty) {
    padding: 0 16px 12px;
}

.wpg-staff-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

@media (max-width: 767px) {
    .wpg-staff-grid {
        grid-template-columns: 1fr;
    }

    .wpg-staff-panel .wpg-admin-table {
        min-width: 0;
    }
}

.wpg-comm-checks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.wpg-comm-checks-label {
    margin: 4px 0;
    font-size: var(--wpg-text-sm);
    font-weight: 700;
    color: var(--wpg-subtle);
}

@media (max-width: 767px) {
    .wpg-page-head,
    .wpg-reminders-list,
    .wpg-top-body {
        padding-left: 12px;
        padding-right: 12px;
    }
}


