/* =========================================================
   Issue Dashboard — Weekly Meeting (Optimized Version)
   ========================================================= */

/* --- 1. Period Quick-Filter Buttons --- */
.issue-period-field {
  margin: 0;
}
.issue-period-btns {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.issue-period-btn {
  min-width: 64px;
  padding: 6px 12px !important;
  font-size: 12px !important;
  font-weight: 600;
  border-radius: 8px !important;
  border: 1px solid #334155 !important;
  background: #0f172a !important;
  color: #e2e8f0 !important;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.issue-period-btn:hover {
  background: #1e293b !important;
  border-color: #475569 !important;
  color: #f8fafc !important;
}
.issue-period-btn.is-on {
  background: #2563eb !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
  font-weight: 700;
}
.issue-period-btn.is-on:hover {
  background: #1d4ed8 !important;
}

/* --- 2. Badge & Navigasi Tab --- */
.wn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: #475569;
  color: #FFFFFF;
  font: 700 11px/1 var(--font-sans, system-ui, -apple-system, sans-serif);
  vertical-align: middle;
}

.weekly-nav-item.is-active .wn-badge {
  background: #2563EB;
  color: #FFFFFF;
}

.issue-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 12px;
  align-items: center;
}

.issue-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1E293B;
  border: 1px solid #334155;
  color: #E2E8F0;
  border-radius: 999px;
  padding: 8px 16px;
  font: 600 13px var(--font-sans, system-ui, -apple-system, sans-serif);
  cursor: pointer;
  transition: all 0.15s ease;
}

.issue-tab:hover {
  background: #334155;
  color: #FFFFFF;
}

.issue-tab.is-on {
  background: #2563EB;
  border-color: #3B82F6;
  color: #FFFFFF;
  font-weight: 700;
}

.issue-tab .wn-badge {
  background: #475569;
  margin-left: 2px;
}

.issue-tab.is-on .wn-badge {
  background: #1D4ED8;
  color: #FFFFFF;
}

/* --- 3. Judul Panel & Badge Custom --- */
.issue-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 700 14px var(--font-sans, system-ui, -apple-system, sans-serif);
  color: #081a18; /* Warna Hijau Tosca */
  font-weight: 800;
  margin: 10px 0 8px;
}

.issue-panel-title .wn-badge {
  background: linear-gradient(135deg, #111827 0%, #0f766e 100%);
  color: #ffffff;
  border: 1px solid #14b8a6;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* --- 4. Tabel Utama --- */
.issue-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(60vh, 600px);
  border: 1px solid #0a4ccf;
  border-radius: 10px;
  background-color: #0e0c0c;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.issue-table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
  font-size: 14px;
  line-height: 1.5;
  background-color: #070606;
}

/* Header Tabel */
.issue-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: #111827 !important;
  color: #c41717 !important;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 2px solid #374151;
  border-right: 1px solid #1F2937;
  white-space: nowrap;
}

.issue-table thead th:last-child {
  border-right: none;
}

