/*
 * Utilitas tata letak untuk halaman kustom Trip n Hook ERP.
 * Ditulis sebagai CSS biasa (bukan utilitas Tailwind) supaya tidak butuh
 * proses build Node — penting karena aplikasi di-deploy ke shared hosting.
 */

.tnh-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .tnh-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tnh-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tnh-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .tnh-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Kartu ringkasan angka */
.tnh-metric__label {
    font-size: 0.8125rem;
    color: var(--gray-500, #6b7280);
}

.tnh-metric__value {
    margin-top: 0.25rem;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.tnh-metric__hint {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--gray-500, #6b7280);
}

.tnh-positive { color: rgb(22 163 74); }
.tnh-negative { color: rgb(220 38 38); }

.dark .tnh-positive { color: rgb(74 222 128); }
.dark .tnh-negative { color: rgb(248 113 113); }

/* Tabel laporan */
.tnh-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.tnh-table th {
    padding: 0.5rem 0;
    text-align: left;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500, #6b7280);
    border-bottom: 1px solid rgb(229 231 235);
}

.tnh-table td {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgb(243 244 246);
}

.dark .tnh-table th { border-bottom-color: rgba(255, 255, 255, 0.1); }
.dark .tnh-table td { border-bottom-color: rgba(255, 255, 255, 0.06); }

.tnh-table .tnh-indent { padding-left: 1.5rem; }
.tnh-table .tnh-num { text-align: right; font-variant-numeric: tabular-nums; }
.tnh-table .tnh-center { text-align: center; }
.tnh-table .tnh-group td { font-weight: 600; padding-top: 1rem; }
.tnh-table .tnh-subtotal td { font-weight: 500; background: rgba(0, 0, 0, 0.025); }
.dark .tnh-table .tnh-subtotal td { background: rgba(255, 255, 255, 0.04); }
.tnh-table .tnh-total td {
    font-weight: 700;
    font-size: 1rem;
    padding-top: 0.75rem;
    border-top: 2px solid currentColor;
}
.tnh-table .tnh-empty td { text-align: center; padding: 1rem 0; color: var(--gray-400, #9ca3af); }

.tnh-scroll { overflow-x: auto; }

/* Papan pipeline */

/*
 * Satu baris yang digulir ke samping, bukan kisi yang membungkus.
 *
 * Kisi memaksa tahap kelima turun ke baris kedua, sehingga papan terbaca
 * seperti dua alur terpisah padahal satu urutan. Menggulir ke samping menjaga
 * urutan tahapnya tetap terbaca kiri ke kanan berapa pun jumlah tahapnya.
 */
.tnh-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    /* Ruang untuk batang gulir dan bayangan kartu supaya tidak terpotong. */
    padding-bottom: 0.75rem;
    scrollbar-width: thin;
    /* Kolom yang tergulir setengah berhenti rapi di tepinya. */
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
}

.tnh-board::-webkit-scrollbar { height: 8px; }
.tnh-board::-webkit-scrollbar-thumb {
    border-radius: 9999px;
    background: rgba(100, 116, 139, 0.35);
}
.dark .tnh-board::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); }

.tnh-board__column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Lebar tetap: kolom menyempit hanya membuat nama pelanggan terpotong,
       sedangkan menggulir ke samping tidak menghilangkan apa pun. */
    flex: 0 0 17rem;
    max-width: 17rem;
    scroll-snap-align: start;
}

@media (max-width: 480px) {
    /* Di layar sempit kolom dibuat sedikit lebih ramping supaya tepi kolom
       berikutnya terlihat — petunjuk bahwa papan masih bisa digulir. */
    .tnh-board__column { flex-basis: 15rem; max-width: 15rem; }
}

.tnh-board__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.04);
    padding: 0.5rem 0.75rem;
}

.dark .tnh-board__header { background: rgba(255, 255, 255, 0.05); }

