/* ===== DARK MODE (DEFAULT) ===== */
body {
    background: #1a1c2c;
    color: white;
    transition: 0.3s;
}

/* Navbar */
.navbar-custom {
    background: #2a2d3e;
    color: white;
}

/* Card / Box */
.card-custom {
    background: #2a2a3d;
    border-radius: 15px;
    padding: 20px;
    color: white;
}

/* Inputs */
input, .form-control {
    background: #3a3d5a;
    color: white;
    border: none;
}

input::placeholder {
    color: #aaa;
}

/* Buttons */
.btn-primary {
    background: #4CAF50;
    border: none;
}

/* ===== LIGHT MODE ===== */
body.light-mode {
    background: #f4f6fb;
    color: #222;
}

body.light-mode .navbar-custom {
    background: #ffffff;
    color: #000;
    border-bottom: 1px solid #ddd;
}

body.light-mode .card-custom {
    background: white;
    color: #222;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

body.light-mode input,
body.light-mode .form-control {
    background: #eee;
    color: #000;
}

body.light-mode input::placeholder {
    color: #666;
}

/* ===== TABLE ===== */

table {
    width: 100%;
    table-layout: fixed;
}

table {
    width: 100%;
    table-layout: fixed;
}

/* Header */
th {
    text-align: center;
    vertical-align: middle !important;
    padding: 12px 8px !important;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
}

/* Body */
td {
    text-align: center;
    vertical-align: middle;
    padding: 10px 8px;
    white-space: normal;
    word-break: break-word;
}

/* ===== COLUMN CONTROL ===== */

/* No */
th:nth-child(1), td:nth-child(1) {
    width: 60px;
}

/* Nombor Sebutharga */
th:nth-child(2), td:nth-child(2) {
    width: 200px;
}

/* Nama Tajuk */
th:nth-child(3), td:nth-child(3) {
    width: 350px;
}

/* Bahagian */
th:nth-child(4), td:nth-child(4) {
    width: 150px;
}

/* Date columns */
th:nth-child(5), td:nth-child(5),
th:nth-child(8), td:nth-child(8),
th:nth-child(10), td:nth-child(10) {
    width: 140px;
}

/* Prevent date breaking */
td:nth-child(5),
td:nth-child(8),
td:nth-child(10) {
    white-space: nowrap;
}

/* Small numeric columns */
th:nth-child(6), td:nth-child(6),
th:nth-child(7), td:nth-child(7) {
    width: 100px;
}

/* Notes columns */
th:nth-child(9), td:nth-child(9),
th:nth-child(11), td:nth-child(11) {
    width: 200px;
}

/* ===== TEXT WRAP ===== */
.text-wrap {
    word-break: break-word;
    white-space: normal;
}

/* ===== TEXT LIMIT ===== */
.limit-3-lines {
    max-height: 3.9em;   /* ~3 lines */
    overflow: hidden;
    line-height: 1.3;
}

.limit-6-lines {
    max-height: 8.4em;   /* ~6 lines */
    overflow: hidden;
    line-height: 1.4;
}

.limit-7-lines {
    max-height: 9.8em;   /* ~7 lines */
    overflow: hidden;
    line-height: 1.4;
}

/* ===== HOVER ===== */
.clickable-row:hover {
    background-color: rgba(255,255,255,0.08);
    cursor: pointer;
}

body.light-mode .clickable-row:hover {
    background-color: #f5f5f5;
}

/* ===== PANELS ===== */
.panel-title {
    font-weight: 600;
    margin-bottom: 15px;
}

.action-panel,
.filter-panel {
    padding: 20px;
}

/* Buttons */
.btn-action {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 10px;
    padding: 10px;
    font-weight: 500;
    transition: 0.2s ease;
}

.btn-add {
    background: #2e8b57;
    color: white;
}

.btn-edit {
    background: #f0b429;
    color: black;
}

.btn-print {
    background: #4aa3df;
    color: white;
}

.btn-action:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* ===== FILTER ===== */
.filter-panel label {
    margin-bottom: 5px;
    font-size: 14px;
}

/* ===== BREADCRUMB ===== */
nav small {
    color: #aaa;
    margin-left: 5px;
}

nav small a {
    color: #4aa3df;
    text-decoration: none;
    font-weight: 500;
}

nav small a:hover {
    text-decoration: underline;
}


td {
    vertical-align: top;
}


.doc-header {
    width: 100%;
    margin-bottom: 30px;
    font-weight: normal; /* 🔥 force normal */
}

.top-code {
    text-align: right;
    font-size: 12px;
    margin-bottom: 10px;
}

.right-header {
    text-align: right;
    line-height: 1.4;
    margin-bottom: 20px;
}

.left-header {
    text-align: left;
    line-height: 1.4;
}

td {
    padding: 3px 5px;
    vertical-align: top;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    margin-bottom: 15px;
}

.report-table th,
.report-table td {
    border: 1px solid black;
    padding: 6px;
    font-size: 13px;
}

.report-table th {
    text-align: center;
}

.report-table td {
    height: 25px;
}

.section-text {
    padding-left: 0;
}

p {
    margin: 6px 0;
    clear: both;
}

.title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: bold;
    line-height: 1.35;
}

.info-table td {
    padding: 2px 5px;
    vertical-align: top;
}

.signature-block {
    width: 480px;
    margin-left: 0;
    text-align: center;   /* ✅ ADD THIS BACK */
    page-break-inside: avoid;
}

.signature-line {
    display: block;
    width: 100%;
    border-top: 1px dotted black;
    margin-bottom: 8px;
}

.signature-label,
.signature-name {
    display: block;
}

.lampiran-ref::before,
.lampiran-ref::after {
    content: "———";
    margin: 0 6px;
}

.lampiran-page {
    break-before: page;
    page-break-before: always;
    margin-top: 0;
}

.lampiran-title {
    text-align: center;
    font-weight: bold;
    margin-bottom: 12px;
}

.lampiran-signature {
    margin-top: 30px;
    page-break-inside: avoid;
}

.lampiran-header-block {
    page-break-inside: avoid;
}

.lampiran-signature {
    page-break-inside: avoid;
    page-break-before: avoid;
}
