:root {
    --accent: #1f8f5f;
    --accent-weak: rgba(31, 143, 95, 0.12);
    --header-h: 50px;
}

body {
    color: #555555;
}

button, input, optgroup, select, textarea {
    font-size: 14px;
}

small {
    font-size: 12px;
}

.app-body {
    margin: 0;
    background: #f5f7fa;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: #ffffff;
    border-bottom: 1px solid #e6e6e6;
    z-index: 1000;
}

.app-header__inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.app-brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.app-header__actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.app-main {
    padding-top: var(--header-h);
}

.app-container {
    padding: 18px;
}

.app-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.app-link:hover {
    text-decoration: underline;
}

.app-button {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    line-height: 1;
    margin-right: 20px;
    width: 120px;
    text-align: center;
}

.app-button--ghost {
    background: transparent;
    color: var(--accent);
}

.login-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 18px;
    align-items: start;
}

.card {
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.card__title {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.app-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.app-card__header h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.app-card__body {
    font-size: 0.95rem;
}

.muted {
    color: #60646b;
}

.app-json-textarea {
    height: 300px;
    resize: vertical; /* 伸ばしたいなら。固定なら none */
}

.app-form-scroll {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px; /* スクロールバー分の余白 */
}

.app-field-row {
    align-items: stretch;
    margin-bottom: 2px;
}

.app-field-box {
    -webkit-appearance: none;
    background-color: transparent;
    border: 0.1rem solid #d1d1d1;
    border-radius: .4rem;
    box-shadow: none;
    box-sizing: inherit;
    height: 3.8rem;
    padding: .6rem 1.0rem .7rem;
    width: 100%;
    background-color: #f0fff0;
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.5rem;
}

.app-field-help {
    font-weight: normal;
    font-size: 1.2rem;
    line-height: 1.2;
}

#apiResult {
    color: #555555;
    font-size: 12px;
    background-color: #f0fff0;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px; /* スクロールバー分の余白 */
}

.app-plan__section-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.app-plan__btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.app-plan__toggle-btn {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    height: 3.2rem;
    margin-bottom: 0;
}

.app-plan__toggle-btn.is-active {
    background: var(--accent);
    color: #fff;
}

.app-plan__help {
    color: #60646b;
    font-size: 12px;
    margin-top: 6px;
}

.app-plan__season-panel {
    margin-top: 10px;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.app-plan__season-title {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 700;
    color: #555;
}

.app-plan__table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.app-plan__table th {
    background: #fafafa;
    font-weight: 700;
    white-space: nowrap;
}

.app-plan__table th,
.app-plan__table td {
    padding: 10px 12px;
    vertical-align: middle;
}

.app-plan__input {
    margin: 0;
    width: 100%;
}

.app-plan__col-handle { width: 70px; }
.app-plan__col-no     { width: 70px; }
.app-plan__col-block  { width: 140px; }
.app-plan__col-date   { width: 170px; }
.app-plan__col-variety{ width: 220px; }
.app-plan__col-area   { width: 140px; }

.app-plan__drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid #d1d1d1;
    border-radius: 8px;
    background: #fff;
    cursor: grab;
    font-size: 16px;
    line-height: 1;
}

.season-row.is-dragging {
    opacity: 0.55;
}

.season-row.is-drop-target {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

/* seasonPanels と 右側JSONを “同じ高さ” にする（履歴/シーズンボタンは除外） */
.app-plan__panels-row {
    align-items: stretch;
}

/* row直下のカラムを縦flexにして中身を100%にできるようにする */
.app-plan__panels-row > .column {
    display: flex;
    flex-direction: column;
}

/* 左右とも「中の箱」を伸ばす */
#seasonPanels {
    flex: 1;
    min-height: 0;
}

.app-plan__sidejson {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* textareaをピッタリ同じ高さまで伸ばす */
#seasonJson {
    flex: 1;
    min-height: 0;
    resize: none; /* 任意：ユーザが伸ばして崩れるのを防ぐ */
    overflow-y: scroll;
}

/* app-plan.css 追記：横幅変化は右側(JSON)優先にする */

/* seasonPanels + JSON の行 */
.app-plan__panels-row {
    align-items: stretch;
}

/* Milligramの .column-70/.column-30 を上書きして
    左(フォーム)は固定寄り、右(JSON)が伸縮担当にする */
.app-plan__panels-row > .column.column-70 {
    flex: 0 0 900px;        /* ← フォーム側の基準幅（好みで調整） */
    max-width: 900px;
}

.app-plan__panels-row > .column.column-30 {
    flex: 1 1 auto;         /* 右側が伸縮 */
    max-width: none;
    min-width: 260px;       /* 右が潰れすぎない最低幅（任意） */
}

.swal2-popup {
    font-size: 1.6rem;
}
.swal2-confirm, .swal2-cancel {
    padding: 1px 10px;
    width: 150px;
}
.swal2-input {
    width: 400px;
    font-size: 16px;
    margin: 0;
    padding: 6px 8px !important;
}
.swal2-textarea {
    width: 100%;
    font-size: 16px;
    margin: 0;
    padding: 6px 8px !important;
}

/* 画面が狭い時は縦積みに戻す（既存のレスポンシブ挙動と整合） */
@media screen and (max-width: 1100px) {
    .app-plan__panels-row {
        flex-direction: column;
        gap: 20px;
    }
    .app-plan__panels-row > .column.column-70,
    .app-plan__panels-row > .column.column-30 {
        flex: 0 0 auto;
        max-width: 100%;
        min-width: 0;
    }
    #seasonJson {

        min-height: 280px;   /* ← 好みで調整（例：280〜400px） */
    }
}
