/* 新デザイン基盤(カード/チップ/固定ボトムナビ)
   Pico CSS(classless)には依存しない画面向け。最低限のリセットも本ファイルで持つ。
   配色・フラットデザインの方向性は自作の家計簿アプリ(kakeibo_xserver)に寄せている。 */

:root {
    --bg: #F0F2F7;
    --panel: #FFFFFF;
    --line: rgba(0, 0, 0, .08);
    --line-strong: rgba(0, 0, 0, .18);
    --text: #1A1A2E;
    --dim: #555770;
    --faint: #898781;
    --up: #E34948;
    --down: #2A78D6;
    --accent: #D9A441;
    --accent-text: #1A1A2E;
    --radius: 8px;
    --radius-pill: 20px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1E1F26;
        --panel: #2A2B35;
        --line: rgba(255, 255, 255, .08);
        --line-strong: rgba(255, 255, 255, .18);
        --text: #E8EAF0;
        --dim: #A0A3B0;
        --faint: #666880;
    }
}

* {
    box-sizing: border-box;
}

body.theme {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.app-wrap {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 14px 32px;
}

/* PCの広い画面では表(需給・イベント・スクリーニング等)が横スクロールなしで
   全カラム見えるよう、コンテナ幅を広げる。カード一覧(トップページ等)も
   この幅の中に収まるが、行がフルwidthの.rowなので横に伸びても崩れない。 */
@media (min-width: 900px) {
    .app-wrap {
        max-width: 1200px;
    }
}

@media (min-width: 1300px) {
    .app-wrap {
        max-width: 1400px;
    }
}

.app-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.app-header {
    padding: 20px 0 14px;
    min-width: 0;
}

.app-nav-icons {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 22px;
    flex-shrink: 0;
}

body.theme a.icon-btn {
    font-size: 20px;
    line-height: 1;
    color: var(--dim);
    text-decoration: none;
}

body.theme a.icon-btn.current {
    color: var(--accent);
}

.app-header .eyebrow {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--dim);
}

.app-header h1 {
    margin: 6px 0 4px;
    font-size: 22px;
    line-height: 1.3;
}

.app-header .sub {
    margin: 0;
    color: var(--dim);
    font-size: 13px;
    line-height: 1.5;
}

.grp {
    font-size: 11px;
    font-weight: 500;
    color: var(--faint);
    letter-spacing: .04em;
    text-transform: uppercase;
    margin: 20px 2px 8px;
}

.grp:first-of-type {
    margin-top: 4px;
}

.card {
    background: var(--panel);
    border: .5px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.card + .card {
    margin-top: 10px;
}

body.theme a.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    color: var(--text);
    text-decoration: none;
}

.row + .row {
    border-top: .5px solid var(--line);
}

.row:active {
    background: var(--bg);
}

.row-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 26px;
    text-align: center;
}

.row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.row-name {
    font-size: 14.5px;
    font-weight: 500;
}

.row-desc {
    font-size: 11.5px;
    color: var(--dim);
    line-height: 1.4;
}

.row-chev {
    flex-shrink: 0;
    color: var(--faint);
    font-size: 16px;
}

.chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.chip {
    background: none;
    color: var(--dim);
    border: .5px solid var(--line-strong);
    border-radius: var(--radius-pill);
    padding: 7px 13px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.chip.on {
    background: var(--accent);
    color: var(--accent-text);
    border-color: var(--accent);
}

.text-up {
    color: var(--up);
}

.text-down {
    color: var(--down);
}


/* ここから、画面本文(テーブル・フォーム・一覧系ページ)向けの要素単位スタイル。
   個々の画面のHTMLはPico時代のまま(素のtable/input/button)でも、body.theme配下なら
   自動的にこのデザインが当たる。カード/チップは新規に作る画面向け、こちらは
   既存テーブル・フォーム資産をそのまま活かすための土台。 */

body.theme h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 22px 0 10px;
}

body.theme h3 {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--dim);
    margin: 16px 0 8px;
}

body.theme p {
    line-height: 1.6;
    margin: 0 0 10px;
}

body.theme a {
    color: var(--accent);
    text-decoration: none;
}

body.theme a:hover {
    text-decoration: underline;
}

body.theme small {
    color: var(--dim);
    font-size: 11.5px;
}

body.theme ul,
body.theme ol {
    margin: 0 0 10px;
    padding-left: 22px;
}

body.theme li {
    margin: 3px 0;
    line-height: 1.5;
}

body.theme details {
    margin: 8px 0;
    font-size: 13px;
}

body.theme summary {
    cursor: pointer;
    color: var(--dim);
}

.table-scroll {
    overflow-x: auto;
    margin: 0 0 14px;
    border: .5px solid var(--line);
    border-radius: var(--radius);
}

body.theme table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    background: var(--panel);
}

body.theme th,
body.theme td {
    padding: 7px 10px;
    text-align: left;
    border-bottom: .5px solid var(--line);
    white-space: nowrap;
}

body.theme th {
    background: var(--bg);
    color: var(--dim);
    font-weight: 500;
}

body.theme tbody tr:last-child td {
    border-bottom: none;
}

body.theme label {
    display: block;
    font-size: 12.5px;
    color: var(--dim);
    margin: 0 0 12px;
}

body.theme input[type="text"],
body.theme input[type="number"],
body.theme input[type="date"],
body.theme input[type="time"],
body.theme input[type="datetime-local"],
body.theme input[type="password"],
body.theme select,
body.theme textarea {
    display: block;
    width: 100%;
    max-width: 360px;
    margin-top: 4px;
    height: 40px;
    padding: 0 10px;
    border: .5px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

body.theme textarea {
    height: auto;
    padding: 8px 10px;
}

body.theme input[type="checkbox"] {
    width: auto;
    height: auto;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
}

body.theme input:focus,
body.theme select:focus,
body.theme textarea:focus {
    outline: none;
    border-color: var(--accent);
}

body.theme button,
body.theme input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 16px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

body.theme button:active,
body.theme input[type="submit"]:active {
    opacity: .85;
}

.btn-link {
    display: inline-block;
    margin: 0 0 14px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}

.error-list {
    background: var(--panel);
    border: .5px solid var(--up);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin: 0 0 14px;
    color: var(--up);
    font-size: 13px;
}

.error-list li {
    margin: 2px 0;
}

/* テーブル内の操作ボタン(一覧の「削除」等)は塗りつぶしボタンだと目立ちすぎるため、
   「編集」リンクと並ぶ程度の控えめなテキストボタンにする。破壊的操作なので赤系にする。 */
body.theme td button,
body.theme td input[type="submit"] {
    height: auto;
    padding: 3px 8px;
    background: none;
    color: var(--up);
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 6px;
}

body.theme td button:active,
body.theme td input[type="submit"]:active {
    background: rgba(227, 73, 72, .12);
    opacity: 1;
}
