.hc-shell-header {
    position: sticky;
    inset-block-start: 0;
    z-index: 70;
    padding: 0.45rem 1.25rem;
    border-block-end: 1px solid var(--hc-color-border, #e2e8f0);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.hc-shell-header--male {
    background: linear-gradient(90deg, rgba(240, 249, 255, 0.96) 0%, rgba(255, 255, 255, 0.96) 45%);
    border-block-end-color: #bae6fd;
}

.hc-shell-header--female {
    background: linear-gradient(90deg, rgba(255, 241, 242, 0.96) 0%, rgba(255, 255, 255, 0.96) 45%);
    border-block-end-color: #fecdd3;
}

.hc-shell-header__inner {
    max-inline-size: 76rem;
    margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
    align-items: center;
    gap: 0.75rem;
}

.hc-shell-header__start {
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.hc-shell-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex: 0 0 auto;
}

.hc-shell-nav__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 2rem;
    block-size: 2rem;
    border-radius: 0.5rem;
    border: 1px solid var(--hc-color-border, #e2e8f0);
    background: var(--hc-color-surface, #ffffff);
    color: #334155;
    text-decoration: none;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.hc-shell-nav__btn:hover {
    background: var(--hc-color-primary-bg, #e0f2fe);
    border-color: var(--hc-color-primary, #0284c7);
    color: var(--hc-color-primary-hover, #0369a1);
}

.hc-shell-nav__btn .material-symbols-outlined {
    font-size: 1.15rem;
    line-height: 1;
}

.hc-shell-nav__sr {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hc-shell-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.hc-shell-brand__logo {
    inline-size: 1.85rem;
    block-size: 1.85rem;
    border-radius: 0.5rem;
    border: 1px solid #bae6fd;
    background: #ffffff;
    object-fit: contain;
    flex-shrink: 0;
}

.hc-shell-brand__text {
    flex-shrink: 0;
}

.hc-shell-brand__name {
    display: none;
}

.hc-shell-brand__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--hc-color-ink-main, #0f172a);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

/* 中央：患者情報ピル（中央寄せ） */
.hc-shell-patient {
    justify-self: center;
    margin: 0;
    min-inline-size: 0;
}

.hc-shell-patient__row {
    display: inline-flex;
    align-items: baseline;
    gap: 0.7rem;
    padding: 0.25rem 0.95rem;
    border-radius: var(--hc-radius-full, 9999px);
    background: var(--hc-color-surface, #ffffff);
    border: 1px solid var(--hc-color-border, #e2e8f0);
    box-shadow: var(--hc-shadow-sm, 0 1px 2px 0 rgba(15, 23, 42, 0.04));
    flex-wrap: wrap;
    min-inline-size: 0;
}

.hc-shell-patient__title {
    display: inline-flex;
    align-items: baseline;
    flex: 0 0 auto;
    color: var(--hc-color-ink-main, #0f172a);
    white-space: nowrap;
}

.hc-shell-patient__name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--hc-color-ink-main, #0f172a);
    line-height: 1.2;
}

.hc-shell-patient__name--empty {
    font-size: 0.95rem;
    color: var(--hc-color-ink-muted, #64748b);
}

.hc-shell-patient__honorific {
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    margin-inline-start: 0.18rem;
}

.hc-shell-patient__badges {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-inline-size: 0;
    font-variant-numeric: tabular-nums;
}

.hc-shell-badge {
    display: inline-flex;
    align-items: center;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.hc-shell-badge[data-shell-field="id"]::after {
    content: "|";
    color: #cbd5e1;
    font-weight: 400;
    margin-inline-start: 0.45rem;
}

.hc-shell-badge[data-shell-field="age"] {
    margin-inline-start: -0.25rem;
}

.hc-shell-badge--gender {
    padding: 0.05rem 0.45rem;
    border-radius: var(--hc-radius-full, 9999px);
    font-size: 0.75rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
}

.hc-shell-header--male .hc-shell-badge--gender {
    background: #e0f2fe;
    color: #0369a1;
}

.hc-shell-header--female .hc-shell-badge--gender {
    background: #ffe4e6;
    color: #be123c;
}

/* 右側：カルテボタン */
.hc-shell-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 0 0 auto;
}

.hc-shell-karte-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0.75rem;
    min-block-size: 2.05rem;
    border-radius: var(--hc-radius-full, 9999px);
    border: 1px solid #fecdd3;
    background: #ffffff;
    color: #0f172a;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--hc-shadow-sm, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
    transition: background-color var(--hc-transition-base, 0.2s ease), border-color var(--hc-transition-base, 0.2s ease), color var(--hc-transition-base, 0.2s ease), box-shadow var(--hc-transition-base, 0.2s ease);
}

.hc-shell-karte-btn:hover {
    background: #fff1f2;
    border-color: #fda4af;
    color: #e11d48;
}

.hc-shell-karte-btn .header-logo-img {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hc-shell-karte-btn .header-logo-img svg {
    display: block;
    inline-size: 1.05rem;
    block-size: 1.05rem;
}

.hc-shell-karte-btn__icon {
    font-size: 0.95rem;
    line-height: 1;
    color: #94a3b8;
}

.hc-shell-karte-btn:hover .hc-shell-karte-btn__icon {
    color: #e11d48;
}

.hc-shell-footer {
    margin-block-start: 1.2rem;
    border-block-start: 1px solid var(--hc-color-border, #e2e8f0);
    background: #ffffff;
    text-align: center;
    padding: 0.85rem;
    color: #64748b;
    font-size: 0.75rem;
}

.hc-shell-footer a {
    color: var(--hc-color-primary, #0284c7);
    text-decoration: none;
}

.hc-shell-footer a:hover {
    text-decoration: underline;
}

@media print {
    .hc-shell-nav,
    .hc-shell-actions {
        display: none !important;
    }
}

@media (max-width: 56rem) {
    .hc-shell-header {
        padding: 0.45rem 0.75rem;
    }

    .hc-shell-header__inner {
        grid-template-columns: 1fr auto;
    }

    .hc-shell-patient {
        grid-column: 1 / -1;
        justify-self: center;
        order: 3;
    }
}
