.tyds-app,
.tyds-gate {
    --tyds-navy: #173b5e;
    --tyds-blue: #2d6f91;
    --tyds-cyan: #dff2f7;
    --tyds-teal: #218c83;
    --tyds-orange: #ed9e2b;
    --tyds-yellow: #fff4cf;
    --tyds-red: #b83636;
    --tyds-green: #217a52;
    --tyds-ink: #243746;
    --tyds-muted: #647584;
    --tyds-line: #d6e1e8;
    --tyds-white: #fff;
    color: var(--tyds-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    line-height: 1.65;
}

.tyds-app * { box-sizing: border-box; }
.tyds-app button, .tyds-app input, .tyds-app select, .tyds-app textarea { font: inherit; }
.tyds-seed { display: none !important; }

.tyds-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 30px;
    margin: 0 0 22px;
    color: #fff;
    background: linear-gradient(135deg, var(--tyds-navy), #245f7c 68%, var(--tyds-teal));
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(23, 59, 94, .18);
}

.tyds-eyebrow {
    display: inline-block;
    margin-bottom: 6px;
    color: #d7f5f0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
}

.tyds-hero h2 { margin: 0 0 6px; color: #fff; font-size: clamp(26px, 4vw, 38px); line-height: 1.25; }
.tyds-hero p { max-width: 720px; margin: 0; color: #edf7fa; }
.tyds-hero-actions { display: flex; flex: 0 0 auto; gap: 8px; }

.tyds-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 18px;
    border: 1px solid var(--tyds-blue);
    border-radius: 9px;
    color: #fff;
    background: var(--tyds-blue);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.tyds-button:hover { color: #fff; background: var(--tyds-navy); transform: translateY(-1px); box-shadow: 0 5px 14px rgba(23, 59, 94, .17); }
.tyds-button-light { border-color: rgba(255,255,255,.55); color: var(--tyds-navy); background: #fff; }
.tyds-button-light:hover { color: var(--tyds-navy); background: #f2fbfc; }
.tyds-button-secondary { border-color: var(--tyds-line); color: var(--tyds-ink); background: #fff; }

.tyds-panel {
    margin-bottom: 22px;
    padding: 24px;
    border: 1px solid var(--tyds-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 7px 24px rgba(36, 55, 70, .07);
}

.tyds-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.tyds-section-heading > div { display: flex; align-items: center; gap: 10px; }
.tyds-section-heading h3 { margin: 0; color: var(--tyds-navy); font-size: 22px; }
.tyds-step { display: inline-grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: #fff; background: var(--tyds-orange); font-weight: 800; }
.tyds-save-state { color: var(--tyds-muted); font-size: 13px; font-weight: 700; }
.tyds-save-state.is-saving { color: var(--tyds-blue); }
.tyds-save-state.is-saved { color: var(--tyds-green); }
.tyds-save-state.is-error { color: var(--tyds-red); }

.tyds-profile-grid,
.tyds-custom-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.tyds-profile-grid label,
.tyds-custom-grid label,
.tyds-detail-grid label { display: flex; flex-direction: column; gap: 5px; color: var(--tyds-muted); font-size: 13px; font-weight: 700; }
.tyds-number-input { display: flex; overflow: hidden; border: 1px solid var(--tyds-line); border-radius: 8px; background: var(--tyds-yellow); }
.tyds-number-input input { width: 100%; min-width: 0; padding: 9px 10px; border: 0 !important; outline: 0; color: var(--tyds-ink); background: transparent !important; font-weight: 700; }
.tyds-number-input em { display: grid; min-width: 43px; padding: 0 8px; place-items: center; border-left: 1px solid #eddcaa; color: var(--tyds-muted); background: #fff9e8; font-style: normal; }
.tyds-profile-note { margin: 12px 0; color: var(--tyds-muted); font-size: 13px; }

.tyds-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.tyds-summary article { padding: 18px; border: 1px solid var(--tyds-line); border-top: 5px solid var(--tyds-teal); border-radius: 12px; background: #fff; box-shadow: 0 5px 16px rgba(36, 55, 70, .06); }
.tyds-summary article > span { display: block; color: var(--tyds-muted); font-size: 13px; font-weight: 700; }
.tyds-summary strong { color: var(--tyds-navy); font-size: 32px; line-height: 1.1; }
.tyds-summary small { margin-left: 3px; color: var(--tyds-muted); }
.tyds-summary .tyds-summary-alert { border-top-color: var(--tyds-orange); background: #fffaf0; }

.tyds-tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 2px solid var(--tyds-line); }
.tyds-tabs button { position: relative; padding: 10px 16px; border: 0; color: var(--tyds-muted); background: transparent; font-weight: 800; cursor: pointer; }
.tyds-tabs button.is-active { color: var(--tyds-navy); }
.tyds-tabs button.is-active::after { position: absolute; right: 0; bottom: -2px; left: 0; height: 4px; content: ""; border-radius: 4px 4px 0 0; background: var(--tyds-orange); }
.tyds-tab-count { display: inline-grid; min-width: 22px; height: 22px; padding: 0 5px; place-items: center; border-radius: 11px; color: #fff; background: var(--tyds-red); font-size: 11px; }

.tyds-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; padding: 12px; border-radius: 10px; background: #f1f7f9; }
.tyds-toolbar input[type="search"],
.tyds-toolbar select,
.tyds-custom-grid input,
.tyds-custom-grid select,
.tyds-custom-grid textarea,
.tyds-row-input,
.tyds-detail-grid textarea { min-height: 38px; padding: 7px 9px; border: 1px solid var(--tyds-line) !important; border-radius: 7px; color: var(--tyds-ink); background: #fff !important; box-shadow: none !important; }
.tyds-toolbar input[type="search"] { min-width: 210px; flex: 1 1 240px; }
.tyds-toolbar label { display: inline-flex; align-items: center; gap: 5px; margin: 0 4px; color: var(--tyds-muted); font-size: 13px; font-weight: 700; }

.tyds-table-wrap { overflow-x: auto; border: 1px solid var(--tyds-line); border-radius: 11px; }
.tyds-table { width: 100%; min-width: 940px; margin: 0 !important; border: 0 !important; border-collapse: collapse; font-size: 14px; }
.tyds-table th { padding: 11px 9px; border: 0; color: #fff; background: var(--tyds-blue); font-size: 12px; text-align: left; white-space: nowrap; }
.tyds-table td { padding: 9px; border: 0; border-bottom: 1px solid var(--tyds-line); vertical-align: middle; }
.tyds-table tbody tr:nth-child(even):not(.tyds-detail-row) { background: #f7fbfc; }
.tyds-item-row.is-hidden-item { opacity: .58; }
.tyds-item-name strong { display: block; color: var(--tyds-ink); }
.tyds-item-name small { display: block; color: var(--tyds-muted); }
.tyds-item-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 3px; }
.tyds-category-label, .tyds-custom-label { display: inline-block; padding: 1px 6px; border-radius: 4px; color: var(--tyds-blue); background: var(--tyds-cyan); font-size: 10px; font-weight: 800; }
.tyds-custom-label { color: #7a4e00; background: #ffefc6; }
.tyds-priority { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.tyds-priority-必須 { color: #8b2727; background: #ffe0e0; }
.tyds-priority-推奨 { color: #1f5f4a; background: #def4eb; }
.tyds-priority-個別 { color: #5c4d78; background: #eee7fa; }
.tyds-hidden-label { color: var(--tyds-red) !important; font-weight: 700; }
.tyds-quantity, .tyds-current, .tyds-shortage-cell { white-space: nowrap; }
.tyds-quantity strong, .tyds-shortage-cell strong { display: inline-block; min-width: 36px; font-size: 17px; text-align: right; }
.tyds-quantity small, .tyds-current small, .tyds-shortage-cell small { margin-left: 4px; color: var(--tyds-muted); }
.tyds-shortage { color: var(--tyds-red); }
.tyds-ok { color: var(--tyds-green); }
.tyds-current input { width: 78px; background: var(--tyds-yellow) !important; }
.tyds-expiry input { width: 140px; }
.tyds-storage input { width: 150px; }
.tyds-row-actions { min-width: 112px; }
.tyds-mini-button { min-height: 28px; margin: 2px; padding: 3px 7px; border: 1px solid var(--tyds-line); border-radius: 5px; color: var(--tyds-blue); background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.tyds-mini-danger { color: var(--tyds-red); }

.tyds-detail-row { background: #fff9e8 !important; }
.tyds-detail-row td { padding: 14px; }
.tyds-detail-grid { display: grid; grid-template-columns: 160px minmax(220px, 1fr) minmax(260px, 2fr); gap: 14px; align-items: start; }
.tyds-detail-grid input { width: 100%; }
.tyds-detail-note textarea { width: 100%; }
.tyds-detail-grid small { color: var(--tyds-muted); font-weight: 400; }
.tyds-item-description p { margin: 0 0 5px; }
.tyds-item-description a { font-weight: 700; }
.tyds-basis { color: var(--tyds-muted); font-size: 12px; }

.tyds-empty, .tyds-purchase-empty { margin: 0; padding: 25px; text-align: center; color: var(--tyds-muted); }
.tyds-purchase-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.tyds-purchase-heading h3, .tyds-purchase-heading p { margin: 0; }

.tyds-custom-box { margin-top: 18px; border: 1px solid var(--tyds-line); border-radius: 10px; background: #f8fbfc; }
.tyds-custom-box summary { padding: 13px 15px; color: var(--tyds-navy); font-weight: 800; cursor: pointer; }
.tyds-custom-form { padding: 0 15px 15px; }
.tyds-custom-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tyds-custom-grid label.tyds-span-2 { grid-column: span 2; }
.tyds-custom-actions { display: flex; gap: 8px; margin-top: 12px; }

.tyds-notes { padding: 18px 22px; border-left: 5px solid var(--tyds-orange); border-radius: 8px; background: #fff7e5; }
.tyds-notes h3 { margin: 0 0 6px; color: var(--tyds-navy); font-size: 18px; }
.tyds-notes p { margin: 4px 0; font-size: 13px; }

.tyds-gate { padding: 25px; border: 1px solid #d6e1e8; border-radius: 12px; background: #f7fbfc; }
.tyds-gate h2 { margin-top: 0; color: var(--tyds-navy); }
.tyds-disaster-card[hidden] { display: none !important; }

@media (max-width: 920px) {
    .tyds-profile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tyds-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tyds-detail-grid { grid-template-columns: 1fr 2fr; }
    .tyds-item-description { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
    .tyds-hero { align-items: flex-start; flex-direction: column; padding: 22px 18px; border-radius: 12px; }
    .tyds-hero-actions { width: 100%; }
    .tyds-hero-actions .tyds-button { flex: 1; }
    .tyds-panel { padding: 16px 12px; border-radius: 12px; }
    .tyds-profile-grid, .tyds-custom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tyds-summary { gap: 8px; }
    .tyds-summary article { padding: 12px; }
    .tyds-summary strong { font-size: 26px; }
    .tyds-tabs { overflow-x: auto; }
    .tyds-tabs button { flex: 0 0 auto; padding: 9px 11px; }
    .tyds-toolbar { align-items: stretch; flex-direction: column; }
    .tyds-toolbar input[type="search"] { width: 100%; min-width: 0; flex-basis: auto; }
    .tyds-toolbar select { width: 100%; }
    .tyds-table-wrap { overflow: visible; border: 0; }
    .tyds-table { min-width: 0; border-collapse: separate; border-spacing: 0 10px; }
    .tyds-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
    .tyds-table tbody, .tyds-table tr, .tyds-table td { display: block; width: 100%; }
    .tyds-table tr.tyds-item-row, .tyds-purchase-table tr { overflow: hidden; border: 1px solid var(--tyds-line); border-radius: 10px; background: #fff !important; box-shadow: 0 4px 12px rgba(36,55,70,.05); }
    .tyds-table td { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #edf2f5; }
    .tyds-table td::before { content: attr(data-label); color: var(--tyds-muted); font-size: 11px; font-weight: 800; }
    .tyds-table .tyds-item-name { display: block; padding: 12px; background: #eef7f9; }
    .tyds-table .tyds-item-name::before { display: none; }
    .tyds-current input, .tyds-expiry input, .tyds-storage input { width: 100%; }
    .tyds-row-actions { min-width: 0; }
    .tyds-detail-row { margin: -10px 5px 10px; }
    .tyds-detail-row td { display: block; padding: 12px; border: 1px solid #eedfb3; border-top: 0; border-radius: 0 0 9px 9px; }
    .tyds-detail-row td::before { display: none; }
    .tyds-detail-grid { grid-template-columns: 1fr; }
    .tyds-item-description { grid-column: auto; }
    .tyds-purchase-heading { align-items: flex-start; flex-direction: column; }
    .tyds-custom-grid label.tyds-span-2 { grid-column: span 2; }
}

@media (max-width: 430px) {
    .tyds-profile-grid, .tyds-custom-grid { grid-template-columns: 1fr; }
    .tyds-custom-grid label.tyds-span-2 { grid-column: auto; }
    .tyds-summary { grid-template-columns: 1fr 1fr; }
    .tyds-section-heading { align-items: flex-start; flex-direction: column; }
}

@media print {
    .tyds-hero-actions, .tyds-toolbar, .tyds-row-actions, .tyds-custom-box, .tyds-save-profile, .tyds-purchase-csv, .tyds-tabs { display: none !important; }
    .tyds-app { color: #000; font-size: 10pt; }
    .tyds-hero { padding: 12px; color: #000; background: #fff; border: 2px solid #173b5e; box-shadow: none; }
    .tyds-hero h2, .tyds-hero p, .tyds-eyebrow { color: #000; }
    .tyds-panel, .tyds-summary article { box-shadow: none; }
    .tyds-table-wrap { overflow: visible; }
    .tyds-table { min-width: 0; font-size: 8pt; }
    .tyds-table th { color: #000; background: #ddd; }
    .tyds-row-input { border: 0 !important; padding: 0; }
}
