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

:root {
    color-scheme: light;
    --bg: #f8fafc;
    --accent: #f97316;
    --accent-dark: #ea580c;
    --text: #0f172a;
    --muted: #64748b;
    --card: #ffffff;
}

body {
    margin: 0;
    font-family: "Poppins", "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #fff7ed, #f8fafc 55%);
    color: var(--text);
    min-height: 100vh;
}

.app-shell {
    min-height: 100vh;
    background: #f7f4ef;
    position: relative;
}

.app-content {
    padding: 6.5rem 1.25rem 2rem;
    margin: 0 auto;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.25rem;
    background: rgba(248, 250, 252, 0.95);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
    z-index: 200;
}

.app-topbar__title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.app-topbar__meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.nav-toggle__btn {
    width: 40px;
    height: 40px;
    border-radius: 0.85rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
}

.side-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: #fff;
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    padding: 1.25rem 1rem;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.side-nav__brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.side-nav__logo {
    width: 44px;
    height: 44px;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, #b67423, #8e5313);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.side-nav__title {
    font-weight: 700;
}

.side-nav__subtitle {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.side-nav__links {
    display: grid;
    gap: 0.4rem;
}

.side-nav__item {
    text-decoration: none;
    color: #312721;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.9rem;
    font-weight: 600;
}

.side-nav__item.active {
    background: rgba(182, 116, 35, 0.12);
    color: #8e5313;
}

.side-nav__icon {
    width: 28px;
    height: 28px;
    border-radius: 0.7rem;
    background: #f2e9dc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 250;
}

.nav-toggle:checked ~ .side-nav {
    transform: translateX(0);
}

.nav-toggle:checked ~ .nav-overlay {
    opacity: 1;
    pointer-events: auto;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

p {
    color: var(--muted);
    margin-top: 0;
}

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

.text-danger {
    color: #b91c1c;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.35rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
    accent-color: #8c4b16;
}

.form-check-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.card {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 1.25rem;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
}

.stack-card {
    margin-bottom: 1rem;
}

.card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn {
    border-radius: 999px;
    padding: 0.6rem 1.25rem;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, #b67423, #8e5313);
    color: #fff;
}

.btn-ghost {
    background: #f2e9dc;
    color: #6f3f0f;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.status-pill {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.status-pill--ok {
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
    border-color: rgba(22, 101, 52, 0.2);
}

.status-pill--warn {
    background: rgba(234, 179, 8, 0.12);
    color: #92400e;
    border-color: rgba(146, 64, 14, 0.2);
}

.status-pill--danger {
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b;
    border-color: rgba(153, 27, 27, 0.2);
}

.status-pill--muted {
    background: rgba(148, 163, 184, 0.2);
    color: #475569;
    border-color: rgba(100, 116, 139, 0.2);
}

.card-list {
    display: grid;
    gap: 0.9rem;
}

.project-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.project-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.project-card__meta {
    margin-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-box {
    margin-bottom: 1rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    font-family: inherit;
}

.form-control--table {
    padding: 0.35rem 0.5rem;
    border-radius: 0.6rem;
    font-size: 0.85rem;
    min-width: 110px;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.form-span-2 {
    grid-column: span 2;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #f2e9dc;
    border-radius: 999px;
    padding: 0.25rem;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.segmented__button {
    border: none;
    background: transparent;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    color: #6f3f0f;
    cursor: pointer;
}

.segmented__button.active {
    background: #fff;
    color: #312721;
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.08);
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.table-wrapper--no-scroll {
    overflow-x: auto;
    scrollbar-width: none;
}

.table-wrapper--no-scroll::-webkit-scrollbar {
    height: 0;
}

.table-scroll-top {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    height: 14px;
    margin-bottom: 0.35rem;
}

.table-scroll-top .table-scroll-inner {
    height: 1px;
}


.observation-log__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.observation-log__formula {
    margin: 0;
    font-size: 0.8rem;
}

.observation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.observation-table th,
.observation-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    text-align: left;
    white-space: nowrap;
}

.observation-table thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    background: #f8f4ee;
}

.observation-table tbody tr:nth-child(even) {
    background: #fbf7f0;
}

.observation-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.observation-table--summary td.num {
    text-align: left;
}

.observation-table__empty {
    text-align: center;
    color: var(--muted);
    padding: 1.5rem 0.75rem;
}

.observation-cards {
    display: none;
    gap: 0.85rem;
}

.observation-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 0.9rem;
    padding: 0.85rem;
    background: #fff;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
}

.observation-card__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.observation-card__title {
    font-weight: 600;
}

.observation-card__meta {
    font-size: 0.8rem;
    color: var(--muted);
}

.observation-card__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 0.85rem;
}

.observation-card__label {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.observation-card__value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.observation-card__actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
}

.observation-scale {
    margin: 0.75rem 0;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.summary-actions__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.summary-chart {
    max-height: 400px;
}

@media (max-width: 860px) {
    .table-scroll-top,
    .table-wrapper {
        display: none;
    }

    .observation-cards {
        display: grid;
    }

    .observation-scale--compact {
        gap: 0.5rem;
    }

    .observation-scale--compact .scale-control {
        min-width: unset;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .observation-scale--compact .form-label {
        margin: 0;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .observation-scale--compact .form-control {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
    }

    .summary-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .summary-row__segmented {
        width: 100%;
        margin-bottom: 0;
    }

    .summary-actions__buttons {
        width: 100%;
    }
}

.observation-scale .scale-control {
    min-width: 160px;
}

.observation-card summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
}

.observation-card__body {
    margin-top: 0.75rem;
    display: grid;
    gap: 0.5rem;
}

.material-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.material-flow__arrow {
    color: var(--muted);
    font-weight: 600;
}

.observation-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.summary-grid,
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.audit-list,
.more-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    display: grid;
    gap: 0.5rem;
}

.more-sheet {
    background: #fff;
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.more-item {
    display: block;
    width: 100%;
    border: none;
    background: #f7f2ea;
    border-radius: 0.85rem;
    padding: 0.9rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #312721;
    cursor: pointer;
    text-decoration: none;
}

.more-item.danger {
    background: #fee2e2;
    color: #991b1b;
}

.balance-amount {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.dashboard-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    display: grid;
    gap: 0.85rem;
}

.chart-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.chart {
    height: 160px;
    border-radius: 0.9rem;
    background: linear-gradient(180deg, rgba(182, 116, 35, 0.12), rgba(248, 250, 252, 0.8));
    padding: 1rem;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    overflow: hidden;
}

.chart--bars span {
    display: block;
    width: 100%;
    max-width: 18px;
    flex: 1 1 auto;
    background: linear-gradient(180deg, #b67423, #8e5313);
    border-radius: 0.5rem 0.5rem 0.3rem 0.3rem;
    height: calc(var(--value) * 1%);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.15);
}

.chart--line {
    position: relative;
    padding: 1.25rem;
}

.chart--line svg {
    width: 100%;
    height: 100%;
}

.report-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.report-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.report-label {
    font-weight: 600;
}

.report-value {
    font-weight: 700;
    color: #8e5313;
}

.toast {
    display: block;
    position: fixed;
    top: 5.5rem;
    right: 1.5rem;
    z-index: 2000;
    padding: 0.75rem 1rem;
    border-radius: 0.9rem;
    font-weight: 600;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    animation: toast-slide-in 0.2s ease-out;
    background: #ecfdf3;
    color: #166534;
    border: 1px solid rgba(22, 101, 52, 0.2);
}

.toast.show {
    display: block !important;
}

.toast--success {
    background: #ecfdf3;
    color: #166534;
    border-color: rgba(22, 101, 52, 0.2);
}

.toast--error {
    background: #fef2f2;
    color: #991b1b;
    border-color: rgba(153, 27, 27, 0.2);
}

@keyframes toast-slide-in {
    from {
        transform: translateY(-8px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (min-width: 900px) {
    .app-content {
        margin-left: 260px;
        padding: 6rem 2rem 2.5rem;
    }

    .app-topbar {
        left: 260px;
        padding: 0 2rem;
    }

    .nav-toggle__btn {
        display: none;
    }

    .side-nav {
        transform: translateX(0);
    }

    .nav-overlay {
        display: none;
    }

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