* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f5f7f9;
    color: #1f2933;
    font-family: "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto;
}

.page.narrow {
    width: min(560px, calc(100% - 32px));
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.nav a {
    padding: 8px 12px;
    border: 1px solid #d0d9e2;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2933;
    text-decoration: none;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 4px;
    color: #607080;
    font-size: 13px;
}

h1 {
    margin: 0;
    font-size: 26px;
}

.panel {
    background: #ffffff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    overflow: hidden;
}

.user-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.user-strip span {
    display: block;
    margin-bottom: 4px;
    color: #607080;
    font-size: 13px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.menu-item {
    display: flex;
    align-items: center;
    min-height: 84px;
    padding: 16px;
    border: 1px solid #d0d9e2;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2933;
    font-weight: 700;
    text-decoration: none;
}

.menu-item:hover {
    border-color: #1c6b8f;
    color: #1c6b8f;
}

.form-panel {
    padding: 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.route-list-page {
    width: min(1560px, calc(100% - 24px));
    margin-top: 20px;
}

.route-list-page .page-header {
    margin-bottom: 12px;
}

.route-list-page .form-panel {
    padding: 14px;
}

.compact-table {
    font-size: 12px;
}

.compact-table th,
.compact-table td {
    padding: 6px 8px;
}

.compact-table input,
.compact-table select {
    min-height: 28px;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.route-table th,
.route-table td {
    white-space: nowrap;
}

.route-table .route-contractor-name {
    font-size: 130%;
    font-weight: 700;
}

.route-table .route-contractor-name strong {
    font-weight: 700;
}

.contractor-name-strong {
    font-size: 130%;
    font-weight: 700;
}

.delivery-completion-contractor-name,
.delivery-completion-contractor-name strong {
    font-size: 130%;
    font-weight: 900 !important;
}

.contractor-name-strong input,
input.contractor-name-strong {
    font-size: 130%;
    font-weight: 700 !important;
}

.contractor-colored-row input,
.contractor-colored-row select,
.contractor-colored-row textarea {
    color: inherit !important;
    -webkit-text-fill-color: currentColor;
}

.contractor-colored-row .contractor-name-strong {
    font-weight: 700 !important;
}

.route-table .route-comment-cell {
    min-width: 14em;
    white-space: nowrap;
}

.route-comment-input {
    width: 100%;
    min-width: 14em;
    box-sizing: border-box;
    min-height: 28px;
    resize: none;
    white-space: nowrap;
}

.route-comment-text {
    display: block;
    min-width: 14em;
    white-space: nowrap;
}

.address-cell {
    min-width: 280px;
    white-space: normal;
    word-break: break-all;
}

.route-table .address-cell {
    min-width: 360px;
    white-space: normal;
    word-break: break-all;
}

.table-scroll {
    overflow-x: auto;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #e6ebf0;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #eef3f7;
    font-weight: 700;
}

.actions,
.footer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid #aab7c4;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2933;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.button.primary {
    border-color: #1c6b8f;
    background: #1c6b8f;
    color: #ffffff;
}

.button.danger {
    border-color: #b84a4a;
    color: #9f2f2f;
}

.message {
    padding: 12px 14px;
    border: 1px solid #acd2bd;
    border-radius: 6px;
    background: #edf8f1;
    color: #20613a;
}

.empty {
    color: #607080;
    text-align: center;
}

.empty-state {
    padding: 40px 24px;
    text-align: center;
}

.empty-state-title {
    margin: 0 0 8px;
    color: #1f2933;
    font-size: 20px;
    font-weight: 700;
}

.empty-state-text {
    margin: 0;
    color: #607080;
    font-size: 14px;
    line-height: 1.7;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}

.form-grid.one-column {
    grid-template-columns: 1fr;
}

.inline-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 16px;
    align-items: end;
}

.csv-import-panel {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e6ebf0;
}

.route-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0;
    margin: 0 14px;
    border-bottom: 1px solid #cdd6df;
}

.route-subtabs {
    margin-top: 8px;
}

.route-tab-form {
    margin: 0 6px -1px 0;
}

.route-tab-with-check {
    display: flex;
    align-items: flex-end;
    gap: 4px;
}

.check-all-btn {
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid #cdd6df;
    border-radius: 4px;
    background: #ffffff;
    color: #51606f;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 4px;
    white-space: nowrap;
}

.route-tab-button {
    min-width: 112px;
    min-height: 38px;
    padding: 0 18px;
    border: 1px solid #cdd6df;
    border-bottom-color: #cdd6df;
    border-radius: 8px 8px 0 0;
    background: #eef3f7;
    color: #51606f;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.route-tab-button.active {
    border-bottom-color: #ffffff;
    background: #ffffff;
    color: #1f2933;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

label.wide {
    grid-column: 1 / -1;
}

.form-field {
    display: grid;
    gap: 6px;
    align-content: start;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #b8c4cf;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2933;
    font: inherit;
}

input[readonly] {
    background: #eef3f7;
}

small {
    color: #b42318;
    font-weight: 400;
}

.error-summary {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #e7a4a4;
    border-radius: 6px;
    background: #fff1f1;
    color: #9f2f2f;
}

.footer-actions {
    justify-content: flex-end;
    margin-top: 24px;
}

.list-edit-actions {
    padding: 0 14px 14px;
}

.badge-delivered {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: #d1f0e0;
    color: #1a6e40;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

tr.completed-row {
    opacity: 0.55;
    background: #f0f4f8;
}

tr.completed-row input[type="checkbox"] {
    accent-color: #6b7a8d;
}

.mobile-delivery-page {
    width: min(100%, 720px);
    margin: 0 auto;
    padding: 12px;
}

.mobile-delivery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.mobile-delivery-header h1 {
    margin: 0;
    font-size: 22px;
}

.mobile-filter,
.mobile-next-panel,
.mobile-stop-card {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #d9e1ea;
    border-radius: 8px;
    background: #ffffff;
}

.mobile-filter form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.mobile-route-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.mobile-route-tabs a {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid #aab7c4;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2933;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.mobile-route-tabs a.active {
    border-color: #1f6feb;
    background: #eaf2ff;
    color: #174ea6;
}

.mobile-label {
    display: block;
    color: #607080;
    font-size: 12px;
    font-weight: 700;
}

.mobile-map-frame {
    position: relative;
    height: 240px;
    margin: 10px 0;
    overflow: hidden;
    border: 1px solid #d9e1ea;
    border-radius: 8px;
    background: #eef3f7;
}

.mobile-map-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.mobile-map-frame .hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.route-map-canvas {
    position: relative;
    height: 240px;
    margin: 10px 0;
    overflow: hidden;
    border: 1px solid #d9e1ea;
    border-radius: 8px;
    background: #e7edf3;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.route-map-canvas:active {
    cursor: grabbing;
}

.route-map-canvas:fullscreen {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
}

.route-map-tiles,
.route-map-markers {
    position: absolute;
    inset: 0;
}

.route-map-tiles img {
    position: absolute;
    width: 256px;
    height: 256px;
    max-width: none;
}

.route-map-markers {
    pointer-events: none;
}

.map-seq-marker {
    position: absolute;
    width: 34px;
    height: 34px;
    margin: -34px 0 0 -17px;
    border: 2px solid #ffffff;
    border-radius: 50% 50% 50% 0;
    background: #d04747;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
    color: #ffffff;
    cursor: pointer;
    pointer-events: auto;
    transform: rotate(-45deg);
}

.map-seq-marker span {
    display: inline-flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    transform: rotate(45deg);
}

.map-seq-marker.delivered {
    background: #1f9d55;
}

.map-seq-marker.active {
    z-index: 2;
    background: #174ea6;
    box-shadow: 0 0 0 4px rgba(23, 78, 166, 0.25), 0 4px 12px rgba(15, 23, 42, 0.35);
}

.route-map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: grid;
    gap: 6px;
}

.route-map-controls button {
    width: 34px;
    height: 34px;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2933;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.mobile-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.mobile-action-row .button {
    flex: 1 1 auto;
}

.mobile-location-status {
    margin: 8px 0 0;
    color: #607080;
    font-size: 12px;
}

.mobile-stop-list {
    display: grid;
    gap: 12px;
}

.mobile-stop-card {
    border-left: 7px solid #d04747;
}

.mobile-stop-card.delivered {
    border-left-color: #1f9d55;
    background: #f2fbf6;
}

.mobile-stop-card.active {
    outline: 2px solid #1f6feb;
}

.mobile-stop-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: start;
}

.mobile-stop-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
}

.mobile-stop-head p {
    margin: 4px 0 0;
    color: #4a5968;
    font-size: 13px;
    line-height: 1.45;
}

.mobile-seq,
.mobile-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 900;
}

