
/* ========================================
   BIRO JASA STNK
   Desain utama aplikasi
   ======================================== */

:root {
    font-family: Arial, Helvetica, sans-serif;
    color: #172b25;
    background: #f4f7f5;
    font-synthesis: none;

    --primary: #176b50;
    --primary-dark: #104c3b;
    --primary-light: #e6f4ed;
    --background: #f4f7f5;
    --surface: #ffffff;
    --text: #172b25;
    --muted: #78877f;
    --border: #e3ebe6;
    --danger: #c03935;
    --success: #16805d;
    --warning: #b7791f;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --shadow-card: 0 3px 14px rgba(25, 55, 42, .045);
}

/* RESET */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

body,
input,
select,
textarea,
button {
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

h1,
h2,
h3,
h4,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0 0 8px;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 750;
    letter-spacing: -.4px;
}

h2 {
    margin: 25px 0 14px;
    font-size: 17px;
    line-height: 1.4;
    font-weight: 700;
}

h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

p {
    line-height: 1.6;
}

small {
    font-size: 12px;
}

/* ========================================
   LOGIN DAN AUTENTIKASI
   ======================================== */

.auth-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 410px;
    background: var(--surface);
    padding: 28px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 35px rgba(25, 55, 42, .07);
}

.brand-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin-bottom: 18px;
    border-radius: 17px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 800;
    font-size: 16px;
}

.auth-card > p {
    color: var(--muted);
    margin: 0 0 24px;
}

/* ========================================
   FORMULIR
   ======================================== */

label {
    display: block;
    margin: 15px 0 7px;
    font-weight: 600;
    font-size: 13px;
    color: #34483e;
}

input,
select,
textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 45px;
    padding: 11px 12px;
    border: 1px solid #d9e4dd;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(23, 107, 80, .10);
}

input::placeholder,
textarea::placeholder {
    color: #a0aca5;
}

input[type="checkbox"],
input[type="radio"] {
    display: inline-block;
    width: auto;
    min-height: auto;
    accent-color: var(--primary);
}

input[type="file"] {
    padding: 9px;
    font-size: 12px;
}

input[readonly],
input:disabled,
select:disabled,
textarea:disabled {
    background: #f1f4f2;
    color: #7b8981;
}

/* ========================================
   TOMBOL
   ======================================== */

button,
.btn,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, transform .15s;
}

button {
    max-width: 100%;
}

button:hover,
.btn:hover,
.button:hover {
    background: var(--primary-dark);
    color: #fff;
}

button:active,
.btn:active,
.button:active {
    transform: scale(.985);
}

button:disabled,
.btn:disabled,
.button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Tombol formulir login tetap lebar */

.auth-card button {
    width: 100%;
    min-height: 46px;
    margin-top: 22px;
}

.btn-secondary,
.button-secondary {
    background: #edf3ef;
    color: #34483e;
    border-color: var(--border);
}

.btn-secondary:hover,
.button-secondary:hover {
    background: #dfeae3;
    color: var(--text);
}

.btn-danger,
.button-danger {
    background: #fff0ef;
    color: var(--danger);
    border-color: #f4d8d5;
}

.btn-danger:hover,
.button-danger:hover {
    background: #fbe1de;
    color: #962c27;
}

.btn-success,
.button-success {
    background: var(--success);
    color: #fff;
}

.btn-small {
    min-height: 33px;
    padding: 7px 10px;
    font-size: 12px;
}

/* ========================================
   PESAN DAN STATUS
   ======================================== */

.alert,
.success,
.notice {
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    margin: 15px 0;
    line-height: 1.6;
}

.alert {
    background: #fff0ef;
    border: 1px solid #f4d8d5;
    color: #a52b27;
}

.success {
    background: #e8f7ee;
    border: 1px solid #ccebd8;
    color: #17683a;
}

.notice {
    background: #fff;
    border: 1px solid var(--border);
    color: #47574e;
}

.notice p {
    color: var(--muted);
    margin-bottom: 0;
}

