/* ===== Transfer Management styles ===== */

.nav-item.subchild {
  padding-left: 40px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-sub);
}
.nav-item.subchild:hover { color: var(--accent); }
.nav-item.subchild.active { color: var(--accent); font-weight: 600; }

.tr-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; flex-wrap: wrap; gap: 12px;
}
.tr-head h1 { font-size: 22px; font-weight: 700; margin: 0; }
.tr-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Filter tabs */
.tr-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tr-tab {
  background: none; border: none;
  padding: 10px 16px; cursor: pointer;
  font-family: inherit; font-size: 13px;
  color: var(--text-sub); font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.tr-tab:hover { color: var(--accent); }
.tr-tab.active {
  color: var(--accent); font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Sub-tabs */
.tr-subtabs {
  margin-top: -8px; margin-bottom: 16px;
  padding-left: 12px;
  border-bottom: 1px dashed var(--border);
}
.tr-subtabs .tr-tab {
  padding: 7px 12px;
  font-size: 12px;
}

/* Table */
.tr-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.tr-table-scroll { overflow-x: auto; max-width: 100%; }
.tr-table {
  width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px;
}
.tr-table th, .tr-table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid rgba(0,0,0,0.05);
  white-space: nowrap;
  background: var(--surface);
}
[data-theme="dark"] .tr-table th,
[data-theme="dark"] .tr-table td { border-right-color: rgba(255,255,255,0.06); }
.tr-table th:last-child, .tr-table td:last-child { border-right: none; }
.tr-table th {
  background: var(--bg); font-weight: 600;
  color: var(--text-sub); font-size: 12px;
  position: sticky; top: 0; z-index: 2;
}
.tr-table tr:last-child td { border-bottom: none; }
.tr-table tbody tr { cursor: pointer; }
.tr-table tbody tr:hover td { background: var(--accent-soft); }
.tr-table td.amount { font-weight: 600; text-align: right; }
.tr-table td.desc { white-space: normal; min-width: 180px; max-width: 260px; }
.tr-table td.memo-cell { white-space: normal; min-width: 160px; max-width: 220px; }
.tr-table .url-cell {
  max-width: 180px; overflow: hidden; text-overflow: ellipsis;
}
.tr-table .url-cell a {
  color: var(--accent); text-decoration: none;
  display: inline-block; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; vertical-align: bottom;
}
.tr-table .url-cell a:hover { text-decoration: underline; }
.tr-table .kintone-check { text-align: center; font-weight: 600; }
.tr-table .kintone-check.ok { color: #10b981; }
.tr-table .kintone-check.ng { color: var(--text-sub); }

/* sticky columns */
.tr-table th.sticky-l, .tr-table td.sticky-l { position: sticky; z-index: 1; }
.tr-table th.sticky-l { z-index: 3; }
.tr-table th.sticky-r, .tr-table td.sticky-r {
  position: sticky; right: 0; z-index: 1;
  box-shadow: -2px 0 4px rgba(0,0,0,0.04);
}
.tr-table th.sticky-r { z-index: 3; }
.tr-table tbody tr:hover td.sticky-l,
.tr-table tbody tr:hover td.sticky-r { background: var(--accent-soft); }
.tr-table .col-no       { left: 0;     min-width: 48px;  width: 48px;  }
.tr-table .col-status   { left: 48px;  min-width: 100px; width: 100px; box-shadow: none; }
.tr-table .col-requester{ left: 148px; min-width: 96px;  width: 96px;
                           box-shadow: 2px 0 4px rgba(0,0,0,0.04); }
.tr-table .col-action   { min-width: 80px; width: 80px; text-align: center; }

/* 2段ヘッダー */
.tr-table thead tr.tr-group-row th { top: 0; height: 30px; padding: 6px 12px; }
.tr-table thead tr.tr-group-row + tr th { top: 30px; }
.tr-table .tr-group {
  text-align: center; font-weight: 600; font-size: 11px; letter-spacing: 0.04em;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border);
}
.tr-table .tr-group-base { background: var(--bg); left: 0; }
.tr-table .tr-group-action { background: var(--bg); right: 0; text-align: center; }
.tr-table .tr-group-a { background: rgba(59,130,246,0.06); }
.tr-table .tr-group-b { background: rgba(16,185,129,0.06); }
.tr-table .tr-group-c { background: rgba(234,179,8,0.08);  }

/* カテゴリ境界の縦仕切り */
.tr-table th.cat-start, .tr-table td.cat-start {
  border-left: 2px solid var(--border);
}

/* 会社別サマリー */
.tr-summary {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.tr-summary-title {
  font-size: 12px; font-weight: 600; color: var(--text-sub);
  letter-spacing: 0.04em; margin-bottom: 10px;
}
.tr-summary-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.tr-summary-card {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; background: var(--bg);
}
.tr-summary-company {
  font-size: 13px; font-weight: 600; margin-bottom: 6px;
}
.tr-summary-total {
  font-size: 11px; color: var(--text-sub); margin-bottom: 4px;
}
.tr-summary-badges {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.tr-summary-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border);
}
.tr-summary-badge.s-request { background: rgba(59,130,246,0.08); color: #1d4ed8; }
.tr-summary-badge.s-process { background: rgba(245,158,11,0.1); color: #b45309; }
.tr-summary-badge.s-done    { background: rgba(16,185,129,0.1); color: #047857; }
.tr-summary-badge.s-reject  { background: rgba(239,68,68,0.1); color: #b91c1c; }

.tr-table td.col-company {
  font-weight: 600;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.status-badge.s-request  { background: rgba(79, 110, 247, 0.15); color: #4f6ef7; }
.status-badge.s-progress { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.status-badge.s-done     { background: rgba(34, 199, 122, 0.15); color: #15a360; }
.status-badge.s-reject   { background: rgba(239, 68, 68, 0.15);  color: #dc2626; }
[data-theme="dark"] .status-badge.s-progress { color: #fbbf24; }
[data-theme="dark"] .status-badge.s-done     { color: #4ade80; }
[data-theme="dark"] .status-badge.s-reject   { color: #f87171; }

.tr-empty {
  padding: 60px 20px; text-align: center;
  color: var(--text-sub); font-size: 14px;
}

/* kintone-style form */
.tr-form-wrap { max-width: 920px; margin: 0 auto; }
.tr-form-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.tr-form-head h1 { margin: 0; font-size: 22px; font-weight: 700; }

.kin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.kin-section-head {
  background: var(--bg);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}
.kin-section-body { padding: 4px 0; }

.kin-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.kin-row:last-child { border-bottom: none; }
.kin-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--text-sub);
  padding-top: 8px;
}
.kin-required {
  display: inline-block;
  background: #ef4444; color: white;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 3px;
  letter-spacing: 0.5px;
}
.kin-value { min-width: 0; }
.kin-value input[type="text"],
.kin-value input[type="date"],
.kin-value input[type="number"],
.kin-value select,
.kin-value textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit; font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.kin-value input:focus,
.kin-value select:focus,
.kin-value textarea:focus { border-color: var(--accent); }
.kin-value textarea { min-height: 72px; resize: vertical; }
.kin-value input[readonly],
.kin-value select[disabled],
.kin-value textarea[readonly] {
  background: var(--bg);
  color: var(--text-sub);
  cursor: default;
}
.kin-value input.invalid,
.kin-value select.invalid,
.kin-value textarea.invalid { border-color: #ef4444; }
.kin-hint { font-size: 11px; color: var(--text-sub); margin-top: 4px; }
.kin-err  { font-size: 11px; color: #ef4444; margin-top: 4px; min-height: 1em; }
.kin-amount-wrap { display: flex; align-items: stretch; gap: 6px; }
.kin-amount-wrap input { flex: 1 1 auto; text-align: right; }
.kin-amount-wrap .yen {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; padding: 0 10px;
  color: var(--text-sub); font-size: 13px;
  background: var(--bg-sub, #f3f4f6); border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
}
.kin-checkbox-wrap {
  display: inline-flex; align-items: center; gap: 8px;
  padding-top: 8px; font-size: 13px;
}
.kin-checkbox-wrap input { width: 16px; height: 16px; accent-color: var(--accent); }

.kin-caseid-box {
  display: inline-block;
  background: var(--bg);
  color: var(--text-sub);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px; font-weight: 600;
  font-family: 'SFMono-Regular', Consolas, monospace;
}

.tr-form-error-top {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  display: none;
}
.tr-form-error-top.active { display: block; }

/* kin-input alias (used in master modals) */
.kin-input { min-width: 0; }
.kin-input input[type="text"],
.kin-input input[type="email"],
.kin-input input[type="date"],
.kin-input input[type="number"],
.kin-input select,
.kin-input textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit; font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.kin-input input:focus,
.kin-input select:focus { border-color: var(--accent); }

@media (max-width: 720px) {
  .kin-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px 16px;
  }
  .kin-label { padding-top: 0; }
  .modal-overlay { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
}

/* ===== ラジオボタン（Kintone入力ステータス等） ===== */
.kin-radio-group {
  display: flex;
  gap: 16px;
  align-items: center;
}
.kin-radio-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.kin-radio-wrap input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

/* ===== ヒント（小さい説明文） ===== */
.kin-hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-sub);
  line-height: 1.5;
}

/* ===== マスタ未一致の入力（赤いボーダーで警告） ===== */
.kin-value input.invalid-value {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.04);
}

/* readonly 入力は微グレーで「触れない」感を出す */
.kin-value input[readonly] {
  background: var(--bg);
  color: var(--text-sub);
  cursor: not-allowed;
}
