/* 請求書作成フォームのスタイル */
.invoice-create {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.invoice-create h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.invoice-create label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
}

.invoice-create input[type="text"],
.invoice-create input[type="number"],
.invoice-create input[type="date"],
.invoice-create textarea,
.invoice-create select {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.invoice-create textarea {
    height: 100px;
}

.invoice-create .item-row {
    margin-top: 10px;
    display: block;
}

.invoice-create .item-description {
    margin-bottom: 10px;
}

.invoice-create .item-details {
    display: flex;
    gap: 10px;
    align-items: center;
}

.invoice-create .even-row {
    background-color: #e6f3ff; /* 薄い青色 */
}

.invoice-create .button-primary,
.invoice-create .button-delete {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.invoice-create .button-primary {
    background: #0073aa;
    color: #fff;
}

.invoice-create .button-delete {
    background: #d63638;
    color: #fff;
}

/* 請求書一覧のスタイル */
.invoice-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.invoice-list th,
.invoice-list td {
    border: 1px solid #ddd;
    padding: 8px;
    font-size: 14px;
    text-align: left;
    vertical-align: middle; /* ボタンの垂直位置を調整 */
}

.invoice-list .even-row {
    background-color: #f9f9f9;
}

.invoice-list .odd-row {
    background-color: #fff;
}

/* 列幅の調整 */
.invoice-list th:nth-child(1), .invoice-list td:nth-child(1) { width: 20%; } /* No. */
.invoice-list th:nth-child(2), .invoice-list td:nth-child(2) { width: 15%; } /* 発行者 */
.invoice-list th:nth-child(3), .invoice-list td:nth-child(3) { width: 10%; } /* 発行日 */
.invoice-list th:nth-child(4), .invoice-list td:nth-child(4) { width: 10%; } /* 支払い期限 */
.invoice-list th:nth-child(5), .invoice-list td:nth-child(5) { width: 15%; } /* 請求先 */
.invoice-list th:nth-child(6), .invoice-list td:nth-child(6) { width: 10%; } /* 合計 */
.invoice-list th:nth-child(7), .invoice-list td:nth-child(7) { width: 10%; } /* 状態 */
.invoice-list th:nth-child(8), .invoice-list td:nth-child(8) { width: 10%; } /* 請求書タイプ */
.invoice-list th:nth-child(9), .invoice-list td:nth-child(9) { width: 10%; min-width: 120px; } /* 操作 */

/* ボタンのスタイルを調整 */
.button-primary,
.button-delete {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin: 2px;
    display: inline-block;
    white-space: nowrap; /* 改行を防ぐ */
}

/* 請求書詳細ページのスタイル */
.invoice-detail {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

.invoice-header {
    text-align: center;
    margin-bottom: 20px;
}

.invoice-no-text {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.invoice-header h1 {
    font-size: 24px;
    margin: 10px 0;
    text-decoration: none; /* 下線を削除 */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.client-info {
    flex: 1;
    margin-right: 20px; /* ロゴとの間隔を確保 */
}

.client-info p {
    margin: 5px 0;
    font-size: 16px; /* 宛先の文字を大きく */
}

.issuer-logo-container {
    text-align: right;
    flex-shrink: 0; /* ロゴが縮まないように */
}

.issuer-logo {
    max-width: 300px; /* ロゴサイズを300pxに */
    height: auto;
}

.invoice-amount {
    text-align: center;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: baseline;
    clear: both; /* 前の要素との重なりを防ぐ */
}

.amount-label {
    font-size: 20px; /* 文字を大きく */
    margin-right: 20px; /* ラベルと金額の間を空ける */
    color: #000000; /* 黒に変更 */
}

.amount-value {
    font-size: 32px; /* 文字を大きく */
    font-weight: bold;
    color: #000000; /* 黒に変更 */
}

.invoice-items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.invoice-items th,
.invoice-items td {
    border: 1px solid #ddd;
    padding: 8px;
    font-size: 12px; /* 表の文字を小さく */
}

.invoice-items th:nth-child(1),
.invoice-items td:nth-child(1) {
    text-align: left; /* No. */
    width: 5%;
}

.invoice-items th:nth-child(2),
.invoice-items td:nth-child(2) {
    text-align: left; /* 商品名/説明 */
    width: 40%;
}

.invoice-items th:nth-child(3),
.invoice-items td:nth-child(3) {
    text-align: right; /* 数量 */
    width: 10%;
    display: table-cell; /* 表示を強制 */
}

.invoice-items th:nth-child(4),
.invoice-items td:nth-child(4) {
    text-align: right; /* 単位 */
    width: 10%;
}

.invoice-items th:nth-child(5),
.invoice-items td:nth-child(5) {
    text-align: right; /* 単価 */
    width: 15%;
}

.invoice-items th:nth-child(6),
.invoice-items td:nth-child(6) {
    text-align: right; /* 税区分 */
    width: 10%;
}

.invoice-items th:nth-child(7),
.invoice-items td:nth-child(7) {
    text-align: right; /* 金額 */
    width: 10%;
}

.invoice-items th {
    background: #f5f5f5;
    font-weight: bold;
}

.invoice-items .even-row {
    background: #f9f9f9;
}

.invoice-items .odd-row {
    background: #fff;
}

.invoice-summary {
    margin-top: 20px;
    text-align: right;
}

.summary-item {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin: 5px 0;
}

.summary-item.total {
    font-weight: bold;
    font-size: 16px;
}

.invoice-footer {
    margin-top: 20px;
}

.invoice-footer p {
    margin: 5px 0;
}

.print-button {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

@media print {
  /* 印刷時は画面と同じレイアウトを維持し、印刷ボタンだけ非表示にする */
  .print-button {
      display: none;
  }
  @page {
      margin: 1cm;
  }
}

@media (max-width: 768px) {
    .invoice-create .item-details {
        flex-wrap: wrap;
    }

    .invoice-create .item-details input,
    .invoice-create .item-details select {
        width: 100%;
        margin-bottom: 10px;
    }

    .invoice-detail .header-content {
        flex-direction: column;
        align-items: center;
    }

    .invoice-detail .client-info,
    .invoice-detail .issuer-logo-container {
        text-align: center;
    }
}

/* 請求先登録ページのスタイル */
.client-register,
.bank-register,
.issuer-upload {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.client-register h2,
.bank-register h2,
.issuer-upload h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.client-register label,
.bank-register label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
}

.client-register input[type="text"],
.client-register input[type="email"],
.client-register textarea,
.bank-register textarea {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.client-register textarea,
.bank-register textarea {
    height: 100px;
}

.client-register ul,
.bank-register ul {
    list-style: none;
    padding: 0;
}

.client-register li,
.bank-register li {
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.button-primary,
.button-delete {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.button-primary {
    background: #0073aa;
    color: #fff;
}

.button-delete {
    background: #d63638;
    color: #fff;
}

/* 発行元ロゴアップロードページのスタイル */
.issuer-upload img {
    max-width: 300px;
    height: auto;
    margin-top: 10px;
}

/* ポップアップのスタイル */
.invoice-popup {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.invoice-popup-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px;
    position: relative;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.close-popup {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-popup:hover,
.close-popup:focus {
    color: #000;
    text-decoration: none;
}

#invoice-popup-body {
    margin-bottom: 20px;
}

/* ============================================================
   DVTV-052 超モダン一覧UI
   ============================================================ */
.dvtv052-wrap {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
    max-width: 100%;
}

/* --- トースト通知 --- */
.dvtv052-toast {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    animation: dvtv052FadeIn .3s;
}
.dvtv052-toast-success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.dvtv052-toast-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }
@keyframes dvtv052FadeIn { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:translateY(0)} }

/* --- サマリーカード --- */
.dvtv052-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.dvtv052-stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 18px;
    flex: 1;
    min-width: 160px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: all .2s;
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
}
.dvtv052-stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateY(-2px); }
.dvtv052-stat-card.active { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,.2); }
.dvtv052-stat-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.dvtv052-stat-num { font-size: 22px; font-weight: 700; line-height: 1.1; color: #1f2937; }
.dvtv052-stat-label { font-size: 11px; color: #6b7280; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.dvtv052-stat-amount { font-size: 12px; color: #4b5563; font-weight: 600; margin-top: 2px; }

/* --- テーブル --- */
.dvtv052-table-wrap {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow-x: auto;
    border: 1px solid #e5e7eb;
}
.dvtv052-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.dvtv052-table thead th {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #f1f5f9;
    padding: 10px 10px;
    font-weight: 600;
    font-size: 11.5px;
    text-align: left;
    white-space: nowrap;
    letter-spacing: .3px;
    border: none;
}
.dvtv052-table thead th:first-child { border-radius: 11px 0 0 0; }
.dvtv052-table thead th:last-child  { border-radius: 0 11px 0 0; }
.dvtv052-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background .15s;
}
.dvtv052-table tbody tr:hover { background: #f8fafc; }
.dvtv052-table tbody tr:nth-child(even) { background: #fafbfc; }
.dvtv052-table tbody tr:nth-child(even):hover { background: #f1f5f9; }
.dvtv052-table tbody td {
    padding: 8px 10px;
    vertical-align: middle;
    border: none;
}

/* 支払済み行 */
.dvtv052-row-paid { opacity: .55; }
.dvtv052-row-paid:hover { opacity: .8; }

/* 期限超過行 */
.dvtv052-row-overdue td { background: #fef2f2 !important; }

/* --- 請求書No --- */
.dvtv052-inv-no {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 4px;
    word-break: break-all;
}

/* --- 金額 --- */
.dvtv052-amount {
    font-weight: 700;
    font-size: 13px;
    color: #1f2937;
    white-space: nowrap;
}

/* --- 発行者 --- */
.dvtv052-creator {
    font-size: 11.5px;
    color: #6b7280;
}

/* --- バッジ --- */
.dvtv052-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .5px;
}
.dvtv052-badge-unpaid { background: linear-gradient(135deg,#fef3c7,#fde68a); color: #92400e; }
.dvtv052-badge-paid   { background: linear-gradient(135deg,#d1fae5,#a7f3d0); color: #065f46; }
.dvtv052-badge-overdue {
    display: inline-block;
    font-size: 9px;
    background: #fee2e2;
    color: #dc2626;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 4px;
}

/* --- タイプタグ --- */
.dvtv052-type-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10.5px;
    background: #ede9fe;
    color: #5b21b6;
    font-weight: 600;
}

/* --- ボタン共通 --- */
.dvtv052-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none !important;
    white-space: nowrap;
    gap: 3px;
    line-height: 1.4;
}
.dvtv052-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.12); }

.dvtv052-btn-detail { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.dvtv052-btn-detail:hover { background: #dbeafe; }

.dvtv052-btn-paid { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.dvtv052-btn-paid:hover { background: #a7f3d0; }

.dvtv052-btn-reset { background: #f3f4f6; color: #6b7280; border-color: #d1d5db; }
.dvtv052-btn-reset:hover { background: #e5e7eb; }

.dvtv052-btn-edit { background: #fef3c7; color: #92400e; border-color: #fde68a; padding: 4px 7px; }
.dvtv052-btn-edit:hover { background: #fde68a; }

.dvtv052-btn-dup { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; padding: 4px 7px; }
.dvtv052-btn-dup:hover { background: #ddd6fe; }

.dvtv052-btn-del { background: #fee2e2; color: #dc2626; border-color: #fca5a5; padding: 4px 7px; }
.dvtv052-btn-del:hover { background: #fca5a5; }

/* --- 操作セル --- */
.dvtv052-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
}
.dvtv052-actions form { margin: 0; }

/* --- ページネーション --- */
.dvtv052-pager {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
}
.dvtv052-btn-page {
    background: #fff;
    color: #374151;
    border-color: #d1d5db;
    min-width: 34px;
    text-align: center;
    padding: 6px 10px;
    font-size: 12px;
}
.dvtv052-btn-page:hover { background: #f3f4f6; }
.dvtv052-page-active {
    background: linear-gradient(135deg,#6366f1,#8b5cf6) !important;
    color: #fff !important;
    border-color: #6366f1 !important;
}

/* --- レスポンシブ --- */
@media (max-width: 768px) {
    .dvtv052-stats { flex-direction: column; }
    .dvtv052-stat-card { min-width: auto; }
    .dvtv052-table { font-size: 11px; }
    .dvtv052-table thead th { font-size: 10px; padding: 8px 6px; }
    .dvtv052-table tbody td { padding: 6px; }
    .dvtv052-actions { gap: 2px; }
    .dvtv052-btn { font-size: 10px; padding: 3px 5px; }
}