.mobile-seq {
    background: #eef3f7;
}

.mobile-status {
    background: #ffdede;
    color: #8f2424;
    white-space: nowrap;
}

.mobile-stop-card.delivered .mobile-status {
    background: #d9f7e6;
    color: #176b3a;
}

.mobile-stop-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.mobile-stop-meta div {
    padding: 8px;
    border-radius: 6px;
    background: #f6f8fa;
}

.mobile-stop-meta dt {
    color: #607080;
    font-size: 11px;
    font-weight: 700;
}

.mobile-stop-meta dd {
    margin: 3px 0 0;
    font-size: 14px;
    font-weight: 800;
}

.pc-compact-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.visit-order-actions {
    display: grid;
    grid-template-columns: repeat(2, 32px);
    gap: 4px;
}

.visit-order-actions form {
    margin: 0;
}

.icon-button {
    width: 32px;
    height: 32px;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2933;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.icon-button:hover {
    border-color: #1c6b8f;
    color: #1c6b8f;
}

.mobile-stop-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.mobile-stop-form textarea {
    width: 100%;
    min-height: 76px;
    resize: vertical;
}

.special-notes-box {
    padding: 10px;
    border: 1px solid #d9e1ea;
    border-radius: 6px;
    background: #f6f8fa;
}

.special-notes-box span {
    display: block;
    color: #607080;
    font-size: 12px;
    font-weight: 700;
}

.special-notes-box p {
    margin: 6px 0 0;
    white-space: pre-wrap;
}

.storage-photo-preview {
    display: grid;
    gap: 6px;
}

.storage-photo-preview span {
    color: #607080;
    font-size: 12px;
    font-weight: 700;
}

.storage-photo-preview a {
    display: block;
    overflow: hidden;
    border: 1px solid #d9e1ea;
    border-radius: 6px;
    background: #f6f8fa;
}

.storage-photo-preview-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.storage-photo-item {
    display: grid;
    gap: 6px;
}

.storage-photo-delete {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
}

.storage-photo-delete input {
    width: auto;
    min-height: 0;
}

.storage-photo-preview img {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.storage-photo-filename {
    display: block;
    padding: 6px 8px;
    overflow-wrap: anywhere;
    color: #4a5968;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}

/* 契約種別１：配送先一覧スタイル */
.ct1-destination-title {
    margin: 12px 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: #607080;
    border-bottom: 1px solid #d9e1ea;
    padding-bottom: 4px;
}

.ct1-destination-item {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid #d9e1ea;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8fafc;
}

.ct1-destination-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.ct1-destination-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-height: 0;
    cursor: pointer;
}

.ct1-destination-address {
    font-size: 12px;
    color: #607080;
    margin: 0;
}

.ct1-destination-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ct1-pickup-count-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
}

.ct1-pickup-count-label input[type="number"] {
    width: 80px;
    min-height: 0;
    padding: 6px 8px;
}

/* 曜日チェックボックスグループ */
.weekday-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    padding: 6px 0;
}

