/* Layout shell only. Everything else should come from Bootstrap utility classes. */

:root {
    --app-sidebar-width: 240px;
    --app-navbar-bg: #1f2937;
}

.app-navbar {
    background-color: var(--app-navbar-bg);
}

.app-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 56px);
}

.app-sidebar {
    width: var(--app-sidebar-width);
    flex: 0 0 var(--app-sidebar-width);
    background-color: #fff;
    border-right: 1px solid var(--bs-border-color);
}

.app-sidebar .nav-link {
    color: var(--bs-body-color);
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.app-sidebar .nav-link:hover:not(.disabled) {
    background-color: var(--bs-tertiary-bg);
}

.app-sidebar .nav-link.active {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--bs-primary);
}

.app-sidebar .nav-link.disabled {
    color: var(--bs-secondary-color);
    cursor: not-allowed;
}

.app-sidebar .nav-toggle {
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    border-radius: 0;
}

.app-sidebar .nav-toggle.open {
    font-weight: 600;
    background-color: var(--bs-tertiary-bg);
}

.app-sidebar .nav-toggle-chevron {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.15s ease;
}

.app-sidebar .nav-toggle[aria-expanded="true"] .nav-toggle-chevron {
    transform: rotate(-180deg);
}

.app-sidebar .nav-submenu .nav-link {
    padding-left: 2.85rem;
    font-size: 0.9375rem;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.app-footer {
    margin-top: auto;
    padding-top: 2rem;
}

/* Login is the one page that renders outside the application shell. */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 26rem;
}

.login-brand {
    font-size: 2.25rem;
    line-height: 1;
    color: var(--bs-primary);
}

/* Money and quantity columns read better right-aligned and in a tabular figure font. */
.text-amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Whole rows that behave as a link to their record. */
.row-link {
    cursor: pointer;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: var(--app-sidebar-width);
        flex: none;
    }
}

/* Monthly attendance dashboard: compact grid with sticky employee column. */
.att-dashboard-scroll {
    overflow-x: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
}

.att-dashboard-table {
    font-size: 0.75rem;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.att-dashboard-table th,
.att-dashboard-table td {
    white-space: nowrap;
    vertical-align: middle;
}

.att-sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: #fff;
    min-width: 9rem;
    max-width: 12rem;
    box-shadow: 1px 0 0 var(--bs-border-color);
}

.att-dashboard-table thead .att-sticky-col {
    z-index: 3;
    background-color: var(--bs-tertiary-bg);
}

.att-name-col {
    text-align: left;
    padding-left: 0.75rem !important;
}

.att-day-col {
    min-width: 2.1rem;
    padding: 0.2rem 0.15rem !important;
    line-height: 1.1;
}

.att-day-num {
    font-weight: 600;
}

.att-day-dow {
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.85;
}

.att-sum-col {
    min-width: 2.25rem;
    background-color: var(--bs-tertiary-bg);
}

.att-weekend {
    background-color: #ffe8cc !important;
}

.att-weekend-cell {
    background-color: #fff8ef;
}

.att-type-header {
    background-color: #6b3a2a;
    color: #fff;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
    border-radius: 0.375rem 0.375rem 0 0;
    margin-top: 0.75rem;
}

.att-cell {
    padding: 0.2rem 0.1rem !important;
    font-weight: 600;
}

.att-present {
    background-color: #8fd14f !important;
    color: #1a3d0a;
}

.att-half_day {
    background-color: #ffd60a !important;
    color: #212529;
}

.att-leave {
    background-color: #dc3545 !important;
    color: #fff;
}

.att-week_off {
    background-color: #cfe2ff !important;
    color: #084298;
}

.att-missing {
    color: #adb5bd;
    font-weight: 500;
}

.att-legend {
    display: inline-block;
    min-width: 1.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    border: 1px solid var(--bs-border-color);
}

.att-month-cal {
    max-width: 22rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: #fff;
}

.att-month-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.att-month-cal-weekdays,
.att-month-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
}

.att-month-cal-weekdays {
    margin-bottom: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7280;
    text-align: center;
}

.att-month-cal-day {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.1rem;
    border-radius: 0.4rem;
    text-decoration: none;
    color: #1f2937;
    background: #eef1f4;
    font-weight: 600;
    font-size: 0.85rem;
}

a.att-month-cal-day:hover {
    background: #dbe4f0;
    color: #1f2937;
}

.att-month-cal-day.is-weekend:not(.is-selected) {
    background: #fff4e5;
}

.att-month-cal-day.is-today:not(.is-selected) {
    box-shadow: inset 0 0 0 2px #3d8b5a;
}

.att-month-cal-day.is-selected {
    background: #1f2937;
    color: #fff;
}

.att-month-cal-day.is-disabled {
    background: #f3f4f6;
    color: #9ca3af;
    font-weight: 500;
}

.att-month-cal-day.is-outside {
    background: transparent;
}

.att-year-month-cal {
    max-width: 18rem;
}

.att-year-month-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
}

/* Variety store ticks: even columns, checkbox and label on one baseline. */
.store-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.75rem, 1fr));
    gap: 0.35rem 0.75rem;
    align-items: center;
}

.store-check-all,
.store-check-grid .form-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    min-height: 0;
    padding-left: 0;
}

