/* App shell: classic Bootstrap admin layout */
:root {
    --app-sidebar-width: 260px;
    --app-content-max-width: 1200px;
}

body {
    background: var(--bs-tertiary-bg);
}

.app-shell {
    background: var(--bs-tertiary-bg);
}

/* Desktop sidebar styling only. Below md (768px) Bootstrap's offcanvas-md
   class takes over: the aside becomes a fixed off-screen drawer. Applying
   sticky/100vh here unconditionally would override that and push main below. */
@media (min-width: 768px) {
    .app-sidebar {
        width: var(--app-sidebar-width);
        min-height: 100vh;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}

.app-brand-mark {
    width: 10px;
    height: 10px;
}

.app-brand-logo {
    height: 26px;
    width: auto;
    object-fit: contain;
}

.app-nav .nav-link {
    border-radius: var(--bs-border-radius);
    padding: 0.6rem 0.75rem;
}

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

.app-main {
    min-width: 0;
}

.app-content {
    max-width: var(--app-content-max-width);
    margin-right: auto;
    margin-left: auto;
}

.app-section-title {
    color: var(--bs-secondary-color);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

h1,
.h3 {
    letter-spacing: 0;
}

.card {
    border-color: var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--bs-box-shadow-sm);
}

.card.border-0 {
    border: 1px solid var(--bs-border-color) !important;
}

.card.border-start {
    border-left-width: 4px !important;
}

.card.border-start.border-primary,
.card.border-start.border-success,
.card.border-start.border-info,
.card.border-start.border-warning,
.card.border-start.border-danger {
    border-color: var(--bs-border-color) !important;
}
.card.border-start.border-primary { border-left-color: var(--bs-primary) !important; }
.card.border-start.border-success { border-left-color: var(--bs-success) !important; }
.card.border-start.border-info    { border-left-color: var(--bs-info)    !important; }
.card.border-start.border-warning { border-left-color: var(--bs-warning) !important; }
.card.border-start.border-danger  { border-left-color: var(--bs-danger)  !important; }

.card-header {
    background: var(--bs-body-bg) !important;
    border-bottom-color: var(--bs-border-color) !important;
    border-top-left-radius: var(--bs-border-radius-lg) !important;
    border-top-right-radius: var(--bs-border-radius-lg) !important;
    padding: 1rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

.card > .card-body.p-0 {
    overflow: hidden;
    border-bottom-right-radius: var(--bs-border-radius-lg);
    border-bottom-left-radius: var(--bs-border-radius-lg);
}

.card form > .row {
    margin-bottom: 1rem;
}

.card form > .row:last-child {
    margin-bottom: 0;
}

.guest-card {
    max-width: 420px;
    width: 100%;
}

.auth-icon {
    width: 56px;
    height: 56px;
}

.card.app-hero,
.card.app-hero.border-0 {
    border: 1px solid var(--bs-border-color) !important;
    background: var(--bs-body-bg);
}

.app-hero .card-body {
    padding: 1.5rem !important;
}

.stat-card {
    background: var(--bs-body-bg);
}

.stat-card .rounded-circle {
    display: flex !important;
}

.metric-icon {
    width: 40px;
    height: 40px;
}

.metric-icon-primary {
    background: rgba(var(--bs-primary-rgb), 0.1);
}

.metric-icon-success {
    background: rgba(var(--bs-success-rgb), 0.1);
}

.metric-icon-info {
    background: rgba(var(--bs-info-rgb), 0.1);
}

.metric-icon-warning {
    background: rgba(var(--bs-warning-rgb), 0.15);
}

.stat-card .text-uppercase {
    text-transform: uppercase !important;
    font-size: 0.875em;
    font-weight: 600 !important;
}

.stat-card .display-6 {
    border-bottom: 0;
    margin-bottom: 0 !important;
    padding-bottom: 0;
}

.progress-thin {
    height: 10px;
}

.color-swatch {
    width: 22px;
    height: 22px;
}

.table {
    --bs-table-bg: transparent;
}

.card .table {
    margin-bottom: 0;
}

.table thead th {
    color: var(--bs-secondary-color);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--bs-tertiary-bg);
    border-bottom-color: var(--bs-border-color);
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--bs-border-color);
}

.card .table-responsive {
    border-radius: 0 0 var(--bs-border-radius-lg) var(--bs-border-radius-lg);
}

.card .table > :not(caption) > * > * {
    border-right: 0;
    border-left: 0;
}

.card .table > :not(caption) > * > :first-child {
    border-left: 0;
}

.card .table > :not(caption) > * > :last-child {
    border-right: 0;
}

.card .table tbody tr:last-child > * {
    border-bottom: 0;
}

.card .table thead th {
    border-top: 0;
}

.pagination svg {
    width: 1rem;
    height: 1rem;
}

.pagination {
    margin-bottom: 0;
}

.dashboard-summary-scroll {
    max-height: 200px;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
}