.weekday-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #c8d4e0;
    border-radius: 6px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    user-select: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.weekday-item:has(.weekday-cb:checked) {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.weekday-item:has(.weekday-cb:disabled) {
    opacity: 0.65;
    cursor: default;
}

.weekday-cb {
    width: 15px;
    height: 15px;
    min-height: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #3b82f6;
}

.pc-route-workspace {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.pc-route-map-panel {
    position: sticky;
    top: 76px;              /* 固定トップバー（64px）の下で止める */
}

.pc-route-map-panel .mobile-map-frame {
    height: 420px;
}

.pc-route-map-panel .route-map-canvas {
    height: 420px;
}

.pc-route-card-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 760px) {
    .page-header,
    .form-grid,
    .csv-import-panel,
    .inline-form,
    .user-strip,
    .menu-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    table {
        min-width: 900px;
    }

    .panel {
        overflow-x: auto;
    }

    .pc-route-workspace,
    .pc-route-card-list {
        grid-template-columns: 1fr;
    }

    .pc-route-map-panel {
        position: static;
    }
}

/* ===== 共通トップバー（fragments/topbar.html） ===== */
.app-topbar {
    position: sticky;            /* スクロールしても画面上部に残す */
    top: 0;
    z-index: 900;                /* 地図のポップアップ（1000〜）より下、本文より上 */
    background: linear-gradient(90deg, #123f57, #1c6b8f);
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(18, 63, 87, 0.25);
}

.app-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: calc(100% - 48px);
    height: 64px;
    margin: 0 auto;
}

.app-topbar svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    text-decoration: none;
}

