:root {
    --arai-navy: #0C3A70;
    --arai-blue: #11529E;
    --arai-blue-soft: #C9DDEF;
    --arai-white: #FFFFFF;
    --arai-black: #111111;
    --arai-text: #262626;
    --arai-text-sub: #666666;
    --arai-bg: #FFFFFF;
    --arai-bg-sub: #F5F5F3;
    --arai-bg-soft: #FAFAF8;
    --arai-border: #D9D9D6;
    --arai-border-dark: #A8A8A4;
    --arai-danger: #9A3434;
    --arai-content-width: 1180px;
}

html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
body {
    margin: 0;
    background: var(--arai-bg);
    color: var(--arai-text);
    font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.container { width: min(100% - 40px, var(--arai-content-width)); margin-inline: auto; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--arai-navy);
    color: var(--arai-white);
    border-bottom: 1px solid rgba(255,255,255,.16);
}
.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 160px;
}
.brand-mark {
    display: block;
    width: 46px;
    height: 46px;
    object-fit: cover;
    flex: 0 0 auto;
}
.brand-wordmark {
    color: #fff;
    font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Noto Serif JP", serif;
    font-size: 24px;
    font-weight: 400;
    letter-spacing: .015em;
    line-height: 1;
    white-space: nowrap;
}
.header-nav { min-height: 72px; display: flex; align-items: stretch; }
.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    color: rgba(255,255,255,.82);
}
.nav-link:hover, .nav-link.active { color: #fff; border-bottom-color: #fff; }

.section-heading-en {
    display: block;
    margin-bottom: 7px;
    color: var(--arai-text-sub);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .16em;
}
.section-heading-en.light { color: rgba(255,255,255,.74); }

.hero-blue, .search-head {
    background: var(--arai-blue);
    color: #fff;
}
.hero-inner { padding: 58px 0 54px; }
.hero-inner h1, .search-head h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.35; letter-spacing: .03em; }
.hero-inner p { margin: 12px 0 0; color: rgba(255,255,255,.82); }
.search-head-inner {
    min-height: 154px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.head-back-link {
    flex: 0 0 auto;
    padding: 10px 16px;
    border: 1px solid rgba(255,255,255,.7);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}
.head-back-link:hover { background: rgba(255,255,255,.1); }

.route-page-section { padding: 44px 0 72px; }
.route-page-wrap { max-width: 930px; }
.route-page-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--arai-border); border-left: 1px solid var(--arai-border); }
.route-page-card {
    min-height: 150px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #fff;
    border-right: 1px solid var(--arai-border);
    border-bottom: 1px solid var(--arai-border);
    transition: background-color .18s, color .18s;
}
.route-page-card span { font-size: 22px; font-weight: 700; color: var(--arai-navy); }
.route-page-card small { font-size: 13px; color: var(--arai-text-sub); }
.route-page-card:hover { background: var(--arai-navy); color: #fff; }
.route-page-card:hover span, .route-page-card:hover small { color: #fff; }
.route-page-subnav { margin-top: 28px; display: flex; justify-content: flex-end; }

.search-work-section { padding: 34px 0 80px; }
.search-page-wrap { max-width: 980px; }
.search-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: end;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--arai-border);
}
.search-field-wrap label { display: block; margin-bottom: 8px; font-weight: 700; }
.search-input-large { min-height: 54px !important; font-size: 17px !important; }
.search-hint { margin: 7px 0 0; color: var(--arai-text-sub); font-size: 13px; }
.search-toolbar-actions { display: flex; gap: 8px; }
.result-meta { min-height: 26px; margin: 20px 0 10px; color: var(--arai-text-sub); font-size: 13px; }
.results { border-top: 1px solid var(--arai-border); }

