@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;800;900&display=swap");

:root {
    --forest-900: #24472d;
    --forest-800: #2f6138;
    --forest-700: #437e47;
    --forest-100: #e7f1e7;
    --sand-100: #f5f1e7;
    --ink-900: #183027;
    --line: rgba(20, 55, 34, 0.12);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(77, 130, 73, 0.22), transparent 32%),
        radial-gradient(circle at bottom right, rgba(225, 207, 152, 0.18), transparent 25%),
        linear-gradient(180deg, #f3f7f1 0%, #f7f5ee 100%);
    color: var(--ink-900);
    font-family: "Roboto", sans-serif;
}

button,
input,
select,
textarea,
.btn,
.form-control,
.form-select,
.tabulator {
    font-family: "Roboto", sans-serif !important;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-card {
    width: min(440px, 100%);
    padding: 2rem;
    border-radius: 28px;
    box-shadow: 0 24px 80px rgba(24, 48, 39, 0.16);
}

.login-card h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: var(--forest-900);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.25rem;
    background: linear-gradient(180deg, rgba(28, 70, 41, 0.96), rgba(20, 50, 31, 0.96));
    color: #fff;
    box-shadow: 18px 0 55px rgba(22, 45, 27, 0.12);
}

.brand-block {
    padding: 1rem 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    margin-bottom: 1rem;
}

.brand-block strong {
    display: block;
    font-size: 1.25rem;
    line-height: 1.25;
}

.module-nav {
    display: grid;
    gap: 0.45rem;
}

.nav-section-title {
    margin: 0.75rem 0.35rem 0.15rem;
    color: rgba(255, 255, 255, 0.48);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.module-nav .nav-link {
    width: 100%;
    border: 0;
    border-radius: 16px;
    padding: 0.8rem 0.9rem;
    text-align: left;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 650;
}

.module-nav .nav-link:hover,
.module-nav .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.sidebar-logout-btn {
    width: 100%;
    margin-top: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 16px;
    padding: 0.8rem 0.9rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-weight: 800;
    text-align: left;
}

.sidebar-logout-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.content-shell {
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.module-content {
    padding: 0 2rem 2rem;
    flex: 1 0 auto;
}

.app-footer {
    margin: 0 2rem 1.4rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.62);
    color: rgba(24, 48, 39, 0.68);
    font-size: 0.9rem;
    text-align: center;
}

.app-footer a {
    color: var(--forest-800);
    font-weight: 800;
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

.pwa-install-button {
    width: 100%;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid rgba(47, 97, 56, 0.3);
    border-radius: 14px;
    color: var(--forest-800);
    background: #fff;
    font-weight: 800;
}

.pwa-install-button:hover {
    color: #fff;
    background: var(--forest-800);
}

.remember-password {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 24px;
    color: rgba(24, 48, 39, 0.76);
}

.remember-password .form-check-input {
    margin: 0;
}

.remember-password .form-check-label {
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
}

.pwa-install-button[hidden],
.pwa-update-toast[hidden] {
    display: none !important;
}

.pwa-update-toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1100;
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto;
    gap: 14px;
    align-items: center;
    width: min(680px, calc(100vw - 44px));
    padding: 16px;
    border: 1px solid rgba(53, 105, 60, 0.2);
    border-radius: 22px;
    background: rgba(253, 255, 250, 0.96);
    box-shadow: 0 24px 70px rgba(20, 50, 31, 0.28);
    backdrop-filter: blur(16px);
    animation: pwaNoticeIn 220ms ease-out;
}

.pwa-update-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(145deg, var(--forest-800), var(--forest-700));
    font-size: 1.55rem;
    font-weight: 900;
}

.pwa-update-copy {
    display: grid;
    gap: 3px;
}

.pwa-update-copy strong {
    color: var(--forest-900);
    font-size: 1rem;
}

.pwa-update-copy span {
    color: rgba(24, 48, 39, 0.68);
    font-size: 0.86rem;
}

.pwa-update-actions {
    display: flex;
    gap: 8px;
}

.pwa-update-actions button {
    min-height: 40px;
    padding: 8px 13px;
    border-radius: 12px;
    font-weight: 800;
}

.pwa-update-later {
    border: 1px solid rgba(36, 71, 45, 0.18);
    color: var(--forest-800);
    background: #fff;
}

.pwa-update-now {
    border: 0;
    color: #fff;
    background: var(--forest-800);
}

