/* 社内ポータル info — 明るい配色（2026-09-28 社長「画面が黒いの嫌だな」「もう少し見やすくおしゃれに」）。
   骨組み（左サイドバー・折りたたみ・選択中の縦ライン）は rakuten-profit と同じ考え方。 */

:root {
    --bg: #f5f7fa;
    --bg-soft: #eef2f8;
    --paper: #ffffff;
    --line: #e4e9f2;
    --line-soft: #eef1f7;
    --ink: #17202f;
    --ink-2: #47536a;
    --muted: #8a94a8;
    --accent: #4338ca;
    --accent-soft: #eef0ff;
    --sky: #0284c7;
    --sky-soft: #e6f4fd;
    --ok: #047857;
    --warn: #b45309;
    --warn-soft: #fef3e2;
    --ng: #be123c;
    --side-w: 232px;
    --side-w-min: 64px;
    --font: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
    --num: "SFMono-Regular", Consolas, "Courier New", monospace;
    --shadow-s: 0 1px 2px rgba(23, 32, 47, .05), 0 1px 3px rgba(23, 32, 47, .04);
    --shadow-m: 0 2px 6px rgba(23, 32, 47, .06), 0 8px 24px rgba(23, 32, 47, .06);

    /* 旧名（他のテンプレートが参照）を新しい色へつなぐ */
    --bg-card: var(--paper);
    --bg-secondary: var(--paper);
    --border: var(--line);
    --text: var(--ink);
    --text-muted: var(--muted);
    --accent-2: var(--sky);
    --font-mono: var(--num);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.7;
    padding-left: var(--side-w);
    transition: padding-left .18s ease;
    -webkit-font-smoothing: antialiased;
}
body.side-collapsed { padding-left: var(--side-w-min); }
body.no-side { padding-left: 0; }

/* ── サイドバー ── */
#side {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--side-w);
    z-index: 900;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border-right: 1px solid var(--line);
    transition: width .18s ease;
    overflow: hidden;
}
body.side-collapsed #side { width: var(--side-w-min); }

#side .top { display: flex; align-items: center; gap: 8px; padding: 16px 14px 14px; }
#side .logo { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; text-decoration: none; color: var(--ink); white-space: nowrap; }
#side .mark {
    width: 32px; height: 32px; flex: none; border-radius: 10px;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 800; letter-spacing: .04em; color: #fff;
    background: linear-gradient(140deg, #4f46e5, #0ea5e9);
    box-shadow: 0 5px 14px rgba(67, 56, 202, .30);
}
#side .name { font-size: 13px; font-weight: 800; letter-spacing: .04em; line-height: 1.3; }
#side .name span { display: block; font-size: 10px; font-weight: 600; letter-spacing: .10em; color: var(--muted); }
body.side-collapsed #side .name { display: none; }

#toggle {
    width: 28px; height: 28px; flex: none;
    display: grid; place-items: center;
    border-radius: 8px; border: 1px solid var(--line);
    background: var(--paper); color: var(--muted);
    cursor: pointer; font-family: inherit; font-size: 13px; line-height: 1;
    transition: background .14s ease, color .14s ease, border-color .14s ease;
}
#toggle:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
body.side-collapsed #side .top { flex-direction: column; gap: 12px; padding: 16px 6px 12px; }

#side .links { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 10px 12px; display: flex; flex-direction: column; gap: 3px; }
#side .links a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; border-radius: 10px;
    font-size: 13px; font-weight: 600; color: var(--ink-2);
    text-decoration: none; white-space: nowrap; position: relative;
    transition: background .14s ease, color .14s ease;
}
#side .links a .ico { width: 20px; flex: none; text-align: center; font-size: 15px; line-height: 1; }
body.side-collapsed #side .links a { justify-content: center; padding: 10px 0; }
body.side-collapsed #side .links a .label { display: none; }
#side .links a:hover { background: var(--bg-soft); color: var(--ink); }
#side .links a.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
#side .links a.active::before {
    content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--accent);
}
#side .sep { height: 1px; margin: 10px 4px; background: var(--line); }

#side .foot { border-top: 1px solid var(--line); padding: 12px 14px; font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
#side .foot .who { color: var(--ink-2); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#side .foot a { color: var(--muted); text-decoration: none; }
#side .foot a:hover { color: var(--accent); }
body.side-collapsed #side .foot { padding: 12px 6px; align-items: center; }
body.side-collapsed #side .foot .who { display: none; }

