/* ============================================
   SiKosan — Modern, Lightweight UI (2026)
   Single stylesheet, system fonts, no deps
   ============================================ */

/* ===== 1. TOKENS & RESET ===== */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e7eaf0;
    --text: #17202a;
    --text-muted: #64748b;
    --text-soft: #94a3b8;

    --primary: #4f46e5;
    --primary-strong: #4338ca;
    --primary-soft: #eef2ff;

    --green: #16a34a;
    --green-soft: #dcfce7;
    --green-text: #166534;
    --red: #dc2626;
    --red-soft: #fee2e2;
    --red-text: #991b1b;
    --amber: #d97706;
    --amber-soft: #fef3c7;
    --amber-text: #92400e;
    --blue: #0284c7;
    --blue-soft: #e0f2fe;
    --blue-text: #075985;
    --teal: #0d9488;
    --teal-soft: #ccfbf1;
    --teal-text: #115e59;
    --violet: #7c3aed;
    --violet-soft: #ede9fe;
    --violet-text: #5b21b6;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);

    --sidebar-w: 240px;
    --header-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 15px;
}

img { display: block; max-width: 100%; }

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

/* ===== 2. APP LAYOUT (SIDEBAR + TOPBAR) ===== */
.app-wrapper { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--header-h);
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.01em;
}

.sidebar-brand .brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.sidebar-brand .tagline-small {
    display: block;
    font-size: .7rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 2px; }

.sidebar-nav .nav-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-soft);
    padding: 12px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.nav-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }

.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-item .nav-icon { width: 22px; text-align: center; font-size: 1rem; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s;
    position: relative;
}

.sidebar-user:hover { background: var(--bg); }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .9rem;
    flex-shrink: 0;
}

.user-meta { min-width: 0; flex: 1; }
.user-meta .user-name { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta .user-email { font-size: .72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta .dropdown-arrow { font-size: .6rem; color: var(--text-soft); margin-left: 2px; }

/* Sidebar user dropdown (opens upward) */
.dropdown-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 300;
    min-width: 180px;
}

.dropdown-menu.show { display: flex; animation: fadeIn .15s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    padding: 10px 14px;
    color: var(--text);
    font-size: .88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.dropdown-item:hover { background: var(--bg); text-decoration: none; }

.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

.text-danger { color: var(--red) !important; }
.text-danger:hover { background: var(--red-soft) !important; }

/* ===== 3. MAIN AREA & TOPBAR ===== */
.main-area { margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 150;
    height: var(--header-h);
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 24px;
}

.topbar-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }

.topbar-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.welcome-text { font-size: .85rem; color: var(--text-muted); }

/* Mobile topbar hamburger */
.menu-btn {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .4);
    z-index: 190;
}

.main-content { flex: 1; padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ===== 4. BUTTONS ===== */
.btn-primary, .btn-secondary, .btn-back, .btn-expense, .btn-expense-confirm, .btn-export,
.btn-pay, .btn-detail, .btn-photo, .btn-checkout, .btn-delete, .btn-edit-room, .btn-delete-room,
.btn-manage, .btn-confirm, .btn-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, box-shadow .15s, transform .15s, color .15s, border-color .15s;
}

.btn-primary {
    padding: .55rem 1.1rem;
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); }

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