.app-brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 7px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.app-brand-text,
.app-account-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.app-brand-text strong {
    font-size: 17px;
    letter-spacing: 0.02em;
}

.app-brand-text small,
.app-account-text small {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
}

.app-account {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    color: #123f57;
    font-weight: 700;
}

.app-account-text strong {
    font-size: 14px;
}

.app-account form {
    margin: 0 0 0 4px;
}

.app-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    background: transparent;
    color: #ffffff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.app-logout svg {
    width: 16px;
    height: 16px;
}

.app-logout:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* パスワード変更（2026-11-19）：ログアウトと同じ見た目。狭い幅では鍵のアイコンだけ */
.app-password-link {
    flex: none;
    white-space: nowrap;
    text-decoration: none;
}
@media (max-width: 1100px) {
    .app-password-label {
        display: none;
    }
    .app-password-link {
        padding: 0 10px;
    }
}

@media (max-width: 640px) {
    .app-topbar-inner {
        width: calc(100% - 24px);
        height: 56px;
    }

    .app-account-text,
    .app-brand-text small {
        display: none;
    }
}

@media print {
    .app-topbar {
        display: none;
    }
}

/* =====================================================================
   リッチテーマ（.ui-rich）
   CT1・CT2 でログインしているときに <body> に付く（2026-11-13 CT1 にも適用。システム管理者は契約種別がないので付かない）。
   文字を一回り小さくし、パネル・表・ボタン・入力欄を立体的に見せる。
   ===================================================================== */
.ui-rich {
    --ui-ink: #1b2a38;
    --ui-muted: #5f7080;
    --ui-line: #e3e9ef;
    --ui-brand: #1c6b8f;
    --ui-brand-2: #2a8db5;
    font-size: 13px;
    color: var(--ui-ink);
    background:
        radial-gradient(1100px 420px at 100% -10%, rgba(28, 107, 143, 0.10), transparent 60%),
        linear-gradient(180deg, #e9f0f6 0, #f4f7fa 340px) fixed;
}

.ui-rich .page {
    margin-top: 22px;
}

/* ---- 見出し ---- */
.ui-rich .page-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(28, 107, 143, 0.14);
}

.ui-rich .eyebrow {
    margin-bottom: 3px;
    color: var(--ui-brand);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ui-rich .page-header h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    letter-spacing: 0.02em;
}

.ui-rich .page-header h1::before {
    content: "";
    flex: none;
    width: 5px;
    height: 20px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--ui-brand-2), var(--ui-brand));
}

/* ---- パネル ---- */
.ui-rich .panel {
    border: 1px solid var(--ui-line);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 40, 60, 0.04), 0 8px 24px rgba(16, 40, 60, 0.06);
}

.ui-rich .form-panel {
    padding: 18px 20px;
}

