:root {
    --app-bg: #f4f9fb;
    --app-surface: #ffffff;
    --app-ink: #172033;
    --app-muted: #657089;
    --app-line: #dfe6f1;
    --app-primary: #058fc2;
    --app-primary-dark: #05617f;
    --app-accent: #20b8c7;
    --app-orange: #ef7622;
    --app-danger: #d6455d;
    --app-shadow: 0 12px 32px rgba(31, 48, 87, 0.09);
    --app-control-height: 43px;
    --app-control-font-size: 1rem;
    --app-control-radius: 9px;
    --app-control-border: #bfd0d7;
    --app-control-placeholder: #98a8b2;
    --app-control-focus: #0d94b0;
    --app-control-focus-shadow: 0 0 0 4px rgba(13, 148, 176, 0.12);
    --app-control-compact-height: 36px;
    --app-control-compact-font-size: 0.85rem;
}

/* Common validation */
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
    border-color: #d94357 !important;
    background-color: #fff6f7 !important;
    box-shadow: 0 0 0 3px rgba(217, 67, 87, 0.14) !important;
}

.validation-field__error {
    margin: 5px 0 0;
    color: #c9364d;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.45;
}

/* モーダル表示でスクロールを固定しても、バー幅による横ずれを発生させない */
html {
    scrollbar-gutter: stable;
}