.pwa-update-now:disabled {
    cursor: wait;
    opacity: 0.68;
}

@keyframes pwaNoticeIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.module-subnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 18px 50px rgba(24, 48, 39, 0.08);
}

.module-subnav-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.subnav-link {
    border: 1px solid rgba(47, 97, 56, 0.18);
    border-radius: 999px;
    padding: 0.55rem 0.85rem;
    background: #fff;
    color: var(--forest-900);
    font-weight: 750;
}

.subnav-link:hover,
.subnav-link.active {
    border-color: transparent;
    background: var(--forest-800);
    color: #fff;
}

.module-page {
    display: none;
}

.module-page.active {
    display: block;
    animation: pageIn 180ms ease-out;
}

.portal-hero {
    border-radius: 30px;
    padding: clamp(1.4rem, 3vw, 2.4rem);
    background:
        radial-gradient(circle at 92% 12%, rgba(255, 255, 255, 0.55), transparent 24%),
        linear-gradient(135deg, rgba(39, 91, 54, 0.96), rgba(89, 127, 70, 0.9));
    color: #fff;
    box-shadow: 0 24px 70px rgba(32, 68, 45, 0.18);
}

.portal-hero.construction,
.portal-hero.boundary {
    background:
        radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.58), transparent 24%),
        linear-gradient(135deg, #274861, #6b7d56);
}

.portal-hero.land {
    background:
        radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.58), transparent 24%),
        linear-gradient(135deg, #4d5530, #b08b45);
}

.portal-hero.insight {
    background:
        radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.58), transparent 24%),
        linear-gradient(135deg, #214c55, #3f7558);
}

.portal-hero h2 {
    margin: 0 0 0.45rem;
    font-size: clamp(1.05rem, 1.55vw, 1.42rem);
    font-weight: 850;
    letter-spacing: 0.06em;
    line-height: 1.2;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.portal-card {
    min-height: 210px;
    padding: 1.35rem;
    border: 1px solid var(--line);
    border-radius: 26px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 250, 244, 0.82));
    box-shadow: 0 18px 50px rgba(24, 48, 39, 0.08);
}

.portal-card.construction,
.portal-card.boundary {
    background:
        linear-gradient(180deg, rgba(246, 250, 249, 0.94), rgba(237, 242, 230, 0.86));
}

.portal-card.land {
    background:
        linear-gradient(180deg, rgba(250, 248, 239, 0.95), rgba(243, 236, 217, 0.9));
}

.portal-card.insight {
    background:
        linear-gradient(180deg, rgba(242, 249, 248, 0.96), rgba(230, 241, 237, 0.9));
}

.portal-card.muted {
    opacity: 0.76;
}

.portal-card span {
    color: var(--forest-700);
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.portal-card h3 {
    margin: 0.45rem 0 0.65rem;
    color: var(--forest-900);
    font-size: 1.35rem;
    font-weight: 850;
}

.portal-card p {
    color: rgba(24, 48, 39, 0.72);
}

.permission-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
}

.permission-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.8rem;
}

.permission-module {
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.72);
}

.permission-module-title {
    font-weight: 850;
    color: var(--forest-900);
}

.permission-module-desc {
    min-height: 2.2rem;
    color: rgba(24, 48, 39, 0.62);
    font-size: 0.82rem;
}

.permission-checks {
    display: grid;
    gap: 0.42rem;
    margin-top: 0.75rem;
}

.permission-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.admin-tab {
    border: 1px solid rgba(67, 126, 71, 0.28);
    background: #fff;
    color: var(--forest-900);
    border-radius: 999px;
    padding: 0.65rem 1rem;
    font-weight: 700;
}

.admin-tab.active,
.admin-tab:hover {
    background: linear-gradient(135deg, var(--forest-700), var(--forest-900));
    color: #fff;
}

.admin-tab-panel {
    display: none;
}

.admin-tab-panel.active {
    display: block;
    animation: pageIn 180ms ease-out;
}

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

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    padding: 2rem 2rem 1rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--forest-700);
    font-size: 0.75rem;
    font-weight: 700;
}

.company-title {
    color: var(--forest-900);
    font-size: clamp(1.35rem, 2.25vw, 2.05rem);
    font-weight: 900;
    letter-spacing: 0.025em;
    line-height: 1.12;
    text-transform: uppercase;
}

