/* ============================
   CSS Variables & Base
   ============================ */
:root {
  --sidebar-w: 260px;
  --sidebar-bg: #1a1438;
  --sidebar-hover: rgba(255,255,255,0.10);
  --sidebar-active: rgba(255,255,255,0.15);
  --sidebar-active-border: #7B5EA7;
  --sidebar-text: #e0e0e0;
  --sidebar-text-active: #fff;
  --topbar-h: 56px;
  --primary: #1a2e4a;
  --accent: #3b82f6;
  --body-bg: #f3f0ff;
  --card-radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
  background: var(--body-bg);
  margin: 0;
  font-size: 0.9rem;
  color: #1e293b;
}

/* ============================
   Login Page
   ============================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 45%, #7B5EA7 75%, #4facfe 100%);
  background-size: cover;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  border: none;
  border-radius: 20px;
  overflow: hidden;
}

.org-logo {
  width: 80px;
  height: 80px;
  background: transparent;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: none;
  overflow: hidden;
}

.org-logo i {
  font-size: 32px;
  color: white;
}

.org-logo-img {
  width: 80px;
  height: auto;
  object-fit: contain;
  border-radius: 16px;
}

.org-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1a2e4a;
  letter-spacing: 0.02em;
}

/* ============================
   Sidebar
   ============================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.sidebar-header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  position: relative;
}

.sidebar-header-text .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1050;
}

.sidebar-icon-wrap {
  width: 55px; height: 55px;
  background: transparent;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-icon-wrap i { color: white; font-size: 18px; }

.sidebar-logo-img {
  width: 55px;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
  white-space: nowrap;
  display: flex;
  align-items: center;
  padding-left: 0;
}

.sidebar-subtitle {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  line-height: 1.2;
  white-space: nowrap;
  padding-left: 0;
  margin-left: 0;
}

.sidebar-nav {
  padding: 12px 8px;
  overflow-y: auto;
  flex: 1;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  padding: 8px 10px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 8px;
  border-left: 3px solid transparent;
  margin-bottom: 2px;
  font-size: 0.875rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.sidebar-link i {
  font-size: 1.05rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: white;
}

.sidebar-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  border-left-color: var(--sidebar-active-border);
  font-weight: 600;
}

/* Sidebar submenu (dropdown) */
.sidebar-submenu {
  display: none;
  padding-left: 18px;
}
.sidebar-submenu.open {
  display: block;
}
.sidebar-sublink {
  font-size: 0.82rem !important;
  padding: 7px 12px !important;
}
.sidebar-parent .sidebar-chevron {
  transition: transform 0.2s;
}
.sidebar-parent.open .sidebar-chevron {
  transform: rotate(180deg);
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
}