/* Shared application shell */
.app-shell {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(180deg, #eef8fb 0, #f4f7fa 280px, #eef2f6 100%);
    color: var(--app-ink);
    font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
}

/*
 * Shared form-control baseline.
 * :where() keeps specificity at zero so dense tables and screen-specific
 * controls can deliberately override the standard size.
 */
:where(
    .app-shell input[type="text"],
    .app-shell input[type="date"],
    .app-shell input[type="time"],
    .app-shell input[type="number"],
    .app-shell input[type="email"],
    .app-shell input[type="password"],
    .app-shell input[type="search"],
    .app-shell select
) {
    box-sizing: border-box;
    min-height: var(--app-control-height);
    border: 1px solid var(--app-control-border);
    border-radius: var(--app-control-radius);
    outline: none;
    background-color: #ffffff;
    color: var(--app-ink);
    font-family: inherit;
    font-size: var(--app-control-font-size);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

:where(
    .app-shell input[type="text"],
    .app-shell input[type="date"],
    .app-shell input[type="time"],
    .app-shell input[type="number"],
    .app-shell input[type="email"],
    .app-shell input[type="password"],
    .app-shell input[type="search"],
    .app-shell select
):focus {
    border-color: var(--app-control-focus);
    box-shadow: var(--app-control-focus-shadow);
}

/* 入力済みの値と例示を見分けやすくする共通プレースホルダー */
:where(
    .app-shell input[type="text"],
    .app-shell input[type="date"],
    .app-shell input[type="time"],
    .app-shell input[type="number"],
    .app-shell input[type="email"],
    .app-shell input[type="password"],
    .app-shell input[type="search"],
    .app-shell textarea,
    .app-shell .app-control
)::placeholder {
    color: var(--app-control-placeholder);
    opacity: 1;
}

.app-control {
    box-sizing: border-box;
    min-height: var(--app-control-height);
    border: 1px solid var(--app-control-border);
    border-radius: var(--app-control-radius);
    outline: none;
    background-color: #ffffff;
    color: var(--app-ink);
    font: inherit;
    font-size: var(--app-control-font-size);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.app-control:focus {
    border-color: var(--app-control-focus);
    box-shadow: var(--app-control-focus-shadow);
}

.app-control--compact {
    min-height: var(--app-control-compact-height);
    font-size: var(--app-control-compact-font-size);
}

/* 8桁手入力・LocalDate送信・ネイティブカレンダーをまとめた共通日付入力 */
.app-date-field {
    min-width: 0;
}

.app-date-field__label {
    display: block;
    margin-bottom: 6px;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.app-date-input {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--app-control-height);
    min-width: 0;
}

.app-date-input__text {
    width: 100%;
    min-width: 0;
    padding: 0 12px;
    border-radius: var(--app-control-radius) 0 0 var(--app-control-radius) !important;
    letter-spacing: .04em;
}

.app-date-input__calendar {
    box-sizing: border-box;
    display: grid;
    min-width: var(--app-control-height);
    min-height: var(--app-control-height);
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--app-control-border);
    border-left: 0;
    border-radius: 0 var(--app-control-radius) var(--app-control-radius) 0;
    padding: 0;
    background: linear-gradient(180deg, #f8fcfd, #eaf5f7);
    appearance: none;
    font: inherit;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.app-date-input__calendar-icon {
    width: 17px;
    height: 16px;
    box-sizing: border-box;
    border: 2px solid #168ca7;
    border-radius: 3px;
}

.app-date-input__calendar-icon::before {
    content: "";
    display: block;
    height: 4px;
    margin: 2px -2px 0;
    border-top: 2px solid #168ca7;
}

.app-date-input__picker {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    pointer-events: none;
    opacity: 0;
}

.app-date-input:focus-within .app-date-input__calendar {
    border-color: var(--app-control-focus);
    box-shadow: 0 0 0 4px rgba(13, 148, 176, .08);
}

.app-date-input__calendar:hover {
    background: #dff2f5;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    border-bottom: 3px solid #24b8d0;
    background:
        radial-gradient(circle at 72% -90%, rgba(255, 255, 255, 0.20), transparent 36%),
        linear-gradient(115deg, #073c56 0%, #075d7b 55%, #078db4 100%);
    box-shadow: 0 8px 28px rgba(5, 61, 85, 0.20);
}

.app-header .app-header__inner {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1600px, calc(100% - 32px));
    max-width: none;
    height: 72px;
    margin: 0 auto;
    padding: 0 8px;
    font-size: 1rem;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: #ffffff;
    text-decoration: none;
}

.app-brand__logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 154px;
    height: 46px;
    padding: 0 15px;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 7px 18px rgba(0, 35, 53, 0.20);
}

.app-brand__logo {
    display: block;
    width: 148px;
    height: auto;
}

.app-brand__copy {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.app-brand__copy strong {
    font-size: 0.96rem;
    letter-spacing: 0.08em;
}

.app-brand__copy small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.app-header .app-header__nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header .header-nav-item {
    margin-left: 0;
}

.app-user {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 13px 7px 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
}

.app-user__icon {
    position: relative;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
}

.app-user__icon::before,
.app-user__icon::after {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    content: "";
}

.app-user__icon::before {
    top: 5px;
    width: 7px;
    height: 7px;
}

.app-user__icon::after {
    bottom: 4px;
    width: 13px;
    height: 7px;
    border-radius: 8px 8px 5px 5px;
}

.app-header a.app-logout {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.78rem;
    font-weight: 800;
    transition: background 0.18s ease, color 0.18s ease;
}

.app-header a.app-logout:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.app-main {
    box-sizing: border-box;
    min-height: calc(100vh - 126px);
    padding: 22px 0 40px;
}

.app-title-row {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: min(1600px, calc(100% - 32px));
    margin: 0 auto 16px;
    padding: 0 4px;
}

.app-title-row > h1 {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #1c2942;
    font-size: clamp(1.25rem, 2.1vw, 1.8rem);
    letter-spacing: 0.025em;
}

.app-title-row > h1::before {
    display: inline-block;
    width: 9px;
    height: 25px;
    margin-right: 11px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--app-orange), var(--app-primary));
    vertical-align: -4px;
    content: "";
}

.app-breadcrumb {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 1px solid #dce4f0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 4px 12px rgba(34, 48, 79, 0.05);
    overflow: hidden;
}

.app-breadcrumb .app-home-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 13px;
    color: #52617b;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    transition: background .18s ease, color .18s ease;
}

.app-breadcrumb .app-home-link:hover {
    background: #eaf7fa;
    color: #087b99;
}

.app-home-link__icon {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 13px;
    margin-top: 2px;
    border-radius: 2px;
    background: #1395ae;
}

.app-home-link__icon::before {
    position: absolute;
    top: -5px;
    left: 1px;
    width: 10px;
    height: 10px;
    border-radius: 2px 1px 2px 1px;
    background: #1395ae;
    transform: rotate(45deg);
    content: "";
}

.app-home-link__icon::after {
    position: absolute;
    right: 2px;
    bottom: 0;
    z-index: 1;
    width: 4px;
    height: 7px;
    border-radius: 1px 1px 0 0;
    background: #ffffff;
    content: "";
}

.app-message {
    width: min(1600px, calc(100% - 32px));
    margin: 0 auto 14px;
}

.app-message .info-list,
.app-message .error-list {
    margin: 0;
    border-width: 1px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(34, 48, 79, 0.06);
}

.app-footer {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 54px;
    padding: 0 max(24px, calc((100% - 1568px) / 2));
    border-top: 1px solid #dbe3ef;
    background: #e5eef2;
    color: #7b869a;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.app-page {
    box-sizing: border-box;
    width: min(1600px, calc(100% - 32px));
    margin: 0 auto 48px;
    padding: 26px;
    border-radius: 24px;
    background: radial-gradient(circle at top right, rgba(5, 143, 194, 0.11), transparent 30%), var(--app-bg);
    color: var(--app-ink);
    font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
}

.page-heading {
    position: relative;
    margin: 0 0 22px;
    padding: 20px 24px 20px 30px;
    overflow: hidden;
    border: 1px solid rgba(5, 143, 194, 0.18);
    border-radius: 18px;
    background: linear-gradient(120deg, #073c56 0%, #067a9c 68%, #20a9c2 100%);
    box-shadow: var(--app-shadow);
    color: #ffffff;
    font-size: clamp(1.2rem, 2vw, 1.65rem);
    letter-spacing: 0.035em;
}

.page-heading::after {
    position: absolute;
    top: -48px;
    right: -20px;
    width: 180px;
    height: 180px;
    border: 28px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    content: "";
}

.content-card {
    box-sizing: border-box;
    margin-top: 20px;
    padding: 20px;
    border: 1px solid var(--app-line);
    border-radius: 18px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--app-ink);
    font-size: 1.05rem;
    letter-spacing: 0.025em;
}

.section-title::before {
    flex: 0 0 auto;
    width: 7px;
    height: 24px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--app-orange), var(--app-primary));
    content: "";
}

