/* static/css/personnel_calc.css */

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background: #f6f8fb;
    color: #111827;
    font-family: 'M PLUS 1p', sans-serif;
}

.page {
    width: 90%;
    max-width: 84rem;
    margin: 0 auto;
    padding: 0.75rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* =========================
   Header
========================= */

.personnel-header-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 32vw);
    gap: 1rem;
    align-items: start;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.personnel-header-left,
.personnel-header-right {
    min-width: 0;
}

.personnel-header-left {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.page-header h1 {
    margin: 0 0 0.5rem;
    font-size: 2.5rem;
    line-height: 1.3;
    color: #111827;
}

.page-header p {
    margin: 0 0 0.5rem;
    color: #1f2a44;
    line-height: 1.6;
    font-size: 1rem;
}

.page-note {
    font-size: 0.85rem;
    color: #666666;
}

.personnel-notice-card {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 0.125rem 0.5rem rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.personnel-notice-accordion {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.personnel-notice-accordion::after {
    content: "▲";
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #4b5563;
}

.personnel-notice-accordion.is-collapsed::after {
    content: "▼";
}

.personnel-notice-title {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #374151;
    border-bottom: 0.0625rem solid #edf2f7;
    background: #fbfdff;
}

.personnel-notice-body {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    line-height: 1.8;
    color: #4b5563;
}

.personnel-notice-body p {
    margin: 0;
}

.personnel-notice-accordion.is-collapsed .personnel-notice-body {
    display: none;
}

.personnel-notice-accordion.is-collapsed .personnel-notice-title {
    border-bottom: none;
}

.personnel-ad-slot {
    width: 100%;
    min-height: 6.25rem;
    border: 0.0625rem dashed #cfc7a4;
    border-radius: 0.75rem;
    background: #ffffff;
    padding: 0.75rem;
    box-sizing: border-box;
}

.personnel-adsense {
    display: block;
    width: 100%;
    min-height: 5.5rem;
}

/* =========================
   Card
========================= */

.card {
    background: #ffffff;
    border-radius: 1.25rem;
    padding: 1rem;
    box-shadow: 0 0.125rem 0.5rem rgba(15, 23, 42, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    color: #222222;
}

.card-header p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #4b5563;
}

/* =========================
   Form Layout
========================= */

.personnel-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
    gap: 1rem;
    align-items: start;
}

.split-input {
    min-width: 0;
}

.split-help {
    min-width: 0;
    background: #f8fbff;
    border: 0.0625rem solid #dbe4f0;
    border-radius: 1rem;
    padding: 1rem;
    box-sizing: border-box;
}

.split-help h3 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: #1f2a44;
}

.split-help p {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #4b5563;
}

.split-help p:last-child {
    margin-bottom: 0;
}

.help-note {
    font-weight: 700;
    color: #1d4ed8;
    background: #eef4ff;
    border-radius: 0.625rem;
    padding: 0.625rem;
}

/* =========================
   Dynamic Blocks
========================= */

.input-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.project-block,
.employee-block {
    background: #fbfdff;
    border: 0.0625rem solid #dbe4f0;
    border-radius: 1rem;
    padding: 1rem;
    box-sizing: border-box;
}

.project-block > div:first-child,
.employee-block > div:first-child {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.875rem;
}

.employee-project-ratios {
    grid-column: 1 / -1;
    background: #ffffff;
    border: 0.0625rem solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.875rem;
}

.employee-project-ratios p {
    margin: 0 0 0.625rem;
    color: #1f2a44;
}

.employee-project-ratios > div {
    margin-bottom: 0.625rem;
}

.employee-project-ratios > div:last-child {
    margin-bottom: 0;
}

/* =========================
   Inputs
========================= */

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #374151;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 0.0625rem solid #d6deeb;
    border-radius: 0.5rem;
    padding: 0.75rem 0.9375rem;
    background: #ffffff;
    color: #1f2a44;
    font-size: 0.9375rem;
    line-height: 1.4;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #9eb8ef;
    box-shadow: 0 0 0 0.1875rem rgba(47, 106, 230, 0.18);
}

/* =========================
   Buttons
========================= */