.small-note {
    margin: 22px 0 0 !important;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

/* Label status */

.badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 5px 9px;
    border-radius: 20px;
    background: #edf2ef;
    color: #526258;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.badge-success,
.status-selesai,
.status-lunas {
    background: #e4f6eb;
    color: #167346;
}

.badge-warning,
.status-menunggu,
.status-diproses,
.status-sebagian {
    background: #fff4dc;
    color: #936314;
}

.badge-danger,
.status-dibatalkan,
.status-belum-lunas {
    background: #ffedeb;
    color: #b42318;
}

/* ========================================
   HEADER / TOPBAR
   ======================================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(25, 55, 42, .025);
    backdrop-filter: blur(12px);
}

.topbar strong,
.topbar small {
    display: block;
}

.topbar strong {
    font-size: 15px;
    font-weight: 800;
    color: var(--primary-dark);
}

.topbar small {
    color: var(--muted);
    margin-top: 3px;
    font-size: 11px;
}

.logout {
    flex-shrink: 0;
    color: var(--danger);
    text-decoration: none;
    font-weight: 700;
    padding: 9px 10px;
    border-radius: 9px;
}

.logout:hover {
    background: #fff0ef;
    color: var(--danger);
}

/* ========================================
   AREA KONTEN
   ======================================== */

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 35px;
}

/* Tambahkan ruang jika halaman memakai navigasi bawah */

