.erp {
    --nano-product-color: var(--blue-500);
}

.content-container {
    background-color: var(--content-background-color);
    padding: 20px 20px;
}

/* Entities Grid */
.entities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.entity-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--content-background-color);
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    padding: 24px;
    min-height: 160px;
    box-shadow: 0 2px 4px var(--shadow-color);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-color-primary);
}

.entity-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px var(--shadow-color);
    border-color: var(--nano-product-color);
}

/* Members Table (Project Details) */
.members-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    margin-bottom: 16px;
}

.members-table thead {
    background-color: var(--zinc-50);
}

.members-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.members-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.members-table tbody tr:hover {
    background-color: var(--button-hover-background-color);
}

/* Gantt Page (Update Project) */
.gantt-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--page-background-color);
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    box-shadow: 0 1px 3px var(--shadow-color);
}

.toolbar-left {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    background: var(--page-background-color);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn:hover {
    background: var(--zinc-50);
    border-color: var(--zinc-300);
}

.btn.primary {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.btn.primary:hover {
    background: var(--blue-600);
}

.btn.danger {
    background: var(--status-error-bg);
    color: var(--status-error-color);
    border-color: var(--status-error-color);
}

.btn.danger:hover {
    background: var(--status-error-color);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.autosave-status {
    font-size: 0.8125rem;
    color: var(--zinc-500);
    font-style: italic;
}

.gantt-wrapper {
    display: grid;
    grid-template-columns: 380px 1fr 340px;
    gap: 1.5rem;
    height: calc(100vh - 250px);
    min-height: 500px;
}

.grid-pane {
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    background: var(--page-background-color);
    overflow-y: auto;
    box-shadow: 0 1px 3px var(--shadow-color);
    display: flex;
    flex-direction: column;
}

.grid-header {
    height: 40px;
    min-height: 40px;
    border-bottom: 1px solid var(--border-color);
    background: var(--zinc-50);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
}

.grid-header-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--zinc-500);
    white-space: nowrap;
}

.grid-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 0 0.75rem;
    /* Removed vertical padding to ensure fixed height */
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease, opacity 0.2s ease;
    height: 40px;
    box-sizing: border-box;
    position: relative;
}

.grid-row.is-dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.drop-zone {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 5;
}

.drop-zone.before {
    top: 0;
    height: 12px;
}

.drop-zone.on {
    top: 12px;
    height: 16px;
}

.drop-zone.after {
    bottom: 0;
    height: 12px;
}


.grid-row.drop-on {
    background: var(--blue-50) !important;
    outline: 2px solid var(--blue-400);
    outline-offset: -2px;
}

.grid-row.drop-before::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--blue-500);
    z-index: 10;
    pointer-events: none;
}

.grid-row.drop-after::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--blue-500);
    z-index: 10;
    pointer-events: none;
}

.grid-row:last-child {
    border-bottom: none;
}

.grid-row:hover {
    background: var(--zinc-50);
}

.grid-row.selected {
    background: var(--blue-50);
    border-left: 3px solid var(--accent-color);
}

.grid-row.phase-row {
    background: var(--zinc-50);
    font-weight: 600;
}

.grid-cell.name {
    height: 100%;
    display: flex;
    align-items: center;
}

.grid-cell.name .text-box {
    width: 100%;
    margin: 0;
}

.grid-cell.name .text-box__input {
    border-color: transparent;
    background: transparent;
    height: 38px;
    /* Slightly less than row height to allow for border */
}

/* Ensure Core components fit nicely in the grid */
.grid-row .text-box {
    margin-bottom: 0;
}

.grid-cell.actions {
    display: flex;
    gap: 0.25rem;
    padding-left: 0.5rem;
}

.icon-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 0.25rem;
    border-radius: 0.125rem;
    cursor: pointer;
    color: var(--zinc-400);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--accent-color);
    background: var(--zinc-100);
}

.icon-btn.danger:hover {
    color: var(--status-error-color);
    background: var(--status-error-bg);
}

.timeline-pane {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    background: var(--page-background-color);
    overflow: auto;
    box-shadow: 0 1px 3px var(--shadow-color);
}

.timeline-header {
    height: 40px;
    border-bottom: 1px solid var(--border-color);
    background: var(--zinc-50);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    min-width: max-content;
}

.timeline-header-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--zinc-500);
    white-space: nowrap;
}