.primary-btn,
.secondary-btn,
.delete-btn {
    border-radius: 0.5rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.primary-btn {
    width: 100%;
    border: 0.0625rem solid #2f6ae6;
    background: #2f6ae6;
    color: #ffffff;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    box-shadow: 0 0.25rem 0.75rem rgba(47, 106, 230, 0.18);
}

.primary-btn:hover {
    background: #2559c7;
    border-color: #2559c7;
    transform: translateY(-0.0625rem);
}

.secondary-btn {
    flex: 0 0 auto;
    border: 0.0625rem solid #2f6ae6;
    background: #ffffff;
    color: #2f6ae6;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
}

.secondary-btn:hover {
    background: #eef4ff;
    transform: translateY(-0.0625rem);
}

.delete-btn {
    width: 100%;
    margin-top: 0.875rem;
    border: 0.0625rem solid #f1c0c0;
    background: #fffafa;
    color: #b42318;
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
}

.delete-btn:hover {
    background: #fff1f1;
    border-color: #e19a9a;
    transform: translateY(-0.0625rem);
}

.form-actions {
    margin-top: 0.25rem;
}

/* =========================
   Result
========================= */

.result-card h3 {
    margin: 1.25rem 0 0.75rem;
    font-size: 1rem;
    color: #222222;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.875rem;
    margin-bottom: 1rem;
}

.summary-item {
    background: #f8fbff;
    border: 0.0625rem solid #dbe4f0;
    border-radius: 0.875rem;
    padding: 0.875rem;
}

.summary-item span {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    color: #64748b;
}

.summary-item strong {
    font-size: 1.15rem;
    color: #111827;
}

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

.result-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #ffffff;
}

.result-table th,
.result-table td {
    border: 0.0625rem solid #d1d5db;
    padding: 0.75rem;
    vertical-align: top;
    box-sizing: border-box;
    font-size: 0.9rem;
}

.result-table th {
    background: #f2f2f2;
    text-align: center;
    font-weight: 700;
    color: #222222;
}

.result-table td {
    color: #1f2937;
}

.total-row {
    font-weight: 700;
    background: #f8fafc;
}

.direct-total {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.breakdown-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.breakdown-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 4rem 7rem;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 0.0625rem solid #e5e7eb;
}

.breakdown-list li:last-child {
    border-bottom: none;
}

.breakdown-list span,
.breakdown-list strong {
    word-break: break-word;
}

/* =========================
   Guide Link
========================= */

.guide-link {
    margin: 0.5rem 0 0;
    text-align: center;
    color: #4b5563;
}

.guide-link a {
    color: #2f6ae6;
    font-weight: 700;
}

.help-step {
    margin-top: 1rem;
    padding: 0.875rem;
    background: #ffffff;
    border: 0.0625rem solid #dbe4f0;
    border-radius: 0.75rem;
}

.help-step h4 {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: #1f2a44;
}

.help-step p {
    margin-bottom: 0.75rem;
}

.help-step p:last-child {
    margin-bottom: 0;
}

/* =========================
   Responsive
   ※ 左入力・右解説はモバイルでも維持
========================= */

@media (max-width: 48rem) {
    .page {
        width: auto;
        padding: 0.625rem 0.75rem 1rem;
        gap: 0.875rem;
    }

    .personnel-header-layout {
        grid-template-columns: 1fr;
        margin-top: 1rem;
    }

    .personnel-header-right {
        order: -1;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 0.75rem;
        border-radius: 1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .secondary-btn {
        width: 100%;
    }

    .split-layout {
        grid-template-columns: minmax(0, 1.35fr) minmax(8rem, 1fr);
        gap: 0.75rem;
    }

    .split-help {
        padding: 0.75rem;
        border-radius: 0.875rem;
    }

    .split-help h3 {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }

    .split-help p {
        font-size: 0.75rem;
        line-height: 1.5;
        margin-bottom: 0.5rem;
    }

    .help-note {
        padding: 0.5rem;
    }

    .project-block > div:first-child,
    .employee-block > div:first-child {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .result-table {
        min-width: 42rem;
    }

    .breakdown-list li {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
}

@media (max-width: 36rem) {
    .page-header h1 {
        font-size: 1.75rem;
    }

    .split-layout {
        grid-template-columns: minmax(0, 1.25fr) minmax(7rem, 1fr);
        gap: 0.5rem;
    }

    .split-help {
        padding: 0.625rem;
    }

    .split-help h3 {
        font-size: 0.8rem;
    }

    .split-help p {
        font-size: 0.7rem;
        line-height: 1.45;
    }

    input[type="text"],
    input[type="number"] {
        font-size: 0.875rem;
        padding: 0.625rem 0.75rem;
    }

    .primary-btn,
    .secondary-btn,
    .delete-btn {
        font-size: 0.875rem;
    }

    .result-table th,
    .result-table td {
        padding: 0.5rem;
        font-size: 0.8125rem;
    }
}