* {
    box-sizing: border-box !important;
}

body {
    margin: 0 !important;
    background: #f7f7f9 !important;
    color: #333 !important;
    font-family :
        -apple-system,
        BlinkMacSystemFont,
        "Helvetica Neue",
        "Yu Gothic",
        "Meiryo" ,
        sans-serif !important;
}

.exchange-container {
    width: min(900px, 100%);
    margin: 0 auto;
    padding: 24px 16px 60px;
}

h1 {
    margin: 0 0 24px;
    text-align: center;
    font-size: 26px;
}

h2 {
    margin: 0;
    font-size: 18px;
}

.card {
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.slot-summary {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 14px !important;
    background: #f5f5f7 !important;
    border-radius: 10px !important;
}

.slot-summary strong {
    font-size: 22px !important;
}

button {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.main-btn,
.sub-btn {
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 14px;
}

.main-btn {
    background: #333;
    color: #fff;
}

.sub-btn {
    background: #eee;
    color: #333;
}

.main-btn:hover,
.sub-btn:hover {
    opacity: .8;
}

.status-guide {
    display: flex;
    gap: 14px;
    margin: 12px 0;
    font-size: 13px;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.item-row {
    display: grid;
    grid-template-columns: 55px 1fr 80px 45px;
    align-items: center;
    gap: 8px;

    padding: 12px;
    border-radius: 9px;
    background: #f7f7f7;

    cursor: pointer;
}

.item-row:hover {
    background: #eee;
}

.item-number {
    font-size: 13px;
    color: #777;
}

.item-name {
    font-weight: 600;
}

.remaining {
    text-align: right;
    font-size: 13px;
}

.item-status {
    text-align: center;
}

.form-group {
    margin-top: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 10px 12px;

    border: 1px solid #ddd;
    border-radius: 8px;

    font-size: 16px;
    font-family: inherit;

    background: #fff;
}

input:focus {
    outline: none;
    border-color: #888;
}

.select-all-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    font-weight: normal !important;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;

    padding: 9px;
    background: #f7f7f7;
    border-radius: 7px;
}

.form-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

#partnerList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.partner-card {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 13px;
}

.partner-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.partner-name {
    font-weight: bold;
}

.partner-meta {
    margin-top: 7px;
    font-size: 13px;
    color: #666;
}

.partner-items {
    margin-top: 8px;
    font-size: 13px;
}

.partner-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.partner-actions button {
    padding: 7px 10px;
    border-radius: 7px;
    background: #eee;
    font-size: 12px;
}

.direct-card {
    padding: 10px;
    margin-top: 8px;
    background: #f7f7f7;
    border-radius: 8px;
    font-size: 13px;
}

.dialog-content {
    width: min(600px, calc(100vw - 30px));
    max-height: 85vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

dialog {
    border: none;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}

dialog::backdrop {
    background: rgba(0,0,0,.4);
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.full-btn {
    width: 100%;
    margin-top: 18px;
}

.detail-partner {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 12px;
    margin-top: 10px;
}

.detail-partner-title {
    font-weight: bold;
    margin-bottom: 8px;
}

.memo-box {
    margin-top: 10px;
}

.memo-box textarea {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
}

.written-buttons {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.written-buttons button {
    padding: 6px 9px;
    border-radius: 6px;
    background: #eee;
    font-size: 12px;
}

.exchange-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.exchange-item:last-child {
    border-bottom: none;
}

.empty {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

@media (max-width: 600px) {

    .exchange-container {
        padding: 18px 10px 40px;
    }

    .item-row {
        grid-template-columns: 45px 1fr 65px 35px;
        padding: 10px 8px;
    }

    .status-guide {
        font-size: 12px;
    }

    .section-title {
        align-items: flex-start;
    }

}

/* =========================
   枠交換メモ タブ
========================= */

.exchange-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;

    margin-bottom: 16px;

    background: #eee;
    padding: 4px;
    border-radius: 12px;
}

.exchange-tab {
    border: none;
    background: transparent;

    padding: 11px 5px;

    border-radius: 9px;

    font-family: inherit;
    font-size: 13px;
    font-weight: 600;

    color: #777;

    cursor: pointer;
}

.exchange-tab.active {
    background: #fff;
    color: #333;

    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.exchange-tab-content {
    display: none;
}

.exchange-tab-content.active {
    display: block;
}


/* スマホ */

@media (max-width: 600px) {

    .exchange-tabs {
        gap: 2px;
        padding: 3px;
    }

    .exchange-tab {
        padding: 10px 2px;
        font-size: 11px;
    }

}

.slot-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {

    .slot-buttons {
        flex-direction: column;
        align-items: stretch;
    }

}

/* =========================
   スマホ：ダイアログ調整
========================= */

@media (max-width: 600px) {

    dialog {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        padding: 16px;
    }

    .dialog-content {
        width: 100%;
        max-width: 100%;
    }

    dialog input[type="number"],
    dialog input[type="text"] {
        font-size: 16px;
    }

}

 /* =========================
    自分の項目指定
 ========================= */

.direct-item-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.direct-item-row {
    padding: 10px;
    background: #f7f7f7;
    border-radius: 8px;
}

.direct-item-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: normal !important;
}

.direct-item-setting {
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding-left: 28px;
}

.direct-all-slots-label {
    display: flex !important;
    align-items: center;
    gap: 5px;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: normal !important;
    white-space: nowrap;
}

.direct-slots-input-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}

.direct-slots-input {
    width: 90px !important;
    padding: 8px 10px !important;
    font-size: 16px !important;
    text-align: right;
}

.direct-slots-input-wrap span {
    font-size: 14px;
    white-space: nowrap;
}


/* スマホ */

@media (max-width: 600px) {

    .direct-item-row {
        padding: 10px;
    }

    .direct-item-setting {
        gap: 10px;
        padding-left: 28px;
    }

    .direct-slots-input {
        width: 80px !important;
    }

}

@media (max-width: 600px) {

    dialog {
        max-height: 90vh;
    }

    .dialog-content {
        max-height: calc(90vh - 32px);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

}

/* =========================
   自分の投票指定：ボタン
========================= */

.direct-card-buttons {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.direct-card-buttons button {
    padding: 6px 12px;
    border: none;
    border-radius: 7px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.edit-direct-btn {
    background: #eee;
    color: #333;
}

.delete-direct-btn {
    background: #f3e3e3;
    color: #b33;
}

.direct-card-buttons button:hover {
    opacity: .8;
}

@media (max-width: 600px) {

    .direct-card-buttons button {
        flex: 1;
        padding: 8px 10px;
        font-size: 13px;
    }

}

/* =========================
   自分の投票指定：文字サイズ
========================= */

.direct-card > strong {
    font-size: 16px;
}

.direct-card-items {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.7;
}

/* =========================
   記入一覧
========================= */

#writeItemList .item-row {
    display: block;
    cursor: default;
}

#writeItemList .item-row:hover {
    background: #f7f7f7;
}

#writeItemList .item-number {
    display: inline;
}

#writeItemList .item-name {
    display: inline;
    margin-left: 6px;
}

.write-entry-list {
    clear: both;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid #eee;
}

.write-entry {
    padding: 5px 0;
    font-size: 14px;
    font-weight: normal;
}

.write-empty {
    clear: both;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #aaa;
}

.written-buttons button.active {
    background: #333;
    color: #fff;
}

/* 高校生以下部門 */
.high-school-item {
    background: #fff8df !important;
}

.high-school-item:hover {
    background: #fff2c2 !important;
}

.write-talent-number {
    color: #c41e3a;
    font-weight: 800;
    font-size: 1.1em;
}

/* =========================
   タレント候補リスト
========================= */

.talent-suggestions {
    display: none;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

.talent-suggestion {
    padding: 11px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 14px;
}

.talent-suggestion:last-child {
    border-bottom: none;
}

.talent-suggestion:active {
    background: #f0f0f0;
}