.dashboard-summary-scroll--more {
    padding-bottom: 0;
}

.dashboard-summary-indicator {
    position: sticky;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 34px;
    color: var(--bs-primary);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
    z-index: 2;
}

.dashboard-summary-indicator--top {
    top: 0;
    margin-bottom: -34px;
    align-items: start;
    padding-top: 0.25rem;
    background: linear-gradient(to top, rgba(var(--bs-body-bg-rgb), 0), var(--bs-body-bg) 72%);
}

.dashboard-summary-indicator--bottom {
    bottom: 0;
    margin-top: -34px;
    align-items: end;
    padding-bottom: 0.25rem;
    background: linear-gradient(to bottom, rgba(var(--bs-body-bg-rgb), 0), var(--bs-body-bg) 72%);
}

.dashboard-summary-scroll--has-overflow:not(.dashboard-summary-scroll--at-top) .dashboard-summary-indicator--top,
.dashboard-summary-scroll--has-overflow:not(.dashboard-summary-scroll--at-bottom) .dashboard-summary-indicator--bottom {
    opacity: 1;
}

.dashboard-summary-indicator .bi {
    font-size: 0.8rem;
    opacity: 0.9;
}

.form-control,
.form-select {
    border-radius: var(--bs-border-radius);
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.15);
}

/* Calendar grid (no Bootstrap equivalent for the cell coloring) */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
@media (max-width: 900px) {
    .cal-grid { grid-template-columns: repeat(2, 1fr); }
}

.cal-month {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    padding: 0.75rem;
    box-shadow: var(--bs-box-shadow-sm);
}
.cal-month h3 {
    text-align: center;
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}
.cal-month table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.cal-month th {
    padding: 0.25rem 0;
    font-weight: 500;
    color: var(--bs-secondary-color);
    font-size: 0.7rem;
}
.cal-month td {
    padding: 0.3rem 0;
    text-align: center;
    border: 1px solid transparent;
}
.cal-month td[data-calendar-date] {
    cursor: pointer;
    user-select: none;
}
.cal-month td.cal-weekend { 
    color: var(--bs-secondary-color); 
    background: var(--bs-tertiary-bg); 
}
.cal-month td.cal-holiday { 
    background: #fff4d6; 
    color: #92400e; 
}
[data-bs-theme="dark"] .cal-month td.cal-holiday { 
    background: rgb(191 162 58 / 0.1); 
    color: #fbbf24;
}
.cal-month td.cal-today { 
    box-shadow: 0px 0px 0px 1px var(--bs-primary) inset;
    /* border: 2px solid var(--bs-primary);  */
    font-weight: 600; 

    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.06);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(var(--bs-primary-rgb), 0.5);
}
.cal-month td.cal-leave { 
    color: #fff; 
    font-weight: 700; 
    position: relative;
}
.cal-month td.cal-leave-pending {
    outline: 2px dashed rgba(255, 255, 255, 0.72);
    outline-offset: -4px;
}
.cal-month td.cal-selected {
    /* box-shadow: 0px 0px 0px 1px var(--bs-primary) inset; */
    background: var(--bs-secondary);
}
[data-bs-theme="dark"] .cal-month td.cal-leave::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 0;
}

[data-bs-theme="dark"] .cal-month td.cal-leave > * {
  position: relative;
  z-index: 1;
}

/* Legend */
.legend { 
    display: flex; 
    gap: 0.75rem; 
    flex-wrap: wrap; 
    margin-bottom: 1rem; 
    font-size: 0.75rem; 
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    padding: 0.38rem 0.6rem;
}
.legend-swatch {
    width: 14px; height: 14px; border-radius: 3px;
    border: 1px solid var(--bs-border-color);
}

.legend-swatch-weekend {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .legend-swatch-holiday {
    background: #32320e;
}

.legend-swatch-holiday {
    background: #fff4d6;
}

.legend-swatch-today {
    border-color: var(--bs-primary);
    border-width: 2px;
}

.legend-swatch-pending {
    background: var(--bs-secondary-bg);
    border-style: dashed;
    border-color: var(--bs-secondary-color);
}

.legend-swatch-leave {
    background: #22aa66;
}

.team-legend {
    gap: 0 0.6rem;
    margin-bottom: 0.75rem;
    opacity: 0.86;
}

.team-legend .legend-item {
    background: transparent;
    border-color: transparent;
    padding: 0.15rem 0.1rem;
}

.team-legend .legend-swatch {
    width: 11px;
    height: 11px;
}

.team-legend .team-legend-leave-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.35rem;
    line-height: 1;
}

.audit-email-body {
    margin: 0;
    white-space: pre-wrap;
}

/* Shared month switcher used by calendar views. */
.month-switcher {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.4rem 0.9rem;
}

.month-switcher__button,
.month-switcher__current {
    min-height: 2.5rem;
    border-radius: var(--bs-border-radius);
}