.ui-rich .route-list-page .form-panel {
    padding: 12px 14px;
}

/* ---- 表 ---- */
.ui-rich table {
    font-size: 12.5px;
}

.ui-rich th,
.ui-rich td {
    padding: 9px 12px;
    border-bottom-color: #edf1f5;
}

.ui-rich th {
    background: linear-gradient(180deg, #f7f9fb, #edf2f6);
    border-bottom: 1px solid #dde5ec;
    color: #46596a;
    font-size: 11.5px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.ui-rich tbody tr:nth-child(even) > td {
    background-color: #fafcfd;
}

/* 行の色（完了行など）を消さないよう、ホバーは重ね塗りで表現 */
.ui-rich tbody tr:hover > td {
    box-shadow: inset 0 0 0 9999px rgba(28, 107, 143, 0.05);
}

.ui-rich .compact-table {
    font-size: 11.5px;
}

.ui-rich .compact-table th,
.ui-rich .compact-table td {
    padding: 5px 7px;
}

/* ---- ボタン ---- */
.ui-rich .button {
    min-height: 32px;
    padding: 0 13px;
    border-color: #c5d0da;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(16, 40, 60, 0.06);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
}

.ui-rich .button:hover {
    border-color: var(--ui-brand);
    color: var(--ui-brand);
    box-shadow: 0 3px 10px rgba(16, 40, 60, 0.10);
}

.ui-rich .button.primary {
    border-color: #1a6386;
    background: linear-gradient(180deg, #2585ad, var(--ui-brand));
    color: #ffffff;
}

.ui-rich .button.primary:hover {
    background: linear-gradient(180deg, #2a92bd, #1e7399);
    color: #ffffff;
}

.ui-rich .button.danger {
    border-color: #e3b3b3;
    background: #ffffff;
    color: #a8322f;
}

.ui-rich .button.danger:hover {
    border-color: #c0392b;
    background: #fff4f4;
    color: #a8322f;
}

/* ---- 入力欄 ---- */
.ui-rich label,
.ui-rich .form-field {
    gap: 4px;
    color: #3d4e5e;
    font-size: 12px;
}

.ui-rich input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.ui-rich select,
.ui-rich textarea {
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid #cdd7e0;
    border-radius: 8px;
    font-size: 12.5px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ui-rich input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.ui-rich select:focus,
.ui-rich textarea:focus {
    border-color: var(--ui-brand-2);
    box-shadow: 0 0 0 3px rgba(42, 141, 181, 0.18);
    outline: none;
}

.ui-rich input[readonly] {
    background: #f1f5f8;
}

.ui-rich .compact-table input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.ui-rich .compact-table select {
    min-height: 26px;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 11.5px;
}

/* ---- お知らせ ---- */
.ui-rich .message,
.ui-rich .error-summary {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 1px 2px rgba(16, 40, 60, 0.05);
}

.ui-rich .message {
    border-left: 4px solid #2f9e6e;
    background: #eaf7f0;
}

.ui-rich .error-summary {
    border-left: 4px solid #c0392b;
    background: #fff2f1;
}

.ui-rich .empty-state-title {
    font-size: 17px;
}

.ui-rich .empty-state-text {
    font-size: 12.5px;
}

/* ---- ルートタブ ---- */
.ui-rich .route-tab-button {
    min-width: 96px;
    min-height: 32px;
    padding: 0 14px;
    background: #e9eff4;
    font-size: 12.5px;
    transition: background 0.15s, color 0.15s;
}

.ui-rich .route-tab-button:hover {
    background: #f3f7fa;
    color: var(--ui-brand);
}

.ui-rich .route-tab-button.active {
    background: #ffffff;
    color: var(--ui-brand);
    box-shadow: inset 0 3px 0 var(--ui-brand);
}

.ui-rich .check-all-btn {
    min-height: 26px;
    border-radius: 6px;
    font-size: 11.5px;
}

/* ---- リッチテーマ：情報量の多い画面（訪問先設定画面・配車計画画面）はさらに小さく ---- */
.ui-rich .dense-page {
    font-size: 12px;
}

.ui-rich .dense-page .page-header h1 {
    font-size: 18px;
}

.ui-rich .dense-page .page-header h1::before {
    height: 18px;
}

.ui-rich .dense-page table {
    font-size: 11.5px;
}

.ui-rich .dense-page th {
    font-size: 10.5px;
}

.ui-rich .dense-page th,
.ui-rich .dense-page td {
    padding: 6px 8px;
}

.ui-rich .dense-page .compact-table {
    font-size: 11px;
}

.ui-rich .dense-page .compact-table th,
.ui-rich .dense-page .compact-table td {
    padding: 4px 6px;
}

.ui-rich .dense-page .button {
    min-height: 28px;
    padding: 0 11px;
    font-size: 11.5px;
}

.ui-rich .dense-page label,
.ui-rich .dense-page .form-field {
    font-size: 11px;
}

.ui-rich .dense-page input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.ui-rich .dense-page select,
.ui-rich .dense-page textarea {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 11.5px;
}

.ui-rich .dense-page .compact-table input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.ui-rich .dense-page .compact-table select {
    min-height: 24px;
    padding: 2px 5px;
    font-size: 11px;
}

.ui-rich .dense-page .route-tab-button {
    min-width: 84px;
    min-height: 28px;
    padding: 0 12px;
    font-size: 11.5px;
}

.ui-rich .dense-page .message,
.ui-rich .dense-page .error-summary {
    padding: 8px 12px;
    font-size: 11.5px;
}

/* ---- 固定トップバー：ページ内ジャンプがバーの下に隠れないようにする ---- */
html {
    scroll-padding-top: 76px;
}

/* ---- トップバーに出す画面のボタン（tbActions） ---- */
.app-topbar-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 6px;
}

.app-topbar-actions .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app-topbar .app-topbar-actions .button {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: none;
    transition: background 0.15s, border-color 0.15s;
}

.app-topbar .app-topbar-actions .button:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.app-topbar .app-topbar-actions .button.primary {
    border-color: #ffffff;
    background: #ffffff;
    color: #123f57;
}

.app-topbar .app-topbar-actions .button.primary:hover {
    background: #e8f2f8;
    color: #123f57;
}

/* ルート最適化の「元に戻す」（2026-11-25）：最適化した直後だけ出るので目立つ色にする（トップバー・画面ヘッダ共通） */
.button.undo-optimize-button,
.app-topbar .app-topbar-actions .button.undo-optimize-button {
    border-color: #f59e0b;
    background: #f59e0b;
    color: #ffffff;
    font-weight: 800;
}

.button.undo-optimize-button:hover,
.app-topbar .app-topbar-actions .button.undo-optimize-button:hover {
    border-color: #d97706;
    background: #d97706;
    color: #ffffff;
}

@media (max-width: 900px) {
    .app-topbar .app-account-text {
        display: none;
    }
}

/* 地図の全画面表示中は固定トップバーを隠す（地図の上部に重ならないように） */
body.map-fs-lock .app-topbar {
    visibility: hidden;
}

/* 経営者アカウント（2026-11-18）：全画面参照のみの帯と、押せなくした保存ボタン（fragments/topbar.html） */
.app-readonly-band {
    padding: 4px 16px;
    background: #fff3e0;
    border-top: 1px solid #ffcc80;
    color: #8a4b00;
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
}
button.is-readonly,
input.is-readonly {
    cursor: not-allowed !important;
    opacity: 0.45;
}

/* ---- 会社ホームページ（2026-11-18、トップバー右・天気の左。別タブで開く。2026-11-26 からログインしたグループの HP） ----
   ボタン枠はやめ、文字リンク（下線は hover だけ）＋小さな外部リンクの印 */
.app-site-link {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 4px;
    height: 36px;
    padding: 0 4px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
    text-decoration: none;
    text-underline-offset: 4px;
    transition: color 0.15s;
}
.app-site-link:hover,
.app-site-link:focus-visible {
    color: #ffffff;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.6);
}
.app-site-link svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .75;
}
/* 歯科医院の「案件オーダー」・営業の「営業支援」（2026-11-18）：天気・交通情報と同じボタン */
.app-order-link {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.app-order-link:hover,
.app-order-link:focus-visible {
    border-color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.28);
    color: #ffffff;
}
.app-order-link svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
@media (max-width: 1100px) {
    .app-site-label {
        font-size: 12px;
    }
}
@media (max-width: 900px) {
    /* 狭い幅では「株式会社」を除いた文言（data-short、例：TDSとは） */
    .app-site-label {
        font-size: 0;
    }
    .app-site-label::after {
        content: attr(data-short);
        font-size: 12px;
    }
}
@media (max-width: 640px) {
    .app-site-link svg {
        display: none;
    }
    .app-order-link {
        height: 34px;
        padding: 0 8px;
    }
    .app-order-label {
        display: none;
    }
}
@media print {
    .app-site-link,
    .app-order-link {
        display: none;
    }
}

/* ================================================================
   システム管理者の画面（2026-11-25）：body.ui-admin（ロール 1 のとき。同日から CT1 でログインしたときも）。ui-rich の上に重ねる
   ・画面タイトルの帯を、トップバーと同じ色のグラデーションのバナーにする
   ・パネルを大きめのカードに、表の見出しをスクロールしても残す
   ================================================================ */
body.ui-admin {
    background: linear-gradient(180deg, #e6eef5 0px, #f2f6f9 260px, #f6f8fa 100%);
}

.ui-admin .page-header {
    /* スクロールしてもトップバーのすぐ下に残す（「メニューへ戻る」などのボタンをいつでも押せるように。2026-11-25） */
    position: sticky;
    top: 72px;
    z-index: 800;                /* 本文・地図より上、トップバー（900）より下 */
    overflow: hidden;
    margin-bottom: 18px;
    padding: 20px 24px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(120deg, #0f3550 0%, #1c6b8f 58%, #2a9d8f 100%);
    color: #ffffff;
    /* 1 つ目の影：トップバーとのすき間（8px）を背景色で埋め、スクロールした行が見えないようにする */
    box-shadow: 0 -8px 0 0 #e9f0f5, 0 12px 30px rgba(15, 53, 80, 0.22);
}

/* 右側の飾り（薄い円） */
.ui-admin .page-header::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -80px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}

.ui-admin .page-header > * {
    position: relative;
    z-index: 1;
}

.ui-admin .page-header .eyebrow {
    color: rgba(255, 255, 255, 0.72);
}

.ui-admin .page-header h1 {
    color: #ffffff;
    font-size: 23px;
}

.ui-admin .page-header h1::before {
    width: 6px;
    height: 24px;
    background: linear-gradient(180deg, #8fe3d6, #ffffff);
}

.ui-admin .page-header .button {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    box-shadow: none;
}

.ui-admin .page-header .button:hover {
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.24);
    color: #ffffff;
}

.ui-admin .page-header .button.primary {
    border-color: #ffffff;
    background: #ffffff;
    color: #0f3550;
}

.ui-admin .page-header .button.primary:hover {
    background: #e6f3f7;
    color: #0f3550;
}

.ui-admin .panel {
    border-color: #d8e3ec;
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(16, 40, 60, 0.04), 0 14px 34px rgba(16, 40, 60, 0.08);
}

/* 表：見出しをスクロールしても残し、色を少し濃くする */
.ui-admin th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #eaf2f7, #dde9f1);
    color: #1d4560;
    border-bottom: 2px solid #c6d8e5;
}

.ui-admin tbody tr:hover > td {
    box-shadow: inset 0 0 0 9999px rgba(42, 157, 143, 0.08);
}

.ui-admin .message,
.ui-admin .error-summary {
    border-radius: 12px;
}

/* 一覧が空のとき */
.ui-admin .empty-state {
    border-radius: 14px;
}

/* スマホ幅ではトップバーが 56px なので、その下に合わせる */
@media (max-width: 640px) {
    .ui-admin .page-header {
        top: 62px;
    }
}