.app-header .department-title {
    margin-top: 0.25rem;
    color: rgba(24, 48, 39, 0.72);
    font-size: clamp(0.68rem, 1.12vw, 1.02rem);
    font-weight: 800;
    letter-spacing: 0.055em;
    line-height: 1.25;
}

.app-header h1 {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 700;
}

.header-side {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    position: relative;
}

.user-pill {
    background: rgba(36, 71, 45, 0.9);
    color: #fff;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    font-weight: 600;
}

.account-menu {
    position: relative;
    z-index: 40;
}

.account-summary {
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    background: rgba(36, 71, 45, 0.96);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 14px 35px rgba(24, 48, 39, 0.16);
}

.account-summary::-webkit-details-marker {
    display: none;
}

.account-summary span {
    font-weight: 800;
    line-height: 1.15;
}

.account-summary small {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.74rem;
    font-weight: 650;
}

.account-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.6rem);
    width: min(310px, calc(100vw - 2rem));
    padding: 0.8rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 70px rgba(24, 48, 39, 0.18);
}

.account-info {
    display: grid;
    gap: 0.2rem;
    padding: 0.55rem 0.65rem 0.75rem;
    margin-bottom: 0.45rem;
    border-bottom: 1px solid var(--line);
}

.account-info strong {
    color: var(--forest-900);
    font-size: 1rem;
}

.account-info span {
    color: #5a6d61;
    font-size: 0.86rem;
}

.account-menu-btn {
    width: 100%;
    border: 0;
    border-radius: 14px;
    padding: 0.72rem 0.8rem;
    background: #eef8ef;
    color: var(--forest-800);
    font-weight: 800;
    text-align: left;
}

.account-menu-btn + .account-menu-btn {
    margin-top: 0.35rem;
}

.account-menu-btn:hover {
    background: #dcefdc;
}

.account-menu-btn.danger {
    background: #fff3f0;
    color: #b42318;
}

.account-menu-btn.danger:hover {
    background: #ffe4de;
}

.panel,
.metric-card {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(38, 56, 30, 0.08);
}

.glass-panel {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
}

.panel {
    padding: 1.25rem;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-card {
    padding: 1.25rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-card span {
    font-size: 0.9rem;
    color: #5a6d61;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.metric-card strong {
    font-size: 2rem;
    color: var(--forest-900);
}

.dashboard-group-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.dashboard-group-card {
    --group-color: #247044;
    position: relative;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--group-color) 24%, white);
    border-radius: 20px;
    padding: 1.05rem;
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--group-color) 18%, transparent), transparent 46%),
        linear-gradient(145deg, #ffffff, color-mix(in srgb, var(--group-color) 7%, #ffffff));
}