.tnh-board__title { font-size: 0.875rem; font-weight: 600; }
.tnh-board__meta { font-size: 0.75rem; color: var(--gray-500, #6b7280); }

.tnh-board__count {
    border-radius: 9999px;
    background: #fff;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.dark .tnh-board__count { background: rgb(17 24 39); }

.tnh-card {
    border-radius: 0.5rem;
    border-left: 4px solid rgb(203 213 225);
    background: #fff;
    padding: 0.75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    ring: 1px;
}

.dark .tnh-card { background: rgb(17 24 39); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }

.tnh-card--baru { border-left-color: rgb(148 163 184); }
.tnh-card--dihubungi { border-left-color: rgb(56 189 248); }
.tnh-card--penawaran { border-left-color: rgb(251 191 36); }
.tnh-card--negosiasi { border-left-color: rgb(232 112 53); }

.tnh-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.tnh-card__name { font-size: 0.875rem; font-weight: 600; text-decoration: none; }
.tnh-card__name:hover { color: rgb(232 112 53); }
.tnh-card__sub { margin-top: 0.125rem; font-size: 0.75rem; color: var(--gray-500, #6b7280); }
.tnh-card__value { margin-top: 0.5rem; font-size: 0.875rem; font-weight: 500; }
.tnh-card__value span { font-weight: 400; font-size: 0.75rem; color: var(--gray-500, #6b7280); }
.tnh-card__foot {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-500, #6b7280);
}
.tnh-card__actions { margin-top: 0.75rem; display: flex; gap: 0.25rem; }
.tnh-card__actions > *:last-child { flex: 1; }

.tnh-flag {
    flex-shrink: 0;
    border-radius: 0.25rem;
    background: rgba(220, 38, 38, 0.1);
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgb(185 28 28);
}

.tnh-due { font-weight: 600; color: rgb(220 38 38); }
.dark .tnh-due { color: rgb(248 113 113); }

.tnh-board__empty {
    border-radius: 0.5rem;
    border: 1px dashed rgb(209 213 219);
    padding: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray-400, #9ca3af);
}

.dark .tnh-board__empty { border-color: rgb(55 65 81); }

/* ---------- pengaturan tahap di papan pipeline ---------- */
.tnh-board__atur {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0 0.6rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}
.dark .tnh-board__atur { border-bottom-color: rgba(255, 255, 255, 0.12); }
.tnh-board__atur > *:nth-child(2) { margin-left: auto; }

/* ---------- papan pipeline: seret kartu antar kolom ---------- */
.tnh-board__drop {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 90px;
}
.tnh-board__drop .tnh-card {
    cursor: grab;
    touch-action: manipulation;
}
.tnh-board__drop .tnh-card:active { cursor: grabbing; }
.tnh-card--bayangan {
    opacity: .4;
    border-style: dashed;
}
.tnh-board__pegangan { cursor: grab; }
.tnh-board__pegangan:active { cursor: grabbing; }


/* ---------- ajak trip ---------- */
.tnh-pratinjau {
    margin-top: 1rem; border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 0.625rem; padding: 0.875rem 1rem; background: rgba(0, 0, 0, 0.02);
}
.dark .tnh-pratinjau { background: rgba(255, 255, 255, 0.04); border-color: rgb(55 65 81); }
.tnh-pratinjau__judul { font-size: 0.75rem; font-weight: 600; color: var(--gray-500, #6b7280); margin-bottom: 0.5rem; }
.tnh-pratinjau__isi { white-space: pre-wrap; font-family: inherit; font-size: 0.8125rem; margin: 0; line-height: 1.6; }

.tnh-ajak { display: flex; flex-direction: column; gap: 0.5rem; }
.tnh-ajak__baris {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    border: 1px solid var(--gray-200, #e5e7eb); border-radius: 0.625rem;
    padding: 0.75rem 1rem; background: #fff;
}
.dark .tnh-ajak__baris { background: rgb(17 24 39); border-color: rgb(55 65 81); }
/* Yang sudah dihubungi diredupkan, bukan disembunyikan: daftarnya tetap utuh
   sehingga jelas berapa yang tersisa dan siapa yang barusan dikirimi. */
.tnh-ajak__baris--sudah { opacity: 0.55; }
.tnh-ajak__orang { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.tnh-ajak__orang a { font-weight: 600; font-size: 0.9375rem; text-decoration: none; color: inherit; }
.tnh-ajak__orang a:hover { text-decoration: underline; }
.tnh-ajak__meta { font-size: 0.75rem; color: var(--gray-500, #6b7280); }
.tnh-ajak__kirim {
    flex: none; text-decoration: none; white-space: nowrap;
    background: #16a34a; color: #fff; font-weight: 600; font-size: 0.8125rem;
    border-radius: 0.5rem; padding: 0.5rem 0.875rem;
}
.tnh-ajak__kirim:hover { background: #15803d; }

/* ---------- tombol WhatsApp pada kartu papan ---------- */
.tnh-card__foot { display: flex; align-items: center; gap: 0.5rem; }
.tnh-card__pic { margin-left: auto; }
.tnh-card__wa {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 1.75rem; height: 1.75rem; border-radius: 9999px;
    background: #16a34a; color: #fff;
    /* Kursor penunjuk, bukan tangan menyeret seperti kartunya: tombol ini
       memang bukan bagian yang diseret. */
    cursor: pointer;
}
.tnh-card__wa:hover { background: #15803d; }
.tnh-card__wa svg { width: 1rem; height: 1rem; }
.tnh-card__wa:focus-visible { outline: 2px solid #16a34a; outline-offset: 2px; }

/* ---------- follow-up hari ini ---------- */
.tnh-ajak__kanan { display: flex; align-items: center; gap: 0.5rem; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.tnh-ajak__lengkapi {
    flex: none; text-decoration: none; white-space: nowrap;
    border: 1px solid rgb(209 213 219); color: inherit;
    font-weight: 600; font-size: 0.8125rem; border-radius: 0.5rem; padding: 0.4375rem 0.875rem;
}
.dark .tnh-ajak__lengkapi { border-color: rgb(55 65 81); }
.tnh-kosong {
    border: 1px dashed rgb(209 213 219); border-radius: 0.75rem;
    padding: 2.5rem 1.5rem; text-align: center;
}
.dark .tnh-kosong { border-color: rgb(55 65 81); }
.tnh-kosong__judul { font-weight: 600; font-size: 1rem; margin-bottom: 0.375rem; }
.tnh-kosong p { color: var(--gray-500, #6b7280); font-size: 0.875rem; margin: 0 0 1rem; max-width: 42ch; margin-inline: auto; }
.tnh-kosong__tautan { font-weight: 600; font-size: 0.875rem; text-decoration: none; color: rgb(234 88 12); }