.user-avatar {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-avatar i { color: rgba(255,255,255,0.7); font-size: 16px; }
.user-name { font-size: 0.85rem; color: rgba(255,255,255,0.85); font-weight: 600; line-height: 1.2; }
.user-role { font-size: 0.7rem; color: rgba(255,255,255,0.4); }

/* ============================
   Main Content
   ============================ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 990;
}

.topbar-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
}

.content-area {
  flex: 1;
  padding: 28px;
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* ============================
   Page Structure
   ============================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.82rem;
  color: #64748b;
  margin: 3px 0 0;
}

/* ============================
   Cards
   ============================ */
.card {
  border: 1px solid #e2e8f0;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #1e293b;
  border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
}

/* Stat Cards */
.stat-card {
  background: white;
  border-radius: var(--card-radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
}

.stat-label {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 3px;
}

/* Alert Cards */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid;
  margin-bottom: 10px;
}

.alert-item.active { background: #fff7ed; border-color: #fed7aa; }
.alert-item.upcoming { background: #fffbeb; border-color: #fde68a; }
.alert-item.info { background: #eff6ff; border-color: #bfdbfe; }

.alert-icon-wrap {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.alert-item.active .alert-icon-wrap { background: #fed7aa; color: #c2410c; }
.alert-item.upcoming .alert-icon-wrap { background: #fde68a; color: #b45309; }
.alert-item.info .alert-icon-wrap { background: #bfdbfe; color: #1d4ed8; }

.alert-title { font-weight: 700; font-size: 0.9rem; color: #1e293b; }
.alert-desc { font-size: 0.8rem; color: #64748b; margin: 2px 0 0; }

/* ============================
   Tables
   ============================ */
.table-wrap {
  background: white;
  border-radius: var(--card-radius);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-wrap .table {
  margin: 0;
  font-size: 0.85rem;
}

.table thead th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  border-top: none;
  font-weight: 800;
  color: #1e293b;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  padding: 10px 14px;
  vertical-align: middle;
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.table-wrap .table-responsive {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

.table-wrap .table-responsive::after {
  content: '';
  display: block;
  height: calc(100vh - 340px);
}

.table-wrap.compact .table-responsive {
  max-height: none;
  overflow-y: visible;
}

.table-wrap.compact .table-responsive::after {
  display: none;
}

/* Reward section titles & tables */
.reward-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.table-wrap.compact {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.table-wrap.compact .table thead th {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px 14px;
  background: #f8fafc;
}

/* Reward member badges */
.reward-badge-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.reward-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f1f5f9;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1.4;
}

@media (max-width: 992px) {
  .reward-badge-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.reward-badge-name {
  font-weight: 600;
}

.reward-badge-amount {
  color: #64748b;
  font-size: 10px;
  margin-left: 4px;
  flex-shrink: 0;
}

/* Kaiin horizontal scroll with sticky columns */
.kaiin-scroll-x {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
}

/* z-index layers: non-fixed td(auto) < non-fixed th(10) < fixed td(20) < fixed th(30) */
.kaiin-scroll-x thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 10;
}

.kaiin-sticky-col1,
.kaiin-sticky-col2,
.kaiin-sticky-col3 {
  position: sticky;
  background: #fff;
  z-index: 20;
  white-space: nowrap;
}

thead .kaiin-sticky-col1,
thead .kaiin-sticky-col2,
thead .kaiin-sticky-col3 {
  background: #f8fafc;
  z-index: 30;
}

.kaiin-sticky-chk {
  position: sticky;
  left: 0;
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  background: #fff;
  z-index: 20;
  padding: 0 !important;
  text-align: center;
  vertical-align: middle;
}
thead .kaiin-sticky-chk { background: #f8fafc; z-index: 30; }
tr:hover .kaiin-sticky-chk { background: #f8f9fa; }

.kaiin-chk {
  width: 14px;
  height: 14px;
  cursor: pointer;
  vertical-align: middle;
}

.kaiin-sticky-col1 { left: 36px; width: 100px; min-width: 100px; }
.kaiin-sticky-col2 { left: 136px; width: 80px; min-width: 80px; }
.kaiin-sticky-col3 { left: 216px; width: 80px; min-width: 80px; border-right: 2px solid #dee2e6 !important; }

tr:hover .kaiin-sticky-col1,
tr:hover .kaiin-sticky-col2,
tr:hover .kaiin-sticky-col3 {
  background: #f8f9fa;
}

.kaiin-narrow-col {
  width: 80px;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table tbody td {
  padding: 11px 14px;
  vertical-align: middle;
  border: 1px solid #e9eef4;
}

.table thead th {
  border-right: 1px solid #dde3ea;
}

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ============================
   Badges & Labels
   ============================ */
.badge-role {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-role.officer { background: #dbeafe; color: #1d4ed8; }
.badge-role.employee { background: #dcfce7; color: #15803d; }
.badge-role.candidate { background: #f3e8ff; color: #7c3aed; }

.badge-team {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-team.front { background: #fef3c7; color: #b45309; }
.badge-team.back { background: #e0f2fe; color: #0369a1; }

/* ============================
   Filter Bar
   ============================ */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.filter-bar .form-select,
.filter-bar .form-control {
  font-size: 0.82rem;
  padding: 5px 10px;
  height: auto;
  border-color: #e2e8f0;
  background: white;
}

.filter-bar .form-select { max-width: 150px; }
.filter-bar .search-input { max-width: 220px; }

/* ============================
   Forms & Modals
   ============================ */
.modal-content {
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  background: var(--primary);
  color: white;
  border-radius: 16px 16px 0 0;
  padding: 16px 20px;
  border-bottom: none;
}

.modal-header .btn-close {
  filter: invert(1) grayscale(1) brightness(2);
}

.modal-title { font-weight: 700; font-size: 1rem; }

.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 0 0 16px 16px;
}

.form-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: #374151;
  margin-bottom: 4px;
}

.form-control, .form-select {
  border-color: #d1d5db;
  border-radius: 8px;
  font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: #1e293b;
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  transition: background-color 5000s ease-in-out 0s;
}

.nav-tabs .nav-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  border-radius: 0;
}

.nav-tabs .nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: none;
}

.nav-tabs { border-bottom: 1px solid #e2e8f0; margin-bottom: 16px; }

/* ============================
   Checklist Specific
   ============================ */
.checklist-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.checklist-container .table thead th:first-child,
.checklist-container .table tbody td:first-child {
  position: sticky;
  left: 0;
  background: #f8fafc;
  z-index: 1;
  border-right: 2px solid #e2e8f0;
  min-width: 140px;
}

.checklist-container .table tbody td:first-child { background: white; }
.checklist-container .table tbody tr:hover td:first-child { background: #f8fafc; }

.checklist-cell {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  padding: 12px 8px !important;
  height: 52px;
}
.checklist-cell:hover { background: #f0f4ff !important; }

.check-state {
  font-size: 1.3rem;
  font-weight: 700;
  display: block;
  width: 100%;
  height: 100%;
  line-height: 1;
}
.check-state.done { color: #16a34a; }
.check-state.ng { color: #dc2626; }
.check-state.pending { color: #cbd5e1; }

/* ============================
   Progress Bar
   ============================ */
.progress-ring {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

/* ============================
   Fee Calendar
   ============================ */
.fee-month-cell {
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 6px;
  padding: 6px 4px;
  min-width: 60px;
}

.fee-month-cell.paid {
  background: #dcfce7;
  color: #15803d;
  font-weight: 700;
}

.fee-month-cell.unpaid {
  background: #fef2f2;
  color: #dc2626;
}

.fee-month-cell.future {
  background: #f8fafc;
  color: #94a3b8;
}

/* ============================
   Document Generation
   ============================ */
.doc-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: var(--card-radius);
  padding: 24px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.doc-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(59,130,246,0.15);
  transform: translateY(-2px);
}

.doc-card-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-size: 28px;
}

/* ============================
   Work Regulations
   ============================ */
.drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: #f8fafc;
  transition: all 0.2s;
  cursor: pointer;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: #eff6ff;
}

.drop-zone i { font-size: 40px; color: #94a3b8; }

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 8px;
  transition: box-shadow 0.2s;
}

.file-item:hover { box-shadow: var(--shadow); }

.file-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.file-icon.pdf { background: #fee2e2; color: #dc2626; }
.file-icon.txt { background: #dbeafe; color: #1d4ed8; }
.file-icon.docx { background: #dbeafe; color: #2563eb; }

/* ============================
   Company Switcher Dropdown
   ============================ */
.company-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.company-switcher:hover {
  background: rgba(255,255,255,0.08);
}

#companyDropdown {
  min-width: 200px;
  background: #0f1e33;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 6px;
  margin-top: 4px;
}

#companyDropdown .dropdown-item {
  color: rgba(255,255,255,0.75);
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

#companyDropdown .dropdown-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

/* Bootstrapデフォルトの :focus/:active が白背景を上書きするのを無効化 */
#companyDropdown .dropdown-item:focus,
#companyDropdown .dropdown-item:focus-visible,
#companyDropdown .dropdown-item:active,
#companyDropdown .dropdown-item.active {
  outline: none;
  background: rgba(255,255,255,0.08);
  color: white;
  box-shadow: none;
}

#companyDropdown .dropdown-item.active-company,
#companyDropdown .dropdown-item.active-company:hover,
#companyDropdown .dropdown-item.active-company:focus,
#companyDropdown .dropdown-item.active-company:focus-visible,
#companyDropdown .dropdown-item.active-company:active {
  background: rgba(59,130,246,0.2) !important;
  color: #93c5fd !important;
  font-weight: 600;
  outline: none;
  box-shadow: none;
}

/* Search highlight */
.highlight { background: #fef08a; border-radius: 2px; padding: 0 1px; }

/* Last-edited tooltip */
#kaiinEditTooltip {
  position: fixed;
  background: #1e293b;
  color: #fff;
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
#kaiinEditTooltip.show { opacity: 1; }

/* ============================
   Buttons
   ============================ */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover { background: #2563eb; border-color: #2563eb; }

.btn-action {
  width: 30px; height: 30px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 0.85rem;
}

/* ============================
   Utilities
   ============================ */
.text-muted { color: #94a3b8 !important; }
.border-0 { border: none !important; }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: #94a3b8;
}

.empty-state i { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; margin: 0; }

/* ============================
   Print Styles
   ============================ */
@media print {
  .no-print { display: none !important; }
  body { background: white; font-size: 11pt; }
  .doc-container { padding: 0; }
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 767.98px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1001;
  }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .content-area { padding: 16px; }
  .page-title { font-size: 1.2rem; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.5rem; }
}

@media (max-width: 575.98px) {
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header .btn { width: 100%; }
}

/* ============================
   Unpaid (未納管理) table
   ============================ */
.unpaid-table {
  border-collapse: collapse;
  border: 2px solid #6c757d;
}
.unpaid-table thead,
.unpaid-table tbody,
.unpaid-table tr {
  border: 2px solid #6c757d;
}
.unpaid-table th,
.unpaid-table td {
  vertical-align: middle !important;
  white-space: nowrap;
  text-align: center;
  border: 2px solid #6c757d !important;
}
.unpaid-table td.unpaid-note,
.unpaid-table th.unpaid-note {
  white-space: normal;
  text-align: center;
}
.unpaid-table td.unpaid-note textarea.unpaid-edit-input {
  text-align: center;
}
.unpaid-table td[data-field="amount"],
.unpaid-table td[data-field="amount"] .unpaid-edit-input {
  font-weight: 700;
}
.kichiku-table th.unpaid-note,
.kichiku-table td.unpaid-note {
  text-align: left;
}
.kichiku-table td.unpaid-note textarea.unpaid-edit-input {
  text-align: left;
}
.kichiku-table td[data-field="monthlyFee"],
.kichiku-table td[data-field="monthlyFee"] .unpaid-edit-input,
.kichiku-table td[data-field="fiscalEnd"],
.kichiku-table td[data-field="fiscalEnd"] .unpaid-edit-input {
  font-weight: 700;
  color: #111;
}
.kichiku-table td.kichiku-copy-cell {
  position: relative;
  min-width: 140px;
  white-space: nowrap;
  font-size: 11px;
}
.kichiku-table .kichiku-copy-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  color: #198754;
  font-weight: 700;
  pointer-events: none;
}

/* 法人記帳代行：横スクロール時の法人名列固定 + 縦スクロール時のヘッダー固定 */
.kichiku-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #f8f9fa;
}
.kichiku-table thead th.kichiku-sticky-corp {
  z-index: 30;
  left: 0;
  border-right: 2px solid #6c757d;
}
.kichiku-table tbody td.kichiku-sticky-corp {
  position: sticky;
  left: 0;
  z-index: 9;
  background-color: #ffffff;
  border-right: 2px solid #6c757d !important;
}
.kichiku-table tbody tr:hover td.kichiku-sticky-corp {
  background-color: #f3f0ff;
}

/* ============================
   法人記帳代行 モダンテーブル
   ============================ */
.kichiku-wrap {
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  background: #fff;
  overflow: hidden;
}
.kichiku-wrap .table-responsive {
  border-radius: 12px;
}
.kichiku-table {
  border: none !important;
  background: #fff;
}
.kichiku-table thead,
.kichiku-table tbody,
.kichiku-table tr {
  border: none !important;
}
.kichiku-table th,
.kichiku-table td {
  border: none !important;
  border-bottom: 1px solid #e9ecef !important;
  padding: 12px 16px !important;
  transition: background-color 0.15s ease;
}
.kichiku-table thead th {
  background-color: #f8f9fa !important;
  color: #495057;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid #dee2e6 !important;
  text-transform: none;
  letter-spacing: 0;
}
.kichiku-table tbody tr {
  background-color: #fff;
}
.kichiku-table tbody tr:nth-of-type(odd),
.kichiku-table tbody tr:nth-of-type(even) {
  background-color: #fff;
}
.kichiku-table tbody tr:hover {
  background-color: #f3f0ff;
}
.kichiku-table tbody tr:hover td {
  background-color: #f3f0ff;
}
.kichiku-table tbody tr:last-child td {
  border-bottom: none !important;
}
/* 法人名sticky列：縦区切り線は外して軽い影で境界を示す */
.kichiku-table thead th.kichiku-sticky-corp,
.kichiku-table tbody td.kichiku-sticky-corp {
  border-right: none !important;
  box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.08);
}

/* AIシステム開発：URL列は左揃え */
.ai-table th.ai-url-col,
.ai-table td.ai-url-col {
  text-align: left !important;
}
/* 進捗度ゲージ */
.ai-table td.ai-progress-cell {
  min-width: 110px;
}
.ai-progress-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ai-progress-text {
  font-size: 12px;
  font-weight: 600;
  color: #495057;
}
.ai-progress-bar {
  width: 80px;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}
.ai-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.2s ease;
}
.unpaid-table td.unpaid-editable {
  cursor: pointer;
}
.unpaid-table td.unpaid-editable:hover {
  background-color: #f8fafc;
}
.unpaid-table td.unpaid-editing {
  padding: 2px !important;
  background-color: #fff;
  box-shadow: inset 0 0 0 2px #3b82f6;
}
.unpaid-table .unpaid-edit-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: inherit;
  font-family: inherit;
  background: #fff;
  outline: none;
}
.unpaid-table .unpaid-edit-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
}
.unpaid-table textarea.unpaid-edit-input {
  resize: vertical;
  min-height: 48px;
}
.unpaid-table th.unpaid-note,
.unpaid-table td.unpaid-note {
  min-width: 280px;
}
.unpaid-table .unpaid-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
}
.unpaid-table .unpaid-actions .btn {
  white-space: nowrap;
  min-width: 90px;
}
.unpaid-table .unpaid-actions .btn.unpaid-icon-btn {
  min-width: 0;
  padding: 4px 8px;
}
.unpaid-table .unpaid-status-badge {
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 9999px;
  display: inline-block;
}

