:root {
    --ink: #1e241f;
    --muted: #687069;
    --paper: #f6f5ef;
    --card: #ffffff;
    --line: #e3e2da;
    --yellow: #f4c542;
    --yellow-soft: #fff4c7;
    --green: #246b49;
    --red: #ad3434;
    --shadow: 0 14px 40px rgba(36, 42, 36, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    line-height: 1.6;
}
a { color: inherit; }
button, input, select { font: inherit; }
textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 20px 20px;
    color: #fff;
    background: #202620;
    display: flex;
    flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px 12px 12px 4px;
    color: #202620;
    background: var(--yellow);
    font-weight: 900;
    letter-spacing: -.08em;
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .06em; }
.brand small { color: #b9c0ba; font-size: .72rem; }
.sidebar nav { margin-top: 38px; display: grid; gap: 5px; }
.nav-link { padding: 11px 14px; border-radius: 10px; color: #dfe4df; text-decoration: none; font-weight: 700; font-size: .92rem; }
.nav-link:hover, .nav-link.is-active { color: #202620; background: var(--yellow); }
.nav-link.is-disabled { color: #737b74; cursor: default; }
.nav-section { margin: 24px 14px 6px; color: #8d958e; font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.sidebar-user { margin-top: auto; padding: 16px 14px 4px; border-top: 1px solid #3a423b; }
.sidebar-user span, .sidebar-user small { display: block; }
.sidebar-user small { color: #9ca49d; overflow-wrap: anywhere; }
.text-button { margin-top: 10px; padding: 0; border: 0; color: var(--yellow); background: transparent; font-size: .82rem; }

.content { width: 100%; max-width: 1500px; margin: 0 auto; padding: 48px clamp(24px, 4vw, 68px) 80px; }
.mobile-header { display: none; }
.page-heading { margin-bottom: 32px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading.compact { align-items: center; }
.page-heading h1 { margin: 2px 0 4px; font-size: clamp(1.9rem, 4vw, 3.1rem); line-height: 1.14; letter-spacing: -.045em; }
.page-heading p:not(.eyebrow) { margin: 0; color: var(--muted); }
.eyebrow { margin: 0; color: var(--green); font-size: .72rem; font-weight: 900; letter-spacing: .15em; }
.status-pill { padding: 8px 13px; border: 1px solid #cbd8cf; border-radius: 999px; background: #edf6f0; color: var(--green); font-size: .78rem; font-weight: 800; white-space: nowrap; }
.status-pill span { width: 8px; height: 8px; margin-right: 7px; display: inline-block; border-radius: 50%; background: #39a369; }
.heading-summary { padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: #fff; font-size: .8rem; white-space: nowrap; }
.heading-summary strong { color: var(--ink); font-size: 1.15rem; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.metric-card { min-height: 166px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 5px 18px rgba(36, 42, 36, .035); }
.metric-card-accent { border-color: #efcd69; background: var(--yellow-soft); }
.metric-card > span, .metric-card > small { display: block; }
.metric-card > span { min-height: 42px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.metric-card strong { display: block; margin: 8px 0 5px; font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1; letter-spacing: -.04em; }
.metric-card strong small { font-size: .8rem; letter-spacing: 0; }
.metric-card > small { color: #858c86; font-size: .7rem; }

.dashboard-grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; }
.panel { padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
.panel h2 { margin: 2px 0; font-size: 1.35rem; letter-spacing: -.02em; }
.panel-heading { display: flex; justify-content: space-between; gap: 20px; }
.progress-number { color: var(--muted); font-size: .78rem; font-weight: 800; }
.progress-track { height: 7px; margin: 22px 0 25px; overflow: hidden; border-radius: 99px; background: #e9e9e3; }
.progress-track span { height: 100%; display: block; border-radius: inherit; background: var(--yellow); }
.progress-phase-2 { width: 33.33%; }
.check-list, .plain-list { margin: 0; padding: 0; list-style: none; }
.check-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.check-list li { padding: 14px; border-radius: 13px; background: #f7f8f4; display: flex; gap: 11px; }
.check-list li > span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font-weight: 900; }
.check-list strong, .check-list small { display: block; }
.check-list strong { font-size: .88rem; }
.check-list small { color: var(--muted); font-size: .7rem; }
.next-panel { overflow: hidden; color: #fff; background: #273129; position: relative; }
.next-panel::after { content: ""; width: 170px; height: 170px; position: absolute; right: -65px; bottom: -70px; border: 28px solid rgba(244, 197, 66, .16); border-radius: 50%; }
.next-panel .eyebrow { color: var(--yellow); }
.next-panel p:not(.eyebrow) { color: #c5cdc6; }
.next-tag { width: fit-content; margin: 20px 0; padding: 6px 10px; border-radius: 7px; color: #242b25; background: var(--yellow); font-size: .72rem; font-weight: 900; }
.plain-list { position: relative; z-index: 1; display: grid; gap: 7px; color: #edf0ed; font-size: .82rem; }
.plain-list li::before { content: "—"; margin-right: 8px; color: var(--yellow); }

.alert { margin: 0 0 20px; padding: 13px 16px; border-radius: 11px; font-size: .88rem; }
.alert-success { border: 1px solid #bad7c5; color: #1f6544; background: #edf8f1; }
.alert-error { border: 1px solid #e5bebe; color: #892727; background: #fff0f0; }
.form-panel { max-width: 760px; }
.settings-form, .form-stack { display: grid; gap: 20px; }
.settings-form label, .form-stack label { display: grid; gap: 7px; }
.settings-form label > span, .form-stack label > span { font-size: .85rem; font-weight: 800; }
.settings-form label > small { color: var(--muted); font-size: .73rem; }
input, select, textarea { width: 100%; padding: 12px 13px; border: 1px solid #cfd2ca; border-radius: 10px; color: var(--ink); background: #fff; outline: none; }
textarea { min-height: 105px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #927514; box-shadow: 0 0 0 3px rgba(244, 197, 66, .25); }
.input-with-unit { display: flex; align-items: center; border: 1px solid #cfd2ca; border-radius: 10px; background: #fff; overflow: hidden; }
.input-with-unit:focus-within { border-color: #927514; box-shadow: 0 0 0 3px rgba(244, 197, 66, .25); }
.input-with-unit input { border: 0; border-radius: 0; box-shadow: none; }
.input-with-unit span { padding: 0 13px; color: var(--muted); white-space: nowrap; }
.form-actions { padding-top: 6px; }
.primary-button { padding: 12px 20px; border: 0; border-radius: 10px; color: #202620; background: var(--yellow); font-weight: 900; box-shadow: 0 5px 14px rgba(146, 117, 20, .18); }
.primary-button:hover { background: #e8b92f; }
.secondary-button { padding: 9px 13px; border: 1px solid #ccd0c9; border-radius: 9px; color: var(--ink); background: #fff; text-decoration: none; font-size: .78rem; font-weight: 800; }
.secondary-button:hover { border-color: #999f98; }
.settings-link-card { max-width: 760px; margin: 0 0 18px; padding: 18px 20px; border: 1px solid #ecd06f; border-radius: 15px; background: var(--yellow-soft); display: flex; align-items: center; justify-content: space-between; gap: 20px; text-decoration: none; }
.settings-link-card strong, .settings-link-card small { display: block; }
.settings-link-card small { color: var(--muted); font-size: .72rem; }
.settings-link-card b { white-space: nowrap; font-size: .78rem; }
.form-stack-wide { display: grid; gap: 16px; }
.form-panel-wide { max-width: 1000px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading.padded { margin: 0; padding: 23px 25px 17px; }
.section-heading h2 { margin: 2px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.form-grid label { display: grid; align-content: start; gap: 7px; }
.form-grid label > span { font-size: .82rem; font-weight: 800; }
.form-grid label > small { color: var(--muted); font-size: .7rem; }
.form-grid .span-2 { grid-column: span 2; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 800; }
.checkbox-label input { width: 18px; height: 18px; }
.sticky-actions { position: sticky; bottom: 82px; z-index: 2; max-width: 1000px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); text-align: right; }

.table-panel { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { color: var(--muted); background: #f7f7f3; font-size: .7rem; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
.log-badge { padding: 4px 7px; border-radius: 6px; background: var(--yellow-soft); font-weight: 800; }
.empty-cell { padding: 40px; text-align: center; color: var(--muted); }
.product-table td:first-child strong, .product-table td:first-child small { display: block; }
.product-table td:first-child small { max-width: 280px; color: var(--muted); white-space: normal; }
.status-label { display: inline-block; padding: 4px 8px; border-radius: 7px; font-size: .7rem; font-weight: 800; }
.status-active { color: #1f6544; background: #e7f5ec; }
.status-muted { color: #686e69; background: #eef0ed; }
.status-warning { color: #80600b; background: var(--yellow-soft); }
.stock-number { font-size: 1.08rem; }
.stock-number.is-low { color: var(--red); }
.low-label { display: block; color: var(--red); font-size: .62rem; font-weight: 800; }
.row-actions { display: flex; gap: 8px; }
.row-actions a { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; text-decoration: none; font-size: .7rem; font-weight: 800; }

.inventory-layout { display: grid; grid-template-columns: minmax(0, .8fr) minmax(340px, 1.2fr); gap: 18px; }
.balance-cards { margin: 18px 0 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.balance-cards > div { padding: 16px; border-radius: 13px; background: #f6f7f3; }
.balance-cards span, .balance-cards strong { display: block; }
.balance-cards span { min-height: 38px; color: var(--muted); font-size: .7rem; }
.balance-cards strong { margin-top: 7px; font-size: 1.6rem; }
.balance-cards strong small { font-size: .7rem; }
.inventory-form { padding-top: 22px; border-top: 1px solid var(--line); }
.movement-list { margin: 18px 0 0; padding: 0; list-style: none; display: grid; }
.movement-list li { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; }
.movement-list li:last-child { border-bottom: 0; }
.movement-list strong, .movement-list span { display: block; }
.movement-list strong { font-size: 1rem; }
.movement-list span, .movement-list small { color: var(--muted); font-size: .7rem; }
.movement-list small { max-width: 55%; text-align: right; }
.empty-text { color: var(--muted); font-size: .82rem; }

.import-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 18px; }
.upload-panel > p:not(.eyebrow), .notice-text { color: var(--muted); font-size: .82rem; }
.upload-panel code { padding: 2px 5px; border-radius: 5px; background: #f2f2ee; }
.upload-form { margin-top: 22px; display: grid; gap: 14px; }
.file-drop { padding: 24px; border: 1px dashed #aeb4ac; border-radius: 14px; background: #f9faf7; display: grid; gap: 8px; }
.file-drop > span { font-weight: 900; }
.file-drop > small { color: var(--muted); font-size: .7rem; }
.file-drop input { padding: 8px; background: #fff; }
.single-column { grid-template-columns: 1fr; margin-top: 18px; }
.notice-text { margin: 20px 0 0; padding: 12px; border-left: 3px solid var(--yellow); background: #fff9e2; }
.import-history { margin-top: 18px; }
.profit-cell { font-weight: 900; }
.table-input { min-width: 94px; padding: 8px 9px; border-radius: 7px; }
.table-checkbox { display: flex; align-items: center; gap: 6px; font-size: .7rem; white-space: nowrap; }
.table-checkbox input { width: 16px; height: 16px; }
td > small { display: block; max-width: 260px; color: var(--muted); white-space: normal; }
.wrap-cell { min-width: 320px; white-space: normal; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 15%, #fff0a8 0, transparent 35%), #202620; }
.login-card { width: min(100%, 440px); padding: clamp(28px, 6vw, 46px); border-radius: 24px; background: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, .28); }
.login-brand { margin-bottom: 28px; text-align: center; }
.brand-mark-large { width: 58px; height: 58px; margin: 0 auto 16px; font-size: 1.4rem; }
.login-brand h1 { margin: 3px 0 5px; font-size: 1.55rem; letter-spacing: -.04em; }
.login-brand > p:last-child { margin: 0; color: var(--muted); font-size: .85rem; }
.login-card .primary-button { width: 100%; margin-top: 3px; }
.secure-note { margin: 20px 0 0; color: var(--muted); text-align: center; font-size: .7rem; }

@media (max-width: 1050px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inventory-layout, .import-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: fixed; z-index: 10; top: auto; bottom: 0; width: 100%; height: 70px; padding: 9px 12px; display: block; box-shadow: 0 -8px 25px rgba(0, 0, 0, .12); }
    .sidebar > .brand, .sidebar-user, .nav-section, .nav-link.is-disabled { display: none; }
    .sidebar nav { height: 100%; margin: 0; grid-template-columns: repeat(5, 1fr); align-items: center; }
    .nav-link { padding: 10px 3px; text-align: center; font-size: .68rem; }
    .content { padding: 0 17px 100px; }
    .mobile-header { height: 70px; margin: 0 -17px 26px; padding: 12px 17px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(246, 245, 239, .94); }
    .mobile-header .brand { gap: 8px; }
    .mobile-header .brand-mark { width: 34px; height: 34px; }
    .mobile-header > span { color: var(--muted); font-size: .78rem; font-weight: 800; }
    .page-heading { align-items: flex-start; }
    .status-pill { margin-top: 8px; }
    .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .metric-card { min-height: 145px; padding: 17px; }
    .metric-card > span { min-height: 38px; font-size: .73rem; }
    .check-list { grid-template-columns: 1fr; }
    .panel { padding: 22px; }
    .table-panel { padding: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .sticky-actions { bottom: 80px; }
}

@media (max-width: 470px) {
    .page-heading { display: block; }
    .status-pill { width: fit-content; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-card { min-height: 128px; }
    .metric-card > span { min-height: auto; }
}