.form-panel {
    padding: 18px;
    border: 1px solid #dce5f5;
    border-radius: 14px;
    background: linear-gradient(135deg, #f8faff, #f2f8fb);
}

.modern-input {
    box-sizing: border-box;
    width: 100%;
    min-height: var(--app-control-height);
    padding: 9px 11px;
    border: 1px solid var(--app-control-border);
    border-radius: var(--app-control-radius);
    outline: none;
    background: #ffffff;
    color: var(--app-ink);
    font: inherit;
    font-size: var(--app-control-font-size);
    line-height: 1.4;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.modern-input:hover {
    border-color: #78a9b9;
}

.modern-input:focus {
    border-color: var(--app-control-focus);
    box-shadow: var(--app-control-focus-shadow);
}

.action-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--app-primary);
    font-size: 0.88rem;
    font-weight: 800;
    text-decoration: none;
}

.action-link::after {
    content: "→";
    transition: transform 0.18s ease;
}

.action-link:hover::after {
    transform: translateX(4px);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 760px;
    overflow: hidden;
    border: 1px solid var(--app-line);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    background: #ffffff;
    color: var(--app-ink);
    font-size: 0.88rem;
    text-align: left;
}

.data-table th {
    padding: 11px 12px;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    background: #07536d;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.025em;
    line-height: 1.4;
    text-align: left;
    white-space: nowrap;
}

.data-table--teal th {
    background: linear-gradient(135deg, #067b79, #12a694);
}

.data-table--violet th {
    background: linear-gradient(135deg, #07536d, #147f9b);
}

.data-table td {
    padding: 11px 12px;
    border: 0;
    border-bottom: 1px solid #e8edf5;
    background: #ffffff;
    color: #303b52;
    vertical-align: middle;
}

.data-table tbody tr:nth-child(even) td {
    background: #f8fafe;
}

.data-table tbody tr:hover td {
    background: #eef4ff;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.cell-number,
.cell-time {
    text-align: right !important;
    white-space: nowrap;
}

.app-page .primary-action,
.app-page .secondary-action {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 120px;
    margin: 0;
    padding: 11px 28px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.app-page .primary-action {
    border: 0;
    background: linear-gradient(135deg, var(--app-primary), #5378eb);
    box-shadow: 0 8px 18px rgba(5, 143, 194, 0.24);
    color: #ffffff;
}

.app-page .primary-action:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--app-primary-dark), var(--app-primary));
    box-shadow: 0 11px 24px rgba(5, 143, 194, 0.30);
}

.app-page .secondary-action {
    border: 1px solid #b8c3d8;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(35, 48, 77, 0.08);
    color: #4d5a72;
}

.app-page .secondary-action:hover {
    border-color: #8797b4;
    background: #eef2f8;
    color: #26334b;
}

.app-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    width: 100%;
    padding: 26px 0 4px;
}

@media (max-width: 720px) {
    .app-header .app-header__inner {
        width: calc(100% - 16px);
        height: 62px;
    }

    .app-brand__logo-wrap {
        min-width: 116px;
        height: 38px;
        padding: 0 10px;
    }

    .app-brand__logo {
        width: 112px;
    }

    .app-brand__copy strong {
        font-size: 0.82rem;
    }

    .app-brand__copy small,
    .app-user__icon {
        display: none;
    }

    .app-user {
        padding: 6px 9px;
        font-size: 0.72rem;
    }

    .app-header a.app-logout {
        min-height: 34px;
        padding: 0 10px;
        font-size: 0.7rem;
    }

    .app-main {
        padding-top: 16px;
    }

    .app-title-row {
        align-items: flex-start;
        flex-direction: column;
        width: calc(100% - 16px);
        gap: 10px;
    }

    .app-breadcrumb {
        align-self: flex-end;
    }

    .app-page {
        width: calc(100% - 16px);
        padding: 14px;
        border-radius: 16px;
    }

    .content-card {
        padding: 14px;
        border-radius: 14px;
    }

    .app-actions {
        flex-direction: column-reverse;
    }

    .app-page .primary-action,
    .app-page .secondary-action {
        width: 100%;
    }
}