/* --- Header sortable (klik untuk urutkan; Shift/Ctrl+klik = multi-sort) --- */
.issue-table thead th.issue-sortable {
  cursor: pointer;
  user-select: none;
}
.issue-table thead th.issue-sortable::after {
  content: '\2195';
  margin-left: 6px;
  font-size: 10px;
  opacity: .6;
  color: inherit;
}
.issue-table thead th.issue-sortable:hover {
  background-color: #1e293b !important;
  opacity: 0.95;
}
.issue-table thead th.issue-sortable[aria-sort="ascending"]::after {
  content: '\25B2';
  opacity: 1;
  color: #60a5fa;
}
.issue-table thead th.issue-sortable[aria-sort="descending"]::after {
  content: '\25BC';
  opacity: 1;
  color: #60a5fa;
}
.issue-table thead th .issue-sort-badge {
  background: #0ea5e9;
  color: #fff;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Isi Cell Tabel (DARK MODE DEFAULT) */
.issue-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #E5E7EB;
  border-right: 1px solid #E5E7EB;
  color: #c2dbe7; /* Teks umum putih keabu-abuan */
  background: linear-gradient(180deg, #181a1b 0%, #0e1011 100%); /* Gradient gelap */
  font-size: 14px;
  font-weight: 400;
  vertical-align: top;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 280px;
}

.issue-table tbody td:last-child {
  border-right: none;
}

/* =======================================================
   FIX MUTLAK: Paksa warna teks terbaca di kedua mode
   ======================================================= */

/* 1. Matikan gradient gelap bawaan pada kolom tanggal/batch agar menyatu dengan tema */
.issue-table td.mono {
  background: transparent !important;
}

/* 2. MODE TERANG: Paksa teks jadi HITAM pekat */
:root[data-wd-theme="light"] .issue-table td.mono,
:root[data-wd-theme="light"] .issue-table td.ctr,
:root[data-wd-theme="light"] .issue-table td.pica-date,
:root[data-wd-theme="light"] .issue-table .issue-edit,
:root[data-wd-theme="light"] .issue-table .issue-status-select {
  color: #000000 !important;
}

/* 3. MODE GELAP: Paksa teks jadi PUTIH terang */
:root[data-wd-theme="dark"] .issue-table td.mono,
:root[data-wd-theme="dark"] .issue-table td.ctr,
:root[data-wd-theme="dark"] .issue-table td.pica-date,
:root[data-wd-theme="dark"] .issue-table .issue-edit,
:root[data-wd-theme="dark"] .issue-table .issue-status-select {
  color: #ffffff !important;
}

/* Hover Baris: Highlight Orange */
.issue-table tbody tr.issue-row {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.issue-table tbody tr.issue-row:hover td,
.issue-table tbody tr:hover td {
  background: #1f1b16 !important; /* Warna solid menggantikan gradient */
  color: #a85406 !important;
  font-weight: bold !important;
}

/* --- 5. Input & Select di dalam Tabel --- */
.issue-table .issue-edit-cell {
  min-width: 120px;
  padding: 5px !important;
}

.issue-table .issue-edit {
  display: block;
  width: 100%;
  min-width: 108px;
  min-height: 34px;
  resize: vertical;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.35;
}

.issue-table .issue-edit:hover,
.issue-table .issue-edit:focus {
  border-color: #93c5fd;
  background: #fff;
  color: #111827;
  outline: none;
}

.issue-table .issue-status-select {
  min-width: 112px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  font: inherit;
}

.issue-table tr.is-saving {
  opacity: 0.65;
}

/* --- 6. Perataan Kolom (Helpers) --- */
.issue-table td.ctr,
.issue-table th.ctr {
  text-align: center !important;
  white-space: nowrap;
}

.issue-table td.num,
.issue-table th.num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Rata kanan: No (1) & Durasi (8) */
.issue-table thead th:nth-child(1),
.issue-table tbody td:nth-child(1),
.issue-table thead th:nth-child(8),
.issue-table tbody td:nth-child(8) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Rata tengah: Date (2) & Shift (3) */
.issue-table thead th:nth-child(2),
.issue-table tbody td:nth-child(2),
.issue-table thead th:nth-child(3),
.issue-table tbody td:nth-child(3) {
  text-align: center;
  white-space: nowrap;
}

/* Teks Terlalu Panjang (Ellipsis) */
.issue-table td.truncate {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- 7. Status & Kind Badges --- */
.issue-kind {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background-color: #FEF3C7;
  color: #92400E !important;
  border: 1px solid #FDE68A;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.status-badge.normal,
.status-badge.success {
  background-color: #DCFCE7;
  color: #166534 !important;
  border: 1px solid #86EFAC;
}

.status-badge.warning {
  background-color: #FEF3C7;
  color: #92400E !important;
  border: 1px solid #FDE68A;
}

.status-badge.error,
.status-badge.danger {
  background-color: #FEE2E2;
  color: #991B1B !important;
  border: 1px solid #FCA5A5;
}

/* --- 8. Action Menu (Pop-up) --- */
.issue-action-menu {
  position: fixed;
  z-index: 1400;
  min-width: 260px;
  max-width: min(360px, 92vw);
  background: #FFFFFF;
  border: 1px solid #D1D5DB;
  border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.25);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.issue-action-menu.hide {
  display: none;
}

.issue-action-head {
  padding: 4px 6px 10px;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 4px;
}

.issue-action-title {
  font: 700 14px system-ui, -apple-system, sans-serif;
  color: #111827;
}

.issue-action-sub {
  font: 400 12px system-ui, -apple-system, sans-serif;
  color: #4B5563;
  margin-top: 2px;
}

.issue-action-btn {
  text-align: left;
  border: 1px solid #D1D5DB;
  background: #F9FAFB;
  color: #1F2937;
  border-radius: 8px;
  padding: 10px 12px;
  font: 600 13px system-ui, -apple-system, sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
}

.issue-action-btn:hover {
  background: #EFF6FF;
  border-color: #3B82F6;
  color: #1D4ED8;
}

.issue-action-btn.primary {
  background: #2563EB;
  border-color: #1D4ED8;
  color: #FFFFFF;
}

.issue-action-btn.primary:hover {
  background: #1D4ED8;
  color: #FFFFFF;
}

.issue-action-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: #4B5563;
  text-align: center;
}

.issue-action-btn.ghost:hover {
  background: #F3F4F6;
  color: #111827;
}


/* Input tanggal inline (Due Date CA / PA) */
.issue-table input.issue-edit-date { min-width: 118px; font: inherit; }
.issue-table td.issue-edit-cell select.issue-status-select { min-width: 72px; }
/* Badge On Progress (salah satu CA/PA sudah Closed) */
.issue-kind--prog { background: #fef3c7; color: #92400e; border-radius: 6px; padding: 1px 6px; font-weight: 700; margin-left: 4px; }