/* ── 本文 ── */
.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 24px 72px; }
h1 { font-size: 22px; font-weight: 800; margin: 0 0 6px; letter-spacing: .01em; }
.sub { color: var(--ink-2); font-size: 13px; margin: 0 0 22px; max-width: 74ch; }
.sub b { color: var(--ink); }

/* 検索 */
.searchbar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
    padding: 12px; box-shadow: var(--shadow-s); margin-bottom: 10px;
}
.searchbar input[type="search"] {
    flex: 1; min-width: 220px; height: 48px; padding: 0 16px;
    border-radius: 12px; border: 1px solid transparent; background: var(--bg-soft); color: var(--ink);
    font-family: inherit; font-size: 16px; letter-spacing: .02em;
    transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.searchbar input[type="search"]::placeholder { color: var(--muted); }
.searchbar input[type="search"]:focus { outline: none; background: var(--paper); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.searchbar button {
    height: 48px; padding: 0 24px; border-radius: 12px; border: 0; cursor: pointer;
    background: var(--accent); color: #fff; font-family: inherit; font-size: 14px; font-weight: 700;
    letter-spacing: .04em; transition: filter .14s ease, transform .1s ease;
}
.searchbar button:hover { filter: brightness(1.12); }
.searchbar button:active { transform: translateY(1px); }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 20px; padding-left: 4px; }

.meta { font-size: 11.5px; margin: 0 0 12px; display: flex; gap: 7px; flex-wrap: wrap; padding-left: 4px; }
.meta span { background: var(--paper); border: 1px solid var(--line); color: var(--ink-2); padding: 3px 10px; border-radius: 999px; font-weight: 600; }

/* ── 在庫表 ── */
.list { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-s); overflow: hidden; }
.list-head, .item {
    display: grid;
    grid-template-columns: 52px 124px minmax(0, 1fr) 168px 94px;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
}
.list-head {
    font-size: 10.5px; font-weight: 800; letter-spacing: .10em; color: var(--muted);
    background: linear-gradient(180deg, #fbfcfe, #f7f9fc); border-bottom: 1px solid var(--line);
}
.list-head .r { text-align: right; }
.item { border-bottom: 1px solid var(--line-soft); cursor: pointer; position: relative; transition: background .12s ease; }
.item:last-child { border-bottom: 0; }
.item:hover { background: #fafcff; }
.item[aria-expanded="true"] { background: #f7f9ff; }
.item[aria-expanded="true"]::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
}
.item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.item .thumb {
    width: 48px; height: 48px; border-radius: 10px; background: var(--bg-soft);
    object-fit: cover; border: 1px solid var(--line); display: block;
}
.item .code { font-family: var(--num); font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--ink); }
.item .nm { min-width: 0; font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .nm .var { margin-left: 8px; font-size: 11.5px; color: var(--muted); }
.item .note { grid-column: 2 / -1; font-size: 11.5px; color: var(--warn); margin-top: -4px; }

.item .supply { display: flex; flex-wrap: wrap; gap: 5px; font-size: 11px; }
.item .supply span { padding: 3px 9px; border-radius: 999px; white-space: nowrap; font-weight: 700; letter-spacing: .02em; }
.item .supply .buy { background: var(--accent-soft); color: var(--accent); }
.item .supply .ship { background: var(--sky-soft); color: var(--sky); }
.item .supply .warn { background: var(--warn-soft); color: var(--warn); }
.item .supply.none { color: #c8cfdc; font-size: 13px; }

.item .stock { text-align: right; white-space: nowrap; }
.item .stock b { font-size: 21px; font-weight: 800; font-family: var(--num); letter-spacing: -.01em; }
.item .stock small { font-size: 11px; color: var(--muted); margin-left: 3px; }
.item .stock.zero b { color: var(--ng); }
.item .stock.low b { color: var(--warn); }
.item .stock.ok b { color: var(--ok); }

/* ── 明細（行を開いた中身） ── */
.item .detail {
    grid-column: 1 / -1; margin: 4px 0 8px; padding: 14px 16px;
    background: var(--bg-soft); border-radius: 12px; cursor: default;
}
.dt-head {
    font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--ink-2);
    margin: 4px 0 6px; display: flex; align-items: center; gap: 7px;
}
.dt-head::before { content: ""; width: 4px; height: 12px; border-radius: 2px; background: var(--accent); }
table.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; margin-bottom: 14px; background: var(--paper); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-s); }
table.dt th {
    font-size: 10.5px; font-weight: 800; color: var(--muted); text-align: left; letter-spacing: .06em;
    padding: 7px 12px; background: #fbfcfe; border-bottom: 1px solid var(--line);
}
table.dt td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; color: var(--ink-2); }
table.dt tr:last-child td { border-bottom: 0; }
table.dt td:first-child { font-family: var(--num); font-weight: 700; color: var(--ink); }
table.dt td.n { text-align: right; font-family: var(--num); font-variant-numeric: tabular-nums; }
.dt-none { font-size: 12.5px; color: var(--muted); padding: 4px 2px; }
.ph { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .04em; margin-right: 4px; }
.ph.nego { background: var(--warn-soft); color: var(--warn); }
.ph.paid { background: #e8f6f0; color: var(--ok); }
.ph.gone { background: #f1f3f7; color: var(--muted); }
.done { font-size: 10px; color: var(--ok); font-weight: 700; margin-left: 4px; }

.empty, .error {
    background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
    padding: 36px 24px; text-align: center; color: var(--muted); font-size: 13px; box-shadow: var(--shadow-s);
}
.error { border-color: #f3c7d1; color: var(--ng); background: #fff6f8; }

/* ── 管理画面 ── */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-s); padding: 20px 22px; margin-bottom: 20px; }
.panel h2 { font-size: 14px; font-weight: 800; margin: 0 0 14px; letter-spacing: .02em; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input[type="text"], input[type="password"], select {
    height: 40px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--paper); color: var(--ink); font-family: inherit; font-size: 13px;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
button.mini {
    height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line);
    background: var(--paper); color: var(--ink-2); font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
    transition: border-color .14s ease, color .14s ease;
}
button.mini:hover { border-color: var(--accent); color: var(--accent); }
button.primary {
    height: 40px; padding: 0 20px; border-radius: 10px; border: 0; background: var(--accent);
    color: #fff; font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer; letter-spacing: .03em;
}
button.primary:hover { filter: brightness(1.12); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.on { background: #e8f6f0; color: var(--ok); }
.badge.off { background: #fdeaef; color: var(--ng); }

/* ── ログイン ── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 50% -10%, #e9edff 0%, var(--bg) 60%); }
.login-card { width: 100%; max-width: 372px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 34px 30px; box-shadow: var(--shadow-m); }
.login-card .mark { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(140deg, #4f46e5, #0ea5e9); margin-bottom: 18px; box-shadow: 0 6px 16px rgba(67, 56, 202, .28); }
.login-card h1 { font-size: 18px; margin-bottom: 22px; }
.login-card label { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-2); margin: 14px 0 6px; letter-spacing: .04em; }
.login-card input { width: 100%; height: 44px; }
.login-card button { width: 100%; margin-top: 22px; height: 46px; }
.login-card .err { margin-top: 16px; color: var(--ng); font-size: 12.5px; }

@media (max-width: 860px) {
    .list-head, .item { grid-template-columns: 48px 108px minmax(0, 1fr) 84px; }
    .list-head span:nth-child(4) { display: none; }
    .item .supply { grid-column: 2 / 4; margin-top: 2px; }
}

@media (max-width: 640px) {
    body { padding-left: 0; padding-bottom: 68px; }
    body.side-collapsed { padding-left: 0; }
    #side { inset: auto 0 0 0; width: 100%; height: 62px; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); box-shadow: 0 -2px 18px rgba(23, 32, 47, .07); }
    #side .top, #side .foot { display: none; }
    #side .links { flex-direction: row; justify-content: space-around; padding: 7px 4px; gap: 0; }
    #side .links a { flex-direction: column; gap: 3px; font-size: 10px; padding: 5px 8px; }
    #side .links a .label { display: block; }
    #side .links a.active::before { display: none; }
    #side .sep { display: none; }
    .wrap { padding: 20px 16px 40px; }
    h1 { font-size: 19px; }
    .list-head { display: none; }
    .item { grid-template-columns: 46px minmax(0, 1fr) 78px; row-gap: 3px; padding: 12px 14px; }
    .item .thumb { grid-row: span 2; }
    .item .code { grid-column: 2; }
    .item .nm { grid-column: 2; font-size: 12.5px; }
    .item .supply { grid-column: 2; }
    .item .stock { grid-row: span 2; }
    .item .note { grid-column: 1 / -1; }
    .item .detail { padding: 12px; }
    table.dt { font-size: 11.5px; display: block; overflow-x: auto; white-space: nowrap; }
}
