/* ===== SBK Group - Land Register theme ===== */
:root {
    --brand: #0f6e56;
    --brand-dark: #0a5241;
    --brand-soft: #e3f2ec;
    --accent: #d98e04;
    --ink: #1c2733;
    --muted: #6b7785;
    --line: #e6e9ee;
    --bg: #f4f6f8;
    --card: #ffffff;
    --side: #10231d;
    --side-ink: #b9c9c2;
    --radius: 14px;

    --bs-primary: var(--brand);
    --bs-primary-rgb: 15, 110, 86;
    --bs-link-color: var(--brand);
    --bs-link-hover-color: var(--brand-dark);
    --bs-body-font-family: "Noto Sans", "Noto Sans Gujarati", "Noto Sans Devanagari", "Nirmala UI", system-ui, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--bg);
    --bs-border-radius: 10px;
}

html { font-size: 15px; }
body { background: var(--bg); color: var(--ink); }

.btn-primary {
    --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn { font-weight: 500; }
.btn-icon { border: 0; background: transparent; font-size: 1.5rem; line-height: 1; padding: .25rem .5rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(15, 110, 86, .15);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 500; margin-bottom: .35rem; }
.form-label.req::after { content: " *"; color: #d63939; }
.validation-summary-valid { display: none; }
.pw-eye { border-color: var(--bs-border-color); color: var(--muted); background: #fff; }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--brand); background: var(--brand-soft); border-color: var(--bs-border-color); }
.input-validation-error { border-color: #d63939; }

/* ===== Layout ===== */
.app { min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 1040;
    background: var(--side); color: var(--side-ink);
    display: flex; flex-direction: column; overflow-y: auto;
    transition: transform .2s ease;
}
.brand {
    display: flex; align-items: center; gap: .75rem;
    padding: 1.25rem 1.25rem 1rem; color: #fff; text-decoration: none;
}
.brand:hover { color: #fff; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 12px; flex: none;
    display: grid; place-items: center; font-size: 1.3rem;
    background: linear-gradient(135deg, var(--brand), #28a17c); color: #fff;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.1rem; }
.brand-text small { color: var(--side-ink); font-size: .78rem; }

.side-nav { padding: .5rem .75rem 2rem; display: flex; flex-direction: column; gap: 2px; }
.nav-group {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    color: #6f8a80; padding: 1rem .75rem .35rem;
}
.nav-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem .75rem; border-radius: 10px;
    color: var(--side-ink); text-decoration: none; font-weight: 500;
}
.nav-item i { font-size: 1.1rem; width: 1.2rem; text-align: center; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.disabled { opacity: .55; cursor: default; }
.nav-item.disabled:hover { background: transparent; color: var(--side-ink); }
.nav-item em {
    margin-left: auto; font-style: normal; font-size: .68rem;
    background: rgba(255, 255, 255, .1); padding: .1rem .45rem; border-radius: 20px;
}

.main { margin-left: 260px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: .75rem;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    padding: .75rem 1.5rem; min-height: 64px;
}
.page-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
.back-btn { flex: none; font-weight: 500; }
.dev-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    background: #fff3dc; color: #9a6400; border: 1px dashed #d98e04;
    border-radius: 20px; padding: .2rem .7rem; font-size: .8rem; font-weight: 600;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.topbar-right form { margin: 0; }
.user-chip { align-items: center; gap: .5rem; font-weight: 500; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand);
    display: grid; place-items: center; font-weight: 700;
}

.content { padding: 1.5rem; flex: 1; }

.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    .sidebar-open .sidebar { transform: none; }
    .sidebar-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(0, 0, 0, .4);
    }
    .content { padding: 1rem; }
    .topbar { padding: .6rem 1rem; }
}

/* ===== Cards, tables ===== */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16, 35, 29, .04); }
.card-header {
    background: transparent; border-bottom: 1px solid var(--line);
    font-weight: 600; padding: .9rem 1.25rem;
}
.card > .table-responsive { border-radius: var(--radius); }
.form-card { max-width: 560px; }
.form-card.wide { max-width: 900px; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.table { --bs-table-hover-bg: #f7faf9; }
.table thead th {
    background: #f8faf9; color: var(--muted); font-weight: 600;
    font-size: .8rem; text-transform: uppercase; letter-spacing: .03em;
    border-bottom: 1px solid var(--line); white-space: nowrap; padding: .75rem 1rem;
}
.table td { padding: .75rem 1rem; border-color: var(--line); }
.table td.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.hint { margin: 0; color: var(--muted); }
.search-box { position: relative; flex: 1; max-width: 380px; }
.search-box i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .form-control { padding-left: 2.4rem; }

.badge { font-weight: 600; padding: .4em .7em; }
.text-bg-success-soft { background: #e3f5ec; color: #11794b; }
.text-bg-secondary-soft { background: #eef0f3; color: #5d6875; }
.text-bg-primary-soft { background: var(--brand-soft); color: var(--brand); }
.text-bg-danger-soft { background: #fdecec; color: #c62828; }
.text-bg-warning-soft { background: #fff3dc; color: #9a6400; }
.pre-line { white-space: pre-line; }

.alert { border-radius: 12px; }
.alert i { margin-right: .35rem; }
.big-icon { font-size: 3rem; color: var(--brand); line-height: 1; margin-bottom: 1rem; }

/* ===== Dashboard ===== */
.welcome {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
    background: linear-gradient(120deg, var(--brand), #1c8f6f);
    color: #fff; border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
}
.welcome h2 { font-size: 1.4rem; margin: 0 0 .25rem; font-weight: 700; }
.welcome p { margin: 0; opacity: .9; }
.today { background: rgba(255, 255, 255, .15); padding: .4rem .8rem; border-radius: 20px; font-weight: 500; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.stat {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .9rem;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.1rem; text-decoration: none; color: var(--ink);
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16, 35, 29, .08); color: var(--ink); }
.stat-icon {
    grid-row: span 2; width: 48px; height: 48px; border-radius: 12px;
    display: grid; place-items: center; font-size: 1.4rem;
}
.stat-icon.c1 { background: #e3f2ec; color: #0f6e56; }
.stat-icon.c2 { background: #fff3dc; color: #b87700; }
.stat-icon.c3 { background: #e5eefc; color: #2f5fb3; }
.stat-icon.c4 { background: #f3e8fb; color: #7b3fa6; }
.stat-icon.c5 { background: #fdecec; color: #c62828; }
.stat-label { color: var(--muted); font-size: .88rem; align-self: end; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }

.stat { grid-template-rows: auto auto auto; }
.stat-icon { grid-row: span 3; }
.stat-value { white-space: nowrap; }
.stat-grid .stat-value { font-size: clamp(1.1rem, 1.6vw, 1.5rem); }
.stat-sub { grid-column: 2; color: var(--muted); font-size: .78rem; line-height: 1.3; }
.dash-title { font-size: 1rem; font-weight: 700; color: var(--brand-dark); margin-bottom: .75rem; }
.chart-box { position: relative; height: 300px; }
.chart-box-h { height: 220px; }
.chart-table { margin-top: .75rem; font-size: .85rem; }
.chart-table summary { cursor: pointer; color: var(--brand); font-weight: 500; }
.chart-table table { margin-top: .5rem; }
.chart-table a { text-decoration: none; }

.soon-box { display: flex; gap: 1rem; align-items: center; color: var(--muted); }
.soon-box i { font-size: 2rem; color: var(--accent); }
.soon-box strong { color: var(--ink); }

/* ===== Deals ===== */
.sum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.sum-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: .9rem 1rem; display: flex; flex-direction: column; gap: .15rem;
}
.sum-card span { color: var(--muted); font-size: .85rem; }
.sum-card strong { font-size: 1.35rem; font-weight: 700; }
.sum-card small { color: var(--muted); font-size: .8rem; }

.unit-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.unit-chip { background: var(--brand-soft); color: var(--brand-dark); border-radius: 20px; padding: .3rem .8rem; font-size: .85rem; }

.click-rows tr[data-href] { cursor: pointer; }
.row-late td { background: #fff7f7; }

.filter-bar .card-body { padding: .9rem 1rem; }
.quick-dates { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; }
.quick-dates a { text-decoration: none; }

.deal-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.deal-head h2 { font-size: 1.5rem; font-weight: 700; margin: .1rem 0; }
.deal-no { font-weight: 600; color: var(--brand); }
.deal-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.info-list { display: grid; grid-template-columns: 40% 60%; gap: .55rem 0; margin: 0; }
.info-list dt { color: var(--muted); font-weight: 500; }
.info-list dd { margin: 0; }
.info-list.calc dd { text-align: right; }
.info-list.calc .total { border-top: 1px solid var(--line); padding-top: .5rem; font-weight: 700; }

.money-strip {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem 1rem;
    padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); background: #fbfcfc;
}
.money-strip div { display: flex; flex-direction: column; }
.money-strip span { font-size: .8rem; color: var(--muted); }
.money-strip strong { font-size: 1.1rem; }
.pay-progress { grid-column: 1 / -1; width: 100%; height: 8px; border: 0; border-radius: 8px; overflow: hidden; background: #e9eef0; appearance: none; }
.pay-progress::-webkit-progress-bar { background: #e9eef0; border-radius: 8px; }
.pay-progress::-webkit-progress-value { background: var(--brand); border-radius: 8px; }
.pay-progress::-moz-progress-bar { background: var(--brand); border-radius: 8px; }
.pay-form { padding: 1.25rem; border-bottom: 1px solid var(--line); background: #f7fbf9; }

.step {
    display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
    background: var(--brand); color: #fff; font-size: .8rem; margin-right: .4rem;
}
.schedule-table { min-width: 640px; }
.schedule-table th { font-size: .75rem; }
.schedule-table td { padding: .4rem .5rem; }
.schedule-table td:nth-child(1) { width: 120px; }
.schedule-table td:nth-child(2) { width: 170px; }
.schedule-table td:nth-child(3) { width: 180px; }
.schedule-table td:last-child { width: 50px; }
.schedule-sum { font-weight: 600; color: var(--brand-dark); }
.schedule-sum.over { color: #c62828; }
.sticky-actions {
    position: sticky; bottom: 0; z-index: 5; background: rgba(244, 246, 248, .95);
    padding: .75rem 0; border-top: 1px solid var(--line);
}
.land-left { margin-top: .4rem; font-weight: 600; color: var(--brand); }
.unit-label { color: var(--muted); font-weight: 400; }

.photo-drop {
    display: flex; flex-direction: column; align-items: center; gap: .25rem; cursor: pointer;
    border: 2px dashed #c8d3d0; border-radius: 12px; padding: 1.5rem; text-align: center; color: var(--muted);
}
.photo-drop:hover { border-color: var(--brand); color: var(--brand); }
.photo-drop i { font-size: 2rem; }
.photo-drop span { font-weight: 600; }
.photo-preview { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.photo-preview img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; }
.photo-tile { position: relative; }
.photo-open { border: 0; padding: 0; background: none; width: 100%; display: block; }
.photo-open img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.photo-tile form { position: absolute; top: 6px; right: 6px; margin: 0; }
.photo-del { border: 0; border-radius: 8px; background: rgba(255, 255, 255, .9); color: #c62828; padding: .2rem .45rem; }
.photo-big { max-width: 100%; max-height: 80vh; border-radius: 8px; }
.photo-upload { margin: 0; }

@media (max-width: 575.98px) {
    .sum-grid, .stat-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
    .sum-card strong, .stat-value { font-size: 1.1rem; }
    .stat { grid-template-columns: 1fr; padding: .8rem; }
    .stat-icon { grid-row: auto; width: 36px; height: 36px; font-size: 1.1rem; margin-bottom: .4rem; }
    .stat-sub { grid-column: auto; }
    .chart-box { height: 240px; }
    .money-strip { grid-template-columns: 1fr 1fr; }
    .info-list { grid-template-columns: 1fr; }
    .info-list dt { margin-top: .35rem; }
}

/* ===== Accounts ===== */
.type-pick, .group-pick { display: grid; gap: .6rem; }
.type-pick { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.group-pick { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.type-option, .group-option { margin: 0; cursor: pointer; }
.type-option input, .group-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-option span, .group-option span {
    display: flex; flex-direction: column; gap: .15rem; height: 100%;
    border: 2px solid var(--line); border-radius: 12px; padding: .75rem 1rem; background: #fff;
}
.type-option i { font-size: 1.4rem; }
.type-option strong, .group-option strong { font-size: 1rem; }
.type-option small, .group-option small { color: var(--muted); font-size: .8rem; }
.type-option input:checked + span, .group-option input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.type-in input:checked + span { border-color: #11794b; background: #e3f5ec; }
.type-out input:checked + span { border-color: #c62828; background: #fdecec; }
.type-option input:focus-visible + span, .group-option input:focus-visible + span { outline: 3px solid rgba(15, 110, 86, .3); }
.group-option input:disabled + span { opacity: .45; cursor: not-allowed; }

.report-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.report-tile {
    display: flex; gap: 1rem; align-items: center; padding: 1.1rem;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--ink); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease;
}
.report-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16, 35, 29, .08); color: var(--ink); }
.report-tile strong { display: block; font-size: 1.05rem; }
.report-tile small { color: var(--muted); }
.report-tile .stat-icon { grid-row: auto; flex: none; }

.report-table td, .report-table th { padding: .55rem 1rem; }
.report-table a { color: inherit; text-decoration: none; }
.report-table a:hover { color: var(--brand); text-decoration: underline; }
.report-table tr.sec td { background: #f8faf9; font-weight: 700; color: var(--brand-dark); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.report-table tr.sub td { color: var(--muted); font-size: .9rem; }
.report-table tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.report-table tr.grand td, .report-table tr.grand th, .table tfoot th { font-weight: 700; background: #f3f7f5; }
.report-table tr.grand.profit td { background: #e3f5ec; color: #11794b; font-size: 1.1rem; }
.report-table tr.grand.loss td { background: #fdecec; color: #c62828; font-size: 1.1rem; }
.row-opening td { background: #fbfcfc; }
.print-head { display: none; }

@media print {
    .sidebar, .topbar, .no-print, .toolbar, .alert-dismissible, .btn { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    body { background: #fff; font-size: 12px; }
    .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
    .print-head { display: block; font-size: 14px; margin-bottom: 10px; }
    .row > [class*="col-lg-"] { width: 50%; }
    a { color: inherit !important; text-decoration: none !important; }
}

/* ===== Users ===== */
.perm-table .form-check-input { width: 1.25em; height: 1.25em; margin: 0; }
.admin-note { display: none; padding: .75rem 1.25rem; background: var(--brand-soft); color: var(--brand); font-weight: 500; }
#permCard.is-admin .admin-note { display: block; }
#permCard.is-admin .table-responsive, #permCard.is-admin #permAll { opacity: .4; pointer-events: none; }

/* ===== Login ===== */
.auth {
    min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    background: radial-gradient(circle at 20% 20%, #1c8f6f 0, transparent 45%),
                radial-gradient(circle at 80% 80%, #d98e04 0, transparent 40%),
                var(--side);
}
.auth-card {
    width: 100%; max-width: 420px; background: #fff; border-radius: 20px;
    padding: 2rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.auth-brand { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.25rem; }
.auth-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand strong { font-size: 1.2rem; }
.auth-brand small { color: var(--muted); }
.lang-switch { display: flex; gap: .35rem; margin-bottom: 1.5rem; background: var(--bg); border-radius: 10px; padding: .25rem; }
.lang-switch form { flex: 1; margin: 0; }
.lang-switch button {
    width: 100%; border: 0; background: transparent; border-radius: 8px;
    padding: .4rem; font-weight: 500; color: var(--muted);
}
.lang-switch button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.auth-title { font-size: 1.4rem; font-weight: 700; margin-bottom: .25rem; }
.auth-sub { color: var(--muted); margin-bottom: 1.25rem; }
.auth-note { margin: 1.25rem 0 0; font-size: .82rem; color: var(--muted); text-align: center; }