.dashboard-group-card.group-cskd { --group-color: #b77716; }
.dashboard-group-card.group-keolai { --group-color: #147b76; }
.dashboard-group-card.group-other { --group-color: #52675a; }

.dashboard-group-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dashboard-group-head span {
    display: block;
    color: var(--group-color);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.dashboard-group-head h3 {
    margin: 0.15rem 0 0;
    color: var(--forest-900);
    font-size: 1.08rem;
    font-weight: 900;
}

.dashboard-group-head > strong {
    border-radius: 999px;
    padding: 0.32rem 0.58rem;
    background: color-mix(in srgb, var(--group-color) 12%, white);
    color: var(--group-color);
    font-size: 0.9rem;
}

.dashboard-group-values {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid rgba(34, 67, 43, 0.1);
}

.dashboard-group-value {
    min-width: 0;
    padding: 0.8rem 0.55rem 0.65rem;
}

.dashboard-group-value + .dashboard-group-value {
    border-left: 1px solid rgba(34, 67, 43, 0.1);
}

.dashboard-group-value > span {
    display: block;
    margin-bottom: 0.25rem;
    color: #6b796f;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dashboard-group-value strong {
    display: block;
    color: var(--forest-900);
    font-size: 1.08rem;
    white-space: nowrap;
}

.dashboard-group-value strong small {
    font-size: 0.68rem;
    font-weight: 700;
}

.dashboard-group-value em {
    display: block;
    margin-top: 0.18rem;
    color: #52645a;
    font-size: 0.74rem;
    font-style: normal;
    overflow-wrap: anywhere;
}

.dashboard-group-progress {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(36, 75, 47, 0.1);
}

.dashboard-group-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--group-color);
}

@media (max-width: 1250px) {
    .dashboard-group-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .dashboard-group-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .dashboard-group-values {
        grid-template-columns: 1fr;
    }

    .dashboard-group-value + .dashboard-group-value {
        border-top: 1px solid rgba(34, 67, 43, 0.1);
        border-left: 0;
    }
}

.alert-metric.watch {
    border-color: rgba(191, 145, 29, 0.26);
}

.alert-metric.warning {
    border-color: rgba(218, 132, 33, 0.32);
    background: rgba(255, 250, 230, 0.9);
}

.alert-metric.reached {
    border-color: rgba(190, 98, 27, 0.34);
    background: rgba(255, 241, 226, 0.92);
}

.alert-metric.danger {
    border-color: rgba(172, 39, 39, 0.32);
    background: rgba(255, 239, 239, 0.92);
}

.dashboard-warning-list {
    display: grid;
    gap: 0.75rem;
    max-height: 380px;
    overflow: auto;
    padding-right: 0.25rem;
}

.dashboard-warning-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    border: 1px solid var(--line);
    border-left: 7px solid var(--forest-700);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    padding: 0.9rem 1rem;
}

.dashboard-warning-card.severity-watch {
    border-left-color: #c8a03a;
}

.dashboard-warning-card.severity-warning {
    border-left-color: #d97d1d;
}

.dashboard-warning-card.severity-reached {
    border-left-color: #bd5c22;
}

.dashboard-warning-card.severity-danger {
    border-left-color: #b12b2b;
}

.warning-title {
    font-weight: 800;
    color: var(--ink-900);
}

.warning-subtitle {
    color: #607064;
    font-size: 0.9rem;
}

.warning-numbers {
    display: grid;
    justify-items: end;
    gap: 0.1rem;
    white-space: nowrap;
}

.warning-numbers strong {
    color: var(--forest-900);
    font-size: 1.2rem;
}

.warning-numbers em {
    color: #7d3c18;
    font-style: normal;
    font-weight: 700;
}

.progress-summary {
    display: grid;
    grid-template-columns: repeat(8, minmax(110px, 1fr));
    gap: 0.75rem;
}

.progress-summary-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
    padding: 0.75rem 0.85rem;
}

.progress-summary-card span {
    display: block;
    color: #607064;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.progress-summary-card strong {
    display: block;
    margin-top: 0.2rem;
    color: var(--forest-900);
    font-size: 1.2rem;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    gap: 0.75rem;
}

.report-summary-card {
    min-height: 116px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(239, 248, 239, 0.72));
    padding: 0.85rem;
}

.report-summary-card span,
.report-summary-card small {
    display: block;
    color: #607064;
    font-size: 0.76rem;
    font-weight: 700;
}

.report-summary-card span {
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.report-summary-card strong {
    display: block;
    margin: 0.25rem 0;
    color: var(--forest-900);
    font-size: 1.28rem;
}

.progress-summary-card.late {
    background: #eaf8ef;
}

.progress-summary-card.warning,
.progress-summary-card.reached {
    background: #fff1e5;
}

.progress-summary-card.danger {
    background: #fff0f0;
}

.severity-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 112px;
    border-radius: 999px;
    padding: 0.25rem 0.55rem;
    font-weight: 800;
    font-size: 0.78rem;
    background: #eef8ef;
    color: #1f6f37;
}

.severity-badge.late {
    background: #eaf8ef;
    color: #1f6f37;
}

.severity-badge.watch {
    background: #fff8db;
    color: #7a5600;
}

.severity-badge.warning,
.severity-badge.reached {
    background: #fff1e5;
    color: #934713;
}

.severity-badge.danger {
    background: #fff0f0;
    color: #9f1d1d;
}

.btn-forest {
    background: linear-gradient(135deg, var(--forest-700), var(--forest-900));
    color: #fff;
    border: none;
}

.btn-forest:hover {
    color: #fff;
    opacity: 0.95;
}

.chart-panel {
    min-height: 320px;
}

.tabulator {
    border-radius: 16px;
    border: 1px solid var(--line);
    overflow: hidden;
}

.tabulator .tabulator-header {
    background: var(--forest-900);
    color: #fff;
}

.warning-box {
    background: rgba(255, 248, 225, 0.95);
    border: 1px solid rgba(180, 140, 30, 0.2);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    max-height: 220px;
    overflow: auto;
    color: #6e5510;
}