.customer { border-bottom: 1px solid var(--arai-border); background: #fff; }
.customer-summary {
    width: 100%;
    min-height: 72px;
    padding: 16px 6px;
    border: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    text-align: left;
    cursor: pointer;
}
.customer-summary:hover { background: var(--arai-bg-soft); }
.customer-name { color: var(--arai-navy); font-size: 18px; font-weight: 700; }
.customer-summary-right { display: inline-flex; align-items: center; gap: 14px; }
.chevron { width: 20px; text-align: center; color: var(--arai-blue); font-size: 24px; font-weight: 400; }
.route-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: #EAF2FA;
    color: var(--arai-navy);
    font-size: 12px;
    font-weight: 700;
}
.customer-detail { padding: 0 0 26px; background: #fff; }
.customer-topline {
    padding: 18px 18px 18px;
    background: var(--arai-bg-soft);
    border-top: 1px solid var(--arai-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}
.customer-reading { font-size: 14px; color: var(--arai-text); }
.customer-updated { margin-top: 4px; font-size: 12px; color: var(--arai-text-sub); }
.small-outline, .detail-action, .text-button, .remove-list, .icon-text-button {
    border: 0;
    border-bottom: 1px solid currentColor;
    background: transparent;
    cursor: pointer;
    padding: 2px 0;
    font-weight: 700;
    font-size: 13px;
}
.small-outline, .detail-action, .text-button { color: var(--arai-blue); }
.small-outline:hover, .detail-action:hover, .text-button:hover { color: var(--arai-navy); }
.detail-action:disabled { color: var(--arai-border-dark); cursor: default; }
.maps-button {
    margin: 18px;
    min-height: 50px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--arai-navy);
    color: #fff;
    font-weight: 700;
}
.maps-button:hover { background: var(--arai-blue); }
.detail-section {
    padding: 20px 18px;
    border-top: 1px solid var(--arai-border);
}
.detail-line {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}
.detail-label {
    color: var(--arai-navy);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.7;
}
.detail-main {
    min-width: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.8;
    overflow-wrap: anywhere;
    word-break: normal;
}
.detail-actions-row {
    width: 180px;
    margin-top: 6px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.address-text { font-weight: 500; }
.plain-list { margin: 0; padding-left: 1.25em; }
.plain-list li + li { margin-top: 4px; }
.empty-detail { margin: 0; color: var(--arai-text-sub); font-weight: 400; }
.empty-state { padding: 36px 18px; color: var(--arai-text-sub); text-align: center; border-bottom: 1px solid var(--arai-border); }

.arai-input {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    background: #fff;
    color: var(--arai-text);
    border: 1px solid var(--arai-border-dark);
    border-radius: 0;
    font-size: 16px;
}
.arai-input:focus { outline: none; border-color: var(--arai-blue); box-shadow: 0 0 0 2px rgba(17,82,158,.12); }
label { display: block; font-weight: 700; font-size: 14px; }
label > .arai-input, label > select { margin-top: 7px; font-weight: 500; }

.arai-button, .arai-button-sub {
    min-height: 46px;
    padding: 11px 18px;
    border-radius: 0;
    cursor: pointer;
    font-weight: 700;
    transition: background-color .18s, color .18s, border-color .18s;
}
.arai-button { background: var(--arai-blue); color: #fff; border: 1px solid var(--arai-blue); }
.arai-button:hover { background: var(--arai-navy); border-color: var(--arai-navy); }
.arai-button-sub { background: #fff; color: var(--arai-navy); border: 1px solid var(--arai-navy); }
.arai-button-sub:hover { background: #EEF4FA; }
.full { width: 100%; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(12,58,112,.48);
}
.modal-backdrop[hidden] { display: none; }
.modal {
    width: min(100%, 860px);
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: #fff;
    border: 1px solid var(--arai-border);
    box-shadow: 0 16px 48px rgba(0,0,0,.16);
    padding: 26px;
}
.modal-compact { width: min(100%, 650px); }
.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    padding-bottom: 18px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--arai-border);
}
.modal-head h2 { margin: 0; font-size: 26px; color: var(--arai-navy); }
.modal-lead { margin: 5px 0 0; color: var(--arai-text-sub); font-size: 13px; }
.icon-text-button { color: var(--arai-text); flex: 0 0 auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.modal form > label { margin-bottom: 14px; }
.memo-field { margin-top: 22px !important; padding-top: 20px; border-top: 1px solid var(--arai-border); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--arai-border); }
.list-editor { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--arai-border); }
.list-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.list-editor-head h3 { margin: 0; font-size: 17px; color: var(--arai-navy); }
.editable-list { display: grid; gap: 8px; }
.editable-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.remove-list { min-height: 46px; padding: 0 10px; border: 1px solid var(--arai-border-dark); color: var(--arai-danger); text-decoration: none; }

.toast {
    position: fixed;
    z-index: 200;
    left: 50%;
    bottom: max(24px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    min-width: min(90vw, 320px);
    padding: 12px 16px;
    background: var(--arai-navy);
    color: #fff;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.toast.error { background: var(--arai-danger); }

.history-page-section { padding: 36px 0 80px; }
.history-page-wrap { max-width: 980px; }
.history-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--arai-border);
}
.history-toolbar p { margin: 0; color: var(--arai-text-sub); }
.history-page-list { border-top: 1px solid var(--arai-border); }
.history-card { padding: 24px 8px; border-bottom: 1px solid var(--arai-border); }
.history-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.history-card-head h2 { margin: 2px 0 0; font-size: 18px; color: var(--arai-navy); }
.history-date { color: var(--arai-text-sub); font-size: 12px; }
.history-changes { display: grid; gap: 8px; }
.history-change-row {
    display: grid;
    grid-template-columns: 120px minmax(0,1fr) 28px minmax(0,1fr);
    gap: 10px;
    align-items: start;
    padding: 10px 12px;
    background: var(--arai-bg-soft);
}
.history-field { font-weight: 700; color: var(--arai-navy); }
.history-before { color: var(--arai-text-sub); overflow-wrap: anywhere; }
.history-arrow { text-align: center; color: var(--arai-blue); }
.history-after { font-weight: 700; overflow-wrap: anywhere; }
.history-memo { margin-top: 12px; color: var(--arai-text-sub); font-size: 13px; }

.login-page { min-height: 100vh; background: var(--arai-navy); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-panel { width: min(100%, 520px); background: #fff; padding: 34px; border-top: 8px solid var(--arai-blue); }
.login-brand { min-height: 64px; display: flex; align-items: center; gap: 14px; margin-bottom: 34px; padding: 10px 14px; background: var(--arai-navy); }
.login-brand-mark { width: 48px; height: 48px; }
.login-wordmark { font-size: 25px; }
.login-heading h1 { margin: 0; color: var(--arai-navy); font-size: 34px; line-height: 1.3; }
.login-copy { color: var(--arai-text-sub); }
.login-form { margin-top: 24px; display: grid; gap: 14px; }
.login-note { margin: 16px 0 0; color: var(--arai-text-sub); font-size: 12px; }
.notice { margin: 18px 0; padding: 10px 12px; border: 1px solid var(--arai-border); }
.notice-error { border-color: #D7A5A5; color: var(--arai-danger); background: #FFF8F8; }

@media (max-width: 820px) {
    .container { width: min(100% - 28px, var(--arai-content-width)); }
    .header-inner { min-height: auto; padding: 10px 0; align-items: flex-start; }
    .brand-mark { width: 40px; height: 40px; }
    .brand-wordmark { font-size: 21px; }
    .header-nav { min-height: 0; flex-wrap: wrap; justify-content: flex-end; }
    .nav-link { min-height: 34px; padding: 0 8px; font-size: 12px; }
    .route-page-grid { grid-template-columns: repeat(2, 1fr); }
    .search-head-inner { min-height: 132px; }
    .search-toolbar { grid-template-columns: 1fr; align-items: stretch; }
    .search-toolbar-actions { justify-content: stretch; }
    .search-toolbar-actions > * { flex: 1; }
    .detail-line { grid-template-columns: 150px minmax(0,1fr); }
    .detail-actions-row { width: 150px; }
}

@media (max-width: 600px) {
    .container { width: min(100% - 24px, var(--arai-content-width)); }
    .site-header { position: static; }
    .header-inner { display: block; }
    .site-brand { margin-bottom: 8px; }
    .header-nav { justify-content: flex-start; margin: 0 -8px; }
    .nav-link { border-bottom-width: 2px; }
    .hero-inner { padding: 38px 0 36px; }
    .hero-inner h1, .search-head h1 { font-size: 28px; }
    .search-head-inner { min-height: 0; padding: 30px 0; display: block; }
    .head-back-link { display: inline-flex; margin-top: 18px; }
    .route-page-section { padding: 26px 0 56px; }
    .route-page-grid { grid-template-columns: 1fr; }
    .route-page-card { min-height: 96px; padding: 18px; }
    .route-page-card span { font-size: 20px; }
    .route-page-subnav { justify-content: stretch; }
    .route-page-subnav .arai-button-sub { width: 100%; }
    .search-work-section { padding: 24px 0 64px; }
    .search-toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .customer-summary { min-height: 68px; padding: 14px 2px; }
    .customer-name { font-size: 16px; }
    .route-badge { font-size: 11px; }
    .customer-topline { display: block; padding: 16px 12px; }
    .small-outline { margin-top: 10px; }
    .maps-button { margin: 14px 12px; padding: 12px 14px; font-size: 14px; }
    .detail-section { padding: 18px 12px; }
    .detail-line {
        grid-template-columns: minmax(76px, 28%) minmax(0, 1fr);
        gap: 14px;
        align-items: start;
    }
    .detail-actions-row {
        width: min(28%, 118px);
        min-width: 76px;
        margin-top: 7px;
        gap: 10px;
        flex-wrap: wrap;
    }
    .detail-action { min-height: 30px; padding: 3px 0; }
    .detail-main { font-size: 15px; line-height: 1.8; }
    .plain-list { padding-left: 1.1em; }
    .modal-backdrop { padding: 0; align-items: end; }
    .modal, .modal-compact { width: 100%; max-height: 94vh; padding: 20px 14px 18px; border-left: 0; border-right: 0; border-bottom: 0; }
    .modal-head h2 { font-size: 22px; }
    .form-grid { grid-template-columns: 1fr; gap: 12px; }
    .modal-actions { position: sticky; bottom: -18px; background: #fff; margin-inline: -14px; padding: 14px; }
    .modal-actions > * { flex: 1; }
    .history-toolbar { display: block; }
    .history-toolbar .arai-button-sub { margin-top: 12px; width: 100%; }
    .history-card { padding: 20px 0; }
    .history-change-row { grid-template-columns: 1fr; gap: 3px; }
    .history-arrow { text-align: left; }
    .history-arrow::after { content: '変更後'; margin-left: 8px; color: var(--arai-text-sub); font-size: 11px; }
    .login-shell { padding: 0; background: #fff; align-items: start; }
    .login-panel { width: 100%; min-height: 100vh; padding: 26px 18px; border-top: 8px solid var(--arai-blue); }
}