.btn-secondary {
    padding: .55rem 1.1rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-back {
    padding: .45rem .9rem;
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-back:hover { color: var(--text); background: var(--bg); }

.btn-sm { padding: .35rem .7rem !important; font-size: .8rem !important; }
.btn-full { width: 100%; }

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: 1.3rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}
.btn-close:hover { background: var(--bg); color: var(--text); }

/* Action buttons (JS-generated) */
.btn-manage { padding: .55rem .9rem; font-size: .82rem; background: var(--primary); color: #fff; }
.btn-manage.rooms    { background: var(--teal); }
.btn-manage.tenants  { background: var(--amber); }
.btn-manage.bills    { background: var(--violet); }
.btn-manage.finance  { background: var(--green); }
.btn-manage.auto-bill { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.btn-manage:hover { opacity: .92; }

.btn-photo, .btn-detail { width: 100%; padding: .5rem; background: var(--primary); color: #fff; }
.btn-photo:hover, .btn-detail:hover { background: var(--primary-strong); }

.btn-pay { width: 100%; padding: .6rem; margin-top: auto; background: var(--green); color: #fff; }
.btn-pay:hover { background: #15803d; }

.btn-export {
    padding: .5rem .95rem;
    background: var(--surface);
    color: var(--red);
    border: 1px solid var(--border);
}
.btn-export:hover:not(:disabled) { background: var(--red-soft); border-color: var(--red); }
.btn-export:disabled { opacity: .6; cursor: not-allowed; }

.btn-expense {
    padding: .5rem .95rem;
    background: var(--surface);
    color: var(--amber);
    border: 1px solid var(--border);
}
.btn-expense:hover { background: var(--amber-soft); border-color: var(--amber); }

.btn-expense-confirm { padding: .55rem 1.1rem; background: var(--amber); color: #fff; }
.btn-expense-confirm:hover { background: var(--amber-text); }

.btn-confirm { background: var(--green); }
.btn-confirm:hover { background: #15803d; }
.btn-confirm:disabled { background: var(--text-soft); cursor: not-allowed; opacity: .7; transform: none; }

.btn-checkout { width: 100%; padding: .7rem; background: var(--red); color: #fff; }
.btn-checkout:hover { background: #b91c1c; }

.btn-delete {
    width: 100%;
    padding: .7rem;
    background: var(--surface);
    color: var(--red);
    border: 1px solid var(--red);
}
.btn-delete:hover { background: var(--red); color: #fff; }

.btn-edit-room { flex: 1; padding: .5rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-edit-room:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.btn-delete-room { flex: 1; padding: .5rem; background: var(--surface); color: var(--red); border: 1px solid var(--border); }
.btn-delete-room:hover { border-color: var(--red); background: var(--red-soft); }

.room-action-row { display: flex; gap: .5rem; margin-top: .5rem; width: 100%; }

.btn-copy {
    padding: .25rem .55rem;
    font-size: .8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
}
.btn-copy:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ===== 5. PAGE HEADER (content top row) ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-header-left h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
.header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.page-header .header-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ===== 6. STAT CARDS ===== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s, transform .2s;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--primary-soft);
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-info h3 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stat-info p { color: var(--text-muted); font-size: .82rem; font-weight: 500; }

.stat-income .stat-icon { background: var(--green-soft); }
.stat-income .stat-info h3 { color: var(--green); }
.stat-expense .stat-icon { background: var(--red-soft); }
.stat-expense .stat-info h3 { color: var(--red); }
.stat-profit .stat-icon { background: var(--primary-soft); }
.stat-profit .stat-info h3 { color: var(--primary); }

/* ===== 7. CONTENT SECTIONS & CARDS ===== */
.content-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.content-section > header { margin: -22px -22px 20px; padding: 18px 22px; border-bottom: 1px solid var(--border); }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.section-header h3 { font-size: 1.05rem; font-weight: 700; }

.section-title {
    grid-column: 1 / -1;
    margin: 8px 0 4px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* Halaman pengaturan */
.settings-hint {
    color: var(--text-muted);
    font-size: .88rem;
    margin: -8px 0 14px;
    max-width: 640px;
}

/* ===== 8. GRIDS & CARDS (Kos / Room / Tenant / Bill) ===== */
.kos-grid, .room-grid, .tenant-grid, .bill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.kos-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.kos-card, .room-card, .tenant-card, .bill-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}

.kos-card:hover, .room-card:hover, .tenant-card:hover, .bill-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kos-card-header, .room-card-header, .tenant-card-header, .bill-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
    margin-bottom: .6rem;
}

.kos-card h4, .room-card-header h4, .tenant-card-header h4, .bill-card-header h4 {
    font-size: 1.02rem;
    font-weight: 700;
}

.kos-card-info, .room-card-info, .tenant-card-info, .bill-card-info {
    color: var(--text-muted);
    font-size: .87rem;
    flex: 1;
}

.kos-card-info p, .room-card-info p, .tenant-card-info p, .bill-card-info p { margin: .25rem 0; }
.kos-card-info p strong, .room-card-info p strong, .tenant-card-info p strong, .bill-card-info p strong { color: var(--text); }

.kos-card-actions, .room-card-actions, .tenant-card-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
}

/* ===== 9. ROOM THUMBNAIL ===== */
.room-thumbnail {
    position: relative;
    width: 100%;
    height: 170px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 14px;
    background: var(--bg);
    flex-shrink: 0;
}

.room-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }

.room-card:hover .room-thumbnail img { transform: scale(1.04); }

.photo-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(15, 23, 42, .72);
    color: #fff;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
}

/* ===== 10. TENANT CARD ===== */
.tenant-card-top { display: flex; gap: 12px; margin-bottom: 12px; }

.ktp-thumbnail {
    width: 62px;
    height: 84px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg);
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 1.5rem;
}

.ktp-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.tenant-card-main { flex: 1; min-width: 0; }
.tenant-card-main .tenant-card-header { margin-bottom: .4rem; }
.tenant-card-main .tenant-card-header h4 {
    font-size: .98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-payment { color: var(--green) !important; font-weight: 600; }

/* Billing badge strip on tenant cards */
.billing-badge {
    padding: .5rem .7rem;
    border-radius: var(--radius-sm);
    font-size: .83rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    margin-bottom: 12px;
}
.billing-badge small { font-weight: 500; font-size: .72rem; opacity: .85; }
.billing-badge.unpaid { background: var(--amber-soft); color: var(--amber-text); }
.billing-badge.paid { background: var(--green-soft); color: var(--green-text); }
.billing-badge.none { background: var(--bg); color: var(--text-muted); }

/* ===== 11. BILL CARD ===== */
.bill-room { color: var(--text-muted); font-size: .8rem; }
.bill-amount { font-size: 1.2rem !important; font-weight: 800; color: var(--text) !important; margin-top: .7rem !important; }

/* ===== 12. STATUS BADGES ===== */
.status-badge, .status-badge-small, .jenis-badge, .jenis-sewa-badge, .kos-badge, .dp-badge {
    display: inline-flex;
    align-items: center;
    padding: .18rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    background: var(--bg);
    color: var(--text-muted);
    white-space: nowrap;
}

.status-available, .status-Available, .status-Aktif, .status-paid, .status-active { background: var(--green-soft); color: var(--green-text); }
.status-occupied, .status-Full, .status-unpaid, .status-inactive, .status-tidak-aktif { background: var(--red-soft); color: var(--red-text); }
.status-cuti { background: var(--amber-soft); color: var(--amber-text); }

.jenis-badge.text-income { background: var(--green-soft); color: var(--green-text); }
.jenis-badge.text-expense { background: var(--red-soft); color: var(--red-text); }

.jenis-sewa-badge { background: var(--blue-soft); color: var(--blue-text); }

.text-income { color: var(--green); font-weight: 700; }
.text-expense { color: var(--red); font-weight: 700; }

/* ===== 13. FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: .84rem;
    font-weight: 600;
    color: var(--text);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .92rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.form-group textarea { height: 76px; resize: vertical; }

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-group input::placeholder { color: var(--text-soft); }

.filter-select {
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.form-message { padding: .75rem 1.5rem; text-align: center; font-weight: 600; font-size: .9rem; }

/* ===== 14. MODALS ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn .18s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-wide { max-width: 760px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
    border-radius: 16px 16px 0 0;
}

.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 22px; }
.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-radius: 0 0 16px 16px;
}

/* ===== 15. UPLOAD ===== */
.upload-area { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px dashed var(--border); }

.upload-placeholder {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    padding: 26px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: var(--bg);
}
.upload-placeholder:hover { border-color: var(--primary); background: var(--primary-soft); }

.upload-icon { font-size: 2rem; display: block; margin-bottom: .4rem; }
.upload-placeholder p { font-weight: 600; margin-bottom: .2rem; }
.upload-placeholder small { color: var(--text-muted); }

.upload-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.preview-item { width: 92px; text-align: center; }
.preview-item img {
    width: 92px;
    height: 92px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.preview-name {
    display: block;
    font-size: .68rem;
    color: var(--text-muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 16. PHOTO GALLERY ===== */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg);
}

.gallery-item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; transition: transform .25s; }
.gallery-item:hover img { transform: scale(1.04); }

.btn-delete-photo {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(220, 38, 38, .92);
    color: #fff;
    font-size: .8rem;
    display: grid;
    place-items: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s;
}
.gallery-item:hover .btn-delete-photo { opacity: 1; }

/* ===== 17. LIGHTBOX ===== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
}

.lightbox img { max-width: 90%; max-height: 90vh; object-fit: contain; border-radius: var(--radius-sm); }

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 24px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.4rem;
    cursor: pointer;
    line-height: 1;
}
.lightbox-close:hover { color: var(--red); }

/* ===== 18. TABLES ===== */
.transaction-list { overflow-x: auto; }

.transaction-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

.transaction-table th, .transaction-table td {
    padding: .7rem .9rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.transaction-table th {
    font-weight: 700;
    color: var(--text-muted);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

.transaction-table tbody tr:hover { background: var(--bg); }

.nominal-cell { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }

/* ===== 19. CHART ===== */
.chart-section { margin-bottom: 24px; }
.chart-container { position: relative; height: 300px; max-width: 560px; margin: 0 auto; }

/* ===== 20. DETAIL PAGE ===== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.detail-card.full-width { grid-column: 1 / -1; }

.detail-header {
    background: var(--primary-soft);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    border-bottom: 1px solid var(--border);
}

.detail-header h3 { font-size: .98rem; font-weight: 700; color: var(--text); }
.detail-header h3, .detail-header h3 * { color: var(--text) !important; }

.detail-body { padding: 18px; }

.info-row { margin-bottom: 14px; }
.info-row:last-child { margin-bottom: 0; }

.info-row label {
    display: block;
    font-size: .74rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.info-value {
    font-size: .92rem;
    padding: .45rem .65rem;
    background: var(--bg);
    border-radius: 6px;
    word-break: break-word;
}

.tenant-actions-group {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed var(--border);
}

.ktp-preview { text-align: center; }
.ktp-preview img {
    max-width: 100%;
    max-height: 280px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    margin: 0 auto 12px;
}

.ktp-upload-placeholder {
    text-align: center;
    padding: 28px;
    background: var(--bg);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
}
.ktp-upload-placeholder p { color: var(--text-muted); margin-bottom: 12px; }

.checkout-info { text-align: center; padding: 14px; background: var(--bg); border-radius: var(--radius-sm); }

.empty-state { color: var(--text-muted); text-align: center; padding: 32px 16px; font-style: italic; }

/* ===== 21. BANNERS / PRICING / WIFI ===== */
.info-banner {
    background: var(--primary-soft);
    border: 1px solid #e0e7ff;
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 24px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.info-icon { font-size: 1.6rem; flex-shrink: 0; }
.info-content h4 { margin-bottom: 6px; font-size: .95rem; }
.info-content p { color: var(--text-muted); margin: .25rem 0; font-size: .88rem; }
.info-content ul { margin: .4rem 0 .4rem 1.25rem; color: var(--text-muted); font-size: .88rem; }

.success-banner {
    background: var(--green-soft);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 24px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.success-icon { font-size: 1.8rem; flex-shrink: 0; }
.success-content h3 { color: var(--green-text); margin-bottom: 4px; font-size: 1rem; }
.success-content p { color: var(--green-text); }

.result-actions {
    display: flex;
    gap: .7rem;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

code {
    background: var(--bg);
    padding: .1rem .4rem;
    border-radius: 5px;
    font-size: .82rem;
    color: var(--primary);
}

.price-info {
    background: var(--blue-soft);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-sm);
    padding: .7rem .9rem;
    margin-top: 4px;
    font-size: .87rem;
    color: var(--blue-text);
}
.price-info strong { color: var(--blue-text); }

.harga-highlight {
    background: var(--primary-soft) !important;
    border-left: 3px solid var(--primary) !important;
    font-size: .95rem !important;
    padding: .7rem .8rem !important;
}

.harga-list { display: flex; flex-direction: column; gap: 6px; background: var(--bg) !important; border-left: 3px solid var(--border) !important; }

.harga-item {
    padding: .45rem .7rem;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: .87rem;
    display: flex;
    justify-content: space-between;
}

.harga-item.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.harga-item.active strong { color: #fff; }

.wifi-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .45rem .65rem;
}

.wifi-value span { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; }

/* ===== 22. SKELETON & LOADING ===== */
.skeleton-card { pointer-events: none; }

.skeleton-thumbnail, .skeleton-ktp, .skeleton-line {
    background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.4s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-thumbnail { width: 100%; height: 170px; margin-bottom: 14px; }
.skeleton-ktp { width: 62px; height: 84px; flex-shrink: 0; }

@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-state { text-align: center; padding: 40px 16px; color: var(--text-muted); }

/* ===== 23. LOGIN ===== */
.login-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(800px 400px at 80% -10%, #e0e7ff 0%, transparent 60%),
        radial-gradient(800px 400px at 10% 110%, #ccfbf1 0%, transparent 60%),
        var(--bg);
    padding: 1rem;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header { text-align: center; margin-bottom: 28px; }
.login-header .logo-small {
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.login-header .logo-small .brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
}
.login-header .tagline-small { color: var(--text-muted); font-size: .88rem; }
.login-form .btn-full { width: 100%; justify-content: center; padding: .65rem; }

/* ===== 24. BOOKING PAGE ===== */
.booking-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: start center;
    padding: 32px 16px;
    background:
        radial-gradient(800px 400px at 80% -10%, #e0e7ff 0%, transparent 60%),
        var(--bg);
}

.booking-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    width: 100%;
    max-width: 620px;
    box-shadow: var(--shadow-md);
}

.step-indicator { display: flex; gap: 8px; margin-bottom: 24px; }

.step {
    flex: 1;
    text-align: center;
    font-size: .8rem;
    color: var(--text-soft);
    font-weight: 700;
    padding: 8px 4px;
    border-radius: 999px;
    background: var(--bg);
}

.step.active { color: var(--primary); background: var(--primary-soft); }

.hidden { display: none !important; }

.room-option {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.room-option:hover { border-color: var(--primary); background: var(--primary-soft); }

.dp-badge { background: var(--amber-soft); color: var(--amber-text); }

.success-animation { font-size: 4rem; animation: bounce .6s ease; }

@keyframes bounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: .45; } 100% { opacity: 1; } }

/* ===== 25. RESPONSIVE ===== */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .menu-btn { display: inline-flex; }
    .main-area { margin-left: 0; }
    .topbar { padding: 0 16px; }
}

@media (max-width: 640px) {
    .main-content { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-section, .kos-grid, .room-grid, .tenant-grid, .bill-grid { grid-template-columns: 1fr; }
    .filter-select, .btn-export, .btn-expense { width: 100%; }
    .page-header, .section-header { align-items: stretch; flex-direction: column; }
    .page-header .header-right { justify-content: stretch; }
    .transaction-table { font-size: .8rem; }
    .transaction-table th, .transaction-table td { padding: .55rem .6rem; }
    .detail-grid { grid-template-columns: 1fr; }
    .ktp-thumbnail { width: 54px; height: 74px; }
}

/* ===== 26. PRINT ===== */
@media print {
    .sidebar, .topbar, .btn-export, .btn-back, .filter-select, .btn-manage, .btn-photo,
    .btn-detail, .btn-pay, .btn-expense, .menu-btn, .sidebar-overlay { display: none !important; }
    .main-area { margin-left: 0 !important; }
    .main-content { padding: 0 !important; }
    body { background: #fff; }
}