.warning-box ul {
    margin: 0;
    padding-left: 1rem;
}

.ledger-wrap {
    overflow: auto;
    border: 1px solid #9ca89c;
    border-radius: 12px;
    background: #fff;
}

.ledger-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
    font-family: "Roboto", sans-serif;
    font-size: 0.95rem;
}

.ledger-table th,
.ledger-table td {
    border: 1px solid #111;
    padding: 0.2rem 0.35rem;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

.ledger-table th {
    background: #f7f7f7;
    text-align: center;
    font-weight: 700;
}

.ledger-table td:nth-child(1),
.ledger-table td:nth-child(2),
.ledger-table td:nth-child(4),
.ledger-table td:nth-child(5) {
    text-align: center;
}

.ledger-table td:nth-child(3) {
    white-space: normal;
    min-width: 310px;
}

.ledger-table .section-title td {
    background: #d4ffd5;
    color: #004b10;
    text-align: center;
    font-weight: 800;
    font-size: 1rem;
}

.ledger-table .block-total td,
.ledger-table .section-total td,
.ledger-table .grand-total td {
    background: #caffcc;
    font-weight: 800;
}

.ledger-table .section-total td {
    background: #b6f7ba;
}

.ledger-table .grand-total td {
    background: #8fe798;
    color: #063b11;
}

.ledger-input,
.ledger-note {
    width: 100%;
    border: 0;
    background: rgba(255, 255, 255, 0.72);
    padding: 0.1rem 0.25rem;
    font: inherit;
}

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

.ledger-note {
    min-width: 180px;
}

.actual-ledger-table th:nth-child(13),
.actual-ledger-table td:nth-child(13) {
    min-width: 190px;
}

.actual-amount-input {
    background: #fffbe8;
    font-weight: 700;
    color: #15351d;
}

.monthly-plan-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.3rem;
    color: #53665a;
    font-size: 0.86rem;
    font-weight: 700;
}

.monthly-plan-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.legend-dot {
    width: 0.78rem;
    height: 0.78rem;
    border: 1px solid #9aa99e;
    border-radius: 50%;
    background: #fff;
}

.legend-dot.selected {
    border-color: #d29b26;
    background: #ffd766;
    box-shadow: 0 0 0 4px rgba(255, 215, 102, 0.22);
}

.legend-dot.remaining {
    border-color: #318350;
    background: #bde5c7;
}

.legend-dot.over-limit {
    border-color: #c43e31;
    background: #ffd8d3;
}

.monthly-plan-table {
    min-width: 1335px;
    table-layout: fixed;
}

.monthly-plan-table .col-select { width: 44px; }
.monthly-plan-table .col-order { width: 44px; }
.monthly-plan-table .col-code { width: 85px; }
.monthly-plan-table .col-work { width: 245px; }
.monthly-plan-table .col-basis { width: 95px; }
.monthly-plan-table .col-annual-labor,
.monthly-plan-table .col-month-labor { width: 90px; }
.monthly-plan-table .col-remaining { width: 120px; }
.monthly-plan-table .col-unit { width: 65px; }
.monthly-plan-table .col-price { width: 100px; }
.monthly-plan-table .col-month-amount { width: 165px; }
.monthly-plan-table .col-note { width: 190px; }

.monthly-plan-table td:nth-child(3) {
    white-space: nowrap;
    text-align: center;
}

.monthly-plan-table td:nth-child(4) {
    white-space: normal;
    text-align: left;
}

.monthly-plan-table th:nth-child(6),
.monthly-plan-table th:nth-child(10),
.monthly-plan-table td:nth-child(6),
.monthly-plan-table td:nth-child(10) {
    white-space: normal;
}

