* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans JP",
        sans-serif;

    background: #f5f6f8;
    color: #333;
}

/* ログイン */

.login-container {
    width: 400px;
    max-width: 90%;
    margin: 100px auto;
    padding: 30px;

    background: #fff;
    border-radius: 8px;

    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px;

    border: 1px solid #ccc;
    border-radius: 4px;

    font-size: 16px;
}

.btn {
    width: 100%;
    padding: 12px;

    border: none;
    border-radius: 4px;

    background: #2563eb;
    color: white;

    font-size: 16px;
    cursor: pointer;
}

.btn:hover {
    opacity: 0.9;
}

.error {
    margin-bottom: 20px;
    padding: 10px;

    background: #fee2e2;
    color: #b91c1c;

    border-radius: 4px;
}

/* ヘッダー */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 15px 30px;

    background: #1f2937;
    color: white;
}

.header h1 {
    margin: 0;
    font-size: 22px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info a {
    color: white;
    text-decoration: none;
}

.user-info a:hover {
    text-decoration: underline;
}

/* メイン */

.container {
    /* max-width: 1400px; */
    margin: 30px auto;
    padding: 0 20px;
}

.container h2 {
    margin-bottom: 20px;
}

.empty-message {
    padding: 30px;

    background: white;
    border-radius: 6px;

    text-align: center;
    color: #666;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-small {
    display: inline-block;
    padding: 10px 16px;
    background: #2563eb;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.btn-back {
    display: inline-block;
    margin-left: 10px;
    padding: 10px 16px;
    background: #6b7280;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.note {
    color: #666;
    font-size: 14px;
}

.table-wrapper {
    width: 100%;
    /* overflow-x: auto; */
    background: white;
    margin-bottom: 20px;
}

table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
}

th,
td {
    border: 1px solid #ddd;
    padding: 8px 10px;
    white-space: nowrap;
    text-align: left;
}

th {
    background: #f3f4f6;
    font-weight: bold;
}

.action-buttons {
    margin-top: 20px;
}

.success {
    padding: 12px 15px;
    margin-bottom: 20px;

    background: #dcfce7;
    color: #166534;

    border-radius: 5px;
}

/* 工事一覧テーブル */
.kouji-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
    font-size: 12px;
    border-collapse: collapse;
}

.kouji-table th,
.kouji-table td {
    padding: 4px 5px;
    border: 1px solid #ddd;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
}

.kouji-table th {
    background: #f3f4f6;
    font-weight: bold;
}

.btn-delete {
    display: inline-block;
    padding: 4px 8px;
    background: #dc2626;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
}

.btn-delete:hover {
    background: #b91c1c;
}

.kouji-row.status-対象外 {
    background-color: #fce7f3;
}

.kouji-row.status-完了 {
    background-color: #dbeafe;
}

.status-select {
    width: 75px;
    padding: 3px;
    font-size: 12px;
}

.btn-import {
    display: inline-block;
    padding: 4px 8px;
    background: #2563eb;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
}

.btn-import:hover {
    background: #1d4ed8;
}

.success-message {
    padding: 12px;
    margin-bottom: 15px;
    background-color: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 5px;
}

.btn-pdf {
    display: inline-block;
    width: auto;
    padding: 4px 8px;
    background-color: #16a34a;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

.btn-pdf:hover {
    background-color: #15803d;
}

.total-row td {
    background-color: #e5e7eb !important;
    border-top: 3px solid #666;
    padding: 12px 15px;
}

.total-summary {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.total-summary span {
    white-space: nowrap;
}

.total-summary strong {
    font-size: 18px;
    margin: 0 3px;
}

.kouji-table thead th {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #374151;
    color: #fff;
}

.kanri-bikou-cell {
    width: 160px;
    min-width: 120px;
    max-width: 180px;
}

.kanri-bikou-text {
    max-width: 170px;
    max-height: 52px;

    overflow: hidden;

    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;

    font-size: 12px;
    line-height: 1.3;

    margin-bottom: 4px;

    /* white-space: pre-wrap; */
}

.btn-kanri-bikou-edit {
    padding: 3px 8px;

    border: 1px solid #9ca3af;
    border-radius: 4px;

    background: #fff;

    font-size: 11px;

    cursor: pointer;
}

.btn-kanri-bikou-edit:hover {
    background: #f3f4f6;
}

/* =========================================
   工事備考モーダル
========================================= */

#kanriBikouModal {
    display: none;

    position: fixed;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    background-color: rgba(0, 0, 0, 0.5);

    z-index: 99999;

    align-items: center;
    justify-content: center;
}

#kanriBikouModal .kanri-bikou-modal-content {
    position: relative;

    width: 500px;
    max-width: 90%;

    background-color: #ffffff;

    padding: 20px;

    border-radius: 8px;

    box-sizing: border-box;
}

#kanriBikouModal textarea {
    width: 100%;
    min-height: 160px;

    padding: 10px;

    box-sizing: border-box;

    resize: vertical;

    font-size: 14px;
}

.kanri-bikou-modal-buttons {
    display: flex;

    justify-content: flex-end;

    gap: 10px;

    margin-top: 15px;
}

.btn-kanri-bikou-save,
.btn-kanri-bikou-cancel {
    padding: 7px 15px;
    cursor: pointer;
}
.mail-sent {
    display: inline-block;
    padding: 4px 8px;
    background: #d4edda;
    color: #155724;
    border-radius: 4px;
    font-weight: bold;
}

.mail-not-sent {
    color: #999;
}