.store-check-all .form-check-input,
.store-check-grid .form-check-input {
    float: none;
    margin: 0;
    flex: 0 0 auto;
}

.store-check-all .form-check-label,
.store-check-grid .form-check-label {
    margin: 0;
    white-space: nowrap;
}

/* Purchase order grids: numeric cells sized for ~5 digits, headers aligned to columns. */
.inv-purchase-grid {
    width: max-content;
    table-layout: fixed;
}

.inv-purchase-grid .inv-col-date {
    width: 5.75rem;
    white-space: normal;
}

.inv-purchase-grid .js-copy-prev-day {
    display: block;
    font-size: 0.7rem;
    line-height: 1.2;
    text-decoration: none;
}

.inv-purchase-grid .inv-col-num {
    width: 6.5rem;
}

.inv-purchase-grid .inv-col-total {
    width: var(--inv-total-col-width, 4.75rem);
    min-width: var(--inv-total-col-width, 4.75rem);
    text-align: end;
}

.inv-entry thead,
.inv-purchase-grid thead {
    --bs-table-bg: #1f2937;
    --bs-table-color: #f8fafc;
    --bs-table-border-color: #374151;
}

.inv-entry thead th {
    background-color: #1f2937;
    color: #f8fafc;
    border-color: #374151;
}

.inv-purchase-grid thead th {
    font-size: 0.75rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
    vertical-align: middle;
    text-align: center;
    background-color: #1f2937;
    color: #f8fafc;
    border-color: #374151;
}

.inv-purchase-grid thead th.inv-col-date {
    text-align: start;
}

.inv-purchase-grid thead th.inv-col-total {
    text-align: end;
    vertical-align: middle;
}

.inv-purchase-grid thead th[colspan] {
    max-width: none;
}

.pnl-sheet tbody td.inv-col-date,
.pnl-sheet tfoot td.inv-col-date {
    background-color: #dbe4f0;
    color: #1e2937;
    font-weight: 600;
}

.pnl-sheet tbody tr.inv-today > td {
    background-color: #fff3c4;
    color: var(--bs-body-color);
}

.pnl-sheet tbody tr.inv-today > td.inv-col-date {
    background-color: #ffe59a;
    box-shadow: inset 3px 0 0 #c49214;
}

.pnl-sheet tfoot td {
    background-color: #eef1f4;
}

.inv-purchase-grid th.inv-store-start,
.inv-purchase-grid td.inv-store-start,
.inv-entry th.inv-store-start,
.inv-entry td.inv-store-start {
    border-left: 2px solid #111827;
}

.inv-purchase-grid .inv-num {
    width: 6.5rem;
    min-width: 6.5rem;
    max-width: 6.5rem;
    padding-left: 0.3rem;
    padding-right: 0.3rem;
    text-align: end;
}

.inv-purchase-grid .js-row-total {
    width: var(--inv-total-col-width, 4.75rem);
    min-width: var(--inv-total-col-width, 4.75rem);
    max-width: none;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    text-align: end;
    vertical-align: middle;
}

/* Editable vs computed cells, plus today's row. */
.inv-entry tbody td {
    background-color: #eef1f4;
    color: #4b5563;
}

.inv-entry tbody td.inv-col-date {
    background-color: #dbe4f0;
    color: #1e2937;
    font-weight: 600;
}

.inv-entry tbody td:has(input:not([readonly]):not(:disabled)) {
    background-color: #e7f5eb;
    color: var(--bs-body-color);
}

.inv-entry input.form-control:not([readonly]):not(:disabled) {
    background-color: #e7f5eb;
    border-color: #9fc9aa;
}

.inv-entry input.form-control:not([readonly]):not(:disabled):focus {
    background-color: #fff;
    border-color: #3d8b5a;
    box-shadow: 0 0 0 0.2rem rgba(61, 139, 90, 0.18);
}

.inv-entry input.form-control[readonly],
.inv-entry input.form-control:disabled {
    background-color: #eef1f4;
    border-color: #d5dae0;
    color: #5c6570;
}

.inv-entry tbody tr.inv-row-locked > td {
    background-color: #e9ecef;
    color: #5c6570;
}

.inv-entry tbody tr.inv-today > td {
    background-color: #fff3c4;
    color: var(--bs-body-color);
}

.inv-entry tbody tr.inv-today > td.inv-col-date {
    background-color: #ffe59a;
    box-shadow: inset 3px 0 0 #c49214;
}

.inv-entry tbody tr.inv-today > td:has(input:not([readonly]):not(:disabled)) {
    background-color: #e3f3e7;
}

.inv-entry tbody tr.inv-row-locked.inv-today > td {
    background-color: #efe4b8;
}

.inv-usage-entry {
    width: max-content;
    table-layout: fixed;
}

.inv-usage-entry .inv-usage-name {
    width: 10rem;
    min-width: 10rem;
    text-align: start;
    white-space: nowrap;
}

.inv-usage-entry .inv-usage-total {
    width: 7rem;
    min-width: 7rem;
    text-align: end;
    white-space: nowrap;
}

.inv-usage-entry .inv-usage-col {
    width: 8rem;
    min-width: 8rem;
    max-width: 8rem;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}

.inv-usage-entry .inv-usage-col .form-control {
    width: 100%;
    min-width: 0;
}

.inv-today-badge {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #8a6d12;
    text-transform: uppercase;
}