.monthly-plan-team-row td {
    padding: 0.55rem 0.7rem;
    background: linear-gradient(90deg, #1f5a35, #3d7b4c);
    color: #fff;
    text-align: left !important;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.monthly-plan-block-row td {
    background: #e9f7e6 !important;
}

.monthly-plan-item-row td {
    transition: background-color 160ms ease;
}

.monthly-plan-selected-row td,
.actual-monthly-planned-row td {
    background: #fff8d9;
}

.monthly-plan-selected-row td:first-child,
.actual-monthly-planned-row td:first-child {
    box-shadow: inset 5px 0 0 #e2a719;
}

.monthly-plan-select {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: #23633b;
    cursor: pointer;
}

.monthly-plan-amount:not(:disabled),
.monthly-plan-item-row .ledger-note:not(:disabled) {
    border: 1px solid #d4bc69;
    border-radius: 6px;
    background: #fffef7;
    min-height: 34px;
}

.monthly-plan-amount:disabled,
.monthly-plan-item-row .ledger-note:disabled {
    color: #657168;
    background: transparent;
}

.monthly-plan-remaining {
    color: #176335;
    font-weight: 800;
}

.monthly-plan-over-limit td {
    background: #fff0ee !important;
}

.monthly-plan-over-limit td:first-child {
    box-shadow: inset 5px 0 0 #c43e31;
}

.monthly-plan-amount.is-over-limit,
.actual-amount-input.is-over-limit {
    border: 2px solid #c43e31 !important;
    background: #fff !important;
    color: #9d261f;
    font-weight: 800;
}

.monthly-plan-badge,
.actual-plan-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 0.55rem;
    border-radius: 999px;
    padding: 0.15rem 0.48rem;
    background: #f1bc36;
    color: #493500;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.actual-plan-badge {
    background: #ffd966;
    box-shadow: 0 2px 8px rgba(139, 98, 0, 0.14);
}

.actual-monthly-planned-row .actual-amount-input {
    border: 2px solid #d99d10;
    border-radius: 6px;
    background: #fff;
}

.admin-plan-ledger-wrap {
    max-height: 560px;
}

.admin-edit-table {
    min-width: 1280px;
}

.admin-edit-table input {
    background: #fffdf2;
}

.admin-edit-table .admin-plan-name {
    min-width: 320px;
}

.admin-calculated-labor {
    background: #eef7ed;
    color: #175d34;
    font-weight: 800;
}

.admin-edit-table .admin-block-name {
    min-width: 320px;
    font-weight: 800;
}

.admin-edit-table .admin-block-basis,
.admin-edit-table .admin-block-order {
    font-weight: 800;
}

.admin-edit-table .row-saved td {
    background: #e9f8e8;
    transition: background 180ms ease-out;
}

.empty-state {
    padding: 1.25rem;
    color: #5f6c62;
}

.empty-state.compact {
    padding: 0.8rem 0;
}

.tabulator .progress-danger {
    background: #fff1f1;
    color: #9f1d1d;
    font-weight: 700;
}

.tabulator .progress-warning {
    background: #fff8db;
    color: #7a5600;
    font-weight: 700;
}

.tabulator .progress-ok {
    background: #eef8ef;
    color: #1f6f37;
    font-weight: 700;
}

@media (max-width: 991px) {
    .app-shell {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .module-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .module-content {
        padding: 0 1rem 1.5rem;
    }

    .content-shell {
        flex: 1 0 auto;
        min-height: 0;
    }

    .app-footer {
        margin: 0 1rem 1.2rem;
    }

    .app-header {
        padding: 1.5rem 1rem 1rem;
        flex-direction: column;
    }

    .header-side,
    .account-menu,
    .account-summary {
        width: 100%;
    }

    .account-dropdown {
        left: 0;
        right: auto;
        width: 100%;
    }

    .dashboard-warning-card {
        grid-template-columns: 1fr;
    }

    .warning-numbers {
        justify-items: start;
    }

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

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

@media (max-width: 767px) {
    body {
        background:
            radial-gradient(circle at 10% 0%, rgba(77, 130, 73, 0.18), transparent 34%),
            linear-gradient(180deg, #f4f8f2 0%, #fbf7ed 100%);
    }

    .login-screen {
        align-items: start;
        padding: 1rem;
    }

    .login-card {
        margin-top: 6vh;
        padding: 1.35rem;
        border-radius: 22px;
    }

    .sidebar {
        padding: 0.85rem;
        border-radius: 0 0 24px 24px;
    }

    .brand-block {
        padding: 0.55rem 0.35rem 0.8rem;
        margin-bottom: 0.75rem;
    }

    .brand-block strong {
        font-size: 1.05rem;
    }

    .module-nav {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.15rem;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .nav-section-title {
        display: none;
    }

    .module-nav .nav-link {
        flex: 0 0 auto;
        width: auto;
        min-width: 132px;
        padding: 0.72rem 0.8rem;
        text-align: center;
        scroll-snap-align: start;
    }

    .app-header {
        gap: 0.85rem;
        padding: 1.1rem 1rem 0.85rem;
    }

    .app-header h1 {
        font-size: 1.75rem;
        line-height: 1.12;
    }

    .company-title {
        font-size: 1.2rem;
        letter-spacing: 0.02em;
        line-height: 1.12;
    }

    .app-header .department-title {
        font-size: 0.6rem;
        margin-top: 0.35rem;
    }

    .eyebrow {
        font-size: 0.68rem;
        letter-spacing: 0.12em;
    }

    .module-content {
        padding: 0 0.8rem 1.2rem;
    }

    .app-footer {
        margin: 0 0.8rem 1rem;
        padding: 0.8rem;
        font-size: 0.82rem;
    }

    .module-subnav {
        display: block;
        padding: 0.75rem;
        border-radius: 20px;
        overflow: hidden;
    }

    .module-subnav-actions {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.1rem;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .subnav-link {
        flex: 0 0 auto;
        padding: 0.52rem 0.78rem;
        scroll-snap-align: start;
    }

    .portal-hero {
        border-radius: 22px;
        padding: 1.2rem;
    }

    .portal-hero h2 {
        font-size: 1.05rem;
        line-height: 1.12;
    }

    .portal-grid,
    .permission-matrix {
        grid-template-columns: 1fr;
    }

    .portal-card {
        min-height: 0;
        padding: 1rem;
        border-radius: 22px;
    }

    .portal-card .btn,
    .panel-head .btn,
    form .btn {
        width: 100%;
    }

    .panel {
        padding: 0.95rem;
        border-radius: 20px;
    }

    .panel-head,
    .permission-head {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .panel-title {
        font-size: 1rem;
    }

    .metric-card {
        min-height: 96px;
        padding: 1rem;
    }

    .metric-card strong {
        font-size: 1.65rem;
    }

    .progress-summary,
    .report-summary {
        grid-template-columns: 1fr;
    }

    .dashboard-warning-list {
        max-height: none;
    }

    .dashboard-warning-card {
        padding: 0.8rem;
        border-radius: 16px;
    }

    .warning-numbers {
        white-space: normal;
    }

    .chart-panel {
        min-height: 260px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.2rem;
        -webkit-overflow-scrolling: touch;
    }

    .admin-tab {
        flex: 0 0 auto;
        padding: 0.58rem 0.85rem;
    }

    .ledger-wrap,
    .warning-box,
    .tabulator .tabulator-tableholder {
        -webkit-overflow-scrolling: touch;
    }

    .ledger-wrap {
        border-radius: 10px;
        max-width: 100%;
    }

    .ledger-table {
        font-size: 0.86rem;
    }

    .ledger-table th,
    .ledger-table td {
        padding: 0.18rem 0.28rem;
    }

    .ledger-input {
        min-width: 96px;
        min-height: 34px;
        font-size: 16px;
    }

    .ledger-note {
        min-width: 150px;
        min-height: 34px;
        font-size: 16px;
    }

    .monthly-plan-actions {
        display: grid !important;
        grid-template-columns: 1fr;
    }

    .monthly-plan-legend {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .tabulator {
        max-width: 100%;
        font-size: 0.86rem;
    }

    .form-control,
    .form-select {
        min-height: 42px;
        font-size: 16px;
    }

    .btn {
        min-height: 42px;
    }
}

@media (max-width: 575px) {
    .pwa-update-toast {
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        grid-template-columns: auto 1fr;
        width: calc(100vw - 24px);
        padding: 14px;
        border-radius: 20px;
    }

    .pwa-update-actions {
        grid-column: 1 / -1;
    }

    .pwa-update-actions button {
        flex: 1;
    }

    .login-card h1 {
        font-size: 2rem;
    }

    .module-nav .nav-link {
        min-width: 118px;
        font-size: 0.86rem;
    }

    .account-summary {
        min-width: 0;
        border-radius: 18px;
    }

    .account-dropdown {
        border-radius: 18px;
    }

    .app-header h1 {
        font-size: 1.48rem;
    }

    .company-title {
        font-size: 1.02rem;
    }

    .app-header .department-title {
        font-size: 0.51rem;
    }

    .portal-hero h2 {
        font-size: 0.92rem;
    }

    .portal-card h3 {
        font-size: 1.16rem;
    }

    .permission-module-desc {
        min-height: 0;
    }

    .actual-ledger-table th:nth-child(13),
    .actual-ledger-table td:nth-child(13) {
        min-width: 150px;
    }
}