body.has-bottom-nav {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.page-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.section-card,
.panel,
.content-card {
    min-width: 0;
    padding: 18px;
    margin-bottom: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.section-card h2,
.panel h2,
.content-card h2 {
    margin-top: 0;
}

/* ========================================
   DASHBOARD
   ======================================== */

.welcome {
    position: relative;
    overflow: hidden;
    padding: 24px;
    margin-bottom: 22px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #176b50, #104c3b);
    color: #fff;
    box-shadow: 0 8px 22px rgba(23, 107, 80, .12);
}

.welcome h1 {
    color: #fff;
}

.welcome p {
    margin: 0 0 8px;
}

.welcome p:last-child {
    margin-top: 10px;
    color: #d4e8de;
    font-size: 13px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.menu-card {
    display: block;
    min-width: 0;
    padding: 17px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-card);
    transition: border-color .15s, transform .15s, box-shadow .15s;
}

.menu-card:hover {
    color: var(--text);
    border-color: #b7d8c6;
    box-shadow: 0 5px 18px rgba(25, 55, 42, .07);
    transform: translateY(-2px);
}

.menu-card span,
.menu-card strong,
.menu-card small {
    display: block;
}

.menu-card span {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 800;
}

.menu-card strong {
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.menu-card small {
    color: var(--muted);
    line-height: 1.5;
    margin-top: 6px;
    font-size: 11px;
}

/* Kartu ringkasan angka */

.summary-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.summary-card,
.stat-card {
    min-width: 0;
    padding: 15px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.summary-card .label,
.stat-card .label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 12px;
}

.summary-card .value,
.stat-card .value {
    display: block;
    color: var(--primary-dark);
    font-size: clamp(17px, 4vw, 23px);
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.summary-card .description,
.stat-card .description {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

/* ========================================
   TABEL
   ======================================== */

.table-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 13px;
}

th,
td {
    padding: 12px 13px;
    border-bottom: 1px solid #edf1ee;
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

th {
    background: #f5f8f6;
    color: #53645a;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #f9fbf9;
}

td a {
    font-weight: 600;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* Alternatif tabel menjadi kartu pada HP.
   Aktifkan dengan class .mobile-cards pada tabel. */

@media (max-width: 600px) {
    table.mobile-cards,
    table.mobile-cards tbody,
    table.mobile-cards tr,
    table.mobile-cards td {
        display: block;
        width: 100%;
    }

    table.mobile-cards thead {
        display: none;
    }

    table.mobile-cards tr {
        padding: 8px 12px;
        border-bottom: 1px solid var(--border);
    }

    table.mobile-cards tr:last-child {
        border-bottom: 0;
    }

    table.mobile-cards td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        padding: 7px 0;
        border-bottom: 0;
        text-align: right;
    }

    table.mobile-cards td::before {
        content: attr(data-label);
        flex: 0 0 40%;
        color: var(--muted);
        font-size: 11px;
        font-weight: 700;
        text-align: left;
    }

    table.mobile-cards td > * {
        max-width: 60%;
    }
}

/* ========================================
   FILTER DAN PENCARIAN
   ======================================== */

.filter-form,
.search-form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.filter-form .form-group,
.search-form .form-group {
    flex: 1 1 150px;
    min-width: 0;
}

.filter-form label,
.search-form label {
    margin-top: 0;
}

.filter-form button,
.search-form button {
    flex: 0 0 auto;
}

/* ========================================
   NAVIGASI BAWAH APLIKASI
   ======================================== */

/*
   Navigasi ini baru aktif setelah markup HTML
   dipasang di file PHP halaman terkait.

   Class yang digunakan:
   .app-bottom-nav
   .bottom-nav-item
   .bottom-nav-item.active
*/

.app-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    padding: 8px 5px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--border);
    box-shadow: 0 -5px 20px rgba(25, 55, 42, .06);
    backdrop-filter: blur(14px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 48px;
    padding: 4px 2px;
    border-radius: 10px;
    color: #839087;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.bottom-nav-item:hover {
    color: var(--primary);
    background: #f4f8f5;
}

.bottom-nav-item .nav-icon {
    display: grid;
    place-items: center;
    min-height: 22px;
    font-size: 20px;
    line-height: 1;
}

.bottom-nav-item .nav-label {
    display: block;
    max-width: 100%;
    font-size: 10px;
    white-space: nowrap;
}

.bottom-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 800;
}

.bottom-nav-item.active .nav-icon {
    color: var(--primary);
}

/* ========================================
   UTILITAS
   ======================================== */

.text-muted {
    color: var(--muted);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.fw-bold {
    font-weight: 700;
}

.mt-0 {
    margin-top: 0 !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.w-100 {
    width: 100%;
}

.d-flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 12px;
}

/* ========================================
   RESPONSIVE DESKTOP
   ======================================== */

@media (min-width: 700px) {
    .container {
        padding-top: 30px;
        padding-bottom: 45px;
    }

    .menu-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }

    .summary-grid,
    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .welcome {
        padding: 30px;
    }

    .section-card,
    .panel,
    .content-card {
        padding: 22px;
    }

    .app-bottom-nav {
        right: auto;
        left: 50%;
        width: min(100%, 720px);
        padding-right: 12px;
        padding-left: 12px;
        border-right: 1px solid var(--border);
        border-left: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
        transform: translateX(-50%);
    }

    .bottom-nav-item {
        min-height: 50px;
        font-size: 11px;
    }
}

/* ========================================
   RESPONSIVE HP
   ======================================== */

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    h1 {
        font-size: 21px;
    }

    h2 {
        font-size: 16px;
    }

    .topbar {
        padding: 12px 14px;
    }

    .topbar strong {
        font-size: 14px;
    }

    .container {
        padding: 18px 13px 25px;
    }

    .welcome {
        padding: 20px 17px;
        border-radius: 17px;
    }

    .menu-grid {
        gap: 10px;
    }

    .menu-card {
        padding: 14px 12px;
        border-radius: 13px;
    }

    .menu-card span {
        width: 36px;
        height: 36px;
        margin-bottom: 11px;
    }

    .summary-grid,
    .stats-grid {
        gap: 9px;
    }

    .summary-card,
    .stat-card {
        padding: 12px;
    }

    .section-card,
    .panel,
    .content-card {
        padding: 14px;
        border-radius: 13px;
    }

    .filter-form,
    .search-form {
        align-items: stretch;
    }

    .filter-form .form-group,
    .search-form .form-group {
        flex-basis: 100%;
    }

    .filter-form button,
    .search-form button {
        flex: 1 1 auto;
    }

    .table-wrap {
        border-radius: 11px;
    }
}

@media (max-width: 360px) {
    .auth-card {
        padding: 22px 17px;
    }

    .container {
        padding-right: 11px;
        padding-left: 11px;
    }

    .menu-grid {
        gap: 8px;
    }

    .menu-card {
        padding: 12px 9px;
    }

    .menu-card strong {
        font-size: 13px;
    }

    .bottom-nav-item .nav-label {
        font-size: 9px;
    }

    .app-bottom-nav {
        padding-right: 2px;
        padding-left: 2px;
    }
}

/* Kurangi animasi bagi pengguna yang memintanya */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