.month-switcher__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.7rem;
    color: var(--bs-body-color);
    background: var(--bs-tertiary-bg);
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.month-switcher__button:hover,
.month-switcher__button:focus {
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.08);
    border-color: rgba(var(--bs-primary-rgb), 0.35);
    text-decoration: none;
}

.month-switcher__button:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.15);
}

.month-switcher__current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
}

.month-switcher__title {
    margin: 0;
    color: var(--bs-body-color);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.2;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .month-switcher {
        width: 100%;
        grid-template-columns: 1fr 1fr;
    }

    .month-switcher__current {
        grid-column: 1 / -1;
        grid-row: 1;
        border-bottom: 1px solid var(--bs-border-color);
        border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0;
    }
}

/* Team table (sticky first column + cell coloring) */
.team-scroll {
    overflow-x: auto;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--bs-box-shadow-sm);
}

.team-card .team-scroll {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.team-table {
    border-collapse: collapse;
    font-size: 0.7rem;
    min-width: 100%;
}
.team-table th, .team-table td {
    border: 1px solid var(--bs-border-color);
    min-width: 24px;
    padding: 0.25rem 0.4rem;
    text-align: center;
}
.team-table td.team-selectable {
    cursor: pointer;
    user-select: none;
}
.team-table td.team-selected {
    box-shadow: inset 0 0 0 2px var(--bs-primary);
}
.team-table thead tr:first-child > * {
    border-top: 0;
}
.team-table tr > :first-child {
    border-left: 0;
}
.team-table tr > :last-child {
    border-right: 0;
}
.team-table tbody tr:last-child > * {
    border-bottom: 0;
}
.team-table th.team-day-number {
    padding-bottom: 0.12rem;
}
.team-table th.team-day-letter {
    color: var(--bs-tertiary-color);
    font-size: 0.62rem;
    font-weight: 600;
    padding-top: 0.12rem;
}
.team-table th.user-name {
    text-align: left;
    padding: 0.4rem 0.75rem;
    min-width: 160px;
    background: var(--bs-tertiary-bg);
    position: sticky;
    left: 0;
    z-index: 1;
}
.team-table th.team-today {
    box-shadow: inset 0 0 0 1px rgba(var(--bs-primary-rgb), 0.5);
}
.team-table th.team-today {
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.06);
    font-weight: 700;
}
.team-table td.team-weekend,
.team-table td.team-non-working { 
    background: var(--bs-tertiary-bg); 
    color: var(--bs-secondary-color); 
}
.team-table td.team-holiday { 
    background: #fff4d6; 
    color: #92400e; 
}
[data-bs-theme="dark"] .team-table td.team-holiday { 
    background: rgb(191 162 58 / 0.1); 
    color: #fbbf24; 
}
.team-table td.team-leave { 
    color: #fff; 
    font-weight: 700; 
    position: relative; 
}
.team-table td.team-leave-pending {
    outline: 2px dashed rgba(255, 255, 255, 0.72);
    outline-offset: -3px;
}

[data-bs-theme="dark"] .team-table td.team-leave::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 0;
}

[data-bs-theme="dark"] .team-table td.team-leave > * {
  position: relative;
  z-index: 1;
}

/* Drawer width on mobile (offcanvas-md takes over here). */
.app-sidebar {
    --bs-offcanvas-width: min(80vw, 280px);
}

@media (max-width: 767.98px) {
    .app-content {
        max-width: none;
        padding: 1rem !important;
    }
}

.badge-outline-primary {
    color: #007bff;
    background-color: transparent;
    background-image: none;
    border-color: #007bff;
    border: 1px solid;
}

.badge-outline-secondary {
    color: #6c757d;
    background-color: transparent;
    background-image: none;
    border-color: #6c757d;
    border: 1px solid;
}

.badge-outline-success {
    color: #28a745;
    background-color: transparent;
    background-image: none;
    border-color: #28a745;
    border: 1px solid;
}

.badge-outline-danger {
    color: #dc3545;
    background-color: transparent;
    background-image: none;
    border-color: #dc3545;
    border: 1px solid;
}

.badge-outline-warning {
    color: #ffc107;
    background-color: transparent;
    background-image: none;
    border-color: #ffc107;
    border: 1px solid;
}

.badge-outline-info {
    color: #17a2b8;
    background-color: transparent;
    background-image: none;
    border-color: #17a2b8;
    border: 1px solid;
}

.badge-outline-light {
    color: #f8f9fa;
    background-color: transparent;
    background-image: none;
    border-color: #f8f9fa;
    border: 1px solid;
}

.badge-outline-dark {
    color: #343a40;
    background-color: transparent;
    background-image: none;
    border-color: #343a40;
    border: 1px solid;
}

/* Fainter placeholder text so hints read as hints, not as filled-in content.
   Opacity (not colour) keeps it theme-agnostic for both light and dark. */
.form-control::placeholder,
.form-select::placeholder,
textarea::placeholder {
    opacity: 0.2;
}