.timeline-body {
    position: relative;
    background-image: linear-gradient(var(--border-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 100% 40px, 40px 100%;
    /* Grid aligned with row height */
    width: max-content;
    min-width: 100%;
}

.bar {
    position: absolute;
    height: 24px;
    border-radius: 0.125rem;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: filter 0.2s ease;
}

.bar:hover {
    filter: brightness(1.05);
}

.task-bar {
    background: linear-gradient(135deg, #6aa9ff 0%, #4a90e2 100%);
    border: 1px solid #357ebd;
}

.task-bar.milestone {
    background: linear-gradient(135deg, #f5a623 0%, #d48806 100%);
    border: 1px solid #b37400;
    width: 20px !important;
    height: 20px;
    transform: rotate(45deg);
    margin-top: 2px;
}

.phase-bar {
    background: #e2e8f0;
    height: 8px;
    border-radius: 4px;
    margin-top: 8px;
    border: 1px solid #cbd5e1;
}

.handle {
    position: absolute;
    width: 8px;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    cursor: ew-resize;
    opacity: 0;
    transition: opacity 0.2s;
}

.bar:hover .handle {
    opacity: 1;
}

.handle.start {
    left: 0;
}

.handle.end {
    right: 0;
}

.drag-surface {
    position: absolute;
    inset: 8px;
    cursor: grab;
}

.drag-surface:active {
    cursor: grabbing;
}

.today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--status-error-color);
    z-index: 5;
    pointer-events: none;
}

.today-line::after {
    content: 'TODAY';
    position: absolute;
    top: 0;
    left: 4px;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--status-error-color);
}

.dependency-layer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.dependency-line {
    stroke: var(--zinc-400);
    stroke-width: 1.5;
    fill: none;
    marker-end: url(#arrowhead);
}

.properties-pane {
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    padding: 1.5rem;
    background: var(--page-background-color);
    box-shadow: 0 1px 3px var(--shadow-color);
    overflow-y: auto;
}

.properties-pane h4 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.125rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 1.25rem;
}

.form-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--zinc-500);
    text-transform: uppercase;
}

.form-field input,
.form-field select,
.form-field textarea {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    font-size: 0.875rem;
}

.form-field input:focus,
.form-field select:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 2px var(--blue-100);
}

.dep-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.dialog {
    background: white;
    padding: 2rem;
    border-radius: 0.125rem;
    min-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.muted {
    color: var(--zinc-400);
    font-style: italic;
}

/* Time Report Redesign */
.time-report-summary {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--page-background-color);
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.summary-card.ai-insights {
    background: #2e3192;
    /* Blue background as in reference */
    color: white;
    border: none;
}

.summary-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-card__title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.ai-insights .summary-card__title {
    opacity: 1;
}

.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.ai-title-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.total-hours {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.hours-large {
    font-size: 2.5rem;
    font-weight: 700;
}

.hours-separator {
    font-size: 1.5rem;
    opacity: 0.5;
}

.hours-planned {
    font-size: 1.25rem;
    opacity: 0.7;
}

.progress-bar-container {
    height: 8px;
    background: var(--zinc-100);
    border-radius: 0.125rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-color);
    border-radius: 0.125rem;
}

.missing-hours {
    font-size: 0.875rem;
    color: var(--status-error-color);
    font-weight: 500;
}

.time-report-container {
    background: var(--page-background-color);
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.calendar-header {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.calendar-row {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: stretch;
}

.week-number {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--zinc-400);
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1 / 1;
    min-height: unset;
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    background: var(--page-background-color);
    transition: all 0.2s ease;
    position: relative;
}

.calendar-day.empty {
    border: none;
    background: transparent;
    cursor: default;
}

.calendar-day:hover:not(.empty) {
    background: var(--zinc-50);
    border-color: var(--accent-color);
}

.calendar-day.selected {
    border: 2px solid var(--accent-color);
    background: var(--zinc-50);
}

.calendar-day.holiday {
    background: var(--zinc-50);
}

.day-number {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
}


.day-hours {
    font-size: 0.75rem;
    color: var(--accent-color);
    font-weight: 700;
}

.holiday-name {
    font-size: 0.625rem;
    color: var(--status-error-color);
    text-align: center;
    position: absolute;
    bottom: 4px;
    width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weekly-report {
    background: var(--page-background-color);
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    padding: 1.5rem;
}

.weekly-report__header {
    margin-bottom: 1.5rem;
}

.table-container {
    overflow: visible;
}

.time-entry-table {
    width: 100%;
    border-collapse: collapse;
}

.time-entry-table th {
    text-align: left;
    padding: 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--zinc-500);
    border-bottom: 1px solid var(--border-color);
}

.time-entry-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.column--center {
    text-align: center;
}

.column--day {
    width: 80px;
    text-align: center;
}

.column--total {
    width: 100px;
    text-align: right;
}

.column--action {
    width: 50px;
    text-align: center;
}

.day-label {
    font-weight: 700;
}

.date-label {
    font-size: 0.625rem;
}

.hours-input input {
    width: 100%;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    padding: 0.25rem;
}

.total-hours-value {
    font-weight: 700;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--zinc-400);
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.icon-button:hover {
    color: var(--accent-color);
}

.icon-button.danger:hover {
    color: var(--status-error-color);
}

.comment-textarea,
.day-comment-textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 0.125rem;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-family: inherit;
    resize: vertical;
    background: var(--zinc-50);
}

.day-comment-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background: white;
}

.font-bold {
    font-weight: 700;
}

.text-right {
    text-align: right;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .time-report-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    .calendar-header,
    .calendar-row {
        grid-template-columns: 40px repeat(7, 1fr);
        font-size: 0.75rem;
    }

    .week-number {
        font-size: 0.625rem;
    }

    .calendar-day {
        padding: 0.25rem;
    }

    .day-hours {
        display: none;
        /* Hide hours on mobile calendar to save space */
    }
}

@media (max-width: 640px) {
    .summary-card {
        padding: 1rem;
    }

    .hours-large {
        font-size: 1.75rem;
    